76
1 Combinatorial Software Test Design (Beyond Pairwise Testing)

Combinatorial software test design beyond pairwise testing

Embed Size (px)

DESCRIPTION

Pairwise and combinatorial testing explained. Orthogonal array-based testing, pair-wise software testing, and other more thorough n-way combinatorial test design strategies are proven to be efficient and effective. Unfortunately, much of the material on the internet about these test design techniques are dense, impenetrable tomes filled with long Greek-letter-infused equations that only a mathematician could love. This presentation aims to explain the principles behind this powerful but under-appreciated software test design approach.

Citation preview

Page 1: Combinatorial software test design beyond pairwise testing

1

Combinatorial Software Test

Design

(BeyondPairwiseTesting)

Page 2: Combinatorial software test design beyond pairwise testing

2

Cover slide photo credit: "Mike" Michael L. Baird, flickr.bairdphotos.comhttp://www.flickr.com/photos/mikebaird/2127310513

Presented at STPCon

October, 2010

By Justin Hunter CEO of Hexawise

Page 3: Combinatorial software test design beyond pairwise testing

3

PROBLEM

Page 4: Combinatorial software test design beyond pairwise testing

2

You can’t test everything.

http://www.flickr.com/photos/maisonbisson/109211670/

The Problem

Page 5: Combinatorial software test design beyond pairwise testing

2

“With so many possible tests to choose from...”

http://www.flickr.com/photos/madabandon/344158061/

The Problem

Page 6: Combinatorial software test design beyond pairwise testing

2

“Things might seem

uncontrollable...”

http://www.flickr.com/photos/maisonbisson/110867288/sizes/l/in/photostream/

The Problem

Page 7: Combinatorial software test design beyond pairwise testing

2

... discouraging, even.

http://www.flickr.com/photos/cheo70/2702682262/

The Problem

Page 8: Combinatorial software test design beyond pairwise testing

8

So, how can you select just a few tests...

http://www.flickr.com/photos/krawcowicz/3830467093/

The Problem

Page 9: Combinatorial software test design beyond pairwise testing

9

... and still achieve

adequate coverage?

http://www.flickr.com/photos/editor/4861496460/

The Problem

Page 10: Combinatorial software test design beyond pairwise testing

10http://www.flickr.com/photos/johncarleton/4890239248

Wait. So this is a test design method to achieve greater coverage in fewer tests. Right?

The Problem

Page 11: Combinatorial software test design beyond pairwise testing

11

If you prioritize speed, yes. You

can achieve greater coverage

in fewer tests.

http://www.flickr.com/photos/legofenris/4212007962/

But for those testers who prioritize thoroughness, this method can also be

used to increase thoroughness dramatically.

It can help you prioritize around

either goal.

Not Just Fewer, Better Tests

Page 12: Combinatorial software test design beyond pairwise testing

12http://www.flickr.com/photos/thomashawk/2402194148

Way

fewer

tests!

(With slightly

better

coverage tha

n we

have now.)

http://www.flickr.com/photos/thomashawk/2402190314

Way better coverage!

(With slightly fewer tests

than we have now.)

The choice is yours to make.

Not Just Fewer, Better Tests

Page 13: Combinatorial software test design beyond pairwise testing

13

How can you create “curiously strong” test cases that will allow

you to achieve either of these testing objectives?

http://www.flickr.com/photos/photobunny_earl/2309612944/

Not Just Fewer, Better Tests

Page 14: Combinatorial software test design beyond pairwise testing

14

SOLUTION

Page 15: Combinatorial software test design beyond pairwise testing

15

This presentation describes an approach that will help you create

powerful test cases.

http://www.flickr.com/photos/maisonbisson/110867008/

The Solution

Page 16: Combinatorial software test design beyond pairwise testing

16

To do so, use combinatorial

test design methods that

build structured variation

into your test cases.

Structured Variation

Page 17: Combinatorial software test design beyond pairwise testing

17

“Test One”

http://www.flickr.com/photos/gelrodandjodie/148759732

Structured Variation?

Page 18: Combinatorial software test design beyond pairwise testing

18

This is not what I mean by structured variation.

“Test Two”

http://www.flickr.com/photos/gelrodandjodie/148759732

Structured Variation?

Page 19: Combinatorial software test design beyond pairwise testing

19

This is not what I mean by structured variation.

“Test Three”

http://www.flickr.com/photos/gelrodandjodie/148759732

Structured Variation?

Page 20: Combinatorial software test design beyond pairwise testing

20

So if that’s not structured variation, what is?

Structured Variation?

Page 21: Combinatorial software test design beyond pairwise testing

21

Structuredvariation

means

http://www.flickr.com/photos/tk_five_0/2281768728

Structured Variation

Page 22: Combinatorial software test design beyond pairwise testing

22

...each test will be

different

http://www.flickr.com/photos/criben/2635618391

Structured Variation

Page 23: Combinatorial software test design beyond pairwise testing

23

...than the tests before

it, and

http://www.flickr.com/photos/horrgakx/3186982135

Structured Variation

Page 24: Combinatorial software test design beyond pairwise testing

24

...testers will do their

testing in different

ways,

http://www.flickr.com/photos/pixelrobber/2626213081

Structured Variation

Page 25: Combinatorial software test design beyond pairwise testing

25

... and explore

from more

angles.

http://www.flickr.com/photos/tk_five_0/2286693552

Structured Variation

Page 26: Combinatorial software test design beyond pairwise testing

26

“OK. Maximum variation is better than redundantly repeated redundant repetition. Got it.

That it? Am I good to go now?”http://www.flickr.com/photos/johncarleton/4890241530

Structured Variation

Page 27: Combinatorial software test design beyond pairwise testing

27

Coverage

No. There’s more.

Much more. Remember coverage?

http://www.flickr.com/photos/30431232@N03/3610846363

Page 28: Combinatorial software test design beyond pairwise testing

28

Accidentally leaving gaps in coverage can lead to

painful results.

http://www.flickr.com/photos/dwfromthepeg/240921271/

Coverage

Page 29: Combinatorial software test design beyond pairwise testing

29

Structured variation

focuses on covering as

much as possible...

http://www.flickr.com/photos/localsurfer/38245658/

Coverage

Page 30: Combinatorial software test design beyond pairwise testing

30

... with as few

resources as

possible...

http://www.flickr.com/photos/mikebaird/4177570453/

Coverage

Page 31: Combinatorial software test design beyond pairwise testing

31

...and in the most

efficiently structured

way possible.

http://www.flickr.com/photos/dannohung/332507807

Coverage

Page 32: Combinatorial software test design beyond pairwise testing

32

FOCUS OF

SOLUTION &

RATIONALE

Page 33: Combinatorial software test design beyond pairwise testing

33

Single-Mode Faults

Most software defects in production today can be triggered by just one test input.

http://www.flickr.com/photos/vaguelyartistic/292083492

Page 34: Combinatorial software test design beyond pairwise testing

34

Software bugs caused by the interaction of two test inputs are very common too.

http://www.flickr.com/photos/kanaka/1798327442

Dual-Mode Faults

Page 35: Combinatorial software test design beyond pairwise testing

Triple-Mode Faults

35

Defects that require three specific test inputs to trigger them are rare.

http://www.flickr.com/photos/kanaka/1798327442

Page 36: Combinatorial software test design beyond pairwise testing

Quadruple-Mode Faults

http://www.flickr.com/photos/33896652@N00/2491286399/

36

Defects that require four more test inputs to trigger them are extremely rare.

http://www.flickr.com/photos/novembering/3816524907

Page 37: Combinatorial software test design beyond pairwise testing

37

Implication on Testing Strategy

Aha! So, to find bugs efficiently, we should focus first on testing all possible

combinations every set of TWO test inputs!http://www.flickr.com/photos/johncarleton/4890236762

Page 38: Combinatorial software test design beyond pairwise testing

38

Implication on Testing Strategy

That’s right, two. Focus on covering all

possible two-way defects first. In fact, that’s so important,

can you say it a second time?

http://www.flickr.com/photos/soulsurfingcrew/2273300213

Page 39: Combinatorial software test design beyond pairwise testing

39

we should focus first on testing

To find bugs efficiently

TWO test inputs!all possible combinations of

http://www.flickr.com/photos/johncarleton/4890236762

Implication on Testing Strategy

Page 40: Combinatorial software test design beyond pairwise testing

40

MECHANICS

Page 41: Combinatorial software test design beyond pairwise testing

41

Combinations of Test Inputs

The key words here

are test inputs and

combinations.

http://www.flickr.com/photos/12tribu/2750040244

Page 42: Combinatorial software test design beyond pairwise testing

42

Test inputs will vary

dramatically from project to project.

Combinations of Test Inputs

Page 43: Combinatorial software test design beyond pairwise testing

43

Well, duh! They would,

wouldn’t they?But how does

it all work?

http://www.flickr.com/photos/johncarleton/4377591743

Combinatorial Software Test Design

Page 44: Combinatorial software test design beyond pairwise testing

44

Here’s how it works: First, people are required to identify what test

inputs should be tested.

http://www.flickr.com/photos/mikebaird/3939231212

Combinatorial Software Test Design

Page 45: Combinatorial software test design beyond pairwise testing

45

Second, computer algorithms will take those inputs and quickly calculate the smallest

possible number of tests required to meet the tester’s specified coverage objectives.

Combinatorial Software Test Design

Page 46: Combinatorial software test design beyond pairwise testing

http://www.flickr.com/photos/thomashawk/2402194148 http://www.flickr.com/photos/thomashawk/2402190314

Way better coverage!

(With slightly fewer tests

than we have now.)

46

Way

fewer

tests!

(With slightly

better

coverage tha

n we

have now.)

... and again, the algorithms will create different

solutions depending upon

your testing objectives.

Combinatorial Software Test Design

Page 47: Combinatorial software test design beyond pairwise testing

47

Way

fewer

tests!

(With slightly

better

coverage tha

n we have

now.)

The woman wanting fewer tests should create 2-way

tests

(AKA “pairwise” or

“AllPairs” tests)

http://www.flickr.com/photos/thomashawk/2402194148

Combinatorial Software Test Design

Page 48: Combinatorial software test design beyond pairwise testing

Way better coverage!

(With slightly fewer tests than

we have now.)

48

This guy, wanting more coverage, should create

more thorough combinatorial tests.

(e.g., 3-way, 4-way, or multi-strength tests).

http://www.flickr.com/photos/thomashawk/2402190314

Combinatorial Software Test Design

Page 49: Combinatorial software test design beyond pairwise testing

49

WHY NOT

DESIGN TESTS

BY HAND?

Page 50: Combinatorial software test design beyond pairwise testing

Test Design: Man vs. Machine(Once test inputs are known)

Human

Computer

Weeks Gaps

Seconds 100%*

Way More Tests

Way Fewer Tests

Speed: Coverage: Efficiency:

Advantages of Combinatorial Software Test Design

*100% of what? 100% of the desired test input combinations (e.g., all pairs of values for 2-way tests solutions, all triplets of possible values for 3-way solutions, etc.).

Page 51: Combinatorial software test design beyond pairwise testing

51

Whatever your test

inputs, combinatorial testing makes

it easy and fast to cover

all of the specific

combinations of test inputs

that you suspect are relatively

important.

http://www.flickr.com/photos/kanaka/1798327442

Coverage Advantages

Page 52: Combinatorial software test design beyond pairwise testing

OK, but wouldn’t I have tested those relatively important combinations on my own?

http://www.flickr.com/photos/johncarleton/4890239248

Advantages of Combinatorial Software Test Design

Page 53: Combinatorial software test design beyond pairwise testing

53

Perhaps, but maybe you...

Forget Run out of time

Use more tests than needed

Accidentally repeat yourself

Advantages of Combinatorial Software Test Design

Page 54: Combinatorial software test design beyond pairwise testing

54

Coverage Advantages

Plus, using combinatorial testing, you’ll also get additional coverage from combinations that wouldn’t have made your list, including...

http://www.flickr.com/photos/tk_five_0/2706278432

Page 55: Combinatorial software test design beyond pairwise testing

55

No, its way cooler than

pareto.

http://www.flickr.com/photos/subspace-eddy/2766810770/

...specialized use cases,

Coverage Advantages

Page 56: Combinatorial software test design beyond pairwise testing

56

... unexpected combinations,

http://www.flickr.com/photos/funky64/2875860978

Coverage Advantages

Page 57: Combinatorial software test design beyond pairwise testing

57

...notable, combinations that capture

your attention,http://www.flickr.com/photos/brb_photography/3221049399

Coverage Advantages

Page 58: Combinatorial software test design beyond pairwise testing

58

...even combinations that rarely, if ever, actually occur,

http://www.flickr.com/photos/grassvalleylarry/5536758

Coverage Advantages

Page 59: Combinatorial software test design beyond pairwise testing

59

... and... combinations that will take

you into different

parts of the application

(and different states) than you would

have otherwise thought to

explore.

http://www.flickr.com/photos/28041049@N00/227352411

Coverage Advantages

Page 60: Combinatorial software test design beyond pairwise testing

60

Quickly testing unusual pairs is

often surprisingly efficient and

effective. Many unexpected

two-way interactions

cause problems.

Coverage Advantages

Page 61: Combinatorial software test design beyond pairwise testing

61

Yes.

Combinations that can’t ever

appear in reality? No problem. You can prevent them from appearing in your plans with “Invalid Pairs.”

http://www.flickr.com/photos/kaptainkobold/4741725788/lightbox/

Constraint Handling

Page 62: Combinatorial software test design beyond pairwise testing

62

READY YET?

Page 63: Combinatorial software test design beyond pairwise testing

63

Ready?

I’m ready already! Let’s do

this!http://www.flickr.com/photos/johncarleton/4890241530

Page 64: Combinatorial software test design beyond pairwise testing

64

Hazards

Not so fast. Hazards exist.

To succeed, you must use

common sense.

http://www.flickr.com/photos/christianhaugen/3604106558

Page 65: Combinatorial software test design beyond pairwise testing

65

Limitations

And let’s not kid

ourselves. Not just anyone can do

this stuff.http://www.flickr.com/photos/mikebaird/573368639

Page 66: Combinatorial software test design beyond pairwise testing

66

Prerequisites

http://www.flickr.com/photos/johncarleton/9511759/

It also requires good critical

thinking skills.

Page 67: Combinatorial software test design beyond pairwise testing

67

Prerequisites

To thrive, you must be able to develop models about

how the systems you’re

exploring work.http://www.flickr.com/photos/10ch/3101275536/

Page 68: Combinatorial software test design beyond pairwise testing

Practice Makes Perfect

Training and practice

will help you

succeed.

http://www.flickr.com/photos/mikebaird/2128091146

Page 69: Combinatorial software test design beyond pairwise testing

69

Questions

?

http://www.flickr.com/photos/nathaninsandiego/3647136579

Page 70: Combinatorial software test design beyond pairwise testing

70

Ready?

Let’s get started!

http://www.flickr.com/photos/mikebaird/2996548709

Page 72: Combinatorial software test design beyond pairwise testing

72

Special thanks to the folks at:and its talented contributing

photographers, including: Mike Baird

Thank you

... and the inimitable John Carleton (who, let the record show, had no input into the cartoonish

statements we added next to his striking expressions).

Page 73: Combinatorial software test design beyond pairwise testing

Why 2-way Testing is Effective

Text

Multiple thorough studies show approximately 85% of defects in production could have been detected by simply testing all possible pairs of values.

Source: “Combinatorial Testing” IEEE Computer, Aug, 2009. Rick Kuhn, Raghu Kacker, Jeff Lei, Justin Hunter

Page 74: Combinatorial software test design beyond pairwise testing

74

Additional Information

Excellent introductory articles and instructional videos: www.CombinatorialTesting.com

Results of a ten-project study of effectiveness:

https://www.hexawise.com/Combinatorial-Softwar-Testing-Case-Studies-IEEE-Computer-Kuhn-Kacker-Lei-Hunter.pdf

Free trials of our firm’s combinatorial test design tool: www.hexawise.com/users/new (which stay free indefinitely for companies using 1-4 licenses).

Also, please feel free to contact me if you have any questions. I’d be happy to quickly review a test plan or two, answer your questions, give quick pointers to help you run a pilot, etc. Seriously.... I enjoy helping people get started with this test design approach. Please don’t hesitate to reach out. There’s no charge and no catch.

Page 75: Combinatorial software test design beyond pairwise testing

26

1.  Plan ScopeBe  clear  about  single  or  mul3ple:

-­‐    Features  /  Func3ons  /  Capabili3es

-­‐    User  types

-­‐    Business  Units

-­‐    H/W  or  S/W  Configura3ons    

Level  of  DetailAcceptable  op3ons:  

-­‐    High  level  “search  for  something”

-­‐    Medium  level  “search  for  a  book”

-­‐    Detailed  “search  for  ‘Catcher  in  the  Rye’  

       by  its  3tle”

Passive  Field  TreatmentDis3nguish  between  important  fields  (par3cularly  those  that  will  trigger  business  rules)  and  unimportant  fields  in  the  applica3on.

Quickly  document  what  your  approach  will  be  towards  passive  fields.  You  might  consider:  ignore  them  (e.g.,  don’t  select  any  Values  in  your  plan)  or  a  3  Value  approach  such  as  “valid”  “Invalid  (then  fix)”  and  “Blank  (then  fix)”

2.  Create Configura3onsFirst  add  hardware  configura3ons

Next  add  soZware  configura3ons

UsersNext,  add  mul3ple  types  of  users  (e.g.,  administrator,  customer,  special  customer)

Consider  permission  /  authority  levels  of  admin  users  as  well  as  business  rules  that  different  users  might  trigger

Ac3onsStart  with  Big  Common  Ac3ons  made  by  users

AZer  comple3ng  Big  Common  Ac3ons,  circle  back  and  add  Small  Ac3ons  and  Excep3ons

Remember  some  ac3ons  may  be  system-­‐generated

3.  Refine Business  RulesSelect  Values  to  trigger  bus.  rules

Iden3fy  equivalence  classes

Test  for  boundary  values

Mark  constraints  /  invalid  pairs

Gap  FillingIden3fy  gaps  by  analyzing  different  states,  orders  of  opera3ons,  decision-­‐tree  outcomes  sought  vs.  delivered  by  tests,  “gap  hun3ng”  conversa3ons  w/  SME’s,  etc.

Fill  gaps  by  either  (i)  adding  Parameters  and/or  Values  or  (ii)  crea3ng  “one-­‐off”  tests.  

Itera3onRefine  longest  lists  of  Values;  reduce  their  numbers  by  using  equivalence  classes,  etc.

Create  Tests  with  and  w/out  borderline  Values;  consider  cost/benefit  tradeoffs  of  addi3onal  test  design  refinements

Consider  stopping  tes3ng  aZer  reaching  ~80%  coverage  

Consider  2-­‐way,  3-­‐way,  and  Mixed-­‐Strength  op3ons

4.  Execute Auto-­‐Scrip3ng      

Add  auto-­‐scrip3ng  instruc3ons  once;  apply  those  instruc3ons  to  all  of  the  tests  in  your  plan  instantly

Don’t  include  complex  Expected  Results  in  auto-­‐scripts  

Expected  ResultsExport  the  tests  into  Excel  when  you’re  done  itera3ng  the  plan

Add  complex  Expected  Results  in  Excel  post-­‐export

Con3nuous  ImprovementIf  possible  measure  defects  found  per  tester  hour  “with  and  without  Hexawise”  and  share  the  results

Add  inputs  based  on  undetected  defects

Share  good,  proven,  plan  templates  with  others

Practice Tips: 4-Step Process

Four-Step Process to Design Efficient and Effective Tests

© Hexawise, 2010. All rights reserved.

Page 76: Combinatorial software test design beyond pairwise testing

27

“You might be headed for trouble if...”

© Hexawise, 2010. All rights reserved.

1.  Plan Scope...  You  cannot  clearly  describe  both  the  scope  of  your  test  plan  and  what  will  be  leZ  out  of  scope.

Level  of  Detail...  Parameters  with  the  most  Values  have  more  Values  than  they  require.    365  values  for  “days  of  the  year”  is  bad.    Instead,  use  equivalence  class  Values  like  “weekend”  &  “weekday.”    When  in  doubt,  choose  more  Parameters  and  fewer  Values.

Passive  Field  Treatment

...  You  cannot  clearly  describe  your  strategy  to  deal  with  unimportant  details.    If  Values  will  impact  business  rules,  focus  on  them.    If  Values  don’t  impact  business  rules,  consider  ignoring  them.  

2.  Create Configura3ons...  You  have  ignored  hardware  and  soZware  configura3ons    without  first  confirming  this  approach  with  stakeholders.

Users...  You  have  not  included  all  the  different  types  of  users  necessary  to  trigger  different  business  rules.    What  user  types  might  create  different  outcomes?    Authority  level?  Age?  Loca3on?    Income?    Customer  status?

Ac3ons...  You  start  entering  Small  Ac3ons  (e.g.,  “search  for  a  hardback  science  book  by  author  name”)  before  you  enter  Big  Ac3ons  (e.g.,  “Put  Something  in  Cart.    Buy  it.”)    First  go  from  beginning  to  end  at  a  high  level.    AZer  you’ve  done  that,  feel  free  to  add  more  details.  

3.  Refine Business  Rules...  You  forget  to  iden3fy  invalid  pairs.          -­‐  or  -­‐    ...  You  rely  only  on  Func3onal  Requirements  and  Tech  Specs  w/out  thinking  hard  yourself  and  asking  ques3ons  to  SME’s  about  business  rules  and  outcomes  that  are  not  yet  triggered.

Gap  Filling...  You  assume  that  the  test  condi3ons  coming  out  of  Hexawise  will  be  100%  of  the  tests  you  should  run.    There  might  well  be  addi3onal  “one-­‐off”  things  that  you  should  test  and/or  a  few  nega3ve  tests  to  design  by  hand.

Itera3on...  You  forget  to  look  at  the  Coverage  Analysis  charts.    If  you  achieve  80%  coverage  in  the  first  quarter  of  the  tests,  you  should  measure  the  cost/benefit  implica3ons  of  execu3ng  the  last  3/4  of  the  tests.

4.  Execute Auto-­‐Scrip3ng...  You  add  detailed  Expected  Results  in  the  tests.                                                                                                          -­‐  or  -­‐  ...  You  forget  that  this  feature  exists  and  find  yourself  typing  out  test-­‐by-­‐test  instruc3ons  one-­‐by-­‐one.

Expected  Results...  You  invest  a  lot  of  3me  in  calcula3ng  and  documen3ng  Expected  Results  before  you  have  determined  your  “final  version”  Parameters  and  Values.    Last  minute  addi3ons  to  inputs  will  jumble  up  test  condi3ons  for  most  test  cases.

Con3nuous  Improvement...  You  don’t  ask  (when  defects  that  the  tests  missed  are  found  post-­‐tes3ng)  “What  input  could  have  been  added  to  the  test  plan  to  detected  this?”  “Should  I  add  that  input  to  the  Hexawise  test  plan  now  to  improve  it  in  advance  of  the  next  3me  it  is  used?”  

Practice Tips: Warning Signs