<p>Our company is currently writing a GUI automation testing tool for compact framework applications. We have initially searched many tools but none of them was right for us. </p>

<p>By using the tool you can record test-cases and group them together to test-suites. For every test-suite there is generated an application, which launches the application-under-test and simulates user-input.</p>

<p>In general the tool works fine, but as we are using <strong>window handles</strong> for simulation user input, you can't do very many things. For example it is impossible for us to get the name of a control (we just get the caption). </p>

<p>Another problem using window handles is checking for a change. At the moment we simulate a click on a control and depending on the result we know if the application has gone to the next step.</p>

<p>Is there any other (simpler) way for doing such things (for example the message queue or anything else)?</p>

[{'answer_id': 18714, 'author': 'Lars Truijens', 'author_id': 1242, 'author_profile': 'https://Stackoverflow.com/users/1242', 'pm_score': 2, 'selected': True, 'text': '<p>If the Automated GUI testing tool has knowledge about the framework the application is written in it could use that information to make better or more advanced scripts. <a href="http://www.automatedqa.com/products/testcomplete/index.asp" rel="nofollow noreferrer">TestComplete</a> for example knows about Borland\'s VCL and WinForms. If you test applications build using Windows Presentation Foundation has advanced support for this <a href="http://msdn.microsoft.com/en-us/library/aa348551.aspx" rel="nofollow noreferrer">build in</a>.</p>\n'}, {'answer_id': 18753, 'author': 'Carl Seleborg', 'author_id': 2095, 'author_profile': 'https://Stackoverflow.com/users/2095', 'pm_score': 2, 'selected': False, 'text': '<p>Interesting problem! I\'ve not done any low-level (think Win32) Windows programming in a while, but here\'s what I would do.</p>\n\n<p>Use a named pipe and have your application listen to it. Using this named pipe as a communication medium, implement a real simple protocol whereby you can query the application for the name of a control given its HWND, or other things you find useful. Make sure the protocol is rich enough so that there is sufficient information exchanged between your application and the test framework. Make sure that the test framework does not yield too much "special behavior" from the app, because then you wouldn\'t really be testing the features, but rather your test framework.</p>\n\n<p>There\'s probably way more elegant and cooler ways to implement this, but this is what I remember from the top of my head, using only simple Win32 API calls.</p>\n\n<p>Another approach, which we have implemented for our product at work, is to record user events, such as mouse clicks and key events in an event script. This should be rich enough so that you can have the application play it back, artificially injecting those events into the message queue, and have it behave the same way it did when you first recorded the script. You basically simulate the user when you play back the script.</p>\n\n<p>In addition to that, you can record any important state (user\'s document, preferences, GUI controls hierarchy, etc.), once when you record the script, and once when you play it back. This gives you two sets of data you can compare, to make sure for instance that everything stays the same. This solution gives you tests that not easy to modify (you have to re-record if your GUI changes), but that provide awesome regression testing.</p>\n\n<p>(EDIT: This is also a terrific QA tool during beta testing, for instance: just have your users record their actions, and if there\'s a crash, you have a good chance of easily reproducing the problem by just playing back the script)</p>\n\n<p>Good luck!</p>\n\n<p>Carl</p>\n'}, {'answer_id': 26330, 'author': 'ollifant', 'author_id': 2078, 'author_profile': 'https://Stackoverflow.com/users/2078', 'pm_score': 0, 'selected': False, 'text': '<p>I finally found a solution to communicate between the testing-application and the application-under-test: <a href="http://msdn.microsoft.com/en-us/magazine/cc163617.aspx" rel="nofollow noreferrer">Managed Spy</a>. It\'s basically a .NET application build on top of ManagedSpyLib. </p>\n\n<p>ManagedSpyLib allows programmatic access to the Windows Forms controls of another process. For this it uses Window Hooks and memory-mapping files.</p>\n\n<p>Thanks for all who helped me to get to this solution!</p>\n'}, {'answer_id': 283414, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Managed Spy does not provide a solution for compact framework applications.</p>\n\n<p>The company Jamo Solutions (www.jamosolutions.com) meets the requirements for automation testing on mobile devices, including .net compact framework applications.</p>\n'}, {'answer_id': 283434, 'author': 'Mladen Prajdic', 'author_id': 31345, 'author_profile': 'https://Stackoverflow.com/users/31345', 'pm_score': 1, 'selected': False, 'text': '<p>use <a href="http://nunitforms.sourceforge.net/" rel="nofollow noreferrer">NUnitForms</a>. I\'ve used them with great success for single and multi threading apps and you don\'t have to worry about handles and stuff like that </p>\n\n<p>Here are some posts about NUnitForms worth reading</p>\n\n<p><a href="http://weblogs.sqlteam.com/mladenp/archive/2007/03/22/60140.aspx" rel="nofollow noreferrer">NUnitForms and failed DragDrop registration - problem of MTA vs STA</a> </p>\n\n<p><a href="http://weblogs.sqlteam.com/mladenp/archive/2007/03/01/60123.aspx" rel="nofollow noreferrer">Compiled application exe GUI testing with NUnitForms</a> </p>\n'}]
['https://Stackoverflow.com/questions/18696', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2078/']