Skip to main content

Enterprise MSF Agile (with CobiT)

Go Search
Home
  
Enterprise MSF Agile (with CobiT) > Wiki Pages > Activity - Create or Update a Unit Test (Implement a Development Task)  

Activity - Create or Update a Unit Test (Implement a Development Task)

Activity Information

Create or Update a Unit Test

Description

Unit tests verify the proper implementation of a unit of code. Performing unit tests during development reduces the number of bugs discovered during testing and helps avoid regression bugs when fixing other bugs or adding new features. Unit tests are not functional tests or integration tests and they only test the operation of the code in isolation. Developers must make sure existing unit tests still pass after writing new code. Running test cases occurs throughout the software development process, starting with the earliest functionality and architectural elements and finishing with regressions at the end of the project. There are different types of test cases, such as verifying scenarios and quality of service requirements. Each of these test types have the same process for running and potentially identifying bugs.

Roles

PerformerDeveloper

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:
    Identify unit tests for the development task covering as much of the functionality as possible. Perform write unit test, validate that the unit test fails, write or refactor code, and perform unit test until all of the identified tests for the task are completed.

    Write or update a single unit test at a time.

    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:
    Run the test, making sure the test fails for any element not completed and passes if the element is working as expected.

    Correct portions of the unit test that yield incorrect or ambiguous results.

Inputs and Outputs

WorkProductInputOutputAllowable States
Unit Test(none)

Predecessors

TypeNameDependency Type
Cost a Development TaskFinish-Start

Successors

TypeNameDependency Type
Perform a Unit TestFinish-Start

Other Instances

Instance Parent

Last modified at 1/17/2008 11:18 PM  by Administrator