QA AND TEST AUTOMATION · PART 1 · MANUAL TESTING, PROPERLY · TECHNIQUE · 13 OF 112

Pairwise Testing and Error Guessing, Explained

Two ways to choose tests when there are too many combinations or no written rule: pairwise (all-pairs) testing that covers every pair of values in a fraction of the runs, with constraints and tools, and error guessing and fault attacks built from experience. Worked on a ShopRung checkout matrix of 54 combinations reduced to 9.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 67
  63. 68
  64. 69
  65. 70
  66. 71
  67. 72
  68. 73
  69. 74
  70. 75
  71. 76
  72. 77
  73. 78
  74. 79
  75. 80
  76. 81
  77. 82
  78. 83
  79. 84
  80. 85
  81. 86
  82. 87
  83. 88
  84. 89
  85. 90
  86. 91
  87. 92
  88. 93
  89. 94
  90. 95
  91. 96
  92. 97
  93. 98
  94. 99
  95. 100
  96. 101
  97. 102
  98. 103
  99. 104
  100. 105
  101. 106
  102. 107
  103. 108
  104. 109
  105. 110
  106. 111
  107. 112
1 / 14

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Every pair, not every combination
  • constraints and tools
  • error guesses and fault attacks
  • keep the list growing

Notes

The problem

Say you must check the ShopRung checkout on three browsers, with two kinds of account, on three screen sizes, with three coupon choices. Every combination is three times two times three times three: fifty four runs of the same flow. Add one more option with three values and it becomes one hundred and sixty two. Nobody runs that by hand every release. So most teams test a few setups by feel, and nobody knows what they missed.

Checkout on many setups
  • browser Chrome, Firefox, Safari 3
  • account alice, new account 2
  • screen desktop, tablet, phone 3
  • coupon none, SAVE10, FLAT5 3
  • all combinations: 3 x 2 x 3 x 3 = 54 runs
  • add one more option → 162

The idea

Studies of real defects found a useful pattern. Most bugs are triggered by one setting alone, many by a combination of two settings, and only a few need three or more at once. Pairwise testing uses that. Instead of every combination, it makes sure every pair of values appears together in at least one run. Safari with a phone, a phone with flat five, Safari with flat five, and so on. Each run covers several pairs at once.

Pairwise (all-pairs)
  • studies of real defects: most are triggered by one setting, many by a pair, few need three or more
  • so: make sure every PAIR of values appears in at least
  • one run
  • Safari + phone, phone + FLAT5, Safari + FLAT5 ... each once

The table

Here are nine runs instead of fifty four. Pick any two columns and any two values, and you will find a row with both. Safari and phone, row seven. A new account with flat five, row eight. A tablet with save ten, row two. Every pair is covered. What you give up is triples: Safari with a phone and flat five together is not in the table. That is the trade, and you make it knowingly.

All pairs in 9 runs
#  browser  account screen  coupon
1  Chrome   alice   desktop none
2  Chrome   new     tablet  SAVE10
3  Chrome   alice   phone   FLAT5
4  Firefox  alice   tablet  FLAT5
5  Firefox  new     phone   none
6  Firefox  new     desktop SAVE10
7  Safari   alice   phone   SAVE10
8  Safari   new     desktop FLAT5
9  Safari   alice   tablet  none

Constraints

Real options have constraints. In ShopRung, a guest has no cart, so a guest with save ten is impossible: rule account eight says the cart needs a login. Safari only runs on Apple devices. Writing these down matters, because an impossible row wastes a run and hides the pairs it was meant to cover. Pairwise tools let you write rules like: if the account is guest, then the coupon is none. They then build the table around them.

Real-world constraints
  • a guest cannot apply a coupon (ACC-8: cart needs login)
  • Safari only runs on Apple devices
  • admin cannot place orders? (ask!)
  • write constraints as rules: IF account = guest THEN coupon = none

Tools

For more than a few parameters, nobody builds the table by hand. Free generators do it: Microsoft's PICT tool, Python libraries like allpairspy, and many online generators. You list the parameters, their values and the constraints, and the tool returns a small set of rows. Most can also cover all triples instead of pairs, called strength three. That gives more rows, still far fewer than every combination, for features where mistakes are expensive.

Generating the table
  • open-source generators: PICT (Microsoft), allpairspy (Python), many online tools
  • input: parameters + values + constraints
  • output: a small set of rows
  • want triples? set strength 3 (more rows, still << all)

Where it fits

Know where pairwise fits. It is great for configurations: browsers, operating systems, screen sizes, feature flags, settings, and optional fields or parameters. It is the wrong tool for business rules like the coupon thresholds, which need boundaries and decision tables. A neat way to say it: pairwise picks where and under which settings to run a test, while the other techniques pick what to check in that test.

Good and bad fits
  • good fit browsers x OS x screen feature flags, settings, form options, API params
  • bad fit money rules (use boundaries and decision tables) known risky triples
  • pairwise picks WHERE to run, other techniques pick WHAT

Error guessing

Now the second technique. Error guessing is experience based: you list the faults that are likely in this kind of software, then design tests to expose them. The guesses come from past bugs in this app, bugs in similar apps, the ways developers usually slip, and what real users actually do. It is not random clicking. A good guess is specific enough to write as a test case, and you keep the list and grow it after every release.

Error guessing
  • an experience-based technique: list faults that are likely, then design tests to expose
  • them
  • sources of guesses: past bugs in this app bugs in similar apps how developers usually slip what users actually do

Guesses for a shop

Here is a starter list for any shop. Double click place order: do you get two orders? Press back after paying. Cancel the same order in two tabs. Type the coupon with spaces around it. Send quantities like two point five, minus one and ninety nine thousand. Search for a percent sign, an underscore, a quote and an emoji. Try names of fifty and fifty one characters. Change stock after adding to the cart. Let the login expire mid checkout. And open another customer's order id.

Try these on ShopRung
  • double-click Place order
  • Back button after paying
  • two tabs: cancel in both coupon " save10 " with spaces
  • quantity 2.5, -1, 99999
  • search: %, _, ', emoji
  • name of 50 and 51 chars
  • stock changes after adding
  • token expires mid-checkout
  • another user's order id

Fault attacks

Error guesses can be organised into fault attacks, grouped by where faults live. Inputs: empty, huge, the wrong type, special characters. State: repeat an action, undo it, two users at once. Time: slow networks, timeouts, expiry and time zones. Data: zero, negative values, duplicates, and records that were deleted. Access: someone else's data. In the exploratory testing lab you will use this kind of list on ShopRung in mystery mode.

Fault attack checklist
  • inputs empty, huge, wrong type, special characters
  • state repeat, undo, two users at once
  • time slow network, timeout, expiry, time zones
  • data zero, negative, duplicates, deleted
  • access another user's data

Its limits

Error guessing finds bugs that no requirement mentions, which is its great strength. Its limit is that it depends on the tester. A junior tester has fewer guesses, and coverage is hard to measure. Teams fix this by keeping a shared list of error guesses, adding every bug that escaped to production, and pairing new testers with experienced ones. Over time the list becomes a valuable team asset.

Strengths and limits
  • strength: finds bugs no requirement mentions
  • limit: only as good as the tester's experience
  • limit: hard to measure coverage
  • fix: keep a shared list, add every escaped bug, pair juniors with seniors

Common mistakes

Common mistakes. Using pairwise for money rules, where boundaries matter more. Forgetting constraints and wasting rows on impossible combinations. Using plain pairs where a known triple is risky. Using error guessing instead of structured techniques rather than on top of them. Writing guesses too vague to repeat, like try weird inputs. And never adding new guesses after a bug escapes to production.

Avoid these
  • pairwise on business rules
  • forgetting constraints
  • pairwise for safety-critical combos that need all triples
  • error guessing instead of structured techniques
  • guesses too vague to repeat
  • never updating the guess list

Say it like this

A common interview question: we support five browsers and four operating systems, plus several settings, how do you test it? Say: I would not run every combination. I list the parameters and values, add the constraints, and generate an all pairs set with a tool, plus any combination we know is risky. Separately, I test the business rules with boundaries and decision tables, and I add error guesses from past bugs.

In the interview
  • "I would not run every combination. I list the parameters and values, add
  • constraints, and generate an all-pairs set with a tool, adding any known risky
  • combination. Separately I
  • test the business rules with boundaries and add error
  • guesses from past bugs."

Interview questions

Q1What is pairwise testing?

A combinatorial technique that chooses test runs so every pair of parameter values appears together at least once, cutting the number of runs drastically compared with all combinations.

Q2Why does pairwise testing work?

Studies of real defects show most are triggered by a single parameter or the interaction of two; few need three or more, so covering all pairs finds most combination bugs.

Q3How many runs do you need for 4 parameters with 3 values each?

All combinations need 81; an all-pairs set needs only 9 (an L9 orthogonal array).

Q4What are constraints in pairwise testing?

Rules that exclude impossible combinations, such as Safari only on Apple devices or no coupon for a guest. Tools build the table around them so no run is wasted.

Q5Name a pairwise tool.

PICT from Microsoft, the allpairspy Python library, and other open-source or online generators; most support constraints and higher strength (triples).

Q6What is error guessing?

An experience-based technique where the tester lists likely faults (from past bugs, similar systems and common developer mistakes) and designs tests to expose them.

Q7Give five error guesses for a payment form.

Double submission, back button after paying, expired card date at the month boundary, amounts with many decimals or zero, and network timeout after the bank charged the card.

Q8When should you not rely on pairwise?

For business rules (use boundaries and decision tables) and for known risky three-way interactions or safety-critical systems, where higher-strength coverage is needed.