THE UNIVERSITY OF LAHORE
Software Testing & Implementation
Exercise SOLUTION
Chapter 4 (Test Design Techniques)
Q1: What are the partitions and boundary values to test the password if characters are
between 6-12 exclusive all the special characters and spaces. Password can be
alphanumeric.
a) Equivalence Partitioning (EP) for p
Valid Valid Valid Invalid Invalid Valid
6 – 12
All special
A-Z a–z 0-9 Spaces Character
characters
length
b) Boundary values (BVA) for password (6-12)
c) What are the valid partitions and which are invalid partitions?
A-Z, a-z, 0-9, 6-12
d) Write invalid boundary values.
5, 13
e) Drive five test cases for the partitions and boundaries.
Test Case Reference Input Outcome
TC_01 Binus123 Valid password
TC_02 Binus_123 Invalid password
TC_03 binusuniversity invalid password
TC_04 binusuniv Valid password
TC_05 BINUSinternational123 Invalid password
Page 1 of 4
Q2: Look at the following program written in high-level language.
READ X
READ Y
IF "X > Y"
PRINT X is greater that Y
ENDIF
a) How many tests are required to achieve 100% statement coverage?
1
b) How many tests are required to achieve 100% decision coverage?
2
c) Write down the possible test sets to achieve 100% statement coverage.
X=10, Y=5
Q3: Look at the following program written in high-level language.
INPUT "Please enter your total order", order
IF order < 100 THEN
discount = order * 0.1
PRINT ”Your discount is”, discount
ELSE
IF order >= 100 THEN
discount = order * 0.15
PRINT "Your discount is"; discount
ENDIF
ENDIF
a) How many tests are required to achieve 100% statement coverage?
2 TESTS
b) How many tests are required to achieve 100% decision coverage?
2 TESTS
c) Write down the possible test sets to achieve 100% statement coverage.
TEST_1: Order = 50
TEST_2 Order= 120
_________________________________________________________________________
Page 2 of 4
Q4: Look at the following program written in high-level language.
Read A, B
IF A is less than B
BIG = B
SMALL = A
ELSE
BIG = A
SMALL = B
Write (Display) BIG, SMALL
a) Draw a control flow diagram (flowchart) of the above program.
b) Test_01 A=3
B=5
Test_02 A=8
B=6
Q5 a Construct a decision table of the following specification.
If the customer is a new customer, offer 20% discount on next order
If the customer is a repeat customer, offer free shipping, otherwise no discount.
Conditions/Causes R1 R2 R3 R4
New Customer Y Y N N
Repeat customer Y N Y N
Actions/Outcomes
Discount % X 20% Free shipping 0%
b) Drive three test cases from the decision table.
Test Case Reference Input Outcome
TC_01 New customer 20% discount
TC_02 Repeat customer Free shipping
TC-03 New and repeat customer Error message
Page 3 of 4
Q6: The state transition diagram is shown below.
a) Define a test, in terms of the sequence of states, to cover all transitions.
ALREADY EXPLAINED IN THE CLASS
b) Produce a state table.
ALREADY EXPLAINED IN THE CLASS
…………………………………….END OF SOLUTION…………………………………….
Page 4 of 4