2. Use Case and Test CasesUse Case and Test Cases
Test Case
• According to RUP, A set of inputs, execution
conditions, and expected results (outputs)
developed … to verify compliance with a specific
requirement (i.e., use case)
• An “intermediate artifact” in that it is a
description of to be manual or automated test
• Created to help organize and develop test scripts
and drivers, both manual and automated
3. Use Case and Test CasesUse Case and Test Cases
Use Case Scenarios
• Each path through a use case is a use case
scenario
• Possible paths include:
Primary Flow
A Primary Flow’s Subflows
Alternate Flows
Warning Flows
Exceptions Flows
• A use case scenario is an instance of a use case
just as an object is an instance of a class
4. Use Case and Test CasesUse Case and Test Cases
Deriving Test Cases from Use Cases
• For each use case, identify all use case scenarios
and captures these in a Scenario Matrix
• For each use case scenario, identify one or more
test cases (i.e., success and failure) and identify
the conditions that would cause it to execute
• Create a test case matrix
5. Use Case and Test CasesUse Case and Test Cases
Scenario Matrix
Scenario Name Starting Flow Alternate Flow
Successful Registration Primary Flow
Unidentified Student Primary Flow Unidentified Student
User quits Primary Flow Quit
Unfulfilled Prerequisite Primary Flow Can Not Enroll
6. Use Case and Test CasesUse Case and Test Cases
Test Case Matrix
• For each scenario, add a row in the test case
matrix for each test case
• For each condition to test (e.g, student ID,
password, courses selected, etc.), add a column in
the test case matrix
• For each test case, identify the expected result of
executing the scenario
7. Use Case and Test CasesUse Case and Test Cases
Test Case Matrix
Scenario Name Student ID Password Expected Result
Successful Registration V V
Confirmation Number
displayed – Success
Unidentified Student I N/A
Error message -
Failure
8. Use Case and Test CasesUse Case and Test Cases
Test Case Matrix
• No actual values are entered for the test
conditions
• Easy to see what conditions are being tested
• Easy to determine test coverage
• Comprehensive testing must include positive and
negative test cases
9. Use Case and Test CasesUse Case and Test Cases
Test Case Matrix with Values
• For each test case, add data values for the test
conditions
• Review and validate the test cases to ensure
accuracy and appropriateness of the data values
• Eliminate redundant or equivalent test cases
• The actual data values entered in the matrix is
the basis for developing test data, the test bed
10. Use Case and Test CasesUse Case and Test Cases
Test Case Matrix with Values
Scenario Name Student ID Password Expected Result
Successful Registration tstartz password
Confirmation Number
displayed – Success
Unidentified Student tstartze N/A
Error message -
Failure
11. Use Case and Test CasesUse Case and Test Cases
Automated Test Scripts
• Using the test case matrix with values, manual or
automated test scripts can be developed
• Automated testing scripts are created using a
testing tool
• A library of automated test scripts greatly
enhances your ability to test each build
• Over time, this library can be used for regression
testing