Testing GUIs is one of the most challenging tasks a tester can undertake. Automated testing of GUIs is an order of magnitude harder. Your dealing with user logic, rather than program logic, and no matter how twisted a programs logic is, you can at least inspect it. Users are not so easily tied down, and they are apt to see your GUI in completely different ways to you.
About the only reasonable way to automate GUI tests is to use some sort of external record and playback mechanism. (See Win32::GuiTest if your running on that platform. I have no knowledge of Prima).
Attempting to emulate the user from within the script under test will cause you to have to do things like duplicating state normally mantained within, and queried from, the GUI object elements themselves, and replicate these into alternate storage (as you mentioned).
This is filled with dire consequences. You're duplicating state and it will enevitably get out of sync. You're adding complexity within your application and completely changing the dynamics of the code. If you only use the duplicated state for testing and query the data from the GUI objects for use, then you are not testing your real code.
A mouse/keystroke recorder that allows you to replay previously recorded, manually-driven test sessions and then compare the states, preferable at each intermediate step as well as the final state--is the only reasonably successful method I have seen.
The recording of mouse actions should be recorded relative to the application window(s), not in absolute screen coordinates to avoid differences caused by where the system displays the windows.
The state comparison should be in terms of text displayed in the controls, the state (highlighted, greyed etc.) and recorded in a manner that allows it to be viewed and edited manually.
Not as a binary file. And not as bitwise comparisons of bitmaps of window or screen captures. Screens vary in size. Windows are usually movable and sizeable. Users can configure their desktops with different colours, fonts and reposition/hide screen elements like toolbars.
That's just a description of the best way (I know of) to do your testing, and some of the pitfalls to watch out for. It doesn't really help you with your quest to write tests, but maybe it will be helpful.
Good luck.
In reply to Re: Testing a GUI application
by BrowserUk
in thread Testing a GUI application
by carcassonne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |