Rob Smyth

Thursday, 7 June 2007

Automated Customer Acceptance Tests - Jigs

Over the last few days at work we seem to have finally succeeded in creating an environment in which we can easily write customer acceptance tests. It is so cool! We are using a combination of NUnit, NUnitForms, and custom "jigs" (thanks goes to Nigel for the guidance and inspiration).

How it works is that NUnit and NUnitForms provide a base framework but the test actually (mostly) use jig classes. That is, a jig for each UI form. The application is one jig and all others are exposed as properties of that jig. Each child control is accessible as a property on the parent control's jig. In each case the jig returns the NUnitForms tester class, not the actual control.

The end result is that the Customer Acceptance Tests (CATs) are simple (usually only half a dozen lines each) and self-documenting. In combination with unit tests they are killers.

Now we have this it is evident that these "jigs" could be auto-generated at compile time by a tool. A jig for each user control in our project. This would also allow us to automatically add code to hide the actual control so that attempts to access (click etc) are only possible if the control is visible. In a CAT we ought to only be able to do what the user can do.

No comments: