SlideShare une entreprise Scribd logo
1  sur  75
Télécharger pour lire hors ligne
TB
Full-day Tutorials
5/6/2014 8:30:00 AM
Key Test Design
Techniques
Presented by:
Lee Copeland
Software Quality Engineering
Brought to you by:
340 Corporate Way, Suite 300, Orange Park, FL 32073
888-268-8770 ∙ 904-278-0524 ∙ sqeinfo@sqe.com ∙ www.sqe.com
Lee Copeland
Software Quality Engineering
With more than thirty years of experience as an information systems professional at commercial and
nonprofit organizations, Lee Copeland has held technical and managerial positions in applications
development, software testing, and software process improvement. Lee has developed and taught
numerous training courses on software development and testing issues, and is a well-known
speaker with Software Quality Engineering. Lee presents at software conferences in the United
States and abroad. He is the author of the popular reference book, A Practitioner’s Guide to
Software Test Design.
Keyy
Test Design
Techniques
Software Quality Engineering
340 Corporate Way, Suite 300
Orange Park, Florida 32073
904.278.0707
SQE ©2001-2011 Version 4.0
Lee Copeland
lee@sqe.com
Administrivia
Tutorial timing Tutorial materials
Messages Meals
Pagers and
Cell phones Facilities
Mastering Test Design V 4.0 © SQE 2001-2011
2
BreaksSmoking
Tutorial Goals
• At the end of the tutorial you will be able
to
– Design test cases using structured formalDesign test cases using structured, formal,
“scientific” techniques
– Implement the “art” of test case design as well as
the science
– Understand how defect taxonomies can improve
test case design
3
Mastering Test Design V 4.0 © SQE 2001-2011
Chapter 1Chapter 1
IntroductionIntroduction
4
Mastering Test Design V 4.0 © SQE 2001-2011
Tutorial Agenda
1. Introduction
2. Black Box Science
3. White Box Science
4. Black Box Art
5. Defect Taxonomies
6. Wrap-up
5
Mastering Test Design V 4.0 © SQE 2001-2011
Chapter Objectives
• At the end of this chapter you will be able
to
– Define “testing”
– Define the components of a test case
– Discuss the problems of how much testing can be
done
6
Mastering Test Design V 4.0 © SQE 2001-2011
Test Design Process - Context
Master Test Plan
Detailed Test Plans
Test Analysis
S t ti
7
Test Design
Test Implementation
Systematic
Software
Testing
tutorial
Mastering Test Design V 4.0 © SQE 2001-2011
What is Testing?
• IEEE Std 610 Software Engineering
Terminology: “test”
1 An activity in which a system or component is1. An activity in which a system or component is
executed under specified conditions, the results
are observed or recorded, and an evaluation is
made of some aspect of the system or
component
2. To conduct an activity as in (1)
3 A set of one or more test cases
8
3. A set of one or more test cases
4. A set of one or more test procedures
5. A set of one or more test cases and procedures
Mastering Test Design V 4.0 © SQE 2001-2011
What Do We Test?
Fundamental issues FUNCTIONS Portability
Usability Reliability
Security Availability
Localization Testability
Real-time issues
System management issues
Localization Testability
Extensibility Interoperability
Timing Capacity
Throughput Performance
Overload
Backup and Recovery
Start up and shut down
9
Purchased software
Start-up and shut-down
Operating systems
DBMS
Communications
Mastering Test Design V 4.0 © SQE 2001-2011
Current Challenges In Test Design
?
?
??
?
?
?
?
10
?
?
Mastering Test Design V 4.0 © SQE 2001-2011
Test environment
Order of execution
What Are Test Cases?
Output(s)
Test environment
11
Input(s)
Mastering Test Design V 4.0 © SQE 2001-2011
What Are Test Cases?
• Inputs can be
– Data entered through the
UI
Input(s)
– Data from interfacing
systems
– Data from interfacing
devices
– Files
D t b
12
– Databases
– State
– Environment
Mastering Test Design V 4.0 © SQE 2001-2011
What Are Test Cases?
• Outputs can be:
– Data to UI
– Data to interfacing
Output(s)
Data to interfacing
systems
– Data to interfacing
devices
– Files
– Databases
13
– State
– Response time
Mastering Test Design V 4.0 © SQE 2001-2011
Data
Test Everything?
Combinations
14
Paths
Impossible!
Mastering Test Design V 4.0 © SQE 2001-2011
Test Wisely!
Cost effective
Time
limited
Risk
based
15
Tool support
Choose
wisely
Mastering Test Design V 4.0 © SQE 2001-2011
Chapter 2Chapter 2
Black BoxBlack Box
ScienceScience
16
ScienceScience
Mastering Test Design V 4.0 © SQE 2001-2011
Tutorial Agenda
1. Introduction
2. Black Box Science
3. White Box Science
4. Black Box Art
5. Defect Taxonomies
6. Wrap-up
17
Mastering Test Design V 4.0 © SQE 2001-2011
Objectives
• At the end of this chapter you will be able to
– Implement the Equivalence Class Partitioning andImplement the Equivalence Class Partitioning and
Boundary Value testing techniques
– Create a Decision Table
– Describe when State-Transition diagrams are useful
and how to create one
– Understand and use “All Pairs” based techniques
18
• Orthogonal arrays and pairs based test cases
– Create a Traceability Matrix
• If one is desired or required
Mastering Test Design V 4.0 © SQE 2001-2011
What is Black Box Science?
• Black Box
– Focus only on the inputs and outputs
– Ignore the internal paths, structure, and implementation
– Can’t know the percentage of code tested
• Science
– Use structured approach(es)
– Approach all data the same
19
– Have a methodology based
coverage measure
Mastering Test Design V 4.0 © SQE 2001-2011
Unit Subsystem
System
Black Box at Different Levels
A black box is a black box is a black box.
20
A black box is a black box is a black box.
It’s just a bigger box with more input,
functionality, and output.
Mastering Test Design V 4.0 © SQE 2001-2011
For Each Software Requirement
• First let’s focus on one requirement /
function / story at a time
– Equivalence Class Partitioning
– Boundary Value Testing
– Combining both across multiple inputs
21
Mastering Test Design V 4.0 © SQE 2001-2011
Equivalence Class Partitioning
• The role of Equivalence Class Partitioning
– Create the minimum number of black box tests
needed while still providing adequate coveragep g q g
• Steps
1. Identify equivalence classes - the input ranges
which are treated the same by the software
• Valid classes: legal input ranges
• Invalid classes: illegal or out of range input values
2 C t t t f h f th i l
22
2. Create a test case for each of the equivalence
classes
ValidInvalid Invalid
Mastering Test Design V 4.0 © SQE 2001-2011
Equivalence Class Partitioning
1. If an input condition specifies a continuous range of
values, there is one valid class and two invalid
classes.
– Example: The input variable is a mortgage applicant’s income.
The valid range is $1000.00/mo. to $75,000.00/mo.
• Valid class: {1000.00 < = income < = 75,000.00}
• Invalid classes: {income < 1000.00}, {income > 75,000.00}
2. If an input condition specifies a discrete range of
permissible values, there is one valid class and two
23
permissible values, there is one valid class and two
invalid classes.
– Example: The input variable is the total number of houses being
purchased, from 1 to 5.
• Valid class: {1 < = #_Houses < = 5}
• Invalid classes: {#_Houses < 1}, {#_Houses > 5}
Mastering Test Design V 4.0 © SQE 2001-2011
Equivalence Class Partitioning
3. If an input condition specifies a set of values, there
is one valid and one invalid equivalence class.
– Example: Types of housing are Condo, Townhouse, and
Si l F ilSingle Family
• Valid class: {Condo, Townhouse, Single Family}
• Invalid class: {...anything else...}
• Sets are different
– If each member of a set yields the same result the set is a
single class
24
single class
– If each member generates a different result then each
member is a separate class with one valid and one invalid
class
Mastering Test Design V 4.0 © SQE 2001-2011
Equivalence Class Partitioning
4. If a “must be” condition is required, there is one
valid equivalence class and one invalid class.
– Example: The mortgage applicant must be a
person.
• Valid class: {person}
• Invalid class: {corporation, ...anything else...}
25
Mastering Test Design V 4.0 © SQE 2001-2011
Another Way to Annotate Partitions
Invalid InvalidValid
999.99 75,000.011000.00 to 75,000.00
Invalid InvalidValid
0 61 to 5
Invalid Valid
All Else Condo, Townhouse, Single Family
26
Invalid Valid
Person
Invalid Valid
All Else
Mastering Test Design V 4.0 © SQE 2001-2011
Equivalence Class Partitioning
• Steps for creating the test cases
1. Define the equivalence classes for your rules
2. Write the first test case to cover as many of
the valid equivalence classes from the rule
set as possible (although they may be
mutually exclusive)
3. Continue writing test cases until all of the
valid equivalence classes from the rules have
27
valid equivalence classes from the rules have
been covered
4. Write one test case for each invalid class
Mastering Test Design V 4.0 © SQE 2001-2011
Example Test Cases (EP)
Test Case Valid Test Cases
Income No. Type Person
1 $4,000.00 2 Condo Bob$ ,
Invalid Test Cases
2 $90,000.00 1 Condo Bob’s mom
3 $800.00 2 Single Family Leroy
4 $4,000.00 7 Townhouse Larry
5 $2,000.00 0 Condo Helen
6 $5 500 00 2 Offi Bld S
28
6 $5,500.00 2 Office Bldg. Sam
7 $60,000.00 2 Townhouse ABC Incorporated
Mastering Test Design V 4.0 © SQE 2001-2011
Boundary Value Testing (BV)
• The role of Boundary Value Testing
An additional black box testing approach– An additional black box testing approach
• Almost always used with Equivalence Partitioning
– Test cases at the boundary of each input
• Includes the following
– At the boundary (where possible or if significant)
29
– Just below the boundary
– Just above the boundary
Mastering Test Design V 4.0 © SQE 2001-2011
Example Test Cases (EP/BV)
Test Case Valid Test Cases
Income No. Type Person
1 $1,000.00 1 Condo Bob$ ,
2 $75,000.00 5 Single Family Helen
3 $37,500.00 3 Townhouse George
Invalid Test Cases
4 $75,000.01 1 Condo Bob’s mom
5 $999.99 2 Single Family Leroy
6 $4 000 00 6 T h L
30
6 $4,000.00 6 Townhouse Larry
7 $2,000.00 0 Condo Helen
8 $5,500.00 2 Office Bldg. Sam
9 $60,000.00 2 Townhouse ABC Incorporated
Mastering Test Design V 4.0 © SQE 2001-2011
More Classes of Invalids
• Looking at more than one data field at a
time
– Try invalid combinationsTry invalid combinations
• All inputs are in valid range
• But they are NOT valid together
• Example: Singapore Airlines, Calcutta to Sydney,
Wednesday (they have no flights on this route on
Wednesday)
– Try invalid orders
31
• All inputs in the valid range
• But NOT valid due to timing or order
• Examples: using a system without logging on; asking for
a refund before paying
Mastering Test Design V 4.0 © SQE 2001-2011
For All Software Requirements
• Focus on testing all of the requirements to
make sure they interoperate successfully
– Cross-functional testing
– Decision Tables
– State-Transition diagrams
– Pair based methods
• Orthogonal Arrays
32
g y
• Combinatorial Analysis (all pairs)
Mastering Test Design V 4.0 © SQE 2001-2011
Cross Functional Testing
• Definition
– Test more than one function at a timeTest more than one function at a time
– Possibly run these tests first
– Why?
• Discover design and interface errors
33
Mastering Test Design V 4.0 © SQE 2001-2011
Cross Functional Testing
EXAMPLE TC1 TC2 TC3 TC4 TC5
Database 2
Mail server 2
* ** *
Remote
Application 3 *
Remote
Application 2 * * *
Remote
Application 1 * *
34
Database 1
* *
Mail server 1
* * *
User interface
* * * *
Mastering Test Design V 4.0 © SQE 2001-2011
Decision Table
• Definition
– A table listing all possible “conditions” (inputs) and
all possible “actions” (outputs)p ( p )
– There is a “rule” for each possible combination of
“conditions”
• Decision tables can be used to represent
very complex business rules based on a
35
set of defined conditions (requirements)
Mastering Test Design V 4.0 © SQE 2001-2011
Decision Table Format
Rule 1 Rule 2 ….. Rule N
Conditions
Condition-1
Condition-2
…….
Condition-x
Actions
A ti 1
36
Action-1
Action-2
……
Action-z
Mastering Test Design V 4.0 © SQE 2001-2011
Example Decision Table
• From the Internal Revenue Service
Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8
Condition
Single Yes Yes Yes Yes No No No No
65 or older OR
blind
Yes Yes No No Yes Yes No No
Unearned income
> $1560
Yes No Yes No Yes No Yes No
37
Action
File Return No No Yes No Yes No Yes Yes
Mastering Test Design V 4.0 © SQE 2001-2011
Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8
Conditions
Claims 0 0 1 1 2-4 2-4 5+ 5+
Another Decision Table
Age 16-25 26-85 16-25 26-85 16-25 26-85 16-25 26-85
Actions
Premium Increase $50 $25 $100 $50 $400 $200 $0 $0
Send Warning No No Yes No Yes Yes No No
Cancel Policy No No No No No No Yes Yes
38
• From an automobile insurance company
Mastering Test Design V 4.0 © SQE 2001-2011
Turning Decision Tables into Test Cases
• Create the decision table by defining
condition and action combinations
• Strike out any rules that are “impossible”• Strike out any rules that are impossible
– Are they really?
– How can you guarantee it?
• Combine columns where the values are
immaterial
We don’t care or do we?
39
– We don t care, or do we?
• Select test data to make each rule “fire”
Mastering Test Design V 4.0 © SQE 2001-2011
State-Transition Diagrams
• Used for “state” machines (what happens
next is dependent on what has happened
before)before)
– Visual illustration of allowed sequences of
functions
– GREAT for finding correct order of valid
operations
– EXCELLENT for finding correct order of test cases
40
– May be difficult to get this level of documentation
in an updated and current form
Mastering Test Design V 4.0 © SQE 2001-2011
A Simple State Example
Please Cancel
Made
Cancelled
By
Customer
Please Cancel/
RefundPaid
Pay Money
Make
Reservation
Please Print Ticket/
Ticket
41
Please Cancel/
Refund
Used
Give Ticket
Ticketed
Mastering Test Design V 4.0 © SQE 2001-2011
Simple State Example with Tests
Please Cancel
Made
Cancelled
By
Customer
Please Cancel/
RefundPaid
Pay Money
Make
Reservation
Please Print Ticket/
Ticket
1
2
3
4 1E 2E
42
Please Cancel/
Refund
Used
Give Ticket
Ticketed
Mastering Test Design V 4.0 © SQE 2001-2011
All Pairs Methods
• Orthogonal Arrays and Combinatorial
Analysis
• A device for selecting a “good” subset of• A device for selecting a good subset of
all possible combinations
– When there are too many combinations to
consider
– When it’s risky to randomly skip testing large parts
of the functionality or combinations
43
• These methods test “All Pairs” (each option with every
other option ONCE, but not all combinations across all
options).
• They exercise multiple pairs simultaneously
• Requires knowledge of all legitimate combinations
Mastering Test Design V 4.0 © SQE 2001-2011
Example Orthogonal Arrays
1 2 3 4 5 6 7
1 0 0 0 0 0 0 0
2 0 1 2 2 0 1 1
3 0 2 1 2 1 0 2
1 2 3
1 0 0 0
L4 (23) L18(3661)
4 0 1 1 0 2 2 3
5 0 2 0 1 2 1 4
6 0 0 2 1 1 2 5
7 1 1 1 1 1 1 0
8 1 2 0 0 1 2 1
9 1 0 2 0 2 1 2
10 1 2 2 1 0 0 3
11 1 0 1 2 0 2 4
2 0 1 1
3 1 0 1
4 1 1 0
1 2 3 4
1 0 0 0 0
2 0 1 1 1
3 0 2 2 2
L9(34)
44
12 1 1 0 2 2 0 5
13 2 2 2 2 2 2 0
14 2 0 1 1 2 0 1
15 2 1 0 1 0 2 2
16 2 0 0 2 1 1 3
17 2 1 2 0 1 0 4
18 2 2 1 0 0 1 5
3 0 2 2 2
4 1 0 1 2
5 1 1 2 0
6 1 2 0 1
7 2 0 2 1
8 2 1 0 2
9 2 2 1 0
Mastering Test Design V 4.0 © SQE 2001-2011
A Problem To Solve
Skype
Tools |
Options |
Privacy
45
•45Mastering Test Design V 4.0 © SQE 2001-2011
A Problem To Solve
46
•46Mastering Test Design V 4.0 © SQE 2001-2011
A Problem To Solve
• Allow calls from – anyone, contact list (2)
• Receive video from – anyone, contact list, no
one (3)
• Allow IMs from – anyone, contact list (2)
• Show video to – contact list, no one (2)
• Keep history for – no history, 2 weeks, 1
month, 3 months, forever (5)
47
• Show online status – yes, no (2)
• Accept cookies – yes, no (2)
•47
2 x 3 x 2 x 2 x 5 x 2 x 2 = 480 combinations
Mastering Test Design V 4.0 © SQE 2001-2011
1 2 3 4 5 6 7
1 0 0 0 0 0 0 0
2 0 0 1 1 2 2 1
3 0 1 0 2 2 1 2
4 0 1 2 0 1 2 3
5 0 2 1 2 1 0 45 0 2 1 2 1 0 4
6 0 2 2 1 0 1 5
7 1 0 0 2 1 2 5
8 1 0 2 0 2 1 4
9 1 1 1 1 1 1 0
10 1 1 2 2 0 0 1
11 1 2 0 1 2 0 3
12 1 2 1 0 0 2 2
L18(3661)
48
•48
13 2 0 1 2 0 1 3
14 2 0 2 1 1 0 2
15 2 1 0 1 0 2 4
16 2 1 1 0 2 0 5
17 2 2 0 0 1 1 1
18 2 2 2 2 2 2 0
Mastering Test Design V 4.0 © SQE 2001-2011
Orthogonal Arrays
• To use Orthogonal Arrays for test selection,
we’ll “map” our testing problem onto an OA
• (Generally) Proceed from top to bottom and
left to right through the problem variables
(because the first language I learned reads left
to right and top to bottom)
49
•49Mastering Test Design V 4.0 © SQE 2001-2011
A Problem To Solve
• Allow calls from – anyone, contact list (2)
• Receive video from – anyone, contact list, no
one (3)one (3)
• Allow IMs from – anyone, contact list (2)
• Show video to – contact list, no one (2)
• Keep history for – no history, 2 weeks, 1
month, 3 months, forever (5)
• Show online status – yes, no (2)
50
y , ( )
• Accept cookies – yes, no (2)
•50
2 x 3 x 2 x 2 x 5 x 2 x 2 = 480 combinations
Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
2 3 4 5 6 7
1 anyOne 0 0 0 0 0 0
2 0 0 1 1 2 2 1
3 0 1 0 2 2 1 2
4 0 1 2 0 1 2 3
5 0 2 1 2 1 0 4
6 0 2 2 1 0 1 5
7 contactList 0 0 2 1 2 5
8 1 0 2 0 2 1 4
9 1 1 1 1 1 1 0
10 1 1 2 2 0 0 1
11 1 2 0 1 2 0 3
12 1 2 1 0 0 2 2
Map
anyOne
onto all 0s
Map
contactList
51
•51
12 1 2 1 0 0 2 2
13 2 0 1 2 0 1 3
14 2 0 2 1 1 0 2
15 2 1 0 1 0 2 4
16 2 1 1 0 2 0 5
17 2 2 0 0 1 1 1
18 2 2 2 2 2 2 0
onto all 1s
Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
2 3 4 5 6 7
1 anyOne 0 0 0 0 0 0
2 anyOne 0 1 1 2 2 1
3 anyOne 1 0 2 2 1 2
4 anyOne 1 2 0 1 2 3
5 anyOne 2 1 2 1 0 4
6 anyOne 2 2 1 0 1 5
7 contactList 0 0 2 1 2 5
8 contactList 0 2 0 2 1 4
9 contactList 1 1 1 1 1 0
10 contactList 1 2 2 0 0 1
11 contactList 2 0 1 2 0 3
12 contactList 2 1 0 0 2 2
Repeat for
each factor
52
•52
12 contactList 2 1 0 0 2 2
13 2 0 1 2 0 1 3
14 2 0 2 1 1 0 2
15 2 1 0 1 0 2 4
16 2 1 1 0 2 0 5
17 2 2 0 0 1 1 1
18 2 2 2 2 2 2 0
Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
Receive
Video
From
3 4 5 6 7
1 anyOne anyOne 0 0 0 0 0
2 anyOne anyOne 1 1 2 2 1
3 anyOne contactList 0 2 2 1 2
4 anyOne contactList 2 0 1 2 3
5 anyOne noOne 1 2 1 0 4
6 anyOne noOne 2 1 0 1 5
7 contactList anyOne 0 2 1 2 5
8 contactList anyOne 2 0 2 1 4
9 contactList contactList 1 1 1 1 0
10 contactList contactList 2 2 0 0 1
11 contactList noOne 0 1 2 0 3
12 contactList noOne 1 0 0 2 2
53
•53
12 contactList noOne 1 0 0 2 2
13 2 anyOne 1 2 0 1 3
14 2 anyOne 2 1 1 0 2
15 2 contactList 0 1 0 2 4
16 2 contactList 1 0 2 0 5
17 2 noOne 0 0 1 1 1
18 2 noOne 2 2 2 2 0
Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
Receive
Video
From
Allow
IMs
From
4 5 6 7
1 anyOne anyOne anyOne 0 0 0 0
2 anyOne anyOne contactList 1 2 2 1
3 anyOne contactList anyOne 2 2 1 2
4 anyOne contactList 2 0 1 2 3
5 anyOne noOne contactList 2 1 0 4
6 anyOne noOne 2 1 0 1 5
7 contactList anyOne anyOne 2 1 2 5
8 contactList anyOne 2 0 2 1 4
9 contactList contactList contactList 1 1 1 0
10 contactList contactList 2 2 0 0 1
11 contactList noOne anyOne 1 2 0 3
12 contactList noOne contactList 0 0 2 2
54
•54
12 contactList noOne contactList 0 0 2 2
13 2 anyOne contactList 2 0 1 3
14 2 anyOne 2 1 1 0 2
15 2 contactList anyOne 1 0 2 4
16 2 contactList contactList 0 2 0 5
17 2 noOne anyOne 0 1 1 1
18 2 noOne 2 2 2 2 0
Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
Receive
Video
From
Allow
IMs
From
Show
Video
To
5 6 7
1 anyOne anyOne anyOne contactList 0 0 0
2 anyOne anyOne contactList noOne 2 2 1
3 anyOne contactList anyOne 2 2 1 2
4 anyOne contactList 2 contactList 1 2 3
5 anyOne noOne contactList 2 1 0 4
6 anyOne noOne 2 noOne 0 1 5
7 contactList anyOne anyOne 2 1 2 5
8 contactList anyOne 2 contactList 2 1 4
9 contactList contactList contactList noOne 1 1 0
10 contactList contactList 2 2 0 0 1
11 contactList noOne anyOne noOne 2 0 3
12 contactList noOne contactList contactList 0 2 2
55
•55
12 contactList noOne contactList contactList 0 2 2
13 2 anyOne contactList 2 0 1 3
14 2 anyOne 2 noOne 1 0 2
15 2 contactList anyOne noOne 0 2 4
16 2 contactList contactList contactList 2 0 5
17 2 noOne anyOne contactList 1 1 1
18 2 noOne 2 2 2 2 0
Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
Receive
Video
From
Allow
IMs
From
Show
Video
To
Show
Online
Status
6 7
1 anyOne anyOne anyOne contactList yes 0 0
2 anyOne anyOne contactList noOne 2 2 1
3 anyOne contactList anyOne 2 2 1 2
4 anyOne contactList 2 contactList no 2 3
5 anyOne noOne contactList 2 no 0 4
6 anyOne noOne 2 noOne yes 1 5
7 contactList anyOne anyOne 2 no 2 5
8 contactList anyOne 2 contactList 2 1 4
9 contactList contactList contactList noOne no 1 0
10 contactList contactList 2 2 yes 0 1
11 contactList noOne anyOne noOne 2 0 3
12 contactList noOne contactList contactList yes 2 2
56
•56
12 contactList noOne contactList contactList yes 2 2
13 2 anyOne contactList 2 yes 1 3
14 2 anyOne 2 noOne no 0 2
15 2 contactList anyOne noOne yes 2 4
16 2 contactList contactList contactList 2 0 5
17 2 noOne anyOne contactList no 1 1
18 2 noOne 2 2 2 2 0
Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
Receive
Video
From
Allow
IMs
From
Show
Video
To
Show
Online
Status
Accept
Cookies
7
1 anyOne anyOne anyOne contactList yes yes 0
2 anyOne anyOne contactList noOne 2 2 1
3 anyOne contactList anyOne 2 2 no 2
4 anyOne contactList 2 contactList no 2 3
5 anyOne noOne contactList 2 no yes 4
6 anyOne noOne 2 noOne yes no 5
7 contactList anyOne anyOne 2 no 2 5
8 contactList anyOne 2 contactList 2 no 4
9 contactList contactList contactList noOne no no 0
10 contactList contactList 2 2 yes yes 1
11 contactList noOne anyOne noOne 2 yes 3
12 contactList noOne contactList contactList yes 2 2
57
•57
12 contactList noOne contactList contactList yes 2 2
13 2 anyOne contactList 2 yes no 3
14 2 anyOne 2 noOne no yes 2
15 2 contactList anyOne noOne yes 2 4
16 2 contactList contactList contactList 2 yes 5
17 2 noOne anyOne contactList no no 1
18 2 noOne 2 2 2 2 0
Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
Receive
Video
From
Allow
IMs
From
Show
Video
To
Show
Online
Status
Accept
Cookies
Keep
History
For
1 anyOne anyOne anyOne contactList yes yes noHistory
2 anyOne anyOne contactList noOne 2 2 2Weeks
3 anyOne contactList anyOne 2 2 no 1Month
4 anyOne contactList 2 contactList no 2 3Months
5 anyOne noOne contactList 2 no yes forEver
6 anyOne noOne 2 noOne yes no 5
7 contactList anyOne anyOne 2 no 2 5
8 contactList anyOne 2 contactList 2 no forEver
9 contactList contactList contactList noOne no no noHistory
10 contactList contactList 2 2 yes yes 2Weeks
11 contactList noOne anyOne noOne 2 yes 3Months
12 contactList noOne contactList contactList yes 2 1Month
58
•58
12 contactList noOne contactList contactList yes 2 1Month
13 2 anyOne contactList 2 yes no 3Months
14 2 anyOne 2 noOne no yes 1Month
15 2 contactList anyOne noOne yes 2 forEver
16 2 contactList contactList contactList 2 yes 5
17 2 noOne anyOne contactList no no 2Weeks
18 2 noOne 2 2 2 2 noHistory
Mastering Test Design V 4.0 © SQE 2001-2011
Orthogonal Arrays
• We have reduced our test cases from 480 to
18 – a substantial reduction (about 96%)
• while testing all pairs of input combinations at
least once
59
•59Mastering Test Design V 4.0 © SQE 2001-2011
Orthogonal Arrays
• But what should we do about the cells in the
OA that have not been assigned values?
–
–
• But first why do we have such cells?
60
But first, why do we have such cells?
•60Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
Receive
Video
From
Allow
IMs
From
Show
Video
To
Show
Online
Status
Accept
Cookies
Keep
History
For
1 anyOne anyOne anyOne contactList yes yes noHistory
2 anyOne anyOne contactList noOne 2 2 2Weeks
3 anyOne contactList anyOne 2 2 no 1Month
4 anyOne contactList 2 contactList no 2 3Months
5 anyOne noOne contactList 2 no yes forEver
6 anyOne noOne 2 noOne yes no 5
7 contactList anyOne anyOne 2 no 2 5
8 contactList anyOne 2 contactList 2 no forEver
9 contactList contactList contactList noOne no no noHistory
10 contactList contactList 2 2 yes yes 2Weeks
11 contactList noOne anyOne noOne 2 yes 3Months
12 contactList noOne contactList contactList yes 2 1Month
61
•61
12 contactList noOne contactList contactList yes 2 1Month
13 2 anyOne contactList 2 yes no 3Months
14 2 anyOne 2 noOne no yes 1Month
15 2 contactList anyOne noOne yes 2 forEver
16 2 contactList contactList contactList 2 yes 5
17 2 noOne anyOne contactList no no 2Weeks
18 2 noOne 2 2 2 2 noHistory
Mastering Test Design V 4.0 © SQE 2001-2011
Orthogonal Arrays
• Let’s fill them in with valid values:
– Select the first value in the list
– Alternate the values
– Set the values according to the percentage
of use (if 60% will be yes and 40% will be
no, then use that percentage)
– Set the values according to the risk that
62
g
value presents
• Which is the best approach?
•62Mastering Test Design V 4.0 © SQE 2001-2011
Allow
Calls
From
Receive
Video
From
Allow
IMs
From
Show
Video
To
Show
Online
Status
Accept
Cookies
Keep
History
For
1 anyOne anyOne anyOne contactList yes yes noHistory
2 anyOne anyOne contactList noOne yes yes 2Weeks
3 anyOne contactList anyOne contactList no no 1Month
4 anyOne contactList anyOne contactList no no 3Months
5 anyOne noOne contactList noOne no yes forEver
6 anyOne noOne contactList noOne yes no noHistory
7 contactList anyOne anyOne contactList no yes 2Weeks
8 contactList anyOne anyOne contactList yes no forEver
9 contactList contactList contactList noOne no no noHistory
10 contactList contactList contactList noOne yes yes 2Weeks
11 contactList noOne anyOne noOne no yes 3Months
12 contactList noOne contactList contactList yes no 1Month
63
•63
12 contactList noOne contactList contactList yes no 1Month
13 anyOne anyOne contactList contactList yes no 3Months
14 contactList anyOne anyOne noOne no yes 1Month
15 anyOne contactList anyOne noOne yes yes forEver
16 ContactList contactList contactList contactList yes yes 1Month
17 anyOne noOne anyOne contactList no no 2Weeks
18 contactList noOne contactList noOne no no noHistory
Mastering Test Design V 4.0 © SQE 2001-2011
PICT Program
• Microsoft has developed
a tool to generate
all the pair combinationsall the pair combinations
• Microsoft’s algorithm is
described in
“Pairwise Testing in the Real World: Practical
Extensions to Test Case Generators” by Jacek
Czerwonka
Mastering Test Design V 3.2 © SQE 2001-2006
64
Czerwonka
• PICT is a free tool you can download and use
•64
PICT Program
Click
here
Mastering Test Design V 3.2 © SQE 2001-2006
65
•65
•http://msdn.microsoft.com/en-us/testing/bb980925
PICT Program
• … and download pict33.msi (a Microsoft
Installer Package)
• Save it
• Execute it to install. (It installs in the Program
Files folder)
Mastering Test Design V 3.2 © SQE 2001-2006
66
• PICTHelp.html has the instructions (They are
very helpful)
•66
PICT Program
• Prepare the input by entering the data into
Notepad
Mastering Test Design V 3.2 © SQE 2001-2006
67
•67
PICT Program
• Run pict.exe
• Specify it’s input and output. For example:
• pict SkypeExampleForPICT.txt >
SkypeTestCasesFromPICT.txt
Mastering Test Design V 3.2 © SQE 2001-2006
68
•68
PICT Program
• Open the output with Excel to make it look
nice
Mastering Test Design V 3.2 © SQE 2001-2006
69
•69
PICT Program
AllowCalls ReceiveVideo AllowIMs ShowVideo KeepHistory ShowStatus AcceptCookies
ContactList ContactList Anyone ContactList OneMonth Yes Yes
Anyone Anyone ContactList NoOne ThreeMonths No No
ContactList NoOne Anyone NoOne Forever No Yes
Anyone ContactList ContactList NoOne NoHistry Yes No
ContactList NoOne ContactList ContactList TwoWeeks Yes No
Anyone NoOne Anyone ContactList ThreeMonths Yes Yes
ContactList Anyone Anyone ContactList NoHistry No Yes
Anyone ContactList ContactList ContactList Forever Yes No
Anyone NoOne ContactList NoOne OneMonth No No
Mastering Test Design V 3.2 © SQE 2001-2006
70
•70
ContactList Anyone Anyone NoOne Forever Yes No
Anyone Anyone Anyone NoOne TwoWeeks No Yes
ContactList ContactList ContactList NoOne ThreeMonths No Yes
Anyone Anyone Anyone ContactList OneMonth No No
Anyone ContactList ContactList NoOne TwoWeeks No Yes
ContactList NoOne ContactList ContactList NoHistry Yes No
PICT Program
• Note the good news – we can test all pairs of
the 7 inputs in only 16 test cases (rather than
the total combinations of 480)the total combinations of 480)
Mastering Test Design V 3.2 © SQE 2001-2006
71
•71
PICT Program
• PICT has a nice feature the other approaches
don’t have – it allows for selection constraints
to be specifiedto be specified
Mastering Test Design V 3.2 © SQE 2001-2006
72
•72
Another Example
73
Mastering Test Design V 4.0 © SQE 2001-2011
Another Example
The borders and shading dialog box :
• 5 settings
• 5 styles (showing)• 5 styles (showing)
• 9 colors
• 9 widths
5 x 5 x 9 x 9 = 2025 combinations
An L81(910) array is the smallest array that meets
our needs
74
our needs
(There is an L81(32494) array that would work)
Mastering Test Design V 4.0 © SQE 2001-2011
Sources
• An excellent book is Quality Engineering Using Robust
Design by Madhav S. Phadke
F t l f th l• For a catalog of orthogonal arrays, see
www.research.att.com/~njas/oadir/index.html
• A nice tool is rdExpert from
www.phadkeassociates.com
• A very robust tool is AETG from Telcordia at
aetgweb.argreenhouse.com
75
Mastering Test Design V 4.0 © SQE 2001-2011
Trace Matrix
• A Trace Matrix can be used to track test
cases during development and execution
– Identification of uniquely “testable” requirements
• Eliminate wishes, hopes, dreams, and other un-testable
statements
• Eliminate duplicates
• Assign a unique ID for each requirement and design
objective
76
• Determine its priority if possible
– Verification of implementation of all requirements
Mastering Test Design V 4.0 © SQE 2001-2011
Track everything!
Trace Matrix - Context
Reqm’ts Design Code
77
Test
Cases
Mastering Test Design V 4.0 © SQE 2001-2011
Trace
Number
Requirement
001
Sect.
1 1
Summary
99 99% availability
Sect.
1 6
Summary
Dual processors
Design
Trace Matrix - Example
001
N/A
1.1
1.2
1.3
99.99% availability
Hardware selected
will be available in
less than 30 days
Transactions will
1.6
1.7
6.1
15.3
N/A
N/A
Dual processors
Hot back-up
On-line diagnostics
On-line performance
monitors
N/A
N/AN/A
78
002 1.4
not be lost (included
with 1.4)
100% of all transactions
input will be processed
(includes 1.3)
2.2
2.3
2.4
Transaction processing
Transaction logs
Retransmission request
for missing transactions
Mastering Test Design V 4.0 © SQE 2001-2011
Method Unit Integ. Sys
Sys to
Sys Web
Equivalence class partitioning √ √ √ √ √
Techniques vs. Levels of Test
Boundary value √ √ √ √ √
Invalid combinations and processes √ √ √ √ √
Cross functional testing √ √ √ √
Decision table √ √ √ √ √
State transition diagrams √ √ √ √ √
79
Orthogonal Arrays and All Pairs √ √ √ √ √
Trace Matrix √ √ √ √ √
Mastering Test Design V 4.0 © SQE 2001-2011
Risk / Priority Based
• Add more test cases for higher risk or
priority
– Some of the factors in risk
• High use software
• Safety criticality
• Criticality to operations
• “Key” features such as security, monetary expenditures
• Others?
– Including risk in the planning from the beginning
can help when there isn’t time to run all of the
Mastering Test Design V 3.2 © SQE 2001-2006
80
can help when there isn t time to run all of the
tests
– Risk is a subjective judgment call
– Test higher risk areas early and more thoroughly
Chapter 3Chapter 3
White BoxWhite Box
ScienceScience
81
ScienceScience
Mastering Test Design V 4.0 © SQE 2001-2011
Tutorial Agenda
1. Introduction
2. Black Box Science
3. White Box Science
4. Black Box Art
5. Defect Taxonomies
6. Wrap-up
82
Mastering Test Design V 4.0 © SQE 2001-2011
Objectives
• At the end of this chapter you will be able
to
– Describe the differences between white and black
box tests
– Define coverage possibilities for unit, integration,
and system level white box tests
83
Mastering Test Design V 4.0 © SQE 2001-2011
White box: Structure/path Black box: Behavior
If
truefalse
What is White Box?
ThenElse
End
Case
1 2 3 4 5
84
End
A B C D E
1 2 3 4 5
The Art of Software Testing
Glenford Myers
Mastering Test Design V 4.0 © SQE 2001-2011
White Box Definitions
• The focus of White Box testing
– Examine paths in the implementationExamine paths in the implementation
– Make sure that each statement, decision branch,
or path is tested with at least one test case
– Definitions of coverage can vary by level of test
– Desirable to use tools to analyze and track
coverage
85
Mastering Test Design V 4.0 © SQE 2001-2011
Understanding Coverage
• What does “coverage” mean?
NOT all possible combinations of data values or– NOT all possible combinations of data values or
paths can be tested
– Coverage is a way of defining how many of the
potential paths were actually exercised by the
tests
– Coverage goals can vary by risk, trust, and level of
t t
86
test
Mastering Test Design V 4.0 © SQE 2001-2011
Coverage for a Unit
• Selection: SLOC
• Possible strategies
• A code Sample
a=1
b=2
Possible strategies
– Statement coverage
(SLOC)
– Decision coverage
(branches)
– Paths
c=3
If (a==2)
{n=n+2;}
Else
{n=n/2;}
p=q/r
If (b/ >3)
87
If (b/c>3)
{z=x+y;}
Mastering Test Design V 4.0 © SQE 2001-2011
Coverage for Integration
• Selection: Unit
P ibl t t i• Possible strategies
– Each unit (already should have
been done)
– All choices (branches) between
units
– All paths
U1
U2 U3 U4
88
p
– Can continue to use statement
coverage measure (using a
coverage tool)
Mastering Test Design V 4.0 © SQE 2001-2011
Local Web
Client
Remote Web
Client
Coverage for Systems
INTERNET
LAN/WAN
WEB
SRV
WEB
APP
WEB
DB
ISP
Firewall/
Proxy
LEG.
APP
LEG.
DB
KEY
ISPPersonal
Firewall
89
Local GUI
Client
Transaction Path
APP = Application
SRV = Server
DB = Database
LEG. = Legacy
Third Party
Service
KEY
Back Office
Systems
Mastering Test Design V 4.0 © SQE 2001-2011
General Control Flow Concepts
Sequence If Then If Then Else
90
Mastering Test Design V 4.0 © SQE 2001-2011
General Control Flow Concepts
IterationCASE
91
Mastering Test Design V 4.0 © SQE 2001-2011
Applying Control Flow to Code
A simple code segment
Input a;
Input b;
Input a
Begin at the top
Input b;
Input c;
If (a==2)
{n=n+2;}
Else
{n=n/2;}
Input b
Input c
92
{ ;}
p=q/r
If (b/c>3)
{z=x+y;}
Mastering Test Design V 4.0 © SQE 2001-2011
Applying Control Flow to Code
A simple code segment
Input a;
Input b;
Input a
Input b
Continue the graph
Input b;
Input c;
If (a==2)
{n=n+2;}
Else
{n=n/2;}
Input b
Input c
If
(a==2)
93
{ ;}
p=q/r
If (b/c>3)
{z=x+y;}
Mastering Test Design V 4.0 © SQE 2001-2011
Applying Control Flow to Code
A simple code segment
Input a;
Input b;
Input a
Input bInput b;
Input c;
If (a==2)
{n=n+2;}
Else
{n=n/2;}
Input b
Input c
If
(a==2)
94
{ ;}
p=q/r
If (b/c>3)
{z=x+y;}
n=n+2
Mastering Test Design V 4.0 © SQE 2001-2011
Applying Control Flow to Code
A simple code segment
Input a;
Input b;
Input a
Input bInput b;
Input c;
If (a==2)
{n=n+2;}
Else
{n=n/2;}
Input b
Input c
If
(a==2)
95
{ ;}
p=q/r
If (b/c>3)
{z=x+y;}
n=n/2 n=n+2
Mastering Test Design V 4.0 © SQE 2001-2011
Applying Control Flow to Code
A simple code segment
Input a;
Input b;
Input a
Input bInput b;
Input c;
If (a==2)
{n=n+2;}
Else
{n=n/2;}
Input b
Input c
If
(a==2)
96
{ ;}
p=q/r
If (b/c>3)
{z=x+y;}
n=n/2 n=n+2
p=q/r
Mastering Test Design V 4.0 © SQE 2001-2011
Applying Control Flow to Code
A simple code segment
Input a;
Input b;
Input a
Input b
Input c
Input b;
Input c;
If (a==2)
{n=n+2;}
Else
{n=n/2;}
If
(a==2)
n=n/2 n=n+2
p=q/r
97
{ ;}
p=q/r
If (b/c>3)
{z=x+y;}
If
b/c>3
Mastering Test Design V 4.0 © SQE 2001-2011
Applying Control Flow to Code
A simple code segment
Input a;
Input b;
Input a
Input b
Input c
Input b;
Input c;
If (a==2)
{n=n+2;}
Else
{n=n/2;}
If
(a==2)
n=n/2 n=n+2
p=q/r
98
{ ;}
p=q/r
If (b/c>3)
{z=x+y;}
If
(b/c>3)
z=x+y
Mastering Test Design V 4.0 © SQE 2001-2011
Understanding Unit Testing
• When unit testing a module, the key
question is how many tests are required to
reasonably and fully exercise the code?reasonably and fully exercise the code?
– What is the minimum number of tests that can be
run to fully exercise the structure of the code?
– How many paths are there?
– How do I determine/create these tests?
99
• There are three approaches to answering
these questions, all require a flow graph
Mastering Test Design V 4.0 © SQE 2001-2011
1st Method to Determine Tests
• McCabe’s technique for
calculating units
– Convert the code to a flow
Input a
Input b
Input c
IfConvert the code to a flow
graph
– Compute the paths by e-n+2(p)
– This is called Cyclomatic
Complexity
• The number of paths to test
• All decision options are tested
If
(a==2)
n=n/2 n=n+2
p=q/r
100
• All decision options are tested
• Each statement is covered at least
once
If
(b/c>3)
z=x+y
Mastering Test Design V 4.0 © SQE 2001-2011
How Many Tests?
• Compute the
paths by e-n+2(p)
Input a
Input b
Input c
If
• e = 9
If
(a==2)
n=n/2 n=n+2
p=q/r
101
If
(b/c>3)
z=x+y
Mastering Test Design V 4.0 © SQE 2001-2011
How Many Tests?
• Compute the paths
by e-n+2(p)
Input a
Input b
Input c
If
• n = 8
If
(a==2)
n=n/2 n=n+2
p=q/r
102
If
(b/c>3)
z=x+y
Mastering Test Design V 4.0 © SQE 2001-2011
How Many Tests?
• Compute the paths by e-
n+2(p)
9 8+2(1) = 3
Input a
Input b
Input c
If9-8+2(1) = 3
• There are no called
modules, so (p) is set to 1
• There are 3 paths that will
cover the code
100% decision coverage
If
(a==2)
n=n/2 n=n+2
p=q/r
103
– 100% decision coverage
– 100% statement coverage
– Does not guarantee 100%
path coverage
If
(b/c>3)
z=x+y
Mastering Test Design V 4.0 © SQE 2001-2011
What are the Paths (tests)?
• Cyclomatic Complexity is 3
• Paths are:
Input a
Input b
Input cA
– ABCEF
– ABDEF
– ABDEFG
• Test cases should cover at
least three paths
If
(a==2)
n=n/2 n=n+2
p=q/r
B
C D
E
104
– There is more than one “basis
set” of paths
If
(b/c>3)
z=x+y
F
G
Mastering Test Design V 4.0 © SQE 2001-2011
2nd Method to Determine Tests
• The next approach is to
manually calculate the
regions of the graph
Input a
Input b
Input c
Ifregions of the graph
– Convert the code to a flow graph
– Count the regions of the flow
graph (including the exterior)
• An area enclosed by lines (edges)
is a region
• The external area is always a
If
(a==2)
n=n/2 n=n+2
p=q/r
1
3
105
The external area is always a
region
• This can be expressed as
– Regions + 1
If
(b/c>3)
z=x+y
2
3
Mastering Test Design V 4.0 © SQE 2001-2011
3rd Method to Determine Tests
• The third approach is to
manually calculate the
decisions in the graph
Input a
Input b
Input c
Ifdecisions in the graph
– Convert the code to a flow graph
– Count the decision nodes in the
flow graph
• This can be expressed as
If
(a==2)
n=n/2 n=n+2
p=q/r
1
106
– Decisions + 1
If
(b/c>3)
z=x+y
2
Mastering Test Design V 4.0 © SQE 2001-2011
Number of Paths (Tests)
• You will notice that all three methods
generate the same result
– CC 9-8+2(1) = 3
– Regions 2+1 = 3
– Decisions 2+1 = 3
• Regions and decisions require the
construction of a graph or manual
analysis of the code
107
analysis of the code
• Cyclomatic complexity can be calculated
using a tool, or done manually
Mastering Test Design V 4.0 © SQE 2001-2011
So, What are the Paths (Tests)?
• Path one:
ABCEF
a=1
b=2
c=3
A
– ABCEF If
(a==2)
n=n/2 n=n+2
p=q/r
B
C D
E
108
If
(b/c>3)
z=x+y
F
G
Mastering Test Design V 4.0 © SQE 2001-2011
So, What are the Paths (Tests)?
• Path two:
ABDEF
a=1
b=2
c=3
A
– ABDEF If
(a==2)
n=n/2 n=n+2
p=q/r
B
C D
E
109
If
(b/c>3)
z=x+y
F
G
Mastering Test Design V 4.0 © SQE 2001-2011
So, What are the Paths (Tests)?
• Path three:
ABDEFG
a=1
b=2
c=3
A
– ABDEFG If
(a==2)
n=n/2 n=n+2
p=q/r
B
C D
E
110
If
(b/c>3)
z=x+y
F
G
Mastering Test Design V 4.0 © SQE 2001-2011
What about (P) ?
• If there are called programs the
computation must account for those
modules as wellmodules as well
• The change is in how the edges (E) and
nodes (N) are determined.
– P represents the number of unconnected parts of
the graph
111
the graph
Mastering Test Design V 4.0 © SQE 2001-2011
What about (P)?
• For
multiple
graphs
A
B C
M1 M2
CALL
a=1
b=2
c=3
A
graphs
– Module 2
is called
by
module 1
B C
D
E
If
(a==2)
n=n/2
n=n+2
Call m2
p=q/r
B
C D
E
112
F G
H
If
(b/c>3)
z=x+y
F
G
Mastering Test Design V 4.0 © SQE 2001-2011
What about (P)?
• Sum the
total edges
– Module 1
M
N O
M1 M2
CALL
a=1
b=2
c=3
A
Module 1
• 9 edges
– Module 2
• 9 edges
– Total
• 18 edges
N O
P
Q
If
(a==2)
n=n/2
n=n+2
Call m2
p=q/r
B
C D
E
113
R S
T
If
(b/c>3)
z=x+y
F
G
Mastering Test Design V 4.0 © SQE 2001-2011
What about (P)?
• Sum the
total nodes
– Module 1
M
N O
M1 M2
CALL
a=1
b=2
c=3
A
Module 1
• 8 nodes
– Module 2
• 8 nodes
– Total
• 16 nodes
N O
P
Q
If
(a==2)
n=n/2
n=n+2
Call m2
p=q/r
B
C D
E
114
R S
T
If
(b/c>3)
z=x+y
F
G
Mastering Test Design V 4.0 © SQE 2001-2011
Calculate the Total Complexity
• Calculate
Complexity
A
B C
M1 M2
CALL
a=1
b=2
c=3
A
• 18 – 16 + 2(2) = 6
• We replace (P)
with two, for the
B C
D
E
If
(a==2)
n=n/2
n=n+2
Call m2
p=q/r
B
C D
E
115
with two, for the
two graphs
F G
H
If
(b/c>3)
z=x+y
F
G
Mastering Test Design V 4.0 © SQE 2001-2011
Chapter 4Chapter 4
Black BoxBlack Box
ArtArt
116
ArtArt
Mastering Test Design V 4.0 © SQE 2001-2011
Tutorial Agenda
1. Introduction
2. Black Box Science
3. White Box Science
4. Black Box Art
5. Defect Taxonomies
6. Wrap-up
117
Mastering Test Design V 4.0 © SQE 2001-2011
Objectives
• At the end of this chapter you will be able
to
– Implement creative test case selection techniques
– Evaluate the use of exploratory testing
118
Mastering Test Design V 4.0 © SQE 2001-2011
Why Science is Not Enough
• Limits of science
– Programmers are logical thinkers so they catchProgrammers are logical thinkers, so they catch
many of the “logical’ defects
– Real users are NOT necessarily logical
– Real environmental circumstances are often
illogical
– Can’t test enough combinations with just scientific
t h i
119
techniques
Mastering Test Design V 4.0 © SQE 2001-2011
Hunches and Guessing
• Talent based testing
– Based on the implementation
Bet I can break
it!!!
Based on the implementation
– Some individuals can walk up
to a system and “break” it
– Good to have multi-dimensional
teams doing the testing
– Experienced testers can just
“k ” h t i lik l t b k
120
“know” what is likely to break
Mastering Test Design V 4.0 © SQE 2001-2011
Group Insights / Examples
• Experience can be shared with examples
– “Best practices” examples of test cases posted onBest practices examples of test cases posted on
an internal web site
• “Best” is a relative term; what’s good on one
system/application may not work on another
– Examples of good tests based on type of element
being tested
121
being tested
• Compiled by experienced personnel
• Available to everyone
• Can be a standard, guidelines, or suggestions
Mastering Test Design V 4.0 © SQE 2001-2011
Exploratory Testing
“The classical approach to
test design is like playing ‘20
Questions’ by writing out all
the questions in advance.”
- James Bach
122
Mastering Test Design V 4.0 © SQE 2001-2011
Exploratory Testing
“Exploratory Testing, as I practice it, usually
proceeds according to a conscious plan. But not
a rigorous plan … it is not scripted in detail.”
“To the extent that the next test we do is
influenced by the result of the last test we did, we
are doing exploratory testing. We become more
exploratory when we can’t tell what tests should
be run in advance of the test cycle ”
123
be run in advance of the test cycle.”
- James Bach
Mastering Test Design V 4.0 © SQE 2001-2011
Exploratory Testing
• Test cases themselves are NOT pre-planned
– Exploratory testing can be concurrent with product
development and test execution
– Based on implicit and explicit (if they exist)
specifications as well as the “as built” product
– Starts with a conjecture as to correct behavior,
followed by exploration for evidence that it
works/does not work
– Based on some kind of mental model
“T it d if it k ” (J B h
124
– “Try it and see if it works” (James Bach
www.satisfice.com is an excellent resource for more
on this topic)
Mastering Test Design V 4.0 © SQE 2001-2011
Exploratory Testing
• Basic steps to exploratory testing
1 Identify the purpose of the product1. Identify the purpose of the product
2. Identify functions
3. Identify areas of potential instability
4. Test each function and record problems
5. Design and record a consistency verification test
125
Mastering Test Design V 4.0 © SQE 2001-2011
Create Creative Invalids
• Break the rules in unexpected ways
– No logic
– StrangeStrange
• Order
• Combinations
• Exception conditions
– The “nobody would ever do that” tests
B i B i “I h l h
126
• Boris Beizer: “It helps to have some
devious testers.”
Mastering Test Design V 4.0 © SQE 2001-2011
Class Exercise
• Pick your technique
– Data in the range 0.0-1.0 should be processed
using algorithm A, data between 1.0 and 10.0g g ,
using algorithm B, and data between 10.0 and
100.0 using algorithm C.
– We’ve got very few written requirements for this
system. We do, however, know something about
how the system is to operate its behavior and
127
how the system is to operate, its behavior, and
functions.
Mastering Test Design V 4.0 © SQE 2001-2011
Class Exercise
• Pick your technique (continued)
– If condition 1 (C1) is true and condition 2 (C2) is
true, then action 1 (A1) should be taken. If C1 is, ( )
true and C2 is false, then A2 is the proper
response. If C1 is false and C2 is true, then A3 is
appropriate. If C1 is false and C2 is false, then A4
is the correct action.
128
Mastering Test Design V 4.0 © SQE 2001-2011
Class Exercise
• Pick your technique (continued)
– In state 1 (S1) events 1 (E1) and 2
(E2) are valid while event 3 (E3) is( ) ( )
not. In state 2 (S2) events 1 (E1) and
3 (E3) are valid while event 2 (E2) is
not. In state 3 (S3) events 2 (E2) and
3 (E3) are valid while event 1 (E1) is
not. If the system is in S1 and E2
occurs, then action 1 (A1) should be
129
taken. If the system is in S3 and E3
occurs, then action 2 (A2) should be
taken.
Mastering Test Design V 4.0 © SQE 2001-2011
Class Exercise
• Pick your technique (continued)
– I’ve got so many combinations to test I
just can’t do them all. Please help!j p
130
Mastering Test Design V 4.0 © SQE 2001-2011
Chapter 5Chapter 5
DefectDefect
TaxonomiesTaxonomies
131
TaxonomiesTaxonomies
Mastering Test Design V 4.0 © SQE 2001-2011
Tutorial Agenda
1. Introduction
2. Black Box Science
3. White Box Science
4. Black box Art
5. Defect Taxonomies
6. Wrap-up
132
Mastering Test Design V 4.0 © SQE 2001-2011
Using a Taxonomy
• A taxonomy is a classification of things into
ordered groups or categories that indicate
natural, hierarchical relationships.p
– In software test design we are concerned
with taxonomies of defects, ordered lists of
common defects we expect to encounter in
our testing.
133
Mastering Test Design V 4.0 © SQE 2001-2011
Sample Taxonomies
• One of the first defect taxonomies was
defined by Boris Beizer in Software Testing
Techniques.q
• The classic book Testing Computer Software
by Cem Kaner contains a detailed taxonomy
of more than 400 types of defects.
• Robert Binder notes that many defects in the
object-oriented paradigm are problems using
134
j p g p g
encapsulation, inheritance, polymorphism,
message sequencing, and state-transitions.
Mastering Test Design V 4.0 © SQE 2001-2011
Sample Taxonomies
• James Whittaker’s book How to Break
Software is a tester’s delight. Proponents of
exploratory testing exhort us to “explore.”p y g p
Whittaker tells us specifically “where to
explore.” Not only does he identify areas in
which faults tend to occur, but he defines
specific testing attacks to locate these faults.
135
• Giri Vijayaraghavan has chosen a much
narrower focus—the eCommerce shopping
cart.
Mastering Test Design V 4.0 © SQE 2001-2011
Example Taxonomy
1XXX Requirements
11XX Requirements incorrect
12XX Requirements logic
13XX R i t l t13XX Requirements, completeness
14XX Verifiability
15XX Presentation, documentation
16XX Requirements changes
2XXX Features And Functionality
21XX Feature/function correctness
22XX Feature completeness
23XX F ti l l t
136
23XX Functional case completeness
24XX Domain bugs
25XX User messages and diagnostics
26XX Exception conditions mishandled
A Portion of Beizer’s Taxonomy
Mastering Test Design V 4.0 © SQE 2001-2011
Example Taxonomy (continued)
3XXX Structural Bugs
31XX Control flow and sequencing
32XX Processing
4XXX Data
41XX Data definition and structure
42XX Data access and handling
5XXX Implementation and Coding
51XX Coding and typographical
52XX Style and standards violations
53XX Documentation
137
6XXX Integration
61XX Internal interfaces
62XX External interfaces, timing, throughput
7XXX System and Software Architecture
A Portion of Beizer’s Taxonomy
Mastering Test Design V 4.0 © SQE 2001-2011
Example Taxonomy (continued)
71XX O/S call and use
72XX Software architecture
73XX Recovery and accountability
74XX Performance
75XX Incorrect diagnostics, exceptions
76XX Partitions, overlays
77XX System generation, environment
8XXX Test Definition and Execution
81XX Test design bugs
82XX Test execution bugs
83XX Test documentation
138
83XX Test documentation
84XX Test case completeness
A Portion of Beizer’s Taxonomy
Mastering Test Design V 4.0 © SQE 2001-2011
Taxonomy Sources
• Beizer, Boris (1990). Software Testing Techniques (2nd
Edition). Van Nostrand Reinhold.
• Binder, Robert V. (2000). Testing Object-Oriented Systems:
Models, Patterns, and Tools. Addison-Wesley.
• Kaner, Cem, Jack Falk, and Hung Quoc Nguyen (1999).
Testing Computer Software (2nd Edition). John Wiley & Sons.
• Whittaker, James A. (2003). How To Break Software: A
Practical Guide to Testing. Addison Wesley.
139
• Vijayaraghavan, Giri and Cem Kaner. “Bugs in your shopping
cart” www.testingeducation.org/articles/BISC_Final.pdf
Mastering Test Design V 4.0 © SQE 2001-2011
Chapter 6Chapter 6
Wrap UpWrap Up
140
Mastering Test Design V 4.0 © SQE 2001-2011
Tutorial Agenda
1. Introduction
2. Black Box Science
3. White Box Science
4. Black Box Art
5. Defect Taxonomies
6. Wrap-up
141
Mastering Test Design V 4.0 © SQE 2001-2011
Now what?
Current Challenges
?
?
??
?
?
?
?
142
?
?
Mastering Test Design V 4.0 © SQE 2001-2011
Tutorial Goals Achieved
• You are now able to
– Design test cases using structured techniques
– Implement the “art” of test case design as well
as the “science”
– Understand how defect taxonomies can
improve test case design
143
Mastering Test Design V 4.0 © SQE 2001-2011
Tutorial Evaluations
How did we do?
* Great * Wonderful
* Fantastic * Terrific
* Superior * Excellent
Tutorial Evaluation
144
Mastering Test Design V 4.0 © SQE 2001-2011
Thank You
• On behalf of Software Quality Engineering, thank
you for attending this tutorial.
• If you have further needs for training or• If you have further needs for training or
consulting, please think first of SQE.
• If I can be of further assistance, please let me
know. My email is lee@sqe.com
145
Mastering Test Design V 4.0 © SQE 2001-2011
Good Luck!
146
Mastering Test Design V 4.0 © SQE 2001-2011

Contenu connexe

Tendances

Test design techniques
Test design techniquesTest design techniques
Test design techniques
Pragya Rastogi
 
Software Testing - Day Two
Software Testing - Day TwoSoftware Testing - Day Two
Software Testing - Day Two
Govardhan Reddy
 

Tendances (20)

Test Driven Development and Quality Improvement
Test Driven Development and Quality ImprovementTest Driven Development and Quality Improvement
Test Driven Development and Quality Improvement
 
White Box Testing
White Box TestingWhite Box Testing
White Box Testing
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
Design Test Case Technique (Equivalence partitioning And Boundary value analy...
Design Test Case Technique (Equivalence partitioning And Boundary value analy...Design Test Case Technique (Equivalence partitioning And Boundary value analy...
Design Test Case Technique (Equivalence partitioning And Boundary value analy...
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
Gray box testing
Gray box testingGray box testing
Gray box testing
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
White box testing
White box testingWhite box testing
White box testing
 
White box & Black box testing
White box & Black box testingWhite box & Black box testing
White box & Black box testing
 
Equivalence partitions analysis
Equivalence partitions analysisEquivalence partitions analysis
Equivalence partitions analysis
 
Software Testing
Software Testing Software Testing
Software Testing
 
Software Testing - Day Two
Software Testing - Day TwoSoftware Testing - Day Two
Software Testing - Day Two
 
Testing foundations
Testing foundationsTesting foundations
Testing foundations
 
Test design techniques
Test design techniquesTest design techniques
Test design techniques
 
Istqb foundation level
Istqb foundation levelIstqb foundation level
Istqb foundation level
 
Icsm20.ppt
Icsm20.pptIcsm20.ppt
Icsm20.ppt
 
Sqa
Sqa Sqa
Sqa
 
Software Quality Testing
Software Quality TestingSoftware Quality Testing
Software Quality Testing
 
Test Coverage: An Art and a Science
Test Coverage: An Art and a ScienceTest Coverage: An Art and a Science
Test Coverage: An Art and a Science
 
Different techniques-of-software-testing
Different techniques-of-software-testingDifferent techniques-of-software-testing
Different techniques-of-software-testing
 

En vedette

Security Testing for Test Professionals
Security Testing for Test ProfessionalsSecurity Testing for Test Professionals
Security Testing for Test Professionals
TechWell
 

En vedette (16)

Testing Lessons Learned from Monty Python
Testing Lessons Learned from Monty PythonTesting Lessons Learned from Monty Python
Testing Lessons Learned from Monty Python
 
Top Challenges in Testing Requirements
Top Challenges in Testing RequirementsTop Challenges in Testing Requirements
Top Challenges in Testing Requirements
 
Seven Keys to Navigating Your Agile Testing Transition
Seven Keys to Navigating Your Agile Testing TransitionSeven Keys to Navigating Your Agile Testing Transition
Seven Keys to Navigating Your Agile Testing Transition
 
Why Software Drives Us Crazy
Why Software Drives Us CrazyWhy Software Drives Us Crazy
Why Software Drives Us Crazy
 
Take a Test Drive of Acceptance Test-Driven Development
Take a Test Drive of Acceptance Test-Driven DevelopmentTake a Test Drive of Acceptance Test-Driven Development
Take a Test Drive of Acceptance Test-Driven Development
 
Influence and Authority: Use Your Personal Power to Get Things Done
Influence and Authority: Use Your Personal Power to Get Things DoneInfluence and Authority: Use Your Personal Power to Get Things Done
Influence and Authority: Use Your Personal Power to Get Things Done
 
Keynote: Asking the Right Questions? What Journalism Can Teach Testers
Keynote: Asking the Right Questions? What Journalism Can Teach TestersKeynote: Asking the Right Questions? What Journalism Can Teach Testers
Keynote: Asking the Right Questions? What Journalism Can Teach Testers
 
Measurement and Metrics for Test Managers
Measurement and Metrics for Test ManagersMeasurement and Metrics for Test Managers
Measurement and Metrics for Test Managers
 
An Ounce of Prevention...
An Ounce of Prevention...An Ounce of Prevention...
An Ounce of Prevention...
 
Security Testing for Test Professionals
Security Testing for Test ProfessionalsSecurity Testing for Test Professionals
Security Testing for Test Professionals
 
How Did I Miss That Bug? Managing Cognitive Bias in Testing
How Did I Miss That Bug? Managing Cognitive Bias in TestingHow Did I Miss That Bug? Managing Cognitive Bias in Testing
How Did I Miss That Bug? Managing Cognitive Bias in Testing
 
Innovation Thinking: Evolve and Expand Your Capabilities
Innovation Thinking: Evolve and Expand Your CapabilitiesInnovation Thinking: Evolve and Expand Your Capabilities
Innovation Thinking: Evolve and Expand Your Capabilities
 
DevOps: Where in the World Is Test?
DevOps: Where in the World Is Test?DevOps: Where in the World Is Test?
DevOps: Where in the World Is Test?
 
Scaling Agile Up to the Enterprise and Staying Lean
Scaling Agile Up to the Enterprise and Staying LeanScaling Agile Up to the Enterprise and Staying Lean
Scaling Agile Up to the Enterprise and Staying Lean
 
Become a Big Data Quality Hero
Become a Big Data Quality HeroBecome a Big Data Quality Hero
Become a Big Data Quality Hero
 
The Three Pillars Approach to Your Agile Test Strategy
The Three Pillars Approach to Your Agile Test StrategyThe Three Pillars Approach to Your Agile Test Strategy
The Three Pillars Approach to Your Agile Test Strategy
 

Similaire à Key Test Design Techniques

Mt s11 test_design
Mt s11 test_designMt s11 test_design
Mt s11 test_design
TestingGeeks
 

Similaire à Key Test Design Techniques (20)

Fundamental Test Design Techniques
Fundamental Test Design TechniquesFundamental Test Design Techniques
Fundamental Test Design Techniques
 
CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4
 
КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...
КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...
КАТЕРИНА АБЗЯТОВА - Certify with confidence: ISTQB Foundation 4.0. Common err...
 
Automated Testing Tutorial
Automated Testing TutorialAutomated Testing Tutorial
Automated Testing Tutorial
 
13-blackwhiteboxtesting.ppt
13-blackwhiteboxtesting.ppt13-blackwhiteboxtesting.ppt
13-blackwhiteboxtesting.ppt
 
13-blackwhiteboxtesting.ppt
13-blackwhiteboxtesting.ppt13-blackwhiteboxtesting.ppt
13-blackwhiteboxtesting.ppt
 
13-blackwhiteboxtesting.ppt
13-blackwhiteboxtesting.ppt13-blackwhiteboxtesting.ppt
13-blackwhiteboxtesting.ppt
 
black box and white box testing .ppt
black box and  white  box testing   .pptblack box and  white  box testing   .ppt
black box and white box testing .ppt
 
G53 qat09pdf6up
G53 qat09pdf6upG53 qat09pdf6up
G53 qat09pdf6up
 
Black boxtesting
Black boxtestingBlack boxtesting
Black boxtesting
 
Class9_SW_Testing_Strategies.pdf
Class9_SW_Testing_Strategies.pdfClass9_SW_Testing_Strategies.pdf
Class9_SW_Testing_Strategies.pdf
 
LlosengCh10E2.ppt
LlosengCh10E2.pptLlosengCh10E2.ppt
LlosengCh10E2.ppt
 
ISTQB, ISEB Lecture Notes- 4
ISTQB, ISEB Lecture Notes- 4ISTQB, ISEB Lecture Notes- 4
ISTQB, ISEB Lecture Notes- 4
 
black-box-1.pdf
black-box-1.pdfblack-box-1.pdf
black-box-1.pdf
 
How to Clean Up Your Continuous Testing Suites for Web & Mobile
How to Clean Up Your Continuous Testing Suites for Web & MobileHow to Clean Up Your Continuous Testing Suites for Web & Mobile
How to Clean Up Your Continuous Testing Suites for Web & Mobile
 
Software engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit designSoftware engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit design
 
Software testing part
Software testing partSoftware testing part
Software testing part
 
Helpful Practices in Agile Testing
Helpful Practices in Agile TestingHelpful Practices in Agile Testing
Helpful Practices in Agile Testing
 
Mt s11 test_design
Mt s11 test_designMt s11 test_design
Mt s11 test_design
 
Yuriy Malyi "E2E testing organization in multi-system projects"
Yuriy Malyi "E2E testing organization in multi-system projects"Yuriy Malyi "E2E testing organization in multi-system projects"
Yuriy Malyi "E2E testing organization in multi-system projects"
 

Plus de TechWell

Plus de TechWell (20)

Failing and Recovering
Failing and RecoveringFailing and Recovering
Failing and Recovering
 
Instill a DevOps Testing Culture in Your Team and Organization
Instill a DevOps Testing Culture in Your Team and Organization Instill a DevOps Testing Culture in Your Team and Organization
Instill a DevOps Testing Culture in Your Team and Organization
 
Test Design for Fully Automated Build Architecture
Test Design for Fully Automated Build ArchitectureTest Design for Fully Automated Build Architecture
Test Design for Fully Automated Build Architecture
 
System-Level Test Automation: Ensuring a Good Start
System-Level Test Automation: Ensuring a Good StartSystem-Level Test Automation: Ensuring a Good Start
System-Level Test Automation: Ensuring a Good Start
 
Build Your Mobile App Quality and Test Strategy
Build Your Mobile App Quality and Test StrategyBuild Your Mobile App Quality and Test Strategy
Build Your Mobile App Quality and Test Strategy
 
Testing Transformation: The Art and Science for Success
Testing Transformation: The Art and Science for SuccessTesting Transformation: The Art and Science for Success
Testing Transformation: The Art and Science for Success
 
Implement BDD with Cucumber and SpecFlow
Implement BDD with Cucumber and SpecFlowImplement BDD with Cucumber and SpecFlow
Implement BDD with Cucumber and SpecFlow
 
Develop WebDriver Automated Tests—and Keep Your Sanity
Develop WebDriver Automated Tests—and Keep Your SanityDevelop WebDriver Automated Tests—and Keep Your Sanity
Develop WebDriver Automated Tests—and Keep Your Sanity
 
Ma 15
Ma 15Ma 15
Ma 15
 
Eliminate Cloud Waste with a Holistic DevOps Strategy
Eliminate Cloud Waste with a Holistic DevOps StrategyEliminate Cloud Waste with a Holistic DevOps Strategy
Eliminate Cloud Waste with a Holistic DevOps Strategy
 
Transform Test Organizations for the New World of DevOps
Transform Test Organizations for the New World of DevOpsTransform Test Organizations for the New World of DevOps
Transform Test Organizations for the New World of DevOps
 
The Fourth Constraint in Project Delivery—Leadership
The Fourth Constraint in Project Delivery—LeadershipThe Fourth Constraint in Project Delivery—Leadership
The Fourth Constraint in Project Delivery—Leadership
 
Resolve the Contradiction of Specialists within Agile Teams
Resolve the Contradiction of Specialists within Agile TeamsResolve the Contradiction of Specialists within Agile Teams
Resolve the Contradiction of Specialists within Agile Teams
 
Pin the Tail on the Metric: A Field-Tested Agile Game
Pin the Tail on the Metric: A Field-Tested Agile GamePin the Tail on the Metric: A Field-Tested Agile Game
Pin the Tail on the Metric: A Field-Tested Agile Game
 
Agile Performance Holarchy (APH)—A Model for Scaling Agile Teams
Agile Performance Holarchy (APH)—A Model for Scaling Agile TeamsAgile Performance Holarchy (APH)—A Model for Scaling Agile Teams
Agile Performance Holarchy (APH)—A Model for Scaling Agile Teams
 
A Business-First Approach to DevOps Implementation
A Business-First Approach to DevOps ImplementationA Business-First Approach to DevOps Implementation
A Business-First Approach to DevOps Implementation
 
Databases in a Continuous Integration/Delivery Process
Databases in a Continuous Integration/Delivery ProcessDatabases in a Continuous Integration/Delivery Process
Databases in a Continuous Integration/Delivery Process
 
Mobile Testing: What—and What Not—to Automate
Mobile Testing: What—and What Not—to AutomateMobile Testing: What—and What Not—to Automate
Mobile Testing: What—and What Not—to Automate
 
Cultural Intelligence: A Key Skill for Success
Cultural Intelligence: A Key Skill for SuccessCultural Intelligence: A Key Skill for Success
Cultural Intelligence: A Key Skill for Success
 
Turn the Lights On: A Power Utility Company's Agile Transformation
Turn the Lights On: A Power Utility Company's Agile TransformationTurn the Lights On: A Power Utility Company's Agile Transformation
Turn the Lights On: A Power Utility Company's Agile Transformation
 

Dernier

Dernier (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Key Test Design Techniques

  • 1. TB Full-day Tutorials 5/6/2014 8:30:00 AM Key Test Design Techniques Presented by: Lee Copeland Software Quality Engineering Brought to you by: 340 Corporate Way, Suite 300, Orange Park, FL 32073 888-268-8770 ∙ 904-278-0524 ∙ sqeinfo@sqe.com ∙ www.sqe.com
  • 2. Lee Copeland Software Quality Engineering With more than thirty years of experience as an information systems professional at commercial and nonprofit organizations, Lee Copeland has held technical and managerial positions in applications development, software testing, and software process improvement. Lee has developed and taught numerous training courses on software development and testing issues, and is a well-known speaker with Software Quality Engineering. Lee presents at software conferences in the United States and abroad. He is the author of the popular reference book, A Practitioner’s Guide to Software Test Design.
  • 3. Keyy Test Design Techniques Software Quality Engineering 340 Corporate Way, Suite 300 Orange Park, Florida 32073 904.278.0707 SQE ©2001-2011 Version 4.0 Lee Copeland lee@sqe.com Administrivia Tutorial timing Tutorial materials Messages Meals Pagers and Cell phones Facilities Mastering Test Design V 4.0 © SQE 2001-2011 2 BreaksSmoking
  • 4. Tutorial Goals • At the end of the tutorial you will be able to – Design test cases using structured formalDesign test cases using structured, formal, “scientific” techniques – Implement the “art” of test case design as well as the science – Understand how defect taxonomies can improve test case design 3 Mastering Test Design V 4.0 © SQE 2001-2011 Chapter 1Chapter 1 IntroductionIntroduction 4 Mastering Test Design V 4.0 © SQE 2001-2011
  • 5. Tutorial Agenda 1. Introduction 2. Black Box Science 3. White Box Science 4. Black Box Art 5. Defect Taxonomies 6. Wrap-up 5 Mastering Test Design V 4.0 © SQE 2001-2011 Chapter Objectives • At the end of this chapter you will be able to – Define “testing” – Define the components of a test case – Discuss the problems of how much testing can be done 6 Mastering Test Design V 4.0 © SQE 2001-2011
  • 6. Test Design Process - Context Master Test Plan Detailed Test Plans Test Analysis S t ti 7 Test Design Test Implementation Systematic Software Testing tutorial Mastering Test Design V 4.0 © SQE 2001-2011 What is Testing? • IEEE Std 610 Software Engineering Terminology: “test” 1 An activity in which a system or component is1. An activity in which a system or component is executed under specified conditions, the results are observed or recorded, and an evaluation is made of some aspect of the system or component 2. To conduct an activity as in (1) 3 A set of one or more test cases 8 3. A set of one or more test cases 4. A set of one or more test procedures 5. A set of one or more test cases and procedures Mastering Test Design V 4.0 © SQE 2001-2011
  • 7. What Do We Test? Fundamental issues FUNCTIONS Portability Usability Reliability Security Availability Localization Testability Real-time issues System management issues Localization Testability Extensibility Interoperability Timing Capacity Throughput Performance Overload Backup and Recovery Start up and shut down 9 Purchased software Start-up and shut-down Operating systems DBMS Communications Mastering Test Design V 4.0 © SQE 2001-2011 Current Challenges In Test Design ? ? ?? ? ? ? ? 10 ? ? Mastering Test Design V 4.0 © SQE 2001-2011
  • 8. Test environment Order of execution What Are Test Cases? Output(s) Test environment 11 Input(s) Mastering Test Design V 4.0 © SQE 2001-2011 What Are Test Cases? • Inputs can be – Data entered through the UI Input(s) – Data from interfacing systems – Data from interfacing devices – Files D t b 12 – Databases – State – Environment Mastering Test Design V 4.0 © SQE 2001-2011
  • 9. What Are Test Cases? • Outputs can be: – Data to UI – Data to interfacing Output(s) Data to interfacing systems – Data to interfacing devices – Files – Databases 13 – State – Response time Mastering Test Design V 4.0 © SQE 2001-2011 Data Test Everything? Combinations 14 Paths Impossible! Mastering Test Design V 4.0 © SQE 2001-2011
  • 10. Test Wisely! Cost effective Time limited Risk based 15 Tool support Choose wisely Mastering Test Design V 4.0 © SQE 2001-2011 Chapter 2Chapter 2 Black BoxBlack Box ScienceScience 16 ScienceScience Mastering Test Design V 4.0 © SQE 2001-2011
  • 11. Tutorial Agenda 1. Introduction 2. Black Box Science 3. White Box Science 4. Black Box Art 5. Defect Taxonomies 6. Wrap-up 17 Mastering Test Design V 4.0 © SQE 2001-2011 Objectives • At the end of this chapter you will be able to – Implement the Equivalence Class Partitioning andImplement the Equivalence Class Partitioning and Boundary Value testing techniques – Create a Decision Table – Describe when State-Transition diagrams are useful and how to create one – Understand and use “All Pairs” based techniques 18 • Orthogonal arrays and pairs based test cases – Create a Traceability Matrix • If one is desired or required Mastering Test Design V 4.0 © SQE 2001-2011
  • 12. What is Black Box Science? • Black Box – Focus only on the inputs and outputs – Ignore the internal paths, structure, and implementation – Can’t know the percentage of code tested • Science – Use structured approach(es) – Approach all data the same 19 – Have a methodology based coverage measure Mastering Test Design V 4.0 © SQE 2001-2011 Unit Subsystem System Black Box at Different Levels A black box is a black box is a black box. 20 A black box is a black box is a black box. It’s just a bigger box with more input, functionality, and output. Mastering Test Design V 4.0 © SQE 2001-2011
  • 13. For Each Software Requirement • First let’s focus on one requirement / function / story at a time – Equivalence Class Partitioning – Boundary Value Testing – Combining both across multiple inputs 21 Mastering Test Design V 4.0 © SQE 2001-2011 Equivalence Class Partitioning • The role of Equivalence Class Partitioning – Create the minimum number of black box tests needed while still providing adequate coveragep g q g • Steps 1. Identify equivalence classes - the input ranges which are treated the same by the software • Valid classes: legal input ranges • Invalid classes: illegal or out of range input values 2 C t t t f h f th i l 22 2. Create a test case for each of the equivalence classes ValidInvalid Invalid Mastering Test Design V 4.0 © SQE 2001-2011
  • 14. Equivalence Class Partitioning 1. If an input condition specifies a continuous range of values, there is one valid class and two invalid classes. – Example: The input variable is a mortgage applicant’s income. The valid range is $1000.00/mo. to $75,000.00/mo. • Valid class: {1000.00 < = income < = 75,000.00} • Invalid classes: {income < 1000.00}, {income > 75,000.00} 2. If an input condition specifies a discrete range of permissible values, there is one valid class and two 23 permissible values, there is one valid class and two invalid classes. – Example: The input variable is the total number of houses being purchased, from 1 to 5. • Valid class: {1 < = #_Houses < = 5} • Invalid classes: {#_Houses < 1}, {#_Houses > 5} Mastering Test Design V 4.0 © SQE 2001-2011 Equivalence Class Partitioning 3. If an input condition specifies a set of values, there is one valid and one invalid equivalence class. – Example: Types of housing are Condo, Townhouse, and Si l F ilSingle Family • Valid class: {Condo, Townhouse, Single Family} • Invalid class: {...anything else...} • Sets are different – If each member of a set yields the same result the set is a single class 24 single class – If each member generates a different result then each member is a separate class with one valid and one invalid class Mastering Test Design V 4.0 © SQE 2001-2011
  • 15. Equivalence Class Partitioning 4. If a “must be” condition is required, there is one valid equivalence class and one invalid class. – Example: The mortgage applicant must be a person. • Valid class: {person} • Invalid class: {corporation, ...anything else...} 25 Mastering Test Design V 4.0 © SQE 2001-2011 Another Way to Annotate Partitions Invalid InvalidValid 999.99 75,000.011000.00 to 75,000.00 Invalid InvalidValid 0 61 to 5 Invalid Valid All Else Condo, Townhouse, Single Family 26 Invalid Valid Person Invalid Valid All Else Mastering Test Design V 4.0 © SQE 2001-2011
  • 16. Equivalence Class Partitioning • Steps for creating the test cases 1. Define the equivalence classes for your rules 2. Write the first test case to cover as many of the valid equivalence classes from the rule set as possible (although they may be mutually exclusive) 3. Continue writing test cases until all of the valid equivalence classes from the rules have 27 valid equivalence classes from the rules have been covered 4. Write one test case for each invalid class Mastering Test Design V 4.0 © SQE 2001-2011 Example Test Cases (EP) Test Case Valid Test Cases Income No. Type Person 1 $4,000.00 2 Condo Bob$ , Invalid Test Cases 2 $90,000.00 1 Condo Bob’s mom 3 $800.00 2 Single Family Leroy 4 $4,000.00 7 Townhouse Larry 5 $2,000.00 0 Condo Helen 6 $5 500 00 2 Offi Bld S 28 6 $5,500.00 2 Office Bldg. Sam 7 $60,000.00 2 Townhouse ABC Incorporated Mastering Test Design V 4.0 © SQE 2001-2011
  • 17. Boundary Value Testing (BV) • The role of Boundary Value Testing An additional black box testing approach– An additional black box testing approach • Almost always used with Equivalence Partitioning – Test cases at the boundary of each input • Includes the following – At the boundary (where possible or if significant) 29 – Just below the boundary – Just above the boundary Mastering Test Design V 4.0 © SQE 2001-2011 Example Test Cases (EP/BV) Test Case Valid Test Cases Income No. Type Person 1 $1,000.00 1 Condo Bob$ , 2 $75,000.00 5 Single Family Helen 3 $37,500.00 3 Townhouse George Invalid Test Cases 4 $75,000.01 1 Condo Bob’s mom 5 $999.99 2 Single Family Leroy 6 $4 000 00 6 T h L 30 6 $4,000.00 6 Townhouse Larry 7 $2,000.00 0 Condo Helen 8 $5,500.00 2 Office Bldg. Sam 9 $60,000.00 2 Townhouse ABC Incorporated Mastering Test Design V 4.0 © SQE 2001-2011
  • 18. More Classes of Invalids • Looking at more than one data field at a time – Try invalid combinationsTry invalid combinations • All inputs are in valid range • But they are NOT valid together • Example: Singapore Airlines, Calcutta to Sydney, Wednesday (they have no flights on this route on Wednesday) – Try invalid orders 31 • All inputs in the valid range • But NOT valid due to timing or order • Examples: using a system without logging on; asking for a refund before paying Mastering Test Design V 4.0 © SQE 2001-2011 For All Software Requirements • Focus on testing all of the requirements to make sure they interoperate successfully – Cross-functional testing – Decision Tables – State-Transition diagrams – Pair based methods • Orthogonal Arrays 32 g y • Combinatorial Analysis (all pairs) Mastering Test Design V 4.0 © SQE 2001-2011
  • 19. Cross Functional Testing • Definition – Test more than one function at a timeTest more than one function at a time – Possibly run these tests first – Why? • Discover design and interface errors 33 Mastering Test Design V 4.0 © SQE 2001-2011 Cross Functional Testing EXAMPLE TC1 TC2 TC3 TC4 TC5 Database 2 Mail server 2 * ** * Remote Application 3 * Remote Application 2 * * * Remote Application 1 * * 34 Database 1 * * Mail server 1 * * * User interface * * * * Mastering Test Design V 4.0 © SQE 2001-2011
  • 20. Decision Table • Definition – A table listing all possible “conditions” (inputs) and all possible “actions” (outputs)p ( p ) – There is a “rule” for each possible combination of “conditions” • Decision tables can be used to represent very complex business rules based on a 35 set of defined conditions (requirements) Mastering Test Design V 4.0 © SQE 2001-2011 Decision Table Format Rule 1 Rule 2 ….. Rule N Conditions Condition-1 Condition-2 ……. Condition-x Actions A ti 1 36 Action-1 Action-2 …… Action-z Mastering Test Design V 4.0 © SQE 2001-2011
  • 21. Example Decision Table • From the Internal Revenue Service Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8 Condition Single Yes Yes Yes Yes No No No No 65 or older OR blind Yes Yes No No Yes Yes No No Unearned income > $1560 Yes No Yes No Yes No Yes No 37 Action File Return No No Yes No Yes No Yes Yes Mastering Test Design V 4.0 © SQE 2001-2011 Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8 Conditions Claims 0 0 1 1 2-4 2-4 5+ 5+ Another Decision Table Age 16-25 26-85 16-25 26-85 16-25 26-85 16-25 26-85 Actions Premium Increase $50 $25 $100 $50 $400 $200 $0 $0 Send Warning No No Yes No Yes Yes No No Cancel Policy No No No No No No Yes Yes 38 • From an automobile insurance company Mastering Test Design V 4.0 © SQE 2001-2011
  • 22. Turning Decision Tables into Test Cases • Create the decision table by defining condition and action combinations • Strike out any rules that are “impossible”• Strike out any rules that are impossible – Are they really? – How can you guarantee it? • Combine columns where the values are immaterial We don’t care or do we? 39 – We don t care, or do we? • Select test data to make each rule “fire” Mastering Test Design V 4.0 © SQE 2001-2011 State-Transition Diagrams • Used for “state” machines (what happens next is dependent on what has happened before)before) – Visual illustration of allowed sequences of functions – GREAT for finding correct order of valid operations – EXCELLENT for finding correct order of test cases 40 – May be difficult to get this level of documentation in an updated and current form Mastering Test Design V 4.0 © SQE 2001-2011
  • 23. A Simple State Example Please Cancel Made Cancelled By Customer Please Cancel/ RefundPaid Pay Money Make Reservation Please Print Ticket/ Ticket 41 Please Cancel/ Refund Used Give Ticket Ticketed Mastering Test Design V 4.0 © SQE 2001-2011 Simple State Example with Tests Please Cancel Made Cancelled By Customer Please Cancel/ RefundPaid Pay Money Make Reservation Please Print Ticket/ Ticket 1 2 3 4 1E 2E 42 Please Cancel/ Refund Used Give Ticket Ticketed Mastering Test Design V 4.0 © SQE 2001-2011
  • 24. All Pairs Methods • Orthogonal Arrays and Combinatorial Analysis • A device for selecting a “good” subset of• A device for selecting a good subset of all possible combinations – When there are too many combinations to consider – When it’s risky to randomly skip testing large parts of the functionality or combinations 43 • These methods test “All Pairs” (each option with every other option ONCE, but not all combinations across all options). • They exercise multiple pairs simultaneously • Requires knowledge of all legitimate combinations Mastering Test Design V 4.0 © SQE 2001-2011 Example Orthogonal Arrays 1 2 3 4 5 6 7 1 0 0 0 0 0 0 0 2 0 1 2 2 0 1 1 3 0 2 1 2 1 0 2 1 2 3 1 0 0 0 L4 (23) L18(3661) 4 0 1 1 0 2 2 3 5 0 2 0 1 2 1 4 6 0 0 2 1 1 2 5 7 1 1 1 1 1 1 0 8 1 2 0 0 1 2 1 9 1 0 2 0 2 1 2 10 1 2 2 1 0 0 3 11 1 0 1 2 0 2 4 2 0 1 1 3 1 0 1 4 1 1 0 1 2 3 4 1 0 0 0 0 2 0 1 1 1 3 0 2 2 2 L9(34) 44 12 1 1 0 2 2 0 5 13 2 2 2 2 2 2 0 14 2 0 1 1 2 0 1 15 2 1 0 1 0 2 2 16 2 0 0 2 1 1 3 17 2 1 2 0 1 0 4 18 2 2 1 0 0 1 5 3 0 2 2 2 4 1 0 1 2 5 1 1 2 0 6 1 2 0 1 7 2 0 2 1 8 2 1 0 2 9 2 2 1 0 Mastering Test Design V 4.0 © SQE 2001-2011
  • 25. A Problem To Solve Skype Tools | Options | Privacy 45 •45Mastering Test Design V 4.0 © SQE 2001-2011 A Problem To Solve 46 •46Mastering Test Design V 4.0 © SQE 2001-2011
  • 26. A Problem To Solve • Allow calls from – anyone, contact list (2) • Receive video from – anyone, contact list, no one (3) • Allow IMs from – anyone, contact list (2) • Show video to – contact list, no one (2) • Keep history for – no history, 2 weeks, 1 month, 3 months, forever (5) 47 • Show online status – yes, no (2) • Accept cookies – yes, no (2) •47 2 x 3 x 2 x 2 x 5 x 2 x 2 = 480 combinations Mastering Test Design V 4.0 © SQE 2001-2011 1 2 3 4 5 6 7 1 0 0 0 0 0 0 0 2 0 0 1 1 2 2 1 3 0 1 0 2 2 1 2 4 0 1 2 0 1 2 3 5 0 2 1 2 1 0 45 0 2 1 2 1 0 4 6 0 2 2 1 0 1 5 7 1 0 0 2 1 2 5 8 1 0 2 0 2 1 4 9 1 1 1 1 1 1 0 10 1 1 2 2 0 0 1 11 1 2 0 1 2 0 3 12 1 2 1 0 0 2 2 L18(3661) 48 •48 13 2 0 1 2 0 1 3 14 2 0 2 1 1 0 2 15 2 1 0 1 0 2 4 16 2 1 1 0 2 0 5 17 2 2 0 0 1 1 1 18 2 2 2 2 2 2 0 Mastering Test Design V 4.0 © SQE 2001-2011
  • 27. Orthogonal Arrays • To use Orthogonal Arrays for test selection, we’ll “map” our testing problem onto an OA • (Generally) Proceed from top to bottom and left to right through the problem variables (because the first language I learned reads left to right and top to bottom) 49 •49Mastering Test Design V 4.0 © SQE 2001-2011 A Problem To Solve • Allow calls from – anyone, contact list (2) • Receive video from – anyone, contact list, no one (3)one (3) • Allow IMs from – anyone, contact list (2) • Show video to – contact list, no one (2) • Keep history for – no history, 2 weeks, 1 month, 3 months, forever (5) • Show online status – yes, no (2) 50 y , ( ) • Accept cookies – yes, no (2) •50 2 x 3 x 2 x 2 x 5 x 2 x 2 = 480 combinations Mastering Test Design V 4.0 © SQE 2001-2011
  • 28. Allow Calls From 2 3 4 5 6 7 1 anyOne 0 0 0 0 0 0 2 0 0 1 1 2 2 1 3 0 1 0 2 2 1 2 4 0 1 2 0 1 2 3 5 0 2 1 2 1 0 4 6 0 2 2 1 0 1 5 7 contactList 0 0 2 1 2 5 8 1 0 2 0 2 1 4 9 1 1 1 1 1 1 0 10 1 1 2 2 0 0 1 11 1 2 0 1 2 0 3 12 1 2 1 0 0 2 2 Map anyOne onto all 0s Map contactList 51 •51 12 1 2 1 0 0 2 2 13 2 0 1 2 0 1 3 14 2 0 2 1 1 0 2 15 2 1 0 1 0 2 4 16 2 1 1 0 2 0 5 17 2 2 0 0 1 1 1 18 2 2 2 2 2 2 0 onto all 1s Mastering Test Design V 4.0 © SQE 2001-2011 Allow Calls From 2 3 4 5 6 7 1 anyOne 0 0 0 0 0 0 2 anyOne 0 1 1 2 2 1 3 anyOne 1 0 2 2 1 2 4 anyOne 1 2 0 1 2 3 5 anyOne 2 1 2 1 0 4 6 anyOne 2 2 1 0 1 5 7 contactList 0 0 2 1 2 5 8 contactList 0 2 0 2 1 4 9 contactList 1 1 1 1 1 0 10 contactList 1 2 2 0 0 1 11 contactList 2 0 1 2 0 3 12 contactList 2 1 0 0 2 2 Repeat for each factor 52 •52 12 contactList 2 1 0 0 2 2 13 2 0 1 2 0 1 3 14 2 0 2 1 1 0 2 15 2 1 0 1 0 2 4 16 2 1 1 0 2 0 5 17 2 2 0 0 1 1 1 18 2 2 2 2 2 2 0 Mastering Test Design V 4.0 © SQE 2001-2011
  • 29. Allow Calls From Receive Video From 3 4 5 6 7 1 anyOne anyOne 0 0 0 0 0 2 anyOne anyOne 1 1 2 2 1 3 anyOne contactList 0 2 2 1 2 4 anyOne contactList 2 0 1 2 3 5 anyOne noOne 1 2 1 0 4 6 anyOne noOne 2 1 0 1 5 7 contactList anyOne 0 2 1 2 5 8 contactList anyOne 2 0 2 1 4 9 contactList contactList 1 1 1 1 0 10 contactList contactList 2 2 0 0 1 11 contactList noOne 0 1 2 0 3 12 contactList noOne 1 0 0 2 2 53 •53 12 contactList noOne 1 0 0 2 2 13 2 anyOne 1 2 0 1 3 14 2 anyOne 2 1 1 0 2 15 2 contactList 0 1 0 2 4 16 2 contactList 1 0 2 0 5 17 2 noOne 0 0 1 1 1 18 2 noOne 2 2 2 2 0 Mastering Test Design V 4.0 © SQE 2001-2011 Allow Calls From Receive Video From Allow IMs From 4 5 6 7 1 anyOne anyOne anyOne 0 0 0 0 2 anyOne anyOne contactList 1 2 2 1 3 anyOne contactList anyOne 2 2 1 2 4 anyOne contactList 2 0 1 2 3 5 anyOne noOne contactList 2 1 0 4 6 anyOne noOne 2 1 0 1 5 7 contactList anyOne anyOne 2 1 2 5 8 contactList anyOne 2 0 2 1 4 9 contactList contactList contactList 1 1 1 0 10 contactList contactList 2 2 0 0 1 11 contactList noOne anyOne 1 2 0 3 12 contactList noOne contactList 0 0 2 2 54 •54 12 contactList noOne contactList 0 0 2 2 13 2 anyOne contactList 2 0 1 3 14 2 anyOne 2 1 1 0 2 15 2 contactList anyOne 1 0 2 4 16 2 contactList contactList 0 2 0 5 17 2 noOne anyOne 0 1 1 1 18 2 noOne 2 2 2 2 0 Mastering Test Design V 4.0 © SQE 2001-2011
  • 30. Allow Calls From Receive Video From Allow IMs From Show Video To 5 6 7 1 anyOne anyOne anyOne contactList 0 0 0 2 anyOne anyOne contactList noOne 2 2 1 3 anyOne contactList anyOne 2 2 1 2 4 anyOne contactList 2 contactList 1 2 3 5 anyOne noOne contactList 2 1 0 4 6 anyOne noOne 2 noOne 0 1 5 7 contactList anyOne anyOne 2 1 2 5 8 contactList anyOne 2 contactList 2 1 4 9 contactList contactList contactList noOne 1 1 0 10 contactList contactList 2 2 0 0 1 11 contactList noOne anyOne noOne 2 0 3 12 contactList noOne contactList contactList 0 2 2 55 •55 12 contactList noOne contactList contactList 0 2 2 13 2 anyOne contactList 2 0 1 3 14 2 anyOne 2 noOne 1 0 2 15 2 contactList anyOne noOne 0 2 4 16 2 contactList contactList contactList 2 0 5 17 2 noOne anyOne contactList 1 1 1 18 2 noOne 2 2 2 2 0 Mastering Test Design V 4.0 © SQE 2001-2011 Allow Calls From Receive Video From Allow IMs From Show Video To Show Online Status 6 7 1 anyOne anyOne anyOne contactList yes 0 0 2 anyOne anyOne contactList noOne 2 2 1 3 anyOne contactList anyOne 2 2 1 2 4 anyOne contactList 2 contactList no 2 3 5 anyOne noOne contactList 2 no 0 4 6 anyOne noOne 2 noOne yes 1 5 7 contactList anyOne anyOne 2 no 2 5 8 contactList anyOne 2 contactList 2 1 4 9 contactList contactList contactList noOne no 1 0 10 contactList contactList 2 2 yes 0 1 11 contactList noOne anyOne noOne 2 0 3 12 contactList noOne contactList contactList yes 2 2 56 •56 12 contactList noOne contactList contactList yes 2 2 13 2 anyOne contactList 2 yes 1 3 14 2 anyOne 2 noOne no 0 2 15 2 contactList anyOne noOne yes 2 4 16 2 contactList contactList contactList 2 0 5 17 2 noOne anyOne contactList no 1 1 18 2 noOne 2 2 2 2 0 Mastering Test Design V 4.0 © SQE 2001-2011
  • 31. Allow Calls From Receive Video From Allow IMs From Show Video To Show Online Status Accept Cookies 7 1 anyOne anyOne anyOne contactList yes yes 0 2 anyOne anyOne contactList noOne 2 2 1 3 anyOne contactList anyOne 2 2 no 2 4 anyOne contactList 2 contactList no 2 3 5 anyOne noOne contactList 2 no yes 4 6 anyOne noOne 2 noOne yes no 5 7 contactList anyOne anyOne 2 no 2 5 8 contactList anyOne 2 contactList 2 no 4 9 contactList contactList contactList noOne no no 0 10 contactList contactList 2 2 yes yes 1 11 contactList noOne anyOne noOne 2 yes 3 12 contactList noOne contactList contactList yes 2 2 57 •57 12 contactList noOne contactList contactList yes 2 2 13 2 anyOne contactList 2 yes no 3 14 2 anyOne 2 noOne no yes 2 15 2 contactList anyOne noOne yes 2 4 16 2 contactList contactList contactList 2 yes 5 17 2 noOne anyOne contactList no no 1 18 2 noOne 2 2 2 2 0 Mastering Test Design V 4.0 © SQE 2001-2011 Allow Calls From Receive Video From Allow IMs From Show Video To Show Online Status Accept Cookies Keep History For 1 anyOne anyOne anyOne contactList yes yes noHistory 2 anyOne anyOne contactList noOne 2 2 2Weeks 3 anyOne contactList anyOne 2 2 no 1Month 4 anyOne contactList 2 contactList no 2 3Months 5 anyOne noOne contactList 2 no yes forEver 6 anyOne noOne 2 noOne yes no 5 7 contactList anyOne anyOne 2 no 2 5 8 contactList anyOne 2 contactList 2 no forEver 9 contactList contactList contactList noOne no no noHistory 10 contactList contactList 2 2 yes yes 2Weeks 11 contactList noOne anyOne noOne 2 yes 3Months 12 contactList noOne contactList contactList yes 2 1Month 58 •58 12 contactList noOne contactList contactList yes 2 1Month 13 2 anyOne contactList 2 yes no 3Months 14 2 anyOne 2 noOne no yes 1Month 15 2 contactList anyOne noOne yes 2 forEver 16 2 contactList contactList contactList 2 yes 5 17 2 noOne anyOne contactList no no 2Weeks 18 2 noOne 2 2 2 2 noHistory Mastering Test Design V 4.0 © SQE 2001-2011
  • 32. Orthogonal Arrays • We have reduced our test cases from 480 to 18 – a substantial reduction (about 96%) • while testing all pairs of input combinations at least once 59 •59Mastering Test Design V 4.0 © SQE 2001-2011 Orthogonal Arrays • But what should we do about the cells in the OA that have not been assigned values? – – • But first why do we have such cells? 60 But first, why do we have such cells? •60Mastering Test Design V 4.0 © SQE 2001-2011
  • 33. Allow Calls From Receive Video From Allow IMs From Show Video To Show Online Status Accept Cookies Keep History For 1 anyOne anyOne anyOne contactList yes yes noHistory 2 anyOne anyOne contactList noOne 2 2 2Weeks 3 anyOne contactList anyOne 2 2 no 1Month 4 anyOne contactList 2 contactList no 2 3Months 5 anyOne noOne contactList 2 no yes forEver 6 anyOne noOne 2 noOne yes no 5 7 contactList anyOne anyOne 2 no 2 5 8 contactList anyOne 2 contactList 2 no forEver 9 contactList contactList contactList noOne no no noHistory 10 contactList contactList 2 2 yes yes 2Weeks 11 contactList noOne anyOne noOne 2 yes 3Months 12 contactList noOne contactList contactList yes 2 1Month 61 •61 12 contactList noOne contactList contactList yes 2 1Month 13 2 anyOne contactList 2 yes no 3Months 14 2 anyOne 2 noOne no yes 1Month 15 2 contactList anyOne noOne yes 2 forEver 16 2 contactList contactList contactList 2 yes 5 17 2 noOne anyOne contactList no no 2Weeks 18 2 noOne 2 2 2 2 noHistory Mastering Test Design V 4.0 © SQE 2001-2011 Orthogonal Arrays • Let’s fill them in with valid values: – Select the first value in the list – Alternate the values – Set the values according to the percentage of use (if 60% will be yes and 40% will be no, then use that percentage) – Set the values according to the risk that 62 g value presents • Which is the best approach? •62Mastering Test Design V 4.0 © SQE 2001-2011
  • 34. Allow Calls From Receive Video From Allow IMs From Show Video To Show Online Status Accept Cookies Keep History For 1 anyOne anyOne anyOne contactList yes yes noHistory 2 anyOne anyOne contactList noOne yes yes 2Weeks 3 anyOne contactList anyOne contactList no no 1Month 4 anyOne contactList anyOne contactList no no 3Months 5 anyOne noOne contactList noOne no yes forEver 6 anyOne noOne contactList noOne yes no noHistory 7 contactList anyOne anyOne contactList no yes 2Weeks 8 contactList anyOne anyOne contactList yes no forEver 9 contactList contactList contactList noOne no no noHistory 10 contactList contactList contactList noOne yes yes 2Weeks 11 contactList noOne anyOne noOne no yes 3Months 12 contactList noOne contactList contactList yes no 1Month 63 •63 12 contactList noOne contactList contactList yes no 1Month 13 anyOne anyOne contactList contactList yes no 3Months 14 contactList anyOne anyOne noOne no yes 1Month 15 anyOne contactList anyOne noOne yes yes forEver 16 ContactList contactList contactList contactList yes yes 1Month 17 anyOne noOne anyOne contactList no no 2Weeks 18 contactList noOne contactList noOne no no noHistory Mastering Test Design V 4.0 © SQE 2001-2011 PICT Program • Microsoft has developed a tool to generate all the pair combinationsall the pair combinations • Microsoft’s algorithm is described in “Pairwise Testing in the Real World: Practical Extensions to Test Case Generators” by Jacek Czerwonka Mastering Test Design V 3.2 © SQE 2001-2006 64 Czerwonka • PICT is a free tool you can download and use •64
  • 35. PICT Program Click here Mastering Test Design V 3.2 © SQE 2001-2006 65 •65 •http://msdn.microsoft.com/en-us/testing/bb980925 PICT Program • … and download pict33.msi (a Microsoft Installer Package) • Save it • Execute it to install. (It installs in the Program Files folder) Mastering Test Design V 3.2 © SQE 2001-2006 66 • PICTHelp.html has the instructions (They are very helpful) •66
  • 36. PICT Program • Prepare the input by entering the data into Notepad Mastering Test Design V 3.2 © SQE 2001-2006 67 •67 PICT Program • Run pict.exe • Specify it’s input and output. For example: • pict SkypeExampleForPICT.txt > SkypeTestCasesFromPICT.txt Mastering Test Design V 3.2 © SQE 2001-2006 68 •68
  • 37. PICT Program • Open the output with Excel to make it look nice Mastering Test Design V 3.2 © SQE 2001-2006 69 •69 PICT Program AllowCalls ReceiveVideo AllowIMs ShowVideo KeepHistory ShowStatus AcceptCookies ContactList ContactList Anyone ContactList OneMonth Yes Yes Anyone Anyone ContactList NoOne ThreeMonths No No ContactList NoOne Anyone NoOne Forever No Yes Anyone ContactList ContactList NoOne NoHistry Yes No ContactList NoOne ContactList ContactList TwoWeeks Yes No Anyone NoOne Anyone ContactList ThreeMonths Yes Yes ContactList Anyone Anyone ContactList NoHistry No Yes Anyone ContactList ContactList ContactList Forever Yes No Anyone NoOne ContactList NoOne OneMonth No No Mastering Test Design V 3.2 © SQE 2001-2006 70 •70 ContactList Anyone Anyone NoOne Forever Yes No Anyone Anyone Anyone NoOne TwoWeeks No Yes ContactList ContactList ContactList NoOne ThreeMonths No Yes Anyone Anyone Anyone ContactList OneMonth No No Anyone ContactList ContactList NoOne TwoWeeks No Yes ContactList NoOne ContactList ContactList NoHistry Yes No
  • 38. PICT Program • Note the good news – we can test all pairs of the 7 inputs in only 16 test cases (rather than the total combinations of 480)the total combinations of 480) Mastering Test Design V 3.2 © SQE 2001-2006 71 •71 PICT Program • PICT has a nice feature the other approaches don’t have – it allows for selection constraints to be specifiedto be specified Mastering Test Design V 3.2 © SQE 2001-2006 72 •72
  • 39. Another Example 73 Mastering Test Design V 4.0 © SQE 2001-2011 Another Example The borders and shading dialog box : • 5 settings • 5 styles (showing)• 5 styles (showing) • 9 colors • 9 widths 5 x 5 x 9 x 9 = 2025 combinations An L81(910) array is the smallest array that meets our needs 74 our needs (There is an L81(32494) array that would work) Mastering Test Design V 4.0 © SQE 2001-2011
  • 40. Sources • An excellent book is Quality Engineering Using Robust Design by Madhav S. Phadke F t l f th l• For a catalog of orthogonal arrays, see www.research.att.com/~njas/oadir/index.html • A nice tool is rdExpert from www.phadkeassociates.com • A very robust tool is AETG from Telcordia at aetgweb.argreenhouse.com 75 Mastering Test Design V 4.0 © SQE 2001-2011 Trace Matrix • A Trace Matrix can be used to track test cases during development and execution – Identification of uniquely “testable” requirements • Eliminate wishes, hopes, dreams, and other un-testable statements • Eliminate duplicates • Assign a unique ID for each requirement and design objective 76 • Determine its priority if possible – Verification of implementation of all requirements Mastering Test Design V 4.0 © SQE 2001-2011
  • 41. Track everything! Trace Matrix - Context Reqm’ts Design Code 77 Test Cases Mastering Test Design V 4.0 © SQE 2001-2011 Trace Number Requirement 001 Sect. 1 1 Summary 99 99% availability Sect. 1 6 Summary Dual processors Design Trace Matrix - Example 001 N/A 1.1 1.2 1.3 99.99% availability Hardware selected will be available in less than 30 days Transactions will 1.6 1.7 6.1 15.3 N/A N/A Dual processors Hot back-up On-line diagnostics On-line performance monitors N/A N/AN/A 78 002 1.4 not be lost (included with 1.4) 100% of all transactions input will be processed (includes 1.3) 2.2 2.3 2.4 Transaction processing Transaction logs Retransmission request for missing transactions Mastering Test Design V 4.0 © SQE 2001-2011
  • 42. Method Unit Integ. Sys Sys to Sys Web Equivalence class partitioning √ √ √ √ √ Techniques vs. Levels of Test Boundary value √ √ √ √ √ Invalid combinations and processes √ √ √ √ √ Cross functional testing √ √ √ √ Decision table √ √ √ √ √ State transition diagrams √ √ √ √ √ 79 Orthogonal Arrays and All Pairs √ √ √ √ √ Trace Matrix √ √ √ √ √ Mastering Test Design V 4.0 © SQE 2001-2011 Risk / Priority Based • Add more test cases for higher risk or priority – Some of the factors in risk • High use software • Safety criticality • Criticality to operations • “Key” features such as security, monetary expenditures • Others? – Including risk in the planning from the beginning can help when there isn’t time to run all of the Mastering Test Design V 3.2 © SQE 2001-2006 80 can help when there isn t time to run all of the tests – Risk is a subjective judgment call – Test higher risk areas early and more thoroughly
  • 43. Chapter 3Chapter 3 White BoxWhite Box ScienceScience 81 ScienceScience Mastering Test Design V 4.0 © SQE 2001-2011 Tutorial Agenda 1. Introduction 2. Black Box Science 3. White Box Science 4. Black Box Art 5. Defect Taxonomies 6. Wrap-up 82 Mastering Test Design V 4.0 © SQE 2001-2011
  • 44. Objectives • At the end of this chapter you will be able to – Describe the differences between white and black box tests – Define coverage possibilities for unit, integration, and system level white box tests 83 Mastering Test Design V 4.0 © SQE 2001-2011 White box: Structure/path Black box: Behavior If truefalse What is White Box? ThenElse End Case 1 2 3 4 5 84 End A B C D E 1 2 3 4 5 The Art of Software Testing Glenford Myers Mastering Test Design V 4.0 © SQE 2001-2011
  • 45. White Box Definitions • The focus of White Box testing – Examine paths in the implementationExamine paths in the implementation – Make sure that each statement, decision branch, or path is tested with at least one test case – Definitions of coverage can vary by level of test – Desirable to use tools to analyze and track coverage 85 Mastering Test Design V 4.0 © SQE 2001-2011 Understanding Coverage • What does “coverage” mean? NOT all possible combinations of data values or– NOT all possible combinations of data values or paths can be tested – Coverage is a way of defining how many of the potential paths were actually exercised by the tests – Coverage goals can vary by risk, trust, and level of t t 86 test Mastering Test Design V 4.0 © SQE 2001-2011
  • 46. Coverage for a Unit • Selection: SLOC • Possible strategies • A code Sample a=1 b=2 Possible strategies – Statement coverage (SLOC) – Decision coverage (branches) – Paths c=3 If (a==2) {n=n+2;} Else {n=n/2;} p=q/r If (b/ >3) 87 If (b/c>3) {z=x+y;} Mastering Test Design V 4.0 © SQE 2001-2011 Coverage for Integration • Selection: Unit P ibl t t i• Possible strategies – Each unit (already should have been done) – All choices (branches) between units – All paths U1 U2 U3 U4 88 p – Can continue to use statement coverage measure (using a coverage tool) Mastering Test Design V 4.0 © SQE 2001-2011
  • 47. Local Web Client Remote Web Client Coverage for Systems INTERNET LAN/WAN WEB SRV WEB APP WEB DB ISP Firewall/ Proxy LEG. APP LEG. DB KEY ISPPersonal Firewall 89 Local GUI Client Transaction Path APP = Application SRV = Server DB = Database LEG. = Legacy Third Party Service KEY Back Office Systems Mastering Test Design V 4.0 © SQE 2001-2011 General Control Flow Concepts Sequence If Then If Then Else 90 Mastering Test Design V 4.0 © SQE 2001-2011
  • 48. General Control Flow Concepts IterationCASE 91 Mastering Test Design V 4.0 © SQE 2001-2011 Applying Control Flow to Code A simple code segment Input a; Input b; Input a Begin at the top Input b; Input c; If (a==2) {n=n+2;} Else {n=n/2;} Input b Input c 92 { ;} p=q/r If (b/c>3) {z=x+y;} Mastering Test Design V 4.0 © SQE 2001-2011
  • 49. Applying Control Flow to Code A simple code segment Input a; Input b; Input a Input b Continue the graph Input b; Input c; If (a==2) {n=n+2;} Else {n=n/2;} Input b Input c If (a==2) 93 { ;} p=q/r If (b/c>3) {z=x+y;} Mastering Test Design V 4.0 © SQE 2001-2011 Applying Control Flow to Code A simple code segment Input a; Input b; Input a Input bInput b; Input c; If (a==2) {n=n+2;} Else {n=n/2;} Input b Input c If (a==2) 94 { ;} p=q/r If (b/c>3) {z=x+y;} n=n+2 Mastering Test Design V 4.0 © SQE 2001-2011
  • 50. Applying Control Flow to Code A simple code segment Input a; Input b; Input a Input bInput b; Input c; If (a==2) {n=n+2;} Else {n=n/2;} Input b Input c If (a==2) 95 { ;} p=q/r If (b/c>3) {z=x+y;} n=n/2 n=n+2 Mastering Test Design V 4.0 © SQE 2001-2011 Applying Control Flow to Code A simple code segment Input a; Input b; Input a Input bInput b; Input c; If (a==2) {n=n+2;} Else {n=n/2;} Input b Input c If (a==2) 96 { ;} p=q/r If (b/c>3) {z=x+y;} n=n/2 n=n+2 p=q/r Mastering Test Design V 4.0 © SQE 2001-2011
  • 51. Applying Control Flow to Code A simple code segment Input a; Input b; Input a Input b Input c Input b; Input c; If (a==2) {n=n+2;} Else {n=n/2;} If (a==2) n=n/2 n=n+2 p=q/r 97 { ;} p=q/r If (b/c>3) {z=x+y;} If b/c>3 Mastering Test Design V 4.0 © SQE 2001-2011 Applying Control Flow to Code A simple code segment Input a; Input b; Input a Input b Input c Input b; Input c; If (a==2) {n=n+2;} Else {n=n/2;} If (a==2) n=n/2 n=n+2 p=q/r 98 { ;} p=q/r If (b/c>3) {z=x+y;} If (b/c>3) z=x+y Mastering Test Design V 4.0 © SQE 2001-2011
  • 52. Understanding Unit Testing • When unit testing a module, the key question is how many tests are required to reasonably and fully exercise the code?reasonably and fully exercise the code? – What is the minimum number of tests that can be run to fully exercise the structure of the code? – How many paths are there? – How do I determine/create these tests? 99 • There are three approaches to answering these questions, all require a flow graph Mastering Test Design V 4.0 © SQE 2001-2011 1st Method to Determine Tests • McCabe’s technique for calculating units – Convert the code to a flow Input a Input b Input c IfConvert the code to a flow graph – Compute the paths by e-n+2(p) – This is called Cyclomatic Complexity • The number of paths to test • All decision options are tested If (a==2) n=n/2 n=n+2 p=q/r 100 • All decision options are tested • Each statement is covered at least once If (b/c>3) z=x+y Mastering Test Design V 4.0 © SQE 2001-2011
  • 53. How Many Tests? • Compute the paths by e-n+2(p) Input a Input b Input c If • e = 9 If (a==2) n=n/2 n=n+2 p=q/r 101 If (b/c>3) z=x+y Mastering Test Design V 4.0 © SQE 2001-2011 How Many Tests? • Compute the paths by e-n+2(p) Input a Input b Input c If • n = 8 If (a==2) n=n/2 n=n+2 p=q/r 102 If (b/c>3) z=x+y Mastering Test Design V 4.0 © SQE 2001-2011
  • 54. How Many Tests? • Compute the paths by e- n+2(p) 9 8+2(1) = 3 Input a Input b Input c If9-8+2(1) = 3 • There are no called modules, so (p) is set to 1 • There are 3 paths that will cover the code 100% decision coverage If (a==2) n=n/2 n=n+2 p=q/r 103 – 100% decision coverage – 100% statement coverage – Does not guarantee 100% path coverage If (b/c>3) z=x+y Mastering Test Design V 4.0 © SQE 2001-2011 What are the Paths (tests)? • Cyclomatic Complexity is 3 • Paths are: Input a Input b Input cA – ABCEF – ABDEF – ABDEFG • Test cases should cover at least three paths If (a==2) n=n/2 n=n+2 p=q/r B C D E 104 – There is more than one “basis set” of paths If (b/c>3) z=x+y F G Mastering Test Design V 4.0 © SQE 2001-2011
  • 55. 2nd Method to Determine Tests • The next approach is to manually calculate the regions of the graph Input a Input b Input c Ifregions of the graph – Convert the code to a flow graph – Count the regions of the flow graph (including the exterior) • An area enclosed by lines (edges) is a region • The external area is always a If (a==2) n=n/2 n=n+2 p=q/r 1 3 105 The external area is always a region • This can be expressed as – Regions + 1 If (b/c>3) z=x+y 2 3 Mastering Test Design V 4.0 © SQE 2001-2011 3rd Method to Determine Tests • The third approach is to manually calculate the decisions in the graph Input a Input b Input c Ifdecisions in the graph – Convert the code to a flow graph – Count the decision nodes in the flow graph • This can be expressed as If (a==2) n=n/2 n=n+2 p=q/r 1 106 – Decisions + 1 If (b/c>3) z=x+y 2 Mastering Test Design V 4.0 © SQE 2001-2011
  • 56. Number of Paths (Tests) • You will notice that all three methods generate the same result – CC 9-8+2(1) = 3 – Regions 2+1 = 3 – Decisions 2+1 = 3 • Regions and decisions require the construction of a graph or manual analysis of the code 107 analysis of the code • Cyclomatic complexity can be calculated using a tool, or done manually Mastering Test Design V 4.0 © SQE 2001-2011 So, What are the Paths (Tests)? • Path one: ABCEF a=1 b=2 c=3 A – ABCEF If (a==2) n=n/2 n=n+2 p=q/r B C D E 108 If (b/c>3) z=x+y F G Mastering Test Design V 4.0 © SQE 2001-2011
  • 57. So, What are the Paths (Tests)? • Path two: ABDEF a=1 b=2 c=3 A – ABDEF If (a==2) n=n/2 n=n+2 p=q/r B C D E 109 If (b/c>3) z=x+y F G Mastering Test Design V 4.0 © SQE 2001-2011 So, What are the Paths (Tests)? • Path three: ABDEFG a=1 b=2 c=3 A – ABDEFG If (a==2) n=n/2 n=n+2 p=q/r B C D E 110 If (b/c>3) z=x+y F G Mastering Test Design V 4.0 © SQE 2001-2011
  • 58. What about (P) ? • If there are called programs the computation must account for those modules as wellmodules as well • The change is in how the edges (E) and nodes (N) are determined. – P represents the number of unconnected parts of the graph 111 the graph Mastering Test Design V 4.0 © SQE 2001-2011 What about (P)? • For multiple graphs A B C M1 M2 CALL a=1 b=2 c=3 A graphs – Module 2 is called by module 1 B C D E If (a==2) n=n/2 n=n+2 Call m2 p=q/r B C D E 112 F G H If (b/c>3) z=x+y F G Mastering Test Design V 4.0 © SQE 2001-2011
  • 59. What about (P)? • Sum the total edges – Module 1 M N O M1 M2 CALL a=1 b=2 c=3 A Module 1 • 9 edges – Module 2 • 9 edges – Total • 18 edges N O P Q If (a==2) n=n/2 n=n+2 Call m2 p=q/r B C D E 113 R S T If (b/c>3) z=x+y F G Mastering Test Design V 4.0 © SQE 2001-2011 What about (P)? • Sum the total nodes – Module 1 M N O M1 M2 CALL a=1 b=2 c=3 A Module 1 • 8 nodes – Module 2 • 8 nodes – Total • 16 nodes N O P Q If (a==2) n=n/2 n=n+2 Call m2 p=q/r B C D E 114 R S T If (b/c>3) z=x+y F G Mastering Test Design V 4.0 © SQE 2001-2011
  • 60. Calculate the Total Complexity • Calculate Complexity A B C M1 M2 CALL a=1 b=2 c=3 A • 18 – 16 + 2(2) = 6 • We replace (P) with two, for the B C D E If (a==2) n=n/2 n=n+2 Call m2 p=q/r B C D E 115 with two, for the two graphs F G H If (b/c>3) z=x+y F G Mastering Test Design V 4.0 © SQE 2001-2011 Chapter 4Chapter 4 Black BoxBlack Box ArtArt 116 ArtArt Mastering Test Design V 4.0 © SQE 2001-2011
  • 61. Tutorial Agenda 1. Introduction 2. Black Box Science 3. White Box Science 4. Black Box Art 5. Defect Taxonomies 6. Wrap-up 117 Mastering Test Design V 4.0 © SQE 2001-2011 Objectives • At the end of this chapter you will be able to – Implement creative test case selection techniques – Evaluate the use of exploratory testing 118 Mastering Test Design V 4.0 © SQE 2001-2011
  • 62. Why Science is Not Enough • Limits of science – Programmers are logical thinkers so they catchProgrammers are logical thinkers, so they catch many of the “logical’ defects – Real users are NOT necessarily logical – Real environmental circumstances are often illogical – Can’t test enough combinations with just scientific t h i 119 techniques Mastering Test Design V 4.0 © SQE 2001-2011 Hunches and Guessing • Talent based testing – Based on the implementation Bet I can break it!!! Based on the implementation – Some individuals can walk up to a system and “break” it – Good to have multi-dimensional teams doing the testing – Experienced testers can just “k ” h t i lik l t b k 120 “know” what is likely to break Mastering Test Design V 4.0 © SQE 2001-2011
  • 63. Group Insights / Examples • Experience can be shared with examples – “Best practices” examples of test cases posted onBest practices examples of test cases posted on an internal web site • “Best” is a relative term; what’s good on one system/application may not work on another – Examples of good tests based on type of element being tested 121 being tested • Compiled by experienced personnel • Available to everyone • Can be a standard, guidelines, or suggestions Mastering Test Design V 4.0 © SQE 2001-2011 Exploratory Testing “The classical approach to test design is like playing ‘20 Questions’ by writing out all the questions in advance.” - James Bach 122 Mastering Test Design V 4.0 © SQE 2001-2011
  • 64. Exploratory Testing “Exploratory Testing, as I practice it, usually proceeds according to a conscious plan. But not a rigorous plan … it is not scripted in detail.” “To the extent that the next test we do is influenced by the result of the last test we did, we are doing exploratory testing. We become more exploratory when we can’t tell what tests should be run in advance of the test cycle ” 123 be run in advance of the test cycle.” - James Bach Mastering Test Design V 4.0 © SQE 2001-2011 Exploratory Testing • Test cases themselves are NOT pre-planned – Exploratory testing can be concurrent with product development and test execution – Based on implicit and explicit (if they exist) specifications as well as the “as built” product – Starts with a conjecture as to correct behavior, followed by exploration for evidence that it works/does not work – Based on some kind of mental model “T it d if it k ” (J B h 124 – “Try it and see if it works” (James Bach www.satisfice.com is an excellent resource for more on this topic) Mastering Test Design V 4.0 © SQE 2001-2011
  • 65. Exploratory Testing • Basic steps to exploratory testing 1 Identify the purpose of the product1. Identify the purpose of the product 2. Identify functions 3. Identify areas of potential instability 4. Test each function and record problems 5. Design and record a consistency verification test 125 Mastering Test Design V 4.0 © SQE 2001-2011 Create Creative Invalids • Break the rules in unexpected ways – No logic – StrangeStrange • Order • Combinations • Exception conditions – The “nobody would ever do that” tests B i B i “I h l h 126 • Boris Beizer: “It helps to have some devious testers.” Mastering Test Design V 4.0 © SQE 2001-2011
  • 66. Class Exercise • Pick your technique – Data in the range 0.0-1.0 should be processed using algorithm A, data between 1.0 and 10.0g g , using algorithm B, and data between 10.0 and 100.0 using algorithm C. – We’ve got very few written requirements for this system. We do, however, know something about how the system is to operate its behavior and 127 how the system is to operate, its behavior, and functions. Mastering Test Design V 4.0 © SQE 2001-2011 Class Exercise • Pick your technique (continued) – If condition 1 (C1) is true and condition 2 (C2) is true, then action 1 (A1) should be taken. If C1 is, ( ) true and C2 is false, then A2 is the proper response. If C1 is false and C2 is true, then A3 is appropriate. If C1 is false and C2 is false, then A4 is the correct action. 128 Mastering Test Design V 4.0 © SQE 2001-2011
  • 67. Class Exercise • Pick your technique (continued) – In state 1 (S1) events 1 (E1) and 2 (E2) are valid while event 3 (E3) is( ) ( ) not. In state 2 (S2) events 1 (E1) and 3 (E3) are valid while event 2 (E2) is not. In state 3 (S3) events 2 (E2) and 3 (E3) are valid while event 1 (E1) is not. If the system is in S1 and E2 occurs, then action 1 (A1) should be 129 taken. If the system is in S3 and E3 occurs, then action 2 (A2) should be taken. Mastering Test Design V 4.0 © SQE 2001-2011 Class Exercise • Pick your technique (continued) – I’ve got so many combinations to test I just can’t do them all. Please help!j p 130 Mastering Test Design V 4.0 © SQE 2001-2011
  • 68. Chapter 5Chapter 5 DefectDefect TaxonomiesTaxonomies 131 TaxonomiesTaxonomies Mastering Test Design V 4.0 © SQE 2001-2011 Tutorial Agenda 1. Introduction 2. Black Box Science 3. White Box Science 4. Black box Art 5. Defect Taxonomies 6. Wrap-up 132 Mastering Test Design V 4.0 © SQE 2001-2011
  • 69. Using a Taxonomy • A taxonomy is a classification of things into ordered groups or categories that indicate natural, hierarchical relationships.p – In software test design we are concerned with taxonomies of defects, ordered lists of common defects we expect to encounter in our testing. 133 Mastering Test Design V 4.0 © SQE 2001-2011 Sample Taxonomies • One of the first defect taxonomies was defined by Boris Beizer in Software Testing Techniques.q • The classic book Testing Computer Software by Cem Kaner contains a detailed taxonomy of more than 400 types of defects. • Robert Binder notes that many defects in the object-oriented paradigm are problems using 134 j p g p g encapsulation, inheritance, polymorphism, message sequencing, and state-transitions. Mastering Test Design V 4.0 © SQE 2001-2011
  • 70. Sample Taxonomies • James Whittaker’s book How to Break Software is a tester’s delight. Proponents of exploratory testing exhort us to “explore.”p y g p Whittaker tells us specifically “where to explore.” Not only does he identify areas in which faults tend to occur, but he defines specific testing attacks to locate these faults. 135 • Giri Vijayaraghavan has chosen a much narrower focus—the eCommerce shopping cart. Mastering Test Design V 4.0 © SQE 2001-2011 Example Taxonomy 1XXX Requirements 11XX Requirements incorrect 12XX Requirements logic 13XX R i t l t13XX Requirements, completeness 14XX Verifiability 15XX Presentation, documentation 16XX Requirements changes 2XXX Features And Functionality 21XX Feature/function correctness 22XX Feature completeness 23XX F ti l l t 136 23XX Functional case completeness 24XX Domain bugs 25XX User messages and diagnostics 26XX Exception conditions mishandled A Portion of Beizer’s Taxonomy Mastering Test Design V 4.0 © SQE 2001-2011
  • 71. Example Taxonomy (continued) 3XXX Structural Bugs 31XX Control flow and sequencing 32XX Processing 4XXX Data 41XX Data definition and structure 42XX Data access and handling 5XXX Implementation and Coding 51XX Coding and typographical 52XX Style and standards violations 53XX Documentation 137 6XXX Integration 61XX Internal interfaces 62XX External interfaces, timing, throughput 7XXX System and Software Architecture A Portion of Beizer’s Taxonomy Mastering Test Design V 4.0 © SQE 2001-2011 Example Taxonomy (continued) 71XX O/S call and use 72XX Software architecture 73XX Recovery and accountability 74XX Performance 75XX Incorrect diagnostics, exceptions 76XX Partitions, overlays 77XX System generation, environment 8XXX Test Definition and Execution 81XX Test design bugs 82XX Test execution bugs 83XX Test documentation 138 83XX Test documentation 84XX Test case completeness A Portion of Beizer’s Taxonomy Mastering Test Design V 4.0 © SQE 2001-2011
  • 72. Taxonomy Sources • Beizer, Boris (1990). Software Testing Techniques (2nd Edition). Van Nostrand Reinhold. • Binder, Robert V. (2000). Testing Object-Oriented Systems: Models, Patterns, and Tools. Addison-Wesley. • Kaner, Cem, Jack Falk, and Hung Quoc Nguyen (1999). Testing Computer Software (2nd Edition). John Wiley & Sons. • Whittaker, James A. (2003). How To Break Software: A Practical Guide to Testing. Addison Wesley. 139 • Vijayaraghavan, Giri and Cem Kaner. “Bugs in your shopping cart” www.testingeducation.org/articles/BISC_Final.pdf Mastering Test Design V 4.0 © SQE 2001-2011 Chapter 6Chapter 6 Wrap UpWrap Up 140 Mastering Test Design V 4.0 © SQE 2001-2011
  • 73. Tutorial Agenda 1. Introduction 2. Black Box Science 3. White Box Science 4. Black Box Art 5. Defect Taxonomies 6. Wrap-up 141 Mastering Test Design V 4.0 © SQE 2001-2011 Now what? Current Challenges ? ? ?? ? ? ? ? 142 ? ? Mastering Test Design V 4.0 © SQE 2001-2011
  • 74. Tutorial Goals Achieved • You are now able to – Design test cases using structured techniques – Implement the “art” of test case design as well as the “science” – Understand how defect taxonomies can improve test case design 143 Mastering Test Design V 4.0 © SQE 2001-2011 Tutorial Evaluations How did we do? * Great * Wonderful * Fantastic * Terrific * Superior * Excellent Tutorial Evaluation 144 Mastering Test Design V 4.0 © SQE 2001-2011
  • 75. Thank You • On behalf of Software Quality Engineering, thank you for attending this tutorial. • If you have further needs for training or• If you have further needs for training or consulting, please think first of SQE. • If I can be of further assistance, please let me know. My email is lee@sqe.com 145 Mastering Test Design V 4.0 © SQE 2001-2011 Good Luck! 146 Mastering Test Design V 4.0 © SQE 2001-2011