I am working on an assignment that is asking me to not find a fault with 100% branch coverage and can make a test suite that achieves less than 100% branch coverage but DOES reveal the fault.
I really don't understand how this could be possible other than having a third input that has absolutely nothing to do with how the branching in the program works and only if that input is messed with could the branches not hit every branch yet still show it.
Like maybe
public int problemMethod(int a, int b, int c)
{
if(a > b)
{
return (a/c);
}
else
{
return 1;
}
}
Like in this case I could go down every branch and get 100% branch coverage and not find the fault if c is never 0. But I could just do 1 test case where a IS > b and c IS 0. That would mean that I found the error but I never did the else branch. Meaning 50% branch testing but found the fault.
Right? I am just really confused on the wording of this problem.
Aucun commentaire:
Enregistrer un commentaire