More

    Pairwise Testing – Orthogonal Array Explained

    Pairwise Testing is a black-box testing technique used in situations where the interaction of the factors cannot be so easily determined, or even when there is no interaction of the factors.

    For example, consider the testing of a web application that has four features (factors) say OS, speed, browser types and anti-virus software and each of these factors has five values (options).

    In order to have full coverage for the application, we need to test 5 x 5 x 5 x 5 = 625 combinations, which is not easily possible.

    We may test all these combinations, provided we have enough time and budget. However, what if we do not have enough time and budget?

    Pairwise testing is the technique we can use in such a situation.

    In pairwise testing, we make sure that all possible pairs of parameter values are covered by at least one test. However, not all possible higher-order combinations such as triples quadruple and so forth will be covered.

    There are two basic models in pairwise testing

    • Orthogonal Array
    • All-pair Table

    Both are tables that tell us which particular options to include in a given test configuration. The tables are guaranteed to contain all options for every factor at least once, and every pair of options across all pairs of factors.

    Let us discuss more on “Orthogonal Array”.

    Before going into the details of the orthogonal array, let us write down the test case by applying the conventional/exhaustive testing technique.

    Example 1

    Consider a function having three factors X, Y and Z and each factor having two options as 0 and 1.

    Now, let us list down all the possible combinations without considering the orthogonal array

    Conventional Method

    TestFactor XFactor YFactor Z
    1000
    2001
    3010
    4011
    5100
    6101
    7110
    8111

    Here, as you can see there are 8 test cases/test combinations

    Let us move on to the details of the orthogonal array and finally will derive the test cases using the orthogonal array technique for the same example.

    Orthogonal Array Method

    Definition of orthogonal array: A two-dimensional array constructed with special mathematical properties such that choosing any two columns in the array provides every pair combination of each number in the array

    If we explain it with Example 1, we need to consider the following.

    • Consider the factors X & Y and ensure that the combinations of X & Y are covered.
    • Consider the factors X & Z and ensure that the combinations of X & Z are covered.
    • Consider the factors Y & Z to ensure that all pairs of combinations are covered.

    Orthogonal array testing is a systematic way of testing all-pair combinations of variables using orthogonal arrays. It significantly reduces the number of all combinations of variables to test all pair combinations

    Rules of writing an orthogonal array.

    Let us get to know the rules of writing an orthogonal array

    There are three rules for selecting an orthogonal array

    1. There must be at least as many columns as factors. i.e. Number of columns = Number of factors
    2. There must be at least enough numbers in the columns to hold the options for each factor. i.e. If you have two options for a factor, then test cases should be there for both the values and if there are three options for a factor, then test cases should be there for all the three values. If we have spare numbers that don’t map to any option for that factor can be represented by a tilde (~).
    3. There must be at least as many rows or test cases as the product of the two largest numbers of options. For example, if one factor has 4 options and another has 3 options and yet another has 2 options, then 4 x 3 = 12 row.

    Applying orthogonal array rules in Example 1.

    Now, let us apply these rules and the definitions of the orthogonal array in example 1 and try to find the tests involved

    Applying Rule 1

    Consider the two factors X & Y. Now list down all possible combinations for the pair which will be 0 0, 0 1, 1 0 and 1 1

    TestFactor XFactor Y
    TC100
    TC201
    TC310
    TC411

    Applying Rule 2

    Consider the factors X & Z and list down all possible combinations for the pair and here notice to shuffle the order while writing the pairs i.e. 0 0, 0 1, 1 1 and 1 0. Note that here we changed the order of the values of Z for the 3rd and 4th pair.

    We can explain this in another way.

    • Write down all the values of X similar to how it is written for the pairs X & Y.
    • For the first two pairs, write values of Z as same as Y in pairs of X & Y.
    • To cover all pair combinations of Y & Z, interchange the values of Z in the 3rd and 4th pairs as highlighted in the table below.
    TestFactor XFactor Z
    TC100
    TC201
    TC311
    TC410

    Applying Rule 3

    Now let us consider the factors Y & Z. Here note that all the combinations for the pairs are now listed. If we had not changed the order for the pairs X & Z, all combinations would not have been covered for pairs Y & Z.

    Now we have to write down the values of Y from the X & Y factor table and values of Z from the X & Z factor table. If we combine this we will get the order of combinations for Y & Z

    TestFactor Y
    (From X & Y Table)
    Factor Z
    (From X & Z Table)
    TC100
    TC211
    TC301
    TC410

    Test combinations derived with orthogonal array method

    Now the table below shows the test cases or test combinations developed using the orthogonal array method.

    TestFactor XFactor YFactor Z
    TC1000
    TC2011
    TC3101
    TC4110

    Note that there are only four test cases after applying the orthogonal array technique.

    Thus the number of test cases by using the orthogonal array technique is reduced to four while in conventional technique the number of test cases is eight.

    I just saved 4 test cases by using the orthogonal technique. Did I miss something? I should have considered the other 4 too.

    Your mind

    This might be what you are thinking when you derived test cases for example 1. However, if we consider a large example wherein testing all combinations is impossible then we will come to know the strength of the orthogonal array technique.

    Orthogonal Array – Naming Conventions

    Now, let us move on to the naming convention followed in orthogonal arrays

    Sample 1

    Consider an orthogonal array having 4 factors and each factor having 3 values each.

    No: of test cases as per the rules of orthogonal array = 3 x 3 = 9

    The naming convention used here should be L 9 (34)

    Formula used in naming convention is L (no: of test cases) Count of values in each factor (number of factors)

    Sample 2

    Consider an orthogonal array having six factors and these six factors are having 3 options each and yet another factor having 6 options.

    No: of test cases = 3 x 6 = 18

    As per the formula, the naming convention can be written as L 18 (3 6 6 1)

    Example 2

    Company A has designed a web page with three distinct sections (Top, middle, and bottom). These sections can be individually shown or hidden by the user. The browsers on which the webpage can be viewed are internet explorer and Firefox. The server used for launching the application can be IIS, Apache and web logic. Write down the number of test cases required by using the orthogonal array technique.

    Step 1

    First lets list down the factors and the options for each factor.

    In this scenario, we have 4 factors.

    1. Section
    2. Visibility
    3. Browser
    4. Server

    Options for these factors are as below.

    FactorOptionsOption Count
    SectionTop, Middle, Bottom3
    VisibilityShown, Hidden2
    BrowserIE, FireFox2
    ServerIIS, Apache, Web Logic3

    Step 2

    Apply the rules of the orthogonal array technique and derive the number of test cases.

    The above orthogonal array is having 4 factors, out of which two factors are having 2 options each and the other two factors are having 3 options each.

    So, No: of test cases = 3 x 3 = 9

    And the naming convention would be (2 2)

    Related Articles

    Recent Articles

    How to fix Date Time data type issue in Blue Prism?

    Know more about the date time issue while using the code stage in Blue Prism and understand how to fix it by dealing with the UTC offset.

    How to deserialize JSON in UiPath?

    Tutorial on how to properly deserialize JSON with UiPath Web Activities. Explains the concept of JSON Array and JSON Object.

    Dynamic or Variable Selectors in UiPath

    Tutorial on how to use dynamic selectors in UiPath. Explains how to use variables in UiPath selectors.

    Change Case Excel Add-In

    Change Case Excel Add-In is a powerful Excel Add-In that can change the case of selected cells. With easy to use Keyboard shortcuts, perform case conversion in style.

    Blue Prism Video Tutorial

    A well-structured video tutorial on Blue Prism, which is the right starting point for your RPA career. #rpa #blueprism

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Stay on top - Get latest articles in your inbox