I'd like to understand what is domain testing, and how do we use it to calculate coverage (if possible)? My question is imagine I have 3 loops in series and I'm using domain testing approach how many test cases are necessary to achieve path coverage ?

   for (x = 0; x < 10; ++x) {
      if (something) {
for (x = 0; x < 10; ++x) {
for (x = 0; x < 10; ++x) {

1 Answer 1


Domain testing is an umbrella term for Equivalent partition and boundary value analysis. Here, we try to cover all the available behaviours of a system by using the least number of inputs. Here domain means each partition that is created.

Equivalent partition means we divide the inputs into different partitions, here each partition means input value range for which the behaviour of the system is identical (means remains the same)

Boundary value analysis means the boundary values of the partitions we found eg if 1 to 5 is a partition then 1 and 5.

For example, consider a system that takes all non zero positive numbers less than 10.

Here the Equivalent partition would be:

**Invalid**: -infinity to 0
**Valid**:    1 to 10
**Invalid**:  11 to +infinity

And the boundary values would be :


So to test this system you can use all the identified boundary values and any, one value from each partition eg -10,5,16

For your given code:

Unless there is a defined behaviour difference for each value of y and z you cannot create a partition table.

There should be clear stating of valid and invalid values for these fields.

From a normal test perspective as there are 3 for loop and, only one for-loop has a condition. you could get 100 % coverage by using two inputs (one to make something false and one to make something true )

As there is no other condition, all the codes will get executed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.