Skip to main content

MSF for CMMI Process Improvement

Go Search
Home
  
MSF for CMMI Process Improvement > Wiki Pages > Activity - Write or Update a Unit Test for Bug Fix  

Activity - Write or Update a Unit Test for Bug Fix

Activity Information

Write or Update a Unit Test for Bug Fix

Description

Unit 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.

Roles

ResponsibleDeveloper

Attributes

Element Categories[CMMI Level 3] VER SP 1.3, [CMMI Track 3] Build, [CMMI Track 4] Stabilize, [CMMI Cycle 6] As Needed
Entry Criteria

The bug work item is in the Active state:
The bug work item is in the Active state.

The task work item is in the Active state:
The task work item is in the Active state.

Exit Criteria

The unit test is written and validated:
The unit test is written and validated.

Is RequiredYes

Steps

  1. Identify 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.
  2. 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.
  3. 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

WorkProductInputOutputAllowable States
Unit Test(none)

Predecessors

TypeNameDependency Type
Code FixFinish-Start
Decide on Strategy for a FixFinish-Start

Successors

TypeNameDependency Type
Perform Unit Test for Bug FixFinish-Start

Last modified at 12/19/2007 10:37 AM  by Administrator