samedi 27 février 2016

Testing - acheving condition coverage with nested if's?

I am trying to find out if it's possible to have a set of test inputs that achieves 100% condition coverage for the following code.

bool a = ...;
bool b = ...;
if (a == True){
    if (b == True && a == False){
        ...
    } else{
        ...
    }
} else{
    ...
}

However, most of the resources I have found only deal with one condition. Therefore I am not sure what to do with nested ifs. Specifically, I am not sure what to do with the second if statement. Since "a == False" should never be true given the outer if statement, is it correct to say that this code can never have 100% condition coverage test cases?

Aucun commentaire:

Enregistrer un commentaire