Here are the test cases that we derive from this table. (If you didn
’t rationalize the table, then you will have
eight test cases rather than six.) Note that you wouldn
’t necessarily test each column, but the table enables you to
make a decision about which combinations to test and which not to test this time.
Test case reference Input
Expected outcome
1
S. Wilkes, with over 60s rail card and family rail card, travelling
with grandson Josh (age 11)
50% discount for both tickets
2
Mrs. M. Davis, with over 60s rail card and family rail card,
travelling alone
34% discount
3
J. Rogers, with over 60s rail card, travelling with his wife
34% discount (for J. Rogers
only, not the wife)
4
S. Gray, with family rail card, travelling with her daughter Betsy 50% discount for both tickets
5
Miss Congeniality, no rail card, travelling alone
No discount
6
Joe Bloggs with no rail card, travelling with his 5-year-old niece 10% discount for both tickets
Note that we may have raised some additional issues when we designed the test cases. For example, does the
discount for a rail card apply only to the traveller or to someone travelling with them? Here we have assumed that
it applies to all travellers for the family rail card, but to the individual passenger only for the over 60s rail card.
State transition exercise
The state diagram is shown in Figure 4.7. The initial state (S1) is when the shopping basket is empty. When an
item is added to the basket, it goes to state (S2), where there are potential purchases. Any additional items added
to the basket do not change the state (just the total number of things to purchase). Items can be removed, which
does not change the state unless the total items ordered goes from 1 to 0. In this case, we go back to the empty
basket (S1). When we want to check out, we go to the summary state (S3) for approval. If the list and prices are
Chia sẻ với bạn bè của bạn: