The document discusses test design techniques for software testing. It defines what a testing technique is and lists some advantages of using techniques, such as finding more faults with less effort, avoiding duplication, and making testing more effective and measurable. It also discusses specific techniques like scripted testing, static testing, dynamic testing including white box and black box techniques. White box techniques covered include statement coverage, branch coverage, path coverage, and cyclomatic complexity. Examples are provided to show how to calculate coverage percentages and cyclomatic complexity.
2. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
What is a testing technique?
A procedure for selecting or designing tests.
Based on a structural or functional model of the software.
Successful at finding faults.
Best practice.
A way of deriving good test cases.
A way of objectively measuring a test effort.
Note: Testing should be rigorous, thorough and
systematic.
2www.talentsprint.com
3. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Advantages of Techniques:
Different People:
Higher probability to find similar faults.
Gain some independence of thought
Effective Testing:
Finds more faults
Focus attention on specific types of fault
Know you're testing the right thing
3www.talentsprint.com
4. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Advantages of Techniques:
Efficient Testing:
Find more faults with less effort
Avoid duplication
Systematic techniques are measurable
Note: Using techniques makes testing much more effective.
4www.talentsprint.com
5. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Advantages of Techniques:
Efficient Testing:
Find more faults with less effort
Avoid duplication
Systematic techniques are measurable
Note: Using techniques makes testing much more effective.
5www.talentsprint.com
6. 6
Introduction to Testing Techniques
Testing
Techniques
Scripted Testing
Experience
Based Testing
Static
Testing
Dynamic
Testing
Tool-Based
Testing
People-Based
Testing
Black Box
Testing
White Box
Testing
Error-Guessing
Technique
Error-Guessing
Testing
Technique
7. 7
Based on behavior /
functionality of software
Based on structure of
software
Introduction to Testing Techniques
Examination of
documentation, source code
listings, etc.
Static
(Non-execution)
Behavioral
(Black Box)
Structural
(White Box)
Types of Systematic Techniques
Dynamic Testing
8. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Scripted Testing:
People Based Testing
Tool Based Testing
8www.talentsprint.com
Reviews
Walkthroughs
Desk-checking
Static AnalysisInspection
etc.
Static
9. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
When is scripted testing used?
Repeatability:
When the tests are detailed enough so that some one other than the
author to execute it in an identical way.
Objectivity:
Test creation does not depend on the extraordinary skill of the
person creating the test but is based on well understood test design
principles.
Auditability: Traceability from requirements, design, and code to
the test cases and back again.
9www.talentsprint.com
10. 10
IEEE 829 Test Documents?
Scripted Testing
Test Plan
Test Design
Specification
Test Log
Test
Incident
Report
Test
Execution
Test Item
Transmittal
Report
Test Case
Specification
Test Procedure
Specification
Test
Summary
Report
11. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Dynamic Testing:
White Box Test Design Techniques
Black Box Test Design Techniques
11www.talentsprint.com
12. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
White Box Test Design Techniques:
The main objective of white box testing is to ensure 100%
code coverage.
Code coverage:
The percentage of code tested during white box testing is called code
coverage.
The source code behind a unit may contain a set of statements, a set of
conditions and a set of branches. If all these are tested, then we say
100% code coverage is achieved.
12www.talentsprint.com
13. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Why White Box Test Design Techniques:
As testing everything at code level may be impossible.
To avoid this, at the same to ensure 100% code coverage
the following techniques are introduced in white box
testing.
13www.talentsprint.com
14. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
White Box Test Design Techniques:
Statement Coverage
Branch/Condition/ Decision Coverage
Path Coverage
Cyclomatic Complexity
14www.talentsprint.com
15. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
White Box Test Design Techniques:
Statement Coverage:
The percentage of statements tested during white box
testing is called statement coverage.
Statement coverage=
(Number of statements tested/total number of statements) x 100
15www.talentsprint.com
16. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
White Box Test Design Techniques:
Branch/ Decision/ Condition Coverage:
The percentage of branches tested during white box
testing is called branch coverage.
Branch coverage=
(Number of branches tested/total number of branches) x 100
16www.talentsprint.com
17. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
White Box Test Design Techniques:
Path Coverage:
The percentage of paths tested during white box testing is
called path coverage.
Path coverage=
(Number of paths tested/total number of paths) x 100
17www.talentsprint.com
18. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
White Box Test Design Techniques:
Cyclomatic Complexity:
Cyclomatic complexity is a source code complexity
measurement that is being correlated to a number of
coding errors.
It is calculated by developing a Control Flow Graph of the
code that measures the number of linearly-independent
paths through a program module.
18www.talentsprint.com
19. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
White Box Test Design Techniques:
Cyclomatic Complexity:
Cyclomatic complexity =E - N + P
where,
E = number of edges in the flow graph.(Lines)
N = number of nodes in the flow graph.(Shapes)
P = number of nodes that have exit points
19www.talentsprint.com
20. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
White Box Test Design Techniques:
Cyclomatic Complexity:
Cyclomatic Complexity C = Number of Decision Points
(i.e. the Decision Boxes in Flow diagram) + 1
20www.talentsprint.com
21. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Points to Remember:
100% LCSAJ will ensure 100% branch coverage.
100% branch coverage will ensure 100% statement
coverage.
100% path coverage will ensure 100% statement
coverage.
100% path coverage will ensure 100% branch coverage.
Best Technique: Path Coverage.
21www.talentsprint.com
22. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Case Study :
Consider a code and how many minimum number of tests are required
to cover 100% Statement & Branch & Path coverage & what is
Cyclomatic Complexity?
Read P
Read Q
IF P+Q >100 then
Print Large
End IF
IF P>50 then
Print P Bigger
End IF
22www.talentsprint.com
23. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Assignment-1
Read A
If A>0 then
If A>21 then
Print Key
End IF
End If
23www.talentsprint.com
24. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Assignment-2
Read A
Read B
If A>0 then
if B=0 then
Print No Values
else
Print B
if A>21 then
Print A
End If
End IF
End If
24www.talentsprint.com
25. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Assignment-3
Read A
Read B
If A<0 then
Print A Negative
else
Print A Positive
End IF
If B<0 then
Print B Negative
else
Print B Positive
End If
25www.talentsprint.com
26. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Assignment-4
Read A
Read B
If A<0 then
Print A Negative
End IF
If B<0 then
Print B Negative
End If
26www.talentsprint.com
27. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Test Design Techniques:
Assignment-5
Read A
If A<0 then
Print A Negative
End IF
If A>0 then
Print A Positive
End If
27www.talentsprint.com
28. DO NOT DISTRIBUTE HIGHLY CONFIDENTIAL
Review Questions:
28www.talentsprint.com
White Box Testing Techniques:
The Structure-Based or White Box Testing Techniques, as described
in BS 7925-2 standards, are :
Statement Testing
Branch / Decision Testing
Data Flow Testing
Branch Condition Testing
Branch Condition Combination Testing
Modified Condition Decision Testing
LCSAJ (Linear Code Sequence and Jump) Testing
Note: All these techniques can also be used as Measurement Techniques.