Task: Implement Developer Tests
Implement one or more tests that enable the validation of the individual software components through execution.
Discipline:  Implementation
Purpose
The purpose of this task is to create tests to ensure that the code works as expected.
Relationships
RolesPrimary Performer: Additional Performers:
InputsMandatory: Optional:
Outputs
Main Description

Developer testing is different from other forms of testing in that it is based on the expected behavior of code units rather than being directly based on the system requirements.

Steps
Refine scope and identify the tests

Select the increment of work to be tested and identify tests to verify that the code being developed for it behaves correctly.  It is best to do this at a small scale, typically much smaller than the complete code base to be authored by a developer over the course of an iteration.

Select appropriate implementation technique

Select the technique to be used when implementing a developer test -- manual or automated testing. Some automated testing techniques are: 

  • programmed tests, using either the same software programming techniques and environment as the component under test, or less complex programming languages and tools ( e.g. scripting languages: tcl, shell based, etc.)
  • recorded or captured tests, built by using test automation tools which capture the interactions between the component under test and the rest of the system, and produce the basic tests
  • generated tests: some aspects of the test, either procedural or the test data, could be automatically generated using more complex test automation tools

Although most of developer tests are implemented using automated testing techniques, manual tests may be more efficient in some circumstances -- GUI tests, for example, may be done manually by following a sequence of instructions that have been captured in a textual description form.

Implement the tests

Implement tests for the components or group of components in the selected scope.

Detail and clearly specify the test environment pre-conditions and the steps to get the component under test to the state where the test(s) can be conducted.  Ensure that the conditions covered by the test are clearly understandable.

Identify the clean-up steps to be followed in order to restore the environment to the original state.

Pay special attention to the implementation of the observation/control points, as these aspects might need special support that has to be implemented in the component under test.

Establish external data sets

Create test data sets outside the actual test case.

In most of the cases, decoupling the test data from the test leads to a more maintainable solution. Other advantages are:

  • more than one test can use the same data set
  • the data is easy to modify and/or multiply
  • the data could be used to control the conditional branching logic within the test

If the test's life span is very short, hard-coding the data within the test might be more efficient.

Verify test implementation

Verify that the tests work correctly. Check the environment setup and clean-up instructions. Run the tests, observe their behavior and fix any defects.  Remember, this is a verification that the test case is correct and complete, the verification of the code unit under test occurs in Task: Run Developer Tests.

It a test framework is being used to manage a suite of unit tests, ensure the unit test works within the framework.

If a test will be long-lived, ask a person with less inside knowledge to run it and check if there is enough support information. Review it with other people within the development team and other interested parties as needed.

More Information