From use CASES to TEST CASES
-test note of "Essential software Test Design"
2015-08-31
Content:
12.1 What is use Cases?
12.2 Use Cases
12.2.1 Example:use Case–withdraw Money
12.3 The model–compiling the Flow Graph
12.4 Creating Base Test Cases
12.4.1 List All Scenarios
To DESCRIBE the requirements in a system, a technique is often used which are called use cases.
12.1 What is use Cases?
Top
Use cases is a step-by-step description of a flow, where an actor interact with a system. An actor is one of a number of different user types, the system itself, or other external systems.
The commonest flow–normal Use–is called the main flow (also called the normal flow or Happy Path) and variations of th IS is termed alternative flows.
The overarching work procedure are this:
- Compile an activity diagram. If this was already in place, the first step was to review it.
- List All Scenarios
- Analyze and prioritize the scenarios according to Risk–which is most important, commonest
- Identify the operational variables which can affect the expected result
- Write one or more test cases for each scenario
12.2 Use Cases
Top
Let us go back to the example of a ATM machine. A Simple use case could look like this:
12.2.1 Example:use Case–withdraw Money
Assumptions:
- The customer ' s Bank is one which is connected to the ATM system.
- The customer has a correct and functioning magnetic strip card.
- The ATM is switched on and are in ready mode.
- The ATM is situated in Sweden so all withdrawals would be in Swedish crowns,
- SEK, and bills that can is withdrawn is.
Actors
Main Flow:
H-1. The use case begins when the customer inserts the card.
H-2. The ATM verifies the card and requests the PIN number.
H-3. The customer types in the correct PIN (4 digits).
H-4. The ATM verifies the PIN and asks the customer to type a amount.
H-5. The customer types in the amount (100-2000 SEK manually or by using the multiple choice keys).
H-6. The ATM verifies that the amount are available in the customer's account and ejects the card, the money and the receipt, an D registers the transaction in the customer's account.
H-7. The customer takes the card, the money and the receipt.
H-8. The ATM returns to standby mode.
H-9. End of use case.
Results
The customer has carried out a successful withdrawal of money.
The customer's account was updated with the transaction.
Alternative flows
Alternative FLOW–A1 Invalid Card
A1-1. At step H-1, the customer inserts an invalid card.
A1-2. The ATM aborts the transaction and the card is ejected.
Alternative flow–a2 wrong PIN
A2-1. At step H-3, the customer types in the wrong PIN.
A2-2. The ATM registers an incorrect PIN and asks the user to try again.
A2-3. The use case is continues with step H-3.
Alternative flow–a3 wrong PIN, 3 times
A3-1. At step H-3, the customer types with the wrong PIN three times in a row.
A3-2. The ATM swallows the card and the transaction is aborted.
A3-3. End of use case.
Alternative flow–a4 incorrect input of amount
A4-1. At step H-5, the customer makes an incorrect entry (not divisible by a hundred, funds is not in the account, exceeds perm itted Maximum withdrawal ...)
A4-2. The ATM disallows the entered amount and asks the user to try again.
A4-3. The use case is continues with step H-5.
Alternative Flow–a5 Customer does not take the
A5-1. At step H-7, the customer takes the "the card", but is not the receipt within seconds.
A5-2. The ATM leaves the receipt hanging out of the machine and retracts the money, places it in a separate container and writes The amount, account number and cause of defect into a defect log.
A5-3. The use case is continues with step H-8.
Alternative Flow–a6 The customer ' s Bank is not on-line (other than Handelsbanken)
A6-1. At step H-6, the ATM cannot verify whether the amount are available in the customer's account. A message shows the contact with the customer's bank is being established and the card is ejected.
A6-2. The use case is continues with step H-8.
Alternative Flow–a7 Customer aborts the withdrawal
A7-1. At all times in the Main flow, apart from steps H-6 and H-7, the customer can choose to abort the transaction
A7-2. The ATM aborts the transaction and ejects the card, and no withdrawal is recorded on the customer's account.
A7-3. The use case is continues with step H-8.
12.3 The model–compiling the Flow Graph
Top
If There is not one already, you compile a flow diagram based on the use case.
Figure 12.1:activity Diagram of the ' flow in the ' Use Case«withdraw money». We have a starting point but several different end points, with different results.
12.4 Creating Base Test Cases
Top
12.4.1 List All Scenarios
To cover the graph, we generate base test cases for the different flows at hand
- Start with the Main flow, which the Happy day Test.
- Continue with the alternative flows–one at a time.
- There is different combinations of alternative flows. It isn't always possible to draw up all the combinations:there could be infinite loops.
From use CASES to TEST CASES