Activity Information Write or Update a Unit Test
DescriptionUnit tests verify the proper implementation of a unit of code. Writing and performing unit tests identifies bugs before testing begins and therefore helps reduce the cost of quality control. Developers must write unit tests for all code that will be written as part of implementing a development task, or implementing a bug fix. Attributes| Element Categories | [CMMI Level 3] VER SP 1.3, [CMMI Track 3] Build, [CMMI Cycle 6] As Needed | | Entry Criteria | An active bug work item exists that requires a new or updated unit test: An active bug work item exists that requires a new or updated unit test.
An active development task work item has been created: An active development task work item has been created. | | Exit Criteria | The unit test is written and validated: The unit test is written and validated. | | Is Required | Yes |
StepsIdentify the Unit Test Scope:
Identify the types of unit tests to be written. Positive unit tests exercise the code as intended and check for the right result. Negative unit tests intentionally misuse the code and check for robustness and appropriate error handling. Fault injection unit tests expose error-handling anomalies. Write or Update the Unit Test:
Write unit tests for the development task covering as much of the functionality as possible.
Use scaffolding and mock objects to maximize the code surface area tested.
If the code has already been written, generate unit tests from the working code. Validate the Unit Test:
Perform a run on the test, making sure the test fails for any element not completed and passes if the element is working as expected.
Correct the portions of the unit test that yield incorrect or ambiguous results.
Inputs and Outputs| WorkProduct | Input | Output | Allowable States |
|---|
| Unit Test |  |  | (none) |
|
Last modified at 12/19/2007 10:37 AM by Administrator
|
|