0

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 ?

Y=12
Z=2
   for (x = 0; x < 10; ++x) {
      if (something) {
          break;
      }
      ...
   }
for (x = 0; x < 10; ++x) {
      Y=X+2
      ...
   }
for (x = 0; x < 10; ++x) {
     Z=10+Z
   }
3

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 :

0,1,10,11

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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