Professional Documents
Culture Documents
Cases
by Jim Heumann
A textual description for the basic flow of events in the Register For Courses Use Generating Test Cases
Case is shown in Figure 3. A test case is a set of test inputs, execu-
tion conditions, and expected results
Figure 3: Textual Description for the University Course Registration Use- developed for a particular objective: to
Case Basic Flow of Events exercise a particular program path or
verify compliance with a specific
Register For Courses requirement, for example.
Basic Flow
The purpose of a test case is to identify
1. Logon and communicate conditions that will
This use case starts when a Student accesses the Registration System. be implemented in test. Test cases are
The system asks for, and the Student enters, the student ID and password. necessary to verify successful and
2. Select ‘Create a Schedule’ acceptable implementation of the prod-
The system displays the functions available to the student. The student uct requirements (use cases).
selects “Create a Schedule.”
3. Obtain Course Information We will describe a three-step process
The system retrieves a list of available course offerings from the Course for generating test cases from a fully-
Catalog System and displays the list to the Student. detailed use case:
4. Select Courses
The Student selects 4 primary course offerings and 2 alternate course offer- 1. For each use case, identify a full set
ings from the list of available course offerings. of use-case scenarios.
5. Submit Schedule 2. For each scenario, identify at least
The student indicates that the schedule is complete. For each selected course one test case and the conditions that
offering on the schedule, the system verifies that the Student has the neces- will make it “execute.”
sary prerequisites. 3. For each test case, identify the data
6. Display Completed Schedule values with which to test.
The system displays the schedule containing the selected course offerings
for the Student and the confirmation number for the schedule. Step One: Generate
Scenarios
As you can see, a significant amount of detail goes into fully specifying a use case. To clearly document the test cases, once
Ideally, the flows should be written as “dialogs” between the system and the again, a matrix format is useful, like the
actors. Each step should explain what the actor does and what the system does in one in Table 4. Notice the top row. The
response; it should also be numbered and have a title. Alternate flows always first column contains the test case ID,
specify where they start in the basic flow and where they go when they end. the second column has a brief descrip-
You can see that a scenario always starts in the basic flow, and besides the basis flow itself, always exercises one ore more
alternate flows. These scenarios will be used as the basis for creating test cases.
Table 4: Test Case Matrix for the Register for Courses Use Case
Test Scenario/ Student Courses Pre-Req’s Course Schedule Expected
Case ID Condition ID Password Selected Fulfilled Open Open Result
RC 1 Scenario 1 - V V V V V V Schedule and
successful confirmation
registration number displayed.
RC 2 Scenario 2 - I N/A N/A N/A N/A N/A Error message -
unidentified back to login
student screen
RC3 Scenario 3 - V V N/A N/A N/A N/A Login screen
valid user quits appears
RC4 Scenario 4 - V V N/A N/A N/A N/A Error message -
course regi- back to step 2
stration system
unavailable
RC 5 Scenario 5 - V V N/A N/A N/A N/A Error message -
registration back to step 2
closed
RC6 Scenario 6 - V V V V I V Error message -
cannot enroll - back to step 3
course full
RC 7 Scenario 7 - V V v I V V Error message -
cannot enroll - back to step 4
pre-requisite
not fulfilled
RC 8 Scenario 8 - V V V V V I Error message -
cannot enroll - back to step 4
schedule conflict
RC 9 Scenario 9 - V V V V V I Error message -
schedule conflict use case ends
and user quits
tion of the test case, including the sce- Notice that in this matrix no data values clearly shows what conditions are being
nario being tested, and all other have actually been entered. The cells of tested for each test case. It is also very
columns except the last one contain the table contain a V, a I or n/a. V indi- easy to determine by looking at the Vs
data elements that will be used in imple- cates valid, I is for invalid and n/a and Is whether you have identified a
menting the tests. The last column con- means that it is not necessary to supply sufficient number of test cases. In addi-
tains a description of the test case’s a data value in this case. This specific tion to the “happy day” scenarios in
expected output. matrix is a good intermediate step; it which everything works fine, each row
in the matrix should have at least one I implemented or executed; they are just Using the clearly-defined methodology
indicating an invalid condition being descriptions of conditions, scenarios, I’ve outlined above for generating test
tested. In the test case matrix in Table 4, and paths. Therefore, it is necessary to cases, testers and developers can sim-
some conditions are obviously missing identify actual values to be used in plify the testing process, increase effi-
— e.g., Registration Closed — because implementing the final tests. Table 5 ciency, and help ensure complete test
RC3, RC4 and RC5 each have the same shows a test case matrix with values coverage.
combination of Is and Vs. Additionally, substituted for the Is and Vs in the pre-
each column should contain an I in at vious matrix. A number of techniques About the Author:
least one cell. Looking at the Password can be used for identifying data values, As Requirements Management Evan-
column in table 4 one can see that there including random or creative data entry, gelist at Rational Software, Jim
is no I, this indicates that a test case is but these are beyond the scope of this Heumann specializes in the front end of
missing, there is no test for a bad pass- article. the software development lifecycle. Jim
word. This “intermediate” test matrix, has been with Rational software for
thus, helps to quickly analyze test cov- Putting It All Together over two years, most of which has been
erage for the associated use case. In current practice, use cases are associ- spent helping customers understand and
ated with the front end of the software implement software processes and
Step Three: Identify Data development lifecycle and test cases are tools.
Values to Test typically associated with the latter part
Once all of the test cases have been of the lifecycle. By leveraging use cases Heumann has been in the software busi-
identified, they should be reviewed and to generate test cases, however, testing ness since 1982, having worked on
validated to ensure accuracy and to teams can get started much earlier in the analysis, development, design, training
identify redundant or missing test cases. lifecycle, allowing them to identify and and project management in several
Then, once they are approved, the final repair defects that would be very costly organizations of various sizes and
step is to substitute actual data values to fix later, ship on time, and ensure that industry segments.
for the Is and Vs. Without test data, test the system will work reliably.
cases (or test procedures) can’t be