|
||
Home News Documentation License Download Contributors Source Code NUnit NMock SourceForge |
NUnitForms is an NUnit extension for unit and acceptance testing of Windows Forms applications. Now it is easy to write automated tests for your Windows Forms (UI) classes. Your NUnit tests can open a window and interact with the controls. Your tests will automatically manipulate and verify the properties of the gui. NUnitForms takes care of cleaning up your forms between tests, detecting and handling modal dialog boxes, and verifying that your expectations for the test are fulfilled. To get started, look through the unit tests provided with the source code and see the Documentation page for some usage examples. Unit testing is defined as testing the code behind of the form and is usually accomplished by mocking out classes that the GUI depends upon. Acceptance testing (sometimes we call this Story Testing) means testing the application through the GUI all the way to the back end. NUnitForms supports both; look at the example application. Support is currently provided for Buttons, CheckBoxes, ComboBoxes, Labels, ListBoxes, RadioButtons, TabControls, TextBoxes, TreeViews, Context Menus, Forms, MenuItems, Modal Forms, Modal MessageBoxes, and the Mouse. If your control is not specifically supported, you can still test it using the "ControlTester" class. It has helpful methods and properties that use reflection to work on any control. You may need to cast some results to the type you expect. It is easy to add support for additional controls so there should be more coming soon. NUnitForms also provides a Recorder application that can record your interactions with a form and "write" a test for you that duplicates your actions. You can perform asserts during this process by right-clicking on your controls and selecting the property to assert. While not all of the testing functionality is currently supported by the recorder, it does provide a good way to familiarize yourself with the API and to demonstrate how testing is accomplished with NUnitForms. The recorder application is provided in separate assemblies and using it is optional. Take a look at the Documentation page for more examples. The News page also has example snippets for recently added features. I recommend that you download the latest from CVS because new features are being added all the time. I use a strict process of unit testing that should ensure no broken code in CVS. Have fun! -Luke Maxon |
|
Copyright © 2003-2007 Luke T. Maxon. All Rights Reserved. |