Code templates for generating unit testing code
October 29th, 2012
There are many code templates available to quickly create tests, test fixtures and assertion calls for all supported unit testing frameworks. For each test framework, they similar , so if you switched to another framework, you can use the same code templates to generate code which will be valid in a new test framework.
Common code templates are:
Template | Description |
tm | Creates a test method. |
tc/tf | Creates a test fixture (class). |
tsu | Creates a ‘set up’ method. |
ttd | Creates a ‘tear down’ method. |
tfsu | Creates a ‘class initialize’ method. |
Asserts code templates:
Template | Description |
ae | Creates an ‘are equal’ assertion call. |
an | Creates an ‘is null’ assertion call. |
at | Creates an ‘is true’ assertion call. |
af | Creates an ‘is false’ assertion call. |
ai | Creates an ‘ignore’ assertion call. |
etc… |
There are also code templates for generating test attributes and using statements with the required namespace references.
Here are the code templates for various test frameworks:
- Code templates for MbUnit
- Code templates for MS VS testing
- Code templates for NUnit
- Code templates for xUnit
- Code templates for Silverlight