STATE TRANSITION TESTING
(Finite State Machine)
State Transition Testing
It evaluates the functionality of a system by analyzing its response to changes in
input conditions or modifications to its current state.
FINITE STATE MACHINE (FSM):
An FSM is a behavioral model whose outcome depends upon both previous and
current inputs.
State Transition Diagram
It has four main components:
(1) States: State the software current stage.
(example: waiting for the pin, accessing an account)
(2)Transition: A transition is initiated by an event.
(3) Events: The event results in a transition.
(example: Event1: Card inserted, Event 2: enter Pin, Event 3: Pin OK, Event 4:
Pin not OK)
(4) Actions: The state change may result in the software taking action.
(example: Outputting an invalid pin message.)
State Transition Diagram
(Example1:ATM Withdrawal process)
State Transition Table
It provides a comprehensive view of all valid and potential invalid transitions
between states, (including the events and resulting actions for valid transitions).
Example:2_ Log in to online banking site
State transition diagram:
State Transition Table:
DECISION TABLE-BASED TESTING
DECISION TABLE-BASED TESTING
Decision table is another useful method to represent the information in a tabular
method.
It has to consider complex combinations of input conditions and resulting actions.
Each operand or variable in a logical expression takes on the value, TRUE or FALSE.
DECISION TABLE-BASED TESTING
A decision table is formed with the following components:
(1) Condition stub: It is a list of input conditions for which the complex combination is
made.
(2) Action stub: It is a list of resulting actions which will be performed if a combination
of input condition is satisfied.
(‘X’ denotes the action entry).
(‘I’ denotes the Don’t-Care state or immaterial state) i.e. condition entry, which has
no effect whether it is True or False.
(3) Rule: When we enter TRUE or FALSE for all input conditions for a particular
combination, then it is called a Rule.
Decision table structure
EXAMPLE: 1
The Food delivery company offer the following discounts for their customers
based on the given conditions:
New Customer : 15%
Repeat Customer : 10%
Coupon Code : 30%
Design test cases using decision table testing.
Decision Table
Rules
1 2 3 4 5 6 7 8
Condition C1: New Customer T T T T F F F F
Stub: : 15%
C2: Repeat T T F F T T F F
Customer : 10%
C3: Coupon Code T F T F T F T F
: 30%
Action Invalid Invalid 45% 15% 40% 10% I I
Stub:
EXAMPLE: 2
A program calculates the total salary of an employee with the conditions that if
the working hours are less than or equal to 48, then give normal salary.
The hours over 48 on normal working days are calculated at the rate of 1.25 of
the salary.
However, on holidays or Sundays, the hours are calculated at the rate of 2.00
times of the salary.
Design test cases using decision table testing.
Solution:
The decision table for the program is shown below:
TEST CASE DESIGN USING DECISION TABLE
The test cases derived from the decision table are given below:
EXAMPLE: 3
A university is admitting students in a professional course subject to the
following conditions:
(a) Marks in Java ≥ 70
(b) Marks in C++ ≥ 60
(c) Marks in OOAD ≥ 60
(d) Total in all three subjects ≥ 220 OR Total in Java and C++ ≥ 150
If the aggregate mark of an eligible candidate is more than 240, he will be
eligible for scholarship course, otherwise he will be eligible for normal course.
The program reads the marks in the three subjects and generates the following
outputs:
(i) Not eligible
(ii) Eligible for scholarship course
(iii) Eligible for normal course
Design test cases for this program using decision table testing.
Solution:
The decision table for the program is shown below:
TEST CASE DESIGN USING DECISION TABLE
The test cases derived from the decision table are given below:
EXAMPLE: 4
A wholesaler has three commodities to sell and has three types of customers.
Discount is given as per the following procedure:
(i) For DGS & D orders, 10% discount is given irrespective of the value of the
order.
(ii) For orders of more than Rs 50,000, agents get a discount of 15% and the
retailer gets a discount of 10%.
(iii) For orders of Rs 20,000 or more and up to Rs 50,000, agents get 12% and
the retailer gets 8% discount.
(iv) For orders of less than Rs 20,000, agents get 8% and the retailer gets 5%
discount.
The above rules do not apply to the furniture items wherein a flat rate of 10%
discount is admissible to all customers irrespective of the value of the order.
Design test cases for this system using decision table testing.
Solution:
The decision table for the program is shown below:
TEST CASE DESIGN USING DECISION TABLE
The test cases derived from the decision table are given below: