Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 50

Testing

1. Static Testing
2. Dynamic Testing

1
• Static Testing – before code development
- prevents the error

• Dynamic testing – after code development


- fixes the error

2
Chapter 4
Dynamic Testing: Black Box
Testing Techniques

3
Objectives

• Black box testing ignores the structural details of the software


• .
• Test case designing using black box techniques.

• Boundary value analysis method

• Equivalence class testing method

• State table based testing method

• Decision table based testing method

• Cause-effect graphing method


4
Evolution of Software Testing
Black Box Testing

5
Evolution of Software Testing
Black Box Testing

• To test the modules independently.

• To test the functional validity of the software

• Interface errors are detected.

• To test the output for the given input

6
• To test the system behavior and check its
performance.

• To test the maximum load or stress on the


system.

• Customer accepts the system within


defined acceptable limits.
7
• Boundary Value Analysis (BVA) is a black box
software testing technique where test cases are
designed using boundary values.
• Test cases with boundary input values will have high
probability of finding the errors

• Boundary means : minimum and maximum

8
Boundary Value Analysis (BVA)

9
Co ordinates of triangle
(10,10)
(255, 10)
(10,100)
( 255, 100)

10
Example of a boundary
• A is a integer between 10 and 255
• Then boundary checking for 10
10(9,10,11)
9 – below the boundary
10 – on the boundary
11 – above the boundary
• Then boundary checking for 255
255(254,255,256)
254 – below the boundary
255 – on the boundary
256 – above the boundary

11
Boundary Value Checking

• Test cases are designed by holding one variable at its extreme


value and other variables at their nominal values in the input
domain.
• The variable at its extreme value can be selected at:

– Minimum value (Min)


– Value just above the minimum value (Min+ )
– Maximum value (Max)
– Value just below the maximum value (Max-)

12
No of Test Cases in Boundary Value checking

• No of variable in a module : n

• Possible no of test cases : 4n +1

13
Robustness Testing Method

A value just greater than the Maximum value (Max+)


A value just less than Minimum value (Min-)
• When test cases are designed considering above points in
addition to BVC, it is called Robustness testing.

• Amax+, Bnom
• Amin-, Bnom
• Anom, Bmax+
• Anom, Bmin-

14
No of Test Cases in Robustness Testing method

• No of variable in a module : n

• Possible no of test cases : 6n +1

15
Software Testing
Worst Case Myths
Testing Method

• When more than one variable are in extreme values, i.e. when more
than one variable are on the boundary. It is called Worst case
testing method.

• Input variables = n ,
• 5n test cases are designed with worst case testing.

16
A program reads an integer number within the range
[1,100] and determines whether the number is a prime
number or not.
Design all test cases for this program using BVC, Robust
testing and worst-case testing methods.

Solution :
Program reads one integer number
So the no of variable is 1
The no of test cases in BVC : 4 n + 1
put n =1
No of test cases = 5

17
Example

• 1) Test cases using BVC

18
No of Test cases in Robust Testing = 6n+1

• No of variable =1 No of Test cases = 6 +1 = 7


• Test Cases Using Robust Testing

19
A Program computes a power b where a lies in the range [1,10]
and
b within the range [1,5]. Design test cases for this program using
Boundary Value Checking

Solution : No of variables = a and b therefore n =2


No of Test cases = 4n+1
put n =2
No of Test cases = 9

20
a b

Min value 1 1

Min + value 2 2

Max value 10 5

Max – value 9 4

Nominal value 5 3

21
Test Case ID a Expected output

b
T101 1 3 1

T102 2 3 8

T103 10 3 1000

T104 9 3 729

T105 5 1 5

T106 5 2 25

T107 5 4 625

T108 5 5 3125

T109 5 3 125

22
Problem

• A program determines the next date in the calender. Its


input is entered in the form of <<ddmmyyyy> with the
following range
1 <mm<12
1<dd<31
1900<yyyy<2025
Its output would be the next date or it will display invalid
date. Design test cases using BVC.

23
Solution
No of input variables = 3
date , month and year
No of Test case = 4n+1
put n =3
No of Test cases = 4*3 +1 = 13

24
Test Month Day Year Expected Output
Case ID
T101 1 15 1962 16-1-1962
T102 2 15 1962 16-2-1962
T103 11 15 1962 16-11-1962
T104 12 15 1962 16-12-1962
T105 6 31 1962 Invalid input
T106 6 15 2024 16-6-2024
T107 6 17 2025 18-6-2025
T108
T109
T110
T111
T112
25
T113
Equivalence Class Testing

• Input domain for testing is too large to test every


input.
• We can divide or partition the input domain
based on the common feature

26
Goals of Equivalence Testing

• Completeness
- full complete testing of all test cases

• Non redundancy
- reduce the repeated test cases

27
Steps of Equivalence Testing

(i) Identification of equivalent test cases

(ii) Design test cases

28
Equivalence Class Testing

29
Example Problem

• A program reads three numbers A, B and C with range [1,50] and


prints largest number. Design all test cases for this program using
equivalence class testing technique.

• Solution :
Partition the domain of input values as valid input and invalid input

30
Classes of input A,B,C
I1 = {<A,B,C> : 1 ≤ A ≤ 50}
I2 = {<A,B,C> : 1 ≤ B ≤ 50}
I3 = {<A,B,C> : 1 ≤ C ≤ 50}
I4 = {<A,B,C> : A < 1}
I5 = {<A,B,C> : A > 50}
I6 = {<A,B,C> : B < 1}
I7 = {<A,B,C> : B > 50}
I8 = {<A,B,C> : C < 1}
I9 = {<A,B,C> : C > 50}

31
Test cases

32
Another Solution

• I1 = {<A,B,C> : A > B, A > C}


• I2 = {<A,B,C> : B > A, B > C}
• I3 = {<A,B,C> : C > A, C > B}
• I4 = {<A,B,C> : A = B, A ≠ C}
• I5 = {<A,B,C> : B = C, A ≠ B}
• I6 = {<A,B,C> : A = C, C ≠ B }
• I7 = {<A,B,C> : A = B = C}

33
34
Problem -2

• A program determines the next date in the calender. Its


input is entered in the form of <<ddmmyyyy> with the
following range
1 <mm<12
1<dd<31
1900<yyyy<2025
Its output would be the next date or it will display invalid
date. Design test cases using equivalence class testing.

35
• Classes of Test Inputs

• I1={<m,d,y> : 1<m < 12 }


• I2 = {<m,d,y>: 1<d < 31}
• I3 = {<m,d,y>: 1900 <y < 2025}
• I4={<m,d,y>: m <1}
• I5= {<m,d,y>: m > 12}
• I6 = {<m,d,y>: d <1 }
• I7 = {<m,d,y>: d > 31 }
• I8 = {<m,d,y>: y <1900 }
• I9 = {<m,d,y>: y > 2025 }

36
Test Month Day Year Expected Output
Case ID
T101 5 20 1996 21- 5 -1996
T102 0 13 2000 Invalid input

T103 13 13 1962 Invalid input

T104 12 0 1989 Invalid input

T105 6 32 2007 Invalid input


T106 11 15 1899 Invalid input

T107 6 17 2027 Invalid input

37
State Table based Testing

• Finite State Machine

• FSM is a behavioural model whose outcome depends


upon the previous and current inputs

38
List of States in a Process

• New State : newly created task


• Ready : When the task is waiting in the ready queue for
its run
• Running : instruction of task are executed by CPU
• Waiting : When the task is waiting for I/O event
• Terminated : The task has finished the execution

39
State Table Based Testing

State Transition Diagrams or State Graph

40
State Table Based Testing

• State Table

41
State Table Based Testing

42
Decision Table based testing

• BVA do not consider the combination of input values


• Useful method to represent the information in a tabular
method

• Complex combination of input conditions and resulting


actions

• Each variable in a logical expression can have 2 values


either TRUE or FALSE

43
Decision Table Based Testing

44
Decision Table Based Testing

Example
• 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 the test cases using decision table testing.

45
Decision Table Based Testing

46
A University is admitting students in a professional course, subject to
the following conditions:
Marks in Java >=70
Marks in C++>=60
Marks in OOAD >=60
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:
•Not eligible
•Eligible for scholarship course
•Eligible for normal course

Design test cases using decision table testing.


47
  R2 R3 R4 R5 R6 R7 R8 R9
R1

C1: Marks in Java>=70 T T T T F I I I T


C2: marks in c++>=60 T T T T I F I I T
C3: marks in OOAD>=60 T T T T I I F I T
C4: Total in three subjects T F T T I I I F T
>=220

C5: Total in Java & C++ >=150 F T F T I I I F T


C6: Aggregate marks>240 F F T T I I I I F
A1: Eligible for normal course                     

A2: eligible for scholarship                   


course

A3: not eligible                    


48
1 Java C++ OOAD Aggregate marks Eligible for normal
75 75 75 225 course

2 75 75 65 215 Eligible for normal


course

3 75 74 93 242 Eligible for scholarship


course

4 76 77 89 242 Eligible for scholarship


course

5 68 78 80 226 Not eligible


6 78 45 78 201 Not eligible
7 80 80 50 210 Not eligible
8 70 72 70 212 Not eligible
9 75 75 72 222 Eligible for normal
course

49
Error Guessing

• Error guessing is the method used when all other methods fail

• method for some special cases which need to be tested.

• It means error or bug can be guessed which do not fit in any of the
earlier defined situations.

• So test cases are generated for these special cases.


• Testers uses the intuition and makes a guess when the bug can be
present.
• Capacity comes from years of experience in the testing field.

50

You might also like