Creating Unit Tests with devmate
Creating unit tests for your code involves 8 steps:
- Create an initial model from your code
- Define equivalence classes and their representatives
- Combine representatives into test cases
- Define expected values
- Optional: Define exceptions that might occur
- Optional: Check for side effects
- Generate code
- Optional: Merge existing and newly generated code
Most steps of this process are automated. You just trigger them. Only steps 2 & 4 (optional 5&6) require your cognitive abilities to map the specification to the test model. In step 2 you define the equivalence classes and their representatives. After they are automatically combined into test cases you have to define the expected outcomes in step 4. You can iteratively develop and enhance your test-model by repeating steps 2, 3, and 4 (optional 5&6) using the equivalence class editor. Also the automatic combination of representatives is not mandatory. You are free to define all test cases and their representatives manually.
Boilerplate Feature for creating a Unit Test Template
devmate also offers a fast way to create a unit test template for XUnit, NUnit and MSTest. Just consider which method you want to test and with two easy clicks devmate creates a functioning template for unit testing. You can then edit this template to your own needs.