What is the difference between Condition coverage and Decision coverage?
I have a simple example:
IF (A && B) THEN
Condition coverage will have two tests (the result will be FALSE):
Decision coverage will have only one test (the result will be TRUE):
Do I understand that right?
In Condition Coverage (also know as Predicate Coverage) each of the boolean expressions must be evaluated to true and false at least once. For example:
IF ((A || B) && C) THEN
To satisfy the condition coverage criteria, you could use the following tests:
A = true | B = not eval | C = false
A = false | B = true | C = true
A = false | B = false | C = not eval
In Decision Coverage (also know as Branch Coverage) you have to test all posible branches. For example:
IF (A){
...
ELSE IF(B) {
...
} ELSE {
...
}
To satisfy the decision coverage criteria for this piece of code you'll need to run 3 tests:
A is evaluated to true
A is evaluated to false and B is evaluated to true
A and B are evaluated to false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With