I have a doubt regarding code coverage.
Consider the below scenario,
If I am having the method Sample() with some parameters and I wrote say example 10 test cases for that method.
While running code coverage, if a part of a code (say for example an if condition) is still not covered.
So if I am going to cover that if condition by writing new test case,
And my doubt is,
Is that single test case is sufficient for that uncovered code? else I have to cover the code by repeating all the existing 10 test cases of that method?
Code coverage 100% alone is not easy task to get.
By your example, it depends on you context(functionality) - it could be two separate scenarios. One is that, by white box testing, you have two existing paths - IF = TRUE or FALSE. Then given set of parameters generate others path inside you function, but if you function is about validation and all you test cases for given scenario tests same result (valid/invalid set of parameters) the expected result is same for all cases. But if you mix success and failure then should be separate.
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