Wednesday, April 2, 2014

Pairwise Test Cases for Data Driven Testing in Agile World

It is a common scenario where a Test Case should be run with more than one set of Test Data. Let us take an example to illustrate this scenario.

A screen has following 4 input parameters. 

  1. Name - Text Field which takes only alphabets
  2. Phone Number - Text Field takes only numbers
  3. Don't Disturb - Radio Button with Yes and No options
Now the possible values for 
  1. Name - alphabets, alpha-numeric characters, special characters, unicode characters, empty string, space, very long string
  2. Phone Number - numbers, alphabets, alpha-numeric characters, special characters, unicode characters, empty string, space, very long number
  3. Don't Disturb - Yes, No
Now if we want to come up with Test cases using combinations of this data we will get

7*8*2 = 112 Test Cases
But Pairwise Testing philosophy says

Most bugs are found when only two variable values conflict, not when all conflict at the same time. (Ref: Efficient Testing with All-Pairs - Prepared for STAREast 2003 International Conference on Software Testing Bernie Berger)
 So let us try to reduce these test cases using pairwise tool.

  1. Download and extract tool from www.saticefice.com
  2. Create an excel sheet with Variables as headers(columns) and values as rows
  3. Save it as .txt file with tab delimited file
  4. now say perl allpairs.pl blog.txt >allpairs.txt
  5. Open the file allpairs.txt using excel or numbers(in case of mac)
  6. Now you can see all the available test cases


Test cases reduced to half in this case.

~Yagna

1 comment:

  1. Yagna,

    Nice post about an important test design technique. You and your readers might also want to check out Hexawise, our more powerful and easier to use test design tool.

    More info is available from our site at hexawise.com.

    If you have any questions, I'd be happy to answer any questions that you might have.

    Thanks!

    - Justin Hunter
    Founder and CEO of Hexawise


    ReplyDelete