# Pairwise Testing. A case study (from Lee Copeland’ book) A web-based application has been written to work with eight different browsers – IE 5.0, 5.5,

## Presentation on theme: "Pairwise Testing. A case study (from Lee Copeland’ book) A web-based application has been written to work with eight different browsers – IE 5.0, 5.5,"— Presentation transcript:

Pairwise Testing

A case study (from Lee Copeland’ book) A web-based application has been written to work with eight different browsers – IE 5.0, 5.5, 6.0, Netscape 6.0, 6.1, 7.0, Mozilla 1.1 and Opera 7. The software runs three different plug-ins – RealPlayer, Media Player or none; runs on six different client operating systems – Windows 2000, ME, XP, Linux, Mac OS X, and Solaris 9. The application resides in three different servers – IIS, Apache and Web Logic, running three different server operating systems – Windows 2000, XP and Linux. Number of possible combinations of input 8 x 3 x 6 x 3 x 3 = 1296 Is it possible to test each one of these combinations?

Another Case Study The valid phone numbers in La Crosse starts with an area code 608, zone code from the set {781, 784, 785, 786, 788, 789} and the offset from the set {0001 – 9998}. It accepts input in one of five different formats: (XXX)-XXX-XXXX (XXX) XXX XXXX XXX-XXX-XXXX XXX XXX XXXX Using the above information, the number of possible VALID phone numbers will be 1 * 6 * 9998 * 5 = 299940.

How to reduce the number of test cases? Test all possible combinations Will delay the project Choose some test cases randomly Not guaranteed to identify all errors Choose an efficient algorithm that generates the test cases, and at the same time identifies most errors Even if does not identify all errors, still identifies several of them and reduces testing time What is this most efficient algorithm?

Pairwise Testing Identify all pairs of input parameters Rationale Most errors occur when a function/module is combined with another function/module Several case studies show that pairwise testing identified most of the errors and significantly reduced testing efforts Brownlie of AT&T NIST

Example 1 Consider three input parameters X, Y and Z each having two possible values as below: X  {X1, X2} Y  {Y1, Y2} Z  {Z1, Z2} Number of possible combinations = 2 * 2 * 2 = 8 This can be reduced to only 4 by using all pairs technique. See the next slide

Example 1 (continued) XYZ X1Y1Z1 X1Y1Z2 X1Y2Z1 X1Y2Z2 X2Y1Z1 X2Y1Z2 X2Y2Z1 X2Y2Z2 XYZ X1Y1Z1 X1Y2Z2 X2Y2Z1 X2Y1Z2

Example 2 Consider 3 inputs A, B, C. Assume A has two possible values – A1 and A2 B has 3 possible values – B1, B2 and B3 C has two possible values – C1 and C2 Exhaustive combinations approach requires 2 x 2 x 3 = 12 test cases Pairwise testing requires only 6 cobinations See the table in the next slide

Example 2 (continued) ABC A1B1C1 A1B2C2 A1B3C1 A2B1C2 A2B2C1 A2B3C2

Orthogonal Array A matrix of numbers Number of columns indicates the number of input parameters Number of rows indicates the number of test cases Each entry A ij indicates one of the possible values of the input parameter j, as considered in the test case i. The table in the previous slide is an orthogonal array

Serial number Parameter 1Parameter 2 1P1 2P2P1 3 P2 4 Orthogonal array of 2 input parameters, each having 2 possible values

Notation for Orthogonal array Notation: L r C 1 1 C 2 1 …C n 1 where ‘r’ represents the number of rows in the orthogonal array which also indicates the number of test cases to be generated ‘C i ’ represents the number of possible values for the i th input If two inputs ‘i’ and ‘j’ have same number of possibilities, i.e., C i = C j, then it can be represented as ‘C i 2’ instead of ‘C i 1 C j 1’

Serial number Parameter 1Parameter 2 1P1 2P2P1 3 P2 4 Orthogonal array of 2 input parameters, each having 2 possible values Represented by the notation L 4 2 1 2 1 or L 4 2 2

Properties of Orthogonal Array Every pair of columns i and j indicate all possible pairs of i th and j th input parameters If a pair of input parameters is duplicated in another row, then every pair of input parameters must be duplicated in the table Forces the table to be “balanced”

Orthogonal Array S.No1234 11111 21222 31333 42123 52231 62312 73132 83213 93321 L 9 3 4 array Value in each cell ranges from 1 to 3. Array with 9 rows and 4 columns Every pair of columns contains all possible pairs of input values between 1 and 3

L 18 3 5 array S.No12345 111111 212331 313232 412213 513123 611322 722222 823112 921313 1023321 1121231 1222133 1333333 1431223 1532121 1631132 1732312 1833211 Balanced Orthogonal array

S.No12345678 111111111 211222222 311333333 412112233 512223311 612331122 713121323 813232131 913313212 1021133221 1121211332 1221322113 1322123132 1422231213 1522312321 1623132312 1723213123 1823321231 L 18 2 1 3 7 array

Using Orthogonal Arrays for Testing Step 1: Identify the input parameters Step 2: Determine the number of choices for each input parameter Step 3: Determine an orthogonal array with one column for each input parameter and values in each column corresponding to the range of values for that input parameter

Using Orthogonal Arrays for Testing (continued) Step 4: Replace the number in each cell by the corresponding value in the input domain Step 5: Construct test cases using the orthogonal array

Example Construct the orthogonal array for the following problem: A web-based application has been written to work with eight different browsers – IE 5.0, 5.5, 6.0, Netscape 6.0, 6.1, 7.0, Mozilla 1.1 and Opera 7. The software runs three different plug-ins – RealPlayer, MediaPlayer or none; runs on six different client operating systems – Windows 2000, ME, XP, Linux, Mac OS X, and Solaris 9. The application resides in three different servers – IIS, Apache and WebLogic, running three different server operating systems – Windows 2000, XP and Linux. See Lee Copeland’s book for the table

Observations The problem requires L x 8 1 6 1 3 3 orthogonal array The closest bigger orthogonal array is L x 8 2 4 3 The table contains 64 rows Additional entries are filled up by the tester Not all combinations of input parameters are represented in the array Only all possible pairs are included in the array

Allpairs Algorithm Constructs all possible pairs of input parameters directly No constraints as in orthogonal arrays For the same case study, this algorithm generates only 48 rows in the table The table generated in this algorithm is “unbalanced”

Another case study

Some pairwise testing tools Hexawise from XBOSOFT AllPairs from James Bach (free) PICT (Pairwise Independent Combinatorial Testing) Tool AETG (Automatic Efficient Test Generator) © XBOSOFT

Limitations Generating orthogonal array or allpairs table is not easy Need commercial or third-party tool support No evidence of which method is better High probability combinations get little attention Dependencies among input variables are not exploited

References Lee Copeland, “A Practitioner’s Guide to Software Test Design”, Artech House Publishers, 2004, ISBN: 1-58053-791-X A.S. Hedayat et al., “Orthogonal Arrays: Theory and Applications”, Springer-Verlag, NY, 1999. J. Czerwonka, “Pairwise Testing in Real World”, Proceedings of the 24 th Pacific Northwest Software Quality Conference, 2006.

References (continued) W. Uthaileang et al., “Pair-wise Testing Applied with Online Registration”, 4 th Joint International Conference on Information and Communication Technology (JICTEE-2014), 5-8 March 2014, Chiang Rai, Thailand.

Download ppt "Pairwise Testing. A case study (from Lee Copeland’ book) A web-based application has been written to work with eight different browsers – IE 5.0, 5.5,"

Similar presentations