Skip to main content

Orthogonal Array Testing is a statistical method used to identify a subset of test cases that can be used to test all possible combinations of input parameters with fewer test cases than exhaustively testing all possible combinations. An Orthogonal Array is a mathematical matrix that specifies a set of test cases that will test all possible combinations of input parameters, while minimizing the number of test cases required.

In Orthogonal Array Testing, the input parameters are varied systematically, and the test cases are designed to cover all possible combinations of input parameter values with minimal redundancy. The goal is to achieve maximum code coverage with minimum testing effort.

Orthogonal Array Testing is particularly useful when testing software applications with multiple input parameters, each of which can take on multiple values. By using Orthogonal Array Testing, testers can reduce the number of test cases required to achieve maximum coverage, while still ensuring that all possible combinations of input parameter values are tested.

An orthogonal array is a mathematical structure that can be represented by the following formula:

Formula
OA(N,k,s,v) \text{OA}(N, k, s, v)

Where:

  • N is the number of test cases required to cover all possible combinations of input parameters. or Actual number of test cases required to test all possible combinations of input parameters.
  • k is the number of input parameters being tested.
  • s is the strength of the test, which is the minimum number of input parameters that must be tested simultaneously to ensure that all possible combinations of input parameters are tested.
  • v is the number of possible values for each input parameter.

To Find minimum number of test cases required to achieve maximum code coverage-

Formula

N=vksksN = \frac{v^k}{s^{k-s}}

Where:

  • The value of N represents the minimum number of test cases required to achieve maximum code coverage by testing all possible combinations of input parameters without redundancy.

By using the orthogonal array formula, it is possible to design a set of test cases that efficiently explore the input space of a software application and help achieve maximum code coverage with minimum test cases.

caution

it's important to note that OAT does not necessarily provide the absolute minimum number of test cases needed to achieve maximum coverage. It's simply a technique that can help reduce the number of test cases needed while still achieving a high level of coverage.

Apply the above formula in following example-

Example- Pizza ordering system that requires three input parameters:

  1. Size, the size can be small, medium, or large.
  2. Crust type, the crust type can be thin or thick.
  3. Toppings, the toppings can be cheese, pepperoni, sausage, mushroom, and onion.

Without using OAT: We would need to test all possible combinations of size, crust type, and toppings, which would require 3 x 2 x 5 = 30 test cases.

Using OAT: However, by using OAT, we can reduce the number of test cases required while still covering all possible combinations of input parameters.

Assuming we use an orthogonal array of strength 2, we can determine the minimum number of test cases required to cover all possible combinations of size, crust type, and toppings as follows:

  • k = 3 (there are three input parameters being tested: size, crust type, and toppings)
  • s = 2 (to ensure that all possible combinations of size, crust type, and toppings are tested, we need to test two input parameters simultaneously)
  • v = 3, 2, 5 (there are three possible values for size, two possible values for crust type, and five possible values for toppings)

Using the orthogonal array formula, we can calculate the minimum number of test cases required to cover all possible combinations of size, crust type, and toppings as follows:

There are three input parameters being tested: A, B, and C (size, crust type, and toppings).

  • Parameter A has three possible values
  • Parameter B has two possible values
  • Parameter C has five possible values.

So, v = 3 (for A), v = 2 (for B), and v = 5 (for C).

Therefore,

vk=31×21×51=30v^k = 3^1 \times 2^1 \times 5^1 = 30

The exponent of 1 for each value is used because each input parameter(size, crust type, and toppings) is being tested only once in this example.

N=vksks=3×2×5232=302=15N = \frac{v^k}{s^{k-s}} = \frac{3 \times 2 \times 5}{2^{3-2}} = \frac{30}{2} = 15

So Now minimum test cases as following-

  • Therefore, we only need to run 15 test cases to cover all possible combinations of size, crust type, and toppings:
  • small-thin-cheese, small-thick-pepperoni, small-thin-sausage, small-thick-mushroom, medium-thin-onion, medium-thick-cheese, medium-thin-pepperoni, medium-thick-sausage, large-thin-mushroom, large-thick-onion, small-thick-cheese, small-thin-pepperoni, small-thick-sausage, small-thin-mushroom, and medium-thick-onion.

Represented in the table form as following-

Test CaseSizeThicknessTopping
1SmallThinCheese
2SmallThickPepperoni
3SmallThinSausage
4SmallThickMushroom
5MediumThinOnion
6MediumThickCheese
7MediumThinPepperoni
8MediumThickSausage
9LargeThinMushroom
10LargeThickOnion
11SmallThickCheese
12SmallThinPepperoni
13SmallThickSausage
14SmallThinMushroom
15MediumThickOnion

How the OAT algorithm can be applied to generate test cases?

The OAT algorithm is a statistical approach that is used to design a set of test cases that can efficiently explore the input space of a software application and help achieve maximum code coverage with minimum test cases. Here are the general steps to apply the OAT algorithm to generate test cases-

  1. Define the input parameters: Identify the input parameters of the software application that need to be tested. For example, in the case of a login form, the input parameters might include username, password, and login button.

  2. Determine the possible values of each parameter: Identify the possible values of each input parameter. For example, the possible values of the username parameter might include valid username, invalid username, and blank username.

  3. Determine the strength of the test: Determine the strength of the test based on the number of parameters and their possible values. For example, a test with two parameters, each with two possible values, would have a strength of two. A test with three parameters, each with three possible values, would have a strength of three.

  4. Select an orthogonal array: Select an orthogonal array that has the appropriate strength to test all possible combinations of input parameters. An orthogonal array is a mathematical structure that ensures that each input parameter is tested at least once and that all possible combinations of input parameters are tested without redundancy.

  5. Assign input values to test cases: Assign input values to each test case based on the selected orthogonal array. Each test case will have a unique combination of input values that corresponds to a row in the orthogonal array.

  6. Execute test cases: Execute the test cases and evaluate the results to ensure that the software application is working as expected.

By following these steps, the OAT algorithm can be applied to generate a set of test cases that efficiently explore the input space of a software application and help achieve maximum code coverage with minimum test cases.

Orthogonal Array Testing Advantages and Disadvantages:

Advantages:

  1. Saves time and resources: By using orthogonal arrays, a smaller number of test cases can cover all possible combinations of input parameters, which can save time and resources during testing.
  2. Ensures coverage: Orthogonal testing ensures that all possible combinations of input parameters are tested, which helps to ensure complete test coverage.
  3. Identifies defects early: By testing a wide range of input parameter combinations, orthogonal testing can help identify defects early in the development cycle.

Disadvantages:

  1. Limited to a specific number of input parameters: Orthogonal testing is limited to a specific number of input parameters, which means that it may not be suitable for testing complex systems with many input parameters.
  2. Requires domain knowledge: To effectively use orthogonal testing, testers need to have a good understanding of the domain and the possible input parameter values, which may require additional training.
  3. Can miss interactions: While orthogonal testing ensures that all possible combinations of input parameters are tested, it does not test for interactions between input parameters, which may lead to defects being missed.