Key Test Design Techniques

75
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 ∙ [email protected] ∙ www.sqe.com

description

All testers know that we can identify many more test cases than we will ever have time to design and execute. The key problem in testing is choosing a small, “smart” subset from the almost infinite number of possibilities available. Join Lee Copeland to discover how to design test cases using formal black-box techniques, including equivalence class and boundary value testing, decision tables, state-transition diagrams, and all-pairs testing. Explore white-box techniques with their associated coverage metrics. Evaluate more informal approaches, such as random and hunch-based testing, and learn the importance of using exploratory testing to enhance your testing ability. Choose the right test case design approaches for your projects. Use the test results to evaluate the quality of both your products and your test designs.

Transcript of Key Test Design Techniques

Page 1: Key Test Design Techniques

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 ∙ [email protected] ∙ www.sqe.com

Page 2: Key Test Design Techniques

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.

Page 3: Key Test Design Techniques

KeyyTest Design

Techniques

Software Quality Engineering340 Corporate Way, Suite 300Orange Park, Florida 32073

904.278.0707

SQE ©2001-2011 Version 4.0

Lee [email protected]

Administrivia

Tutorial timing Tutorial materials

Messages Meals

Pagers andCell phones Facilities

Mastering Test Design V 4.0 © SQE 2001-2011 2

BreaksSmoking

Page 4: Key Test Design Techniques

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

3Mastering Test Design V 4.0 © SQE 2001-2011

Chapter 1Chapter 1

IntroductionIntroduction

4Mastering Test Design V 4.0 © SQE 2001-2011

Page 5: Key Test Design Techniques

Tutorial Agenda

1. Introduction2. Black Box Science3. White Box Science4. Black Box Art5. Defect Taxonomies6. Wrap-up

5Mastering 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

6Mastering Test Design V 4.0 © SQE 2001-2011

Page 6: Key Test Design Techniques

Test Design Process - Context

Master Test Plan

Detailed Test Plans

Test Analysis

S t ti

7

Test Design

Test Implementation

SystematicSoftwareTestingtutorial

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 cases4. A set of one or more test procedures5. A set of one or more test cases and procedures

Mastering Test Design V 4.0 © SQE 2001-2011

Page 7: Key Test Design Techniques

What Do We Test?Fundamental issues FUNCTIONS Portability

Usability ReliabilitySecurity AvailabilityLocalization Testability

Real-time issues

System management issues

Localization TestabilityExtensibility Interoperability

Timing CapacityThroughput Performance

OverloadBackup and RecoveryStart up and shut down

9

Purchased software

Start-up and shut-down

Operating systemsDBMSCommunications

Mastering Test Design V 4.0 © SQE 2001-2011

Current Challenges In Test Design

????????

10

??

Mastering Test Design V 4.0 © SQE 2001-2011

Page 8: Key Test Design Techniques

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

Page 9: Key Test Design Techniques

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

Page 10: Key Test Design Techniques

Test Wisely!

Cost effective Time limited

Risk based

15

Tool supportChoose wisely

Mastering Test Design V 4.0 © SQE 2001-2011

Chapter 2Chapter 2

Black BoxBlack BoxScienceScience

16

ScienceScience

Mastering Test Design V 4.0 © SQE 2001-2011

Page 11: Key Test Design Techniques

Tutorial Agenda

1. Introduction2. Black Box Science3. White Box Science4. Black Box Art5. Defect Taxonomies6. Wrap-up

17Mastering 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

Page 12: Key Test Design Techniques

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 SubsystemSystem

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

Page 13: Key Test Design Techniques

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

21Mastering 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

Page 14: Key Test Design Techniques

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

Page 15: Key Test Design Techniques

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...}

25Mastering 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

Page 16: Key Test Design Techniques

Equivalence Class Partitioning

• Steps for creating the test cases1. 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 CasesIncome No. Type Person

1 $4,000.00 2 Condo Bob$ ,

Invalid Test Cases2 $90,000.00 1 Condo Bob’s mom3 $800.00 2 Single Family Leroy4 $4,000.00 7 Townhouse Larry5 $2,000.00 0 Condo Helen6 $5 500 00 2 Offi Bld S

28

6 $5,500.00 2 Office Bldg. Sam7 $60,000.00 2 Townhouse ABC Incorporated

Mastering Test Design V 4.0 © SQE 2001-2011

Page 17: Key Test Design Techniques

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 CasesIncome No. Type Person

1 $1,000.00 1 Condo Bob$ ,2 $75,000.00 5 Single Family Helen3 $37,500.00 3 Townhouse George

Invalid Test Cases4 $75,000.01 1 Condo Bob’s mom5 $999.99 2 Single Family Leroy6 $4 000 00 6 T h L

30

6 $4,000.00 6 Townhouse Larry7 $2,000.00 0 Condo Helen8 $5,500.00 2 Office Bldg. Sam9 $60,000.00 2 Townhouse ABC Incorporated

Mastering Test Design V 4.0 © SQE 2001-2011

Page 18: Key Test Design Techniques

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

Page 19: Key Test Design Techniques

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

33Mastering Test Design V 4.0 © SQE 2001-2011

Cross Functional TestingEXAMPLE 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

Page 20: Key Test Design Techniques

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 NConditionsCondition-1Condition-2…….Condition-xActionsA ti 1

36

Action-1Action-2……Action-z

Mastering Test Design V 4.0 © SQE 2001-2011

Page 21: Key Test Design Techniques

Example Decision Table

• From the Internal Revenue Service

Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8ConditionSingle Yes Yes Yes Yes No No No No65 or older OR blind Yes Yes No No Yes Yes No No

Unearned income > $1560 Yes No Yes No Yes No Yes No

37

ActionFile 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 8ConditionsClaims 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

ActionsPremium Increase $50 $25 $100 $50 $400 $200 $0 $0Send Warning No No Yes No Yes Yes No NoCancel Policy No No No No No No Yes Yes

38

• From an automobile insurance company

Mastering Test Design V 4.0 © SQE 2001-2011

Page 22: Key Test Design Techniques

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

Page 23: Key Test Design Techniques

A Simple State Example

Please Cancel

MadeCancelled

ByCustomer

Please Cancel/RefundPaid

Pay MoneyMake

Reservation

Please Print Ticket/Ticket

41

Please Cancel/RefundUsed

Give TicketTicketed

Mastering Test Design V 4.0 © SQE 2001-2011

Simple State Example with Tests

Please Cancel

MadeCancelled

ByCustomer

Please Cancel/RefundPaid

Pay MoneyMake

Reservation

Please Print Ticket/Ticket

123 4 1E 2E

42

Please Cancel/RefundUsed

Give TicketTicketed

Mastering Test Design V 4.0 © SQE 2001-2011

Page 24: Key Test Design Techniques

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

Page 25: Key Test Design Techniques

A Problem To Solve

SkypeTools |

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

Page 26: Key Test Design Techniques

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 combinationsMastering Test Design V 4.0 © SQE 2001-2011

1 2 3 4 5 6 7

1 0 0 0 0 0 0 02 0 0 1 1 2 2 13 0 1 0 2 2 1 24 0 1 2 0 1 2 35 0 2 1 2 1 0 45 0 2 1 2 1 0 46 0 2 2 1 0 1 57 1 0 0 2 1 2 58 1 0 2 0 2 1 49 1 1 1 1 1 1 0

10 1 1 2 2 0 0 111 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 314 2 0 2 1 1 0 215 2 1 0 1 0 2 416 2 1 1 0 2 0 517 2 2 0 0 1 1 118 2 2 2 2 2 2 0

Mastering Test Design V 4.0 © SQE 2001-2011

Page 27: Key Test Design Techniques

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 combinationsMastering Test Design V 4.0 © SQE 2001-2011

Page 28: Key Test Design Techniques

Allow CallsFrom

2 3 4 5 6 7

1 anyOne 0 0 0 0 0 02 0 0 1 1 2 2 13 0 1 0 2 2 1 24 0 1 2 0 1 2 35 0 2 1 2 1 0 46 0 2 2 1 0 1 57 contactList 0 0 2 1 2 58 1 0 2 0 2 1 49 1 1 1 1 1 1 0

10 1 1 2 2 0 0 111 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 213 2 0 1 2 0 1 314 2 0 2 1 1 0 215 2 1 0 1 0 2 416 2 1 1 0 2 0 517 2 2 0 0 1 1 118 2 2 2 2 2 2 0

onto all 1s

Mastering Test Design V 4.0 © SQE 2001-2011

Allow CallsFrom

2 3 4 5 6 7

1 anyOne 0 0 0 0 0 02 anyOne 0 1 1 2 2 13 anyOne 1 0 2 2 1 24 anyOne 1 2 0 1 2 35 anyOne 2 1 2 1 0 46 anyOne 2 2 1 0 1 57 contactList 0 0 2 1 2 58 contactList 0 2 0 2 1 49 contactList 1 1 1 1 1 0

10 contactList 1 2 2 0 0 111 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 213 2 0 1 2 0 1 314 2 0 2 1 1 0 215 2 1 0 1 0 2 416 2 1 1 0 2 0 517 2 2 0 0 1 1 118 2 2 2 2 2 2 0

Mastering Test Design V 4.0 © SQE 2001-2011

Page 29: Key Test Design Techniques

Allow CallsFrom

ReceiveVideoFrom

3 4 5 6 7

1 anyOne anyOne 0 0 0 0 02 anyOne anyOne 1 1 2 2 13 anyOne contactList 0 2 2 1 24 anyOne contactList 2 0 1 2 35 anyOne noOne 1 2 1 0 46 anyOne noOne 2 1 0 1 57 contactList anyOne 0 2 1 2 58 contactList anyOne 2 0 2 1 49 contactList contactList 1 1 1 1 0

10 contactList contactList 2 2 0 0 111 contactList noOne 0 1 2 0 3

12 contactList noOne 1 0 0 2 2

53•53

12 contactList noOne 1 0 0 2 213 2 anyOne 1 2 0 1 314 2 anyOne 2 1 1 0 215 2 contactList 0 1 0 2 416 2 contactList 1 0 2 0 517 2 noOne 0 0 1 1 118 2 noOne 2 2 2 2 0

Mastering Test Design V 4.0 © SQE 2001-2011

Allow CallsFrom

ReceiveVideoFrom

AllowIMs

From

4 5 6 7

1 anyOne anyOne anyOne 0 0 0 02 anyOne anyOne contactList 1 2 2 13 anyOne contactList anyOne 2 2 1 24 anyOne contactList 2 0 1 2 35 anyOne noOne contactList 2 1 0 46 anyOne noOne 2 1 0 1 57 contactList anyOne anyOne 2 1 2 58 contactList anyOne 2 0 2 1 49 contactList contactList contactList 1 1 1 0

10 contactList contactList 2 2 0 0 111 contactList noOne anyOne 1 2 0 3

12 contactList noOne contactList 0 0 2 2

54•54

12 contactList noOne contactList 0 0 2 213 2 anyOne contactList 2 0 1 314 2 anyOne 2 1 1 0 215 2 contactList anyOne 1 0 2 416 2 contactList contactList 0 2 0 517 2 noOne anyOne 0 1 1 118 2 noOne 2 2 2 2 0

Mastering Test Design V 4.0 © SQE 2001-2011

Page 30: Key Test Design Techniques

Allow CallsFrom

ReceiveVideoFrom

AllowIMs

From

ShowVideo

To

5 6 7

1 anyOne anyOne anyOne contactList 0 0 02 anyOne anyOne contactList noOne 2 2 13 anyOne contactList anyOne 2 2 1 24 anyOne contactList 2 contactList 1 2 35 anyOne noOne contactList 2 1 0 46 anyOne noOne 2 noOne 0 1 57 contactList anyOne anyOne 2 1 2 58 contactList anyOne 2 contactList 2 1 49 contactList contactList contactList noOne 1 1 0

10 contactList contactList 2 2 0 0 111 contactList noOne anyOne noOne 2 0 3

12 contactList noOne contactList contactList 0 2 2

55•55

12 contactList noOne contactList contactList 0 2 213 2 anyOne contactList 2 0 1 314 2 anyOne 2 noOne 1 0 215 2 contactList anyOne noOne 0 2 416 2 contactList contactList contactList 2 0 517 2 noOne anyOne contactList 1 1 118 2 noOne 2 2 2 2 0

Mastering Test Design V 4.0 © SQE 2001-2011

Allow CallsFrom

ReceiveVideoFrom

AllowIMs

From

ShowVideo

To

ShowOnlineStatus

6 7

1 anyOne anyOne anyOne contactList yes 0 02 anyOne anyOne contactList noOne 2 2 13 anyOne contactList anyOne 2 2 1 24 anyOne contactList 2 contactList no 2 35 anyOne noOne contactList 2 no 0 46 anyOne noOne 2 noOne yes 1 57 contactList anyOne anyOne 2 no 2 58 contactList anyOne 2 contactList 2 1 49 contactList contactList contactList noOne no 1 0

10 contactList contactList 2 2 yes 0 111 contactList noOne anyOne noOne 2 0 3

12 contactList noOne contactList contactList yes 2 2

56•56

12 contactList noOne contactList contactList yes 2 213 2 anyOne contactList 2 yes 1 314 2 anyOne 2 noOne no 0 215 2 contactList anyOne noOne yes 2 416 2 contactList contactList contactList 2 0 517 2 noOne anyOne contactList no 1 118 2 noOne 2 2 2 2 0

Mastering Test Design V 4.0 © SQE 2001-2011

Page 31: Key Test Design Techniques

Allow CallsFrom

ReceiveVideoFrom

AllowIMs

From

ShowVideo

To

ShowOnlineStatus

Accept Cookies

7

1 anyOne anyOne anyOne contactList yes yes 02 anyOne anyOne contactList noOne 2 2 13 anyOne contactList anyOne 2 2 no 24 anyOne contactList 2 contactList no 2 35 anyOne noOne contactList 2 no yes 46 anyOne noOne 2 noOne yes no 57 contactList anyOne anyOne 2 no 2 58 contactList anyOne 2 contactList 2 no 49 contactList contactList contactList noOne no no 0

10 contactList contactList 2 2 yes yes 111 contactList noOne anyOne noOne 2 yes 3

12 contactList noOne contactList contactList yes 2 2

57•57

12 contactList noOne contactList contactList yes 2 213 2 anyOne contactList 2 yes no 314 2 anyOne 2 noOne no yes 215 2 contactList anyOne noOne yes 2 416 2 contactList contactList contactList 2 yes 517 2 noOne anyOne contactList no no 118 2 noOne 2 2 2 2 0

Mastering Test Design V 4.0 © SQE 2001-2011

Allow CallsFrom

ReceiveVideoFrom

AllowIMs

From

ShowVideo

To

ShowOnlineStatus

Accept Cookies

Keep History

For1 anyOne anyOne anyOne contactList yes yes noHistory2 anyOne anyOne contactList noOne 2 2 2Weeks3 anyOne contactList anyOne 2 2 no 1Month4 anyOne contactList 2 contactList no 2 3Months5 anyOne noOne contactList 2 no yes forEver6 anyOne noOne 2 noOne yes no 57 contactList anyOne anyOne 2 no 2 58 contactList anyOne 2 contactList 2 no forEver9 contactList contactList contactList noOne no no noHistory

10 contactList contactList 2 2 yes yes 2Weeks11 contactList noOne anyOne noOne 2 yes 3Months

12 contactList noOne contactList contactList yes 2 1Month

58•58

12 contactList noOne contactList contactList yes 2 1Month13 2 anyOne contactList 2 yes no 3Months14 2 anyOne 2 noOne no yes 1Month15 2 contactList anyOne noOne yes 2 forEver16 2 contactList contactList contactList 2 yes 517 2 noOne anyOne contactList no no 2Weeks18 2 noOne 2 2 2 2 noHistory

Mastering Test Design V 4.0 © SQE 2001-2011

Page 32: Key Test Design Techniques

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

Page 33: Key Test Design Techniques

Allow CallsFrom

ReceiveVideoFrom

AllowIMs

From

ShowVideo

To

ShowOnlineStatus

Accept Cookies

Keep History

For1 anyOne anyOne anyOne contactList yes yes noHistory2 anyOne anyOne contactList noOne 2 2 2Weeks3 anyOne contactList anyOne 2 2 no 1Month4 anyOne contactList 2 contactList no 2 3Months5 anyOne noOne contactList 2 no yes forEver6 anyOne noOne 2 noOne yes no 57 contactList anyOne anyOne 2 no 2 58 contactList anyOne 2 contactList 2 no forEver9 contactList contactList contactList noOne no no noHistory

10 contactList contactList 2 2 yes yes 2Weeks11 contactList noOne anyOne noOne 2 yes 3Months

12 contactList noOne contactList contactList yes 2 1Month

61•61

12 contactList noOne contactList contactList yes 2 1Month13 2 anyOne contactList 2 yes no 3Months14 2 anyOne 2 noOne no yes 1Month15 2 contactList anyOne noOne yes 2 forEver16 2 contactList contactList contactList 2 yes 517 2 noOne anyOne contactList no no 2Weeks18 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

gvalue presents

• Which is the best approach?

•62Mastering Test Design V 4.0 © SQE 2001-2011

Page 34: Key Test Design Techniques

Allow CallsFrom

ReceiveVideoFrom

AllowIMs

From

ShowVideo

To

ShowOnlineStatus

Accept Cookies

Keep History

For1 anyOne anyOne anyOne contactList yes yes noHistory2 anyOne anyOne contactList noOne yes yes 2Weeks3 anyOne contactList anyOne contactList no no 1Month4 anyOne contactList anyOne contactList no no 3Months5 anyOne noOne contactList noOne no yes forEver6 anyOne noOne contactList noOne yes no noHistory7 contactList anyOne anyOne contactList no yes 2Weeks8 contactList anyOne anyOne contactList yes no forEver9 contactList contactList contactList noOne no no noHistory

10 contactList contactList contactList noOne yes yes 2Weeks11 contactList noOne anyOne noOne no yes 3Months

12 contactList noOne contactList contactList yes no 1Month

63•63

12 contactList noOne contactList contactList yes no 1Month13 anyOne anyOne contactList contactList yes no 3Months14 contactList anyOne anyOne noOne no yes 1Month15 anyOne contactList anyOne noOne yes yes forEver16 ContactList contactList contactList contactList yes yes 1Month17 anyOne noOne anyOne contactList no no 2Weeks18 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

Page 35: Key Test Design Techniques

PICT Program

Clickhere

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

Page 36: Key Test Design Techniques

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

Page 37: Key Test Design Techniques

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

Page 38: Key Test Design Techniques

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

Page 39: Key Test Design Techniques

Another Example

73Mastering 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

Page 40: Key Test Design Techniques

Sources

• An excellent book is Quality Engineering Using Robust Design by Madhav S. PhadkeF t l f th l• For a catalog of orthogonal arrays, seewww.research.att.com/~njas/oadir/index.html

• A nice tool is rdExpert fromwww.phadkeassociates.com

• A very robust tool is AETG from Telcordia ataetgweb.argreenhouse.com

75Mastering 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

Page 41: Key Test Design Techniques

Track everything!

Trace Matrix - Context

Reqm’ts Design Code

77

Test Cases

Mastering Test Design V 4.0 © SQE 2001-2011

TraceNumber

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 daysTransactions will

1.61.76.1

15.3

N/A

N/A

Dual processorsHot back-upOn-line diagnosticsOn-line performancemonitorsN/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.22.32.4

Transaction processingTransaction logsRetransmission requestfor missing transactions

Mastering Test Design V 4.0 © SQE 2001-2011

Page 42: Key Test Design Techniques

Method

Unit

Integ.

Sys

Sys toSys

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

Page 43: Key Test Design Techniques

Chapter 3Chapter 3

White BoxWhite BoxScienceScience

81

ScienceScience

Mastering Test Design V 4.0 © SQE 2001-2011

Tutorial Agenda

1. Introduction2. Black Box Science3. White Box Science4. Black Box Art5. Defect Taxonomies6. Wrap-up

82Mastering Test Design V 4.0 © SQE 2001-2011

Page 44: Key Test Design Techniques

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

83Mastering Test Design V 4.0 © SQE 2001-2011

White box: Structure/path Black box: BehaviorIf truefalse

What is White Box?

ThenElse

End

Case

1 2 3 4 5

84

End

A B C D E1 2 3 4 5

The Art of Software TestingGlenford Myers

Mastering Test Design V 4.0 © SQE 2001-2011

Page 45: Key Test Design Techniques

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

85Mastering 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

Page 46: Key Test Design Techniques

Coverage for a Unit

• Selection: SLOC

• Possible strategies

• A code Samplea=1b=2Possible strategies

– Statement coverage (SLOC)

– Decision coverage (branches)

– Paths

c=3If (a==2)

{n=n+2;}Else

{n=n/2;}p=q/rIf (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

Page 47: Key Test Design Techniques

Local WebClient

Remote WebClient

Coverage for Systems

INTERNET

LAN/WANWEBSRV

WEBAPP

WEBDB

ISP

Firewall/Proxy

LEG.APP

LEG.DB

KEY

ISPPersonalFirewall

89

Local GUIClient

Transaction Path

APP = ApplicationSRV = ServerDB = DatabaseLEG. = Legacy

Third PartyService

KEY

Back OfficeSystems

Mastering Test Design V 4.0 © SQE 2001-2011

General Control Flow Concepts

Sequence If Then If Then Else

90Mastering Test Design V 4.0 © SQE 2001-2011

Page 48: Key Test Design Techniques

General Control Flow Concepts

IterationCASE

91Mastering Test Design V 4.0 © SQE 2001-2011

Applying Control Flow to Code

A simple code segmentInput a;Input b; Input a

Begin at the top

Input b;Input c;If (a==2)

{n=n+2;}Else

{n=n/2;}

Input bInput c

92

{ ;}p=q/rIf (b/c>3)

{z=x+y;}

Mastering Test Design V 4.0 © SQE 2001-2011

Page 49: Key Test Design Techniques

Applying Control Flow to Code

A simple code segmentInput a;Input b;

Input aInput b

Continue the graph

Input b;Input c;If (a==2)

{n=n+2;}Else

{n=n/2;}

Input bInput c

If(a==2)

93

{ ;}p=q/rIf (b/c>3)

{z=x+y;}

Mastering Test Design V 4.0 © SQE 2001-2011

Applying Control Flow to Code

A simple code segmentInput a;Input b;

Input aInput bInput b;

Input c; If (a==2)

{n=n+2;}Else

{n=n/2;}

Input bInput c

If(a==2)

94

{ ;}p=q/rIf (b/c>3)

{z=x+y;}

n=n+2

Mastering Test Design V 4.0 © SQE 2001-2011

Page 50: Key Test Design Techniques

Applying Control Flow to Code

A simple code segmentInput a;Input b;

Input aInput bInput b;

Input c;If (a==2)

{n=n+2;}Else

{n=n/2;}

Input bInput c

If(a==2)

95

{ ;}p=q/rIf (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 segmentInput a;Input b;

Input aInput bInput b;

Input c; If (a==2)

{n=n+2;}Else

{n=n/2;}

Input bInput c

If(a==2)

96

{ ;}p=q/rIf (b/c>3)

{z=x+y;}

n=n/2 n=n+2

p=q/r

Mastering Test Design V 4.0 © SQE 2001-2011

Page 51: Key Test Design Techniques

Applying Control Flow to Code

A simple code segmentInput a;Input b;

Input aInput bInput 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/rIf (b/c>3)

{z=x+y;}

Ifb/c>3

Mastering Test Design V 4.0 © SQE 2001-2011

Applying Control Flow to Code

A simple code segmentInput a;Input b;

Input aInput bInput 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/rIf (b/c>3)

{z=x+y;}

If(b/c>3)

z=x+y

Mastering Test Design V 4.0 © SQE 2001-2011

Page 52: Key Test Design Techniques

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 aInput bInput 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

onceIf

(b/c>3)

z=x+y

Mastering Test Design V 4.0 © SQE 2001-2011

Page 53: Key Test Design Techniques

How Many Tests?

• Compute the paths by e-n+2(p)

Input aInput bInput c

If

• e = 9If

(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 aInput bInput c

If

• n = 8If

(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

Page 54: Key Test Design Techniques

How Many Tests?• Compute the paths by e-

n+2(p)

9 8+2(1) = 3

Input aInput bInput 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 aInput bInput 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

Page 55: Key Test Design Techniques

2nd Method to Determine Tests

• The next approach is to manually calculate the regions of the graph

Input aInput bInput 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+y2

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 aInput bInput 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 + 1If

(b/c>3)

z=x+y

2

Mastering Test Design V 4.0 © SQE 2001-2011

Page 56: Key Test Design Techniques

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=1b=2c=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

Page 57: Key Test Design Techniques

So, What are the Paths (Tests)?

• Path two:

ABDEF

a=1b=2c=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=1b=2c=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

Page 58: Key Test Design Techniques

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 M2CALL

a=1b=2c=3

A

graphs– Module 2

is called by module 1

B C

D

E

If(a==2)

n=n/2n=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

Page 59: Key Test Design Techniques

What about (P)?

• Sum the total edges– Module 1

M

N O

M1 M2CALL

a=1b=2c=3

A

Module 1• 9 edges

– Module 2• 9 edges

– Total• 18 edges

N O

P

Q

If(a==2)

n=n/2n=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 M2CALL

a=1b=2c=3

A

Module 1• 8 nodes

– Module 2• 8 nodes

– Total• 16 nodes

N O

P

Q

If(a==2)

n=n/2n=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

Page 60: Key Test Design Techniques

Calculate the Total Complexity

• Calculate Complexity

A

B C

M1 M2CALL

a=1b=2c=3

A

• 18 – 16 + 2(2) = 6

• We replace (P) with two, for the

B C

D

E

If(a==2)

n=n/2n=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 BoxArtArt

116

ArtArt

Mastering Test Design V 4.0 © SQE 2001-2011

Page 61: Key Test Design Techniques

Tutorial Agenda

1. Introduction2. Black Box Science3. White Box Science4. Black Box Art5. Defect Taxonomies6. Wrap-up

117Mastering 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

118Mastering Test Design V 4.0 © SQE 2001-2011

Page 62: Key Test Design Techniques

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

Page 63: Key Test Design Techniques

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

122Mastering Test Design V 4.0 © SQE 2001-2011

Page 64: Key Test Design Techniques

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

Page 65: Key Test Design Techniques

Exploratory Testing

• Basic steps to exploratory testing

1 Identify the purpose of the product1. Identify the purpose of the product2. Identify functions3. Identify areas of potential instability4. Test each function and record problems5. Design and record a consistency verification test

125Mastering 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

Page 66: Key Test Design Techniques

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.0 g 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.

128Mastering Test Design V 4.0 © SQE 2001-2011

Page 67: Key Test Design Techniques

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

130Mastering Test Design V 4.0 © SQE 2001-2011

Page 68: Key Test Design Techniques

Chapter 5Chapter 5

DefectDefectTaxonomiesTaxonomies

131

TaxonomiesTaxonomies

Mastering Test Design V 4.0 © SQE 2001-2011

Tutorial Agenda

1. Introduction2. Black Box Science3. White Box Science4. Black box Art5. Defect Taxonomies6. Wrap-up

132Mastering Test Design V 4.0 © SQE 2001-2011

Page 69: Key Test Design Techniques

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.

133Mastering 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 Softwareby 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 gencapsulation, inheritance, polymorphism, message sequencing, and state-transitions.

Mastering Test Design V 4.0 © SQE 2001-2011

Page 70: Key Test Design Techniques

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 pWhittaker 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 Taxonomy1XXX Requirements

11XX Requirements incorrect

12XX Requirements logic13XX R i t l t13XX Requirements, completeness

14XX Verifiability15XX Presentation, documentation

16XX Requirements changes2XXX Features And Functionality

21XX Feature/function correctness22XX Feature completeness23XX F ti l l t

136

23XX Functional case completeness24XX Domain bugs25XX User messages and diagnostics26XX Exception conditions mishandled

A Portion of Beizer’s TaxonomyMastering Test Design V 4.0 © SQE 2001-2011

Page 71: Key Test Design Techniques

Example Taxonomy (continued)

3XXX Structural Bugs

31XX Control flow and sequencing

32XX Processing4XXX Data

41XX Data definition and structure42XX Data access and handling

5XXX Implementation and Coding

51XX Coding and typographical52XX Style and standards violations53XX Documentation

137

6XXX Integration

61XX Internal interfaces62XX External interfaces, timing, throughput7XXX System and Software Architecture

A Portion of Beizer’s TaxonomyMastering Test Design V 4.0 © SQE 2001-2011

Example Taxonomy (continued)

71XX O/S call and use72XX Software architecture

73XX Recovery and accountability74XX Performance75XX Incorrect diagnostics, exceptions76XX Partitions, overlays

77XX System generation, environment

8XXX Test Definition and Execution

81XX Test design bugs82XX Test execution bugs83XX Test documentation

138

83XX Test documentation84XX Test case completeness

A Portion of Beizer’s TaxonomyMastering Test Design V 4.0 © SQE 2001-2011

Page 72: Key Test Design Techniques

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

140Mastering Test Design V 4.0 © SQE 2001-2011

Page 73: Key Test Design Techniques

Tutorial Agenda

1. Introduction2. Black Box Science3. White Box Science4. Black Box Art5. Defect Taxonomies6. Wrap-up

141Mastering Test Design V 4.0 © SQE 2001-2011

Now what?

Current Challenges

????????

142

??

Mastering Test Design V 4.0 © SQE 2001-2011

Page 74: Key Test Design Techniques

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

143Mastering Test Design V 4.0 © SQE 2001-2011

Tutorial Evaluations

How did we do?* Great * Wonderful* Fantastic * Terrific * Superior * Excellent

Tutorial Evaluation

144Mastering Test Design V 4.0 © SQE 2001-2011

Page 75: Key Test Design Techniques

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 [email protected]

145Mastering Test Design V 4.0 © SQE 2001-2011

Good Luck!

146Mastering Test Design V 4.0 © SQE 2001-2011