Task: Develop Test Cases for Unit Testing
This task describes how to develop the test cases and test data for unit testing.
Relationships
RolesPrimary Performer: Additional Performers:
InputsMandatory:
    Optional:
      Outputs
        Main Description

        Identifying test scripts requires some practice because they occur at different levels. At the highest level, a test script verifies one path of execution through a capability. At its lowest, it verifies the execution of a single operation/method/function.

        Testing from the lowest level to the highest simplifies the testing effort because you verify that the component entities (the private/protected methods) work properly before testing the more complex composite operations.

        Start creating test scripts by verifying that each method performs as designed. Call the method and verify it returns the expected value. Start by testing the innermost private and protected methods. After you verify these, verify the outer public methods that call the private/protected methods.

        Some typical low level test scripts include:

        • Properly computing a function
        • Executing the proper number of iterations of a loop (while/do and for commands)
        • Executing all legs of conditional statements (if/then/else and goto commands)
        • Bad pointer or reference handling
        • Bad input data handling
        • Handling data outside the expected range