Task: Implement Developer Tests
Implement one or more tests to verify an implementation element.
Disciplines: Development
CollapsePurpose  
Prepare to validate an implementation element (e.g. an operation, a class, a stored procedure) through unit testing. The result is one or more new developer tests.
CollapseRelationships  
RolesPrimary Performer: Additional Performers:
InputsMandatory:
    Optional:
      Outputs
        CollapseMain 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.

        It is best to do this at a small scale, much smaller than the complete code base to be authored by a developer over the course of an iteration. This can be done for one operation, one field added to a user interface, one stored procedure, etc. As the code base is incrementally built, new tests will be authored and existing tests might be revisited to test additional behavior.

        CollapseSteps  
        ExpandRefine scope and identify the test(s)  

        Select the increment of work to be tested and identify developer test(s) to verify that the software implementation being developed behaves correctly. One source for the expected behavior for an implementation element is the software design.

        In identifying the tests or in any other part of this task, consider collaborating with a team member who is well-versed in the issues of testing.

        ExpandWrite the test setup  
        To successfully run a test the system must be in a known state so that the correct behavior can be defined. Implement the setup logic that must be performed as part of the developer test.
        ExpandDefine the expected results  

        Define the expected results of each test so that it can be verified.

        After a test runs, you need to be able to compare the results of running the test against what was expected to happen. The test is successful when the actual results match the expected results.

        ExpandWrite the test logic  
        Write the steps that perform the actual test(s).
        ExpandDefine the test response  
        Define the information the test(s) must produce to successfully indicate success or failure. Consider if a response of True or False is sufficient, or if a detailed message should be logged as well.
        ExpandWrite clean-up code  
        Identify, and then implement, the steps to be followed in order to restore the environment to the original state for each test. The goal is to ensure that there are no side effects from running the tests.
        ExpandTest the test  

        Verify that each developer test works correctly. To do this:

        • Run the test(s), observe their behavior, and fix any defects in the tests.
        • Ensure that the expected results are defined properly and that they're being checked correctly.
        • Check the clean-up logic for each test.
        • Ensure that each developer test works within your test suite framework.
        CollapseKey Considerations  
        1. Automate tests via a unit regression testing tool (for example, xUnit) so that tests may be run by developers whenever they make changes to the code.
        2. Test to the risk of the implementation element. For example, the more critical an element is, the more important it is to test it thoroughly.
        3. Pair with team members with testing skills in all steps of this task to gain insight on testing and quality considerations.

        The [Project Work] is implicitly used in implementation tasks to manage which requirements or change requests are being realized in the code.

        CollapseAlternatives  
        Rely on acceptance tests to validate your software. This will likely be time consuming, late, and not as effective as developer testing in identifying bugs and finding their location in the code.
        CollapseMore Information