For example here is my scenario:
function A() {
C();
}
function B() {
C();
}
function C() {
if (someState > 0) then doSomething();
else doSomethingElse();
}
I want to make all test case that coverage all code. Because C() has a condition so for testing C(), we need two testing method: testC1() and testC2(). So the total test is: testA_C1() testA_C2() testB_C1() testB_C1(). Number of testing methods will be increased dramatically when there are more conditions, and there are more methods that use same method C()
The problem here is: C() is not depend on any state of A() and B(), so in fact I think C() can be tested separately. So I think we can save a big amount of unit test.
My question is: How can I test in this scenario. I'm using Powermock for Android Testing.
Thanks :)
Aucun commentaire:
Enregistrer un commentaire