mardi 28 août 2018

Equivalence classes exercise

I'm new to Equivalence Classes and I'm trying to solve the following:

In a simulation software used in underwater diving, a method "CalculateDiving(int depth, int oxygen) throws ImmersionException" calculates the maximum time of diving, given the oxygen percentage in the oxygen cylinders and the depth in which you are. The oxygen can be in the range 21..36%. Depth is in the range 10..50 meters. If the oxygen is more than 30%, the maximum depth is 40 meters. Beyond this depth an exception is raised (ImmersionException)

So, my attempt at finding the equivalence classes is the following:

O1 = {oxygen: 21 <= oxygen <= 30}
O2 = {oxygen: 30 < oxygen <= 36}
P1 = {depth: 10 <= depth <= 40}
P2 = {depth: depth > 40}

And this is my attempt at writing WECT test cases (Weak Equivalence Class Testing)

+-----------+--------+-------+-----------+
| Test Case | Oxygen | Depth |  Output   |
+-----------+--------+-------+-----------+
| WECT1     |     25 |    30 | time1     |
| WECT2     |     35 |    40 | time2     |
| WECT3     |     35 |    50 | exception |
+-----------+--------+-------+-----------+

I am not sure if this is correct as I've read the maximum number of test cases should be 2 not 3.

The exercise also asks to write 3 test cases following the Robust Worst Case Testing, is it similar to what I have done above?

Thanks.

Aucun commentaire:

Enregistrer un commentaire