# Test configuration generation in Combinatorial testing – Example | Set-2

We have discussed the algorithm used for test configuration generation in the article Test Configuration Generation in Combinatorial Testing. Let’s understand the algorithm in-depth with a solved example given below.

### Example

Consider an application that works on any of the three browsers: Safari, Internet Explorer and Firefox. The application runs on three Operating systems including Windows, macOS, and Linux. The application is able to connect to the devices using three connection protocols including LAN, PPP, and ISDN. Also, the output is sent to a printer that is either local or networked or is sent to a screen by the application. For the given application, do the following:

- Identify the factors and levels in the given problem
- Generate test configuration for the application using MOLS which satisfy the following constraints:
- Safari supports only macOS
- Internet Explorer works only on Windows
- Firefox works on all the three OS, i.e. macOS, Windows, and Linux

**Solution: **

**1. Identify factors and levels**

For the given problem, the factors and levels are:

FACTORS | LEVELS |
---|---|

F1′ : Browser | Safari, Internet Explorer, Firefox |

F2′ : Operating System | Windows, macOS, Linux |

F3′ : Protocol | LAN, PPP, ISDN |

F4′ : Printer | Network, Local, To_Screen |

Therefore, there are a total of **4 factors and each factor has 3 levels**.

**2. Generate test configuration**

**(a) Relabel the factors**

Factors have to be relabeled such that :

Since, |F1| = |F2| = |F3| = |F4| = 3 So, the relation |F1| >= |F2| >= |F3| >= .........|Fn-1| >= |Fn| is satisfied. Therefore, factors are labeled as: F1 = F1' F2 = F2' F3 = F3' F4 = F4' Also, as b = |F1| and k = |F2|, Therefore, b = 3 and k = 3

**NOTE: **|Fi| is the number of levels in factor Fi. Also, b denotes the number of blocks and k denotes the number of rows in each block.

**(b) Prepare a table and fill columns F1 and F2**

Let’s now prepare a table containing 4 columns since there are four factors. Also, we need ( b x k ) number of rows, i.e. ( 3 x 3 ) = 9 rows divided into 3 blocks. Now, we fill Column F1 with 1s in Block 1, 2s in Block 2, and so on. Also, we fill the Column F2 using the sequence 1,2,3……k in Rows 1 through k. The table prepared is as follows:

BLOCK | ROW | F1 | F2 | F3 | F4 |
---|---|---|---|---|---|

1 | 1 | 1 | 1 | ||

1 | 2 | 1 | 2 | ||

1 | 3 | 1 | 3 | ||

2 | 1 | 2 | 1 | ||

2 | 2 | 2 | 2 | ||

2 | 3 | 2 | 3 | ||

3 | 1 | 3 | 1 | ||

3 | 2 | 3 | 2 | ||

3 | 3 | 3 | 3 |

**(c) Find MOLS of order k and fill the rest of the columns**

Since k = 3, So, MOLS of order 3 are required. We know that if k is a prime or power of prime then number of MOLS = k - 1 As k = 3 is prime, therefore 2 MOLS exists that are: 1 2 3 1 2 3 M1 = 2 3 1 M2 = 3 1 2 3 1 2 2 3 1

We fill the remaining two columns using the columns of M1 for F3 and columns of M2 for F4:

BLOCK | ROW | F1 | F2 | F3 | F4 |
---|---|---|---|---|---|

1 | 1 | 1 | 1 | 1 | 1 |

1 | 2 | 1 | 2 | 2 | 3 |

1 | 3 | 1 | 3 | 3 | 2 |

2 | 1 | 2 | 1 | 2 | 2 |

2 | 2 | 2 | 2 | 3 | 1 |

2 | 3 | 2 | 3 | 1 | 3 |

3 | 1 | 3 | 1 | 3 | 3 |

3 | 2 | 3 | 2 | 1 | 2 |

3 | 3 | 3 | 3 | 2 | 1 |

**(d) Check if constraints are satisfied **

In the given problems, factors **F1(Browser) and F2 (Operating system) are dependent on each other** as:

- Safari supports only macOS
- Internet Explorer works only on Windows
- Firefox works on all the three OS, i.e. macOS, Windows, and Linux

So, an entry in the row is highlighted in yellow if it does not satisfy the constraints mentioned above:

BLOCK | ROW | F1 | F2 | F3 | F4 |
---|---|---|---|---|---|

1 | 1 | 1 | 1 | 1 | 1 |

1 | 2 | 1 | 2 | 2 | 3 |

1 | 3 | 1 | 3 | 3 | 2 |

2 | 1 | 2 | 1 | 2 | 2 |

2 | 2 | 2 | 2 | 3 | 1 |

2 | 3 | 2 | 3 | 1 | 3 |

3 | 1 | 3 | 1 | 3 | 3 |

3 | 2 | 3 | 2 | 1 | 2 |

3 | 3 | 3 | 3 | 2 | 1 |

In the above table, there are four rows that do not satisfy the given constraints. For example, Row 1 of Block 1, F1 = 1 and F2 = 1, i.e. F1 is Safari and F2 is Windows, however, it is clearly mentioned in the first constraint that Safari only supports macOS and no other operating system. Hence, this row does not satisfy the constraints and is hence highlighted.

**(e) Remove configurations that do not satisfy given constraints**

The configurations that are highlighted in yellow in the above table have to be removed and to do this, we will use a two-step procedure:

- Modify the highlighted rows so that the constraints are maintained
- Add new configurations that cover the pairs that were left uncovered while replacing the highlighted rows

So, in the first step, we modify the above-highlighted rows such that these rows satisfy the given constraints. The modified table is shown below:

BLOCK | ROW | F1 | F2 | F3 | F4 |
---|---|---|---|---|---|

1 | 1 | 1 | 2 | 1 | 1 |

1 | 2 | 1 | 2 | 2 | 3 |

1 | 3 | 1 | 2 | 3 | 2 |

2 | 1 | 2 | 1 | 2 | 2 |

2 | 2 | 2 | 1 | 3 | 1 |

2 | 3 | 2 | 1 | 1 | 3 |

3 | 1 | 3 | 1 | 3 | 3 |

3 | 2 | 3 | 2 | 1 | 2 |

3 | 3 | 3 | 3 | 2 | 1 |

For the second step, The new configurations are as follows: F1 F2 F3 F4 - 1 1 1 ....(A) - 3 3 2 ....(B) - 2 3 1 ....(C) - 3 1 3 ....(D) Here, '-' denotes that F1 could take any value out of 1,2,3.

**(A) and (C) is already satisfied** in the above table since:

- F2 = 1 and F3 = 1 is occurring in Row 3 of Block 2. Also, F3 = 1 and F4 = 1 is occurring in Row 1 of Block 1. Hence, (A) is satisfied
- Similarly, F2 = 2 and F3 = 3 is occurring in Row 3 of Block 1 and F3 = 3 and F4 = 1 is occurring in Row 2 of Block 2. Hence, (C) is satisfied

However, (B) and (D) are not satisfied in the above table, so we add them to the unique configuration table. The updated table is shown below:

BLOCK | ROW | F1 | F2 | F3 | F4 |
---|---|---|---|---|---|

1 | 1 | 1 | 2 | 1 | 1 |

1 | 2 | 1 | 2 | 2 | 3 |

1 | 3 | 1 | 2 | 3 | 2 |

2 | 1 | 2 | 1 | 2 | 2 |

2 | 2 | 2 | 1 | 3 | 1 |

2 | 3 | 2 | 1 | 1 | 3 |

3 | 1 | 3 | 1 | 3 | 3 |

3 | 2 | 3 | 2 | 1 | 2 |

3 | 3 | 3 | 3 | 2 | 1 |

4 | 1 | – | 3 | 3 | 2 |

4 | 2 | – | 3 | 1 | 3 |

**(f) Replace the numbers in the columns with the given factor values**

We now replace the values of columns F1, F2, F3 and F4 with their actual value i.e. levels. The **final design configuration** is as shown below:

S.No. | F1 | F2 | F3 | F4 |
---|---|---|---|---|

1 | 1 [Safari] | 2 [macOS] | 1 [LAN] | 1 [Network] |

2 | 1 [Safari] | 2 [macOS] | 2 [PPP] | 3 [To_Screen] |

3 | 1 [Safari] | 2 [macOS] | 3 [ISDN] | 2 [Local] |

4 | 2 [Internet Explorer] | 1 [Windows] | 2 [PPP] | 2 [Local] |

5 | 2 [Internet Explorer] | 1 [Windows] | 3 [ISDN] | 1 [Network] |

6 | 2 [Internet Explorer] | 1 [Windows] | 1 [LAN] | 3 [To_Screen] |

7 | 3 [Firefox] | 1 [Windows] | 3 [ISDN] | 3 [To_Screen] |

8 | 3 [Firefox] | 2 [macOS] | 1 [LAN] | 2 [Local] |

9 | 3 [Firefox] | 3 [Linux] | 2 [PPP] | 1 [Network] |

10 | – | 3 [Linux] | 3 [ISDN] | 2 [Local] |

11 | – | 3 [Linux] | 1 [LAN] | 3 [To_Screen] |

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the **CS Theory Course** at a student-friendly price and become industry ready.