Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dynamic Black-Box Testing Part 2

Similar presentations


Presentation on theme: "Dynamic Black-Box Testing Part 2"— Presentation transcript:

1 Dynamic Black-Box Testing Part 2
• How to reduce the number of test cases using: Decision Tables State Transition

2 Black-box Testing There are four specification-based or black-box techniques: Equivalence partitioning Boundary value analysis State transition testing Decision tables Focused on business logic or business rules. The techniques of equivalence partitioning and boundary value analysis are often applied to specific situations or inputs. However, if different combinations of inputs result in different actions being taken, this can be more difficult to show using equivalence partitioning and boundary value analysis

3 State Transition Testing
A black box test design technique in which test cases are designed to execute valid and invalid state transitions Finite state system: system where you get a different output for the same input, depending on what has happened before Shown as a state diagram

4 State Testing A software state is a condition or mode that the software is currently in A software tester must test a program's states and the transitions between them. to verify the program's logic flow through its various states Example Windows Paint program All the tools, menu items, colors are states Whenever you select one of these and make the software change its look, its menus, or its operation, you're changing its state It's usually possible to visit all the states The difficulty is that except for the simplest programs, it's often impossible to traverse all paths to all states.

5 State Transition Testing
A state transition model has four basic parts: The states that the software may occupy (shown as circles) The transitions from one state to another (lines with arrows) The events that cause a transition (text near the transitions) The actions that result from a transition

6 Example Entering a Personal Identity Number (PIN) to a bank account
Other events: cancel , time-out

7 State Transition Testing
Deriving test cases Test case for every normal situation Visit each state at least once Test the state-to-state transitions that look like the most popular (frequently used) Test all the error states and returning from the error states Test the least common paths between states Test random state transitions

8 State Table A table showing the resulting transitions for each state combined with each possible event, showing both valid and invalid transitions List states as rows List all possible events as columns Each cell will indicate which state the system will move to, when the corresponding event occur at some state. Negative test conditions will attempt invalid transitions

9 State Table Invalid PIN Valid PIN Insert card
- S2 S1) Start State S3 S6 S2) Wait for PIN S4 S3) 1st try invalid S5 S4) 2nd try invalid S7 S5) 3rd Try invalid ? S6) Access to account S1 (for new card) S7) Eat card State table for PIN example

10 Airline Reservations System
I call Southwest Airlines to make a reservation. I provide information about the origin and destination of my travel, and the date and time that I wish to fly. A reservation is made for me and stored in their system. My reservation is now in the "Made" state. Depending on the various fare rules, I'm given a certain amount of time to pay for the ticket. It could be within 24 hours; or it might be until 1 hour before departure. Once I pay for the ticket, my reservation changes state. It's now "Paid". On the day of travel, I arrive at the airport in plenty of time, stand in the incredibly long lines, and get a printed copy of my ticket. The reservation is now in the "Ticketed" state. When I give my ticket to the agent and get on the plane, the reservation changes to the "Used" state. Of course, I can cancel my reservation at any time before I get on the plane. If I've paid for it, I should be able to get a refund or at least a credit.

11 Airline Reservations System

12 Quiz What should state transition diagrams show?
Draw the state transition diagram for the process of withdrawing from a bank ATM

13 Decision Tables A black box test design technique in which test cases are designed to execute the combinations of inputs and/or stimuli (causes) shown in a decision table Provide a systematic way of stating complex business rules Can be used by analysts, developers and testers

14 Decision Table Help testers explore the effects of combinations of different inputs and other software states that must correctly implement business rules. Testing all combinations may be impractical if not impossible. So, test a subset of combinations But making the choice of which combinations to test is what makes it effective

15 Using Decision Tables Identify a suitable function or subsystem which reacts according to a combination of inputs or events (not too many inputs) Identify the aspects that need to be combined, then you put them into a table Identify all of the combinations of True and False Number of combinations= 2^ number of aspects Identify expected outcome for each combination

16 Using Decision Tables 5. Finally, write test cases to exercise each of the rules in decision table.

17 Decision Table Example
If you are a new customer and you want to open a credit card account then you will get a 15% discount on all your purchases today. If you are an existing customer and you hold a loyalty card, you get a 10% discount. If you have a coupon, you can get 20% off today (but it can’t be used with the ‘new customer’ discount). Discount amounts are added, if applicable.

18 Decision Table Example

19 Decision Table Example
Note that we have put X for the discount for two of the columns (Rules 1 and 2) – this means that this combination should not occur. You cannot be both a new customer and also holding a loyalty card We would have one test for each column or rule of our decision table If time-constrained, we may not have time to test all combinations full table helps us to decide which combinations to test

20 Quiz Scenario: If you hold an “over 60” rail card, you get a 34% discount on whatever ticket you buy. If you are travelling with a child (under 16), you can get a 50% discount on any ticket if you hold a family rail card, otherwise you get a 10% discount. You can only hold one type of rail card. Produce a decision table showing all combinations of fare types and resulting discounts and derive test cases from the decision table


Download ppt "Dynamic Black-Box Testing Part 2"

Similar presentations


Ads by Google