
This blog post explores input space partitioning coverage criteria through a detailed example involving triangle classification based on side lengths. It covers various coverage criteria including all combinations, pairwise, and multiple base choice coverage, while emphasizing the importance of defining valid test cases and recognizing infeasible combinations.
In this final lecture on input space partitioning, we will recap the concepts covered in previous sessions and delve into a practical example involving triangle classification based on side lengths. We will explore various coverage criteria that can be defined using input space partitioning.
We began the week by discussing functional testing and its popular categories. We then focused on input space partitioning, a core functional testing technique. In previous lectures, we examined different methods of partitioning inputs, including interface-based and functionality-based partitioning. We also defined six coverage criteria based on input space partitioning:
To illustrate these coverage criteria, we will use the triangle type example, which classifies a triangle based on the lengths of its three sides. The program determines whether the triangle is valid, scalene, isosceles, or equilateral based on the input sides.
For our triangle type example, we will consider the relationship of each side to zero and one. The criteria for valid triangles state that if any side is less than or equal to zero, the triangle is invalid. The valid triangles are classified as follows:
We will define four partitions based on the relationship of each side to zero:
Using the defined partitions, we can generate test cases for each coverage criterion.
For ACC, we calculate the total number of test cases using the formula:
Enumerating all 64 test cases is impractical, but we can start by varying one side while keeping the others constant. For example:
This method continues until all combinations are exhausted.
Pairwise coverage is a more efficient criterion. For our triangle example, we can derive 16 test cases by ensuring that every pair of partitions is covered. For instance:
This approach reduces the number of test cases significantly while still ensuring coverage.
In MBCC, we select multiple base choices for our test cases. For example, if we choose two base choices, we can derive 20 tests, but after removing redundancies, we can arrive at 16 unique test cases. The base choices might include:
While defining test cases, we must also be aware of infeasible combinations. For instance, if we have a partition stating that the list has exactly one element, it cannot coexist with a partition stating that the element is found more than once. Such combinations must be ruled out to ensure valid test cases.
Constraints help us manage infeasible test requirements. There are two types of constraints:
By applying these constraints, we can refine our test cases and ensure they are feasible.
In this lecture, we explored input space partitioning and its application in defining coverage criteria through a practical example of triangle classification. We discussed various coverage criteria, the importance of defining valid test cases, and the need to recognize infeasible combinations. Next week, we will transition to a new module on mutation testing, concluding our exploration of input space partitioning.
Paste a YouTube link and let Magica create the key takeaways.
Summarize another video