47
(c) Michael Stahl, 2009, All Rights Reserved 1 AllPairs and PICT Free tools for test design optimization Michael Stahl Senior SW Test engineer

AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 1

AllPairs and PICTFree tools for test design optimization

Michael Stahl

Senior SW Test engineer

Page 2: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 2

Outline

Combination Testing – Problem Statement

Allpairs by James Bach

PICT by Microsoft

Examples from the Industry

Tips

Resources & References

Page 3: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 3

Disclaimers

Names and brands referenced herein may be claimed as the property of third parties

The views expressed in this presentation are solely my own, and do not in any manner represent the views of my employer

Information in this presentation is provided “AS IS” without any warranties or representations of any kind

Page 4: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 4

Let’s go for a Test Drive

http://www.metacafe.com/watch/731344/exotic_cars_info20_com_esp_electronic_stability_program

Page 5: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 5

Testing an ESP System

Car Weight Net, Maxload, Overload,

Location: Front seat, back seat, trunk, roof

Tires: Type: Radial, Standard, min width, max width

Condition: New, worn,

Air Pressure: Nominal, over, under

Driving conditions: Surface: Asphalt, concrete, loose gravel, ice, snow, wet, flooded,

wet+leaves, wet+gravel, oil, sand

Incline: Up, Down, straight

Contour: Left turn, right turn, straight

Speed: Slow, Fast

Wind: Left, Right, Front, Back

Actions: Quiescent, break, accelerate, down-shift, up-shift

Cross Product: 1,140,480 different test cases (for each car model!)

(ואת האלמנט לא הכנסתי)

Page 6: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 6

Combination Testing

The problem: Combinatorial Explosion

which leads to

“Test Explosion”:

More tests than you can ever (want to) run

Common in Software:

Configuration parameters, internal events, external events, user inputs, environment parameters

Page 7: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 7

Testing an ESP System

Combinational Explosion

y = 0.8749e1.2707x

1

10

100

1000

10000

100000

1000000

10000000

Weig

ht (3

)

Weig

ht Loca

tion

(4)

Tire T

ype

(4)

Tire C

ondition

(2)

Tire P

ress

ure (3

)

Sur

face

(11)

Incline (3

)

Cont

our (

3)

Spe

ed (2

)

Wind (4

)

Action

(5)

Parameter

# o

f T

es

ts

# of Tests

Expon. (# of Tests)

Page 8: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 8

Strategy #1: Do you really have a

problem? Case#1: The parameters are orthogonal, test each

variable by itself

Case#2: Combinations can be covered while testing

other things (con: complicates test planning)

Case#3: Enough planned iterations to cover the

combinations (con: calls for tight control)

Example:

Screen Input fields

Caveat: Nothing is as simple as it looks

Evaluate the Risk!

Page 9: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 9

Strategy #2: All Pairs

Theory: ( [Tatsumi], [Cohen at al.])

(Bad) interaction between variables is usually

between two variables

Bugs involving interactions between three or more

parameters are progressively less common

Therefore:

Test all-pair interactions

Augment with a few selected tests

Page 10: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 10

Tools in Action

Allpairs.exe (James Bach)

PICT (Microsoft)

Page 11: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 11

The Application Under Test:

Generic Installer

Driver

ShTime

AT

AdTool

IM

ITool

AC

PS

TS

All combinations = 29 =

512 test cases

Page 12: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 12

All-Pairs by James Bach

Text-based, written in Perl by James Bach

Command-line tool

Simple

10 minutes to download and learn

Not optimal (by the author’s testimony)

Good enough

Free!

Get it at:

http://www.satisfice.com/tools.shtml

Page 13: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 13

All-Pairs by James Bach: Input file

Page 14: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 14

All-Pairs by James Bach: Output file

Page 15: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 15

All-Pairs: Additional Notes

Input file is TAB limited – remove additional ones from the end

Parameters names – max 8 chars

”Don’t Care” values (“~”): Choose a value which Maximizes the probability of a failure; or:

Maximizes the impact of the failure

Variable order in input file impacts number of times a given combination is tested

Limitations: No logic

Pairs only

Page 16: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 16

Pairwise Independent Combinatorial

Testing tool (PICT)

Command-line tool

Created by Microsoft

A bit more complicated then Allpairs

… but much more powerful

Free!

Get it at:

http://msdn.microsoft.com/en-us/testing/bb980925.aspx

Page 17: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 17

PICT – Basic usage

Page 18: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 18

PICT – Output

Statistics:

Page 19: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 19

PICT Options

Usage: pict model [options]

Options:

/o:N - Order of combinations (default: 2)

/d:C - Separator for values (default: ,)

/a:C - Separator for aliases (default: |)

/n:C - Negative value prefix (default: ~)

/e:file - File with seeding rows

/r[:N] - Randomize generation, N - seed

/c - Case-sensitive model evaluation

/s - Show model statistics

Page 20: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 20

PICT Demo

Combination Order control

Randomization

Constraints

Sub-Models

Aliasing

Weighting

Negative Tests

Seeding

Page 21: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 21

The Application Under Test:

Generic Installer

Driver

ShTime

AT

AdTool

IM

ITool

AC

PS

TS

Page 22: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 22

Real World Cases – Case#1

PICT file:

1 constraint

56 IF-THEN-ELSE equations

All Pairs

Final result: 90 test cases

Page 23: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 23

Real World Cases – Case#2

Page 24: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 24

Real World Cases – Case#2

Cross value: 138240

PICT file

Security & ME Wake-up: Aliases

6 IF-THEN

All combinations (/o:9)

Final Result: 90 tests

Augmented by 18 special case tests

Page 25: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 25

Additional Benefits

Helps overcome the “Magic Seven” number problem:

Not more than about seven items can be held simultaneously in working memory [Miller]

Impossible to manipulate large number of items and systematically explore all their potentially relevant combinations without help

A test problem may involve 5,10 or more parameters

Parameters can be combined in thousands of different ways

PICT helps in organizing the information and analyzing it in manageable chunks

Final result is a much better understanding of the problem and the feature

Page 26: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 26

Risks

N-pairs is another tool in your toolbox

Not guaranteed to find all bugs

The test quality is dependant on the input values you chose

Was your Equivalence Class partitioning correct?

Did you select the “right” representative value?

If the output is influenced by more then 2 variables, you need a higher level then all-pairs to catch bugs

Blind selection of pairs will miss the “interesting” or often-used combinations

Read [Bach, Shroeder]:

“We believe that this technique is over promoted and poorly understood”

Don’t fall in love with the tool – it’s not a Silver Bullet

• Apply your Tester’s instincts

• Analyze the situation

Page 27: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 27

Tips

Use the tool for situation analysis – not just as a mechanical test-case generator

Add constraint equations to document your conclusions

Use aliases – but ensure you cover all alias values

Document your considerations inside the file

You’ll be the first to ask “what was I thinking when I decided on this constraint”?

Save the PICT file as part of the Testware

Document the orthogonally level used and other switches

Add the “augmentation tests” as a seed file or as comments in the PICT file

Trivial but sometime forgotten:

Are you sure all inputs and all values are relevant?

Avoid falling in love with a complicated scenario

Page 28: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 28

It’s not always just 2 parameters…(Department of Horror Stories)

At least 6 parameters involved:

AP1

Config: Open/WEP

FW X

AP2

Config: Open/NoWEP

RF Toggle Go Figure!...

Open -

WEP

FW Ver X

Open -

NoWEP

Page 29: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 29

Resources & References

www.allpairs.org

Articles, Resources, Tools list (29 tools; 5 Free)

[Tatsumi]: http://www.pairwise.org/docs/icqc87.pdf

[Cohen at al.]

http://www.argreenhouse.com/papers/gcp/AETGissre96.shtml

[Miller]: Miller, G.A. (1956): The magical number seven, plus or

minus two, Psychological Review 63:2, p. 81-97.

http://msdn.microsoft.com/en-us/library/cc150619.aspx

[Bach, Shroeder]: Bach, J., and P. Shroeder. “Pairwise Testing: A

Best Practice that Isn’t.” In Proceedings of the 22nd Pacific

Northwest Software Quality Conference, pages 180–196, 2004

( http://www.testingeducation.org/wtst5/PairwisePNSQC2004.pdf )

Page 30: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 30

PICT Demo – Screen shots

Page 31: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 31

PICT Options: /o:N

Page 32: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 32

PICT Options: /r

Page 33: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 33

PICT Options: /r:N

Page 34: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 34

PICT – Constraints

Example:IF [ITool] = “Off”

THEN [AC] = “Off”

Page 35: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 35

PICT – Conditional Constraints

Page 36: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 36

PICT – More Constraints

Page 37: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 37

PICT – Sub Models

Bundle certain parameters into groups that

get their own combinatory order

Increase or decrease the coverage level

within this group

Page 38: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 38

PICT – Sub Models - Example

Default Install settings:

PS, TS - On

AdTool, IM, ITool, AC – Off

Higher combinational risks for the “Off” group Lower use internally (by testers, developers, beta testers)

Users more likely to “pick & choose”

Mitigation: Check all combinations between the non-default options

Page 39: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 39

PICT – Sub Models - Example

Page 40: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 40

PICT – Aliasing

A certain parameter can take a few values

Does not matter which value is used

But will be nice to test all values

Example:

Add Operating System to the install parameters

No real difference between Service Packs – just

make sure we test on all of them

Page 41: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 41

PICT – Aliasing - ExampleWithout “Aliasing”: OS: XP-sp2,XP-sp3,V,V-SP1

With “Aliasing”: OS: XP-sp2|XP-sp3,V|V-SP1

No guarantee you will get all aliased values! PICT sees them as single value!

Page 42: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 42

PICT – Weighting

Bias the value distribution to test certain

values more then others

Example:

Vista is more important then XP

Page 43: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 43

PICT – Weighting - Example

OS: XP, Vista OS: XP, Vista (5)

XP: 9 / Vista: 11 XP: 6 / Vista: 14

Does not guarantee the requested ratio. PICT priorities:

• Cover all combinations in the smallest number of test cases

• Choose values according to their weights.

Page 44: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 44

PICT – Negative Testing

Wrong value in one parameter may mask the

application’s ability to catch wrong value in

another

Mark values as “negative” to avoid multi-

negative values combinations

Prevents “masking” effects

Example:

Application’s prerequisites are: ActiveX and .Net

Need to verify each pre-requisite is tested

Page 45: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 45

PICT – Negative Testing- Example

ActX: On, ~Off

dotNet: On, ~Off

No case of both “Off”

(I’d add both “Off”)

Page 46: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 46

PICT – Seeding

/e:file Enforce specific combinations

Reduce test-case changes when one parameter

changes

Page 47: AllPairs and PICT - TestPrincipiatestprincipia.com/wp-content/uploads/2017/10/Pairwise-Testing.SIGiST.v2.pdf(c) Michael Stahl, 2009, All Rights Reserved 2 Outline Combination Testing

(c) Michael Stahl, 2009, All Rights Reserved 47

PICT – Seeding - Example