Testing with equivalence classes

Test with equivalence classes using TPT.

Equivalence classes in the test case design are used to reasonably reduce the number of test cases. An equivalence class describes a value range. It is expected that that system under test reacts the same, no matter which value from that class you use as input. So it is common to specify a representative value and use it for testing instead of testing all of the values of that class. You should of course also test the smallest and the biggest value of an equivalence class to check if the system under test changes or keeps its behavior as expected.

In the natural language, equivalence classes are for example “fast”, “slow”, “bright”, or “dark”. It is up to you to specify what for example is regarded as “bright” or “dark”.

Specifying equivalence classes or sets of equivalence classes is an easy task with TPT. The equivalence classes can afterwards be used in the test model. For example, the equivalence class “bright” should be applied to the signal “light_intensity” in the step list to test the reaction of the system to the smallest value from that class. You would simply enter “ec.bright.min” as value to the signal “light_intensity”. “ec” stands for equivalence class, “bright” is the name of the class, and “min” refers to the smallest value (boundary value) of the given class.

When you change the range of the equivalence class “bright”, “ec.bright.min” would still test the smallest value. Thus, it’s a good idea to use equivalence classes to keep the tests readable and maintainable.

With TPT, you can also automatically generate test cases based on equivalence classes.

To find out if all relevant equivalence classes were used in the tests or if “forbidden” equivalence classes where applied, just make use of the so-called Equivalence Class assesslet in TPT.

With these powerful features it is very easy to fulfill the requirements of the ISO26262 safety standard.