Relational Operator Coverage
Overview
Let’s understand the Relational operator coverage metric in this tutorial. This metric measures that the relational operators in the program are covered during testing. This is a white box testing metric.
A relational operator is a symbol that compares two values or expressions and determines their relationship. These operators are commonly used in programs to create conditions and make decisions based on the comparisons.
Relational Operator Coverage
Relational Operator Coverage measure reports whether boundary situations occur with relational operators (<, <=, >, >=). The hypothesis is that boundary test cases find off-by-one errors and mistaken uses of wrong relational operators, such as < instead of <=.
Example
Let’s consider the following simple code fragment with an if statement. The if statement condition a < b consists of a relational operator ( < ):
if (a < b)
statement;
The test reports whether the situation a==b occurs. If a==b occurs and the program behaves correctly, you can assume the relational operator is not supposed to be < instead of <= operator.
—
Software Testing Tutorials:
https://www.testingdocs.com/software-testing-tutorials/