Home  /  Questions  /  Question

50   50
Feb 14, 2011

Which patterns to use for a Test Automation Framework?

I am writing a Test Automation Framework that involves automating testing a Winforms and WPF based application having 200 screens. The Automation Framework should do the control clicks and screen actions just as a tester would do to test a case by manually clicking the controls on the screens.

The Framework can change only when one of the following happens:
1. New screens and functionalities are added.
2. Existing screens are modified (UI).
3. Existing screen functionalities are modified. For example, changing a ListView to a GridView to show data on a button click.
4. Changes in business rules.

I am new to patterns and am learning. Based on these requirements, can someone please tell me what Patterns may prove most useful (if at all) in writing this framework?


70   96.1
Feb 20, 2011
Hi there

I know that the NUnit test framework uses the Composite Pattern.

Good luck with the framework :-)

Hans-Petter Eitvet

370   99.9
Mar 03, 2011

maybe a bit off topic but why do you want to write your own TA framework? There are tools which handle this for you, for example VS 2010 has its tests which can be then, after compiling, ran by MSTest command line utility. Or there are others, like QTP, Quality Center and so on.

Developing your own framework would be reasonable when you have your custom APIs for UI / SDK automation, as in my case. We developed our own tool, because the product has it's own UI API. This tool can handle multiple formats and is extensible via plugins (e.g. MEF would do the job here).

You also have to think about how to parametrize tests, how to log and store results, how to play scripts back etc.


1,128   99.9
Mar 08, 2011
I would recommend you to try an use an existing framework (if possible) instead. Take a look at project White. Even if it doesn't meet all of your requirements you might find it useful to check out its source code.

The project is located here: http://code.google.com/p/white-project/

Some of its features include...
 * Automates Win32, WinForm, WPF and SWT applications
 * Hides the complexity of window messages and Microsoft UIAutomation library under object based API * Consistent API for all kinds of application
 * Use any .NET language