The goal is not to execute all statements in one case, but in all test cases together. Therefor, if you combine the two cases, you cover 100% of the statements.
@@DeepakKumar2105 Because he used negative numbers in the TC2, which means the statement is in the 3rd line is FALSE, therefore we can jump to line 5. And he already covered line 4 in the TC1 which was the TRUE path. A flow chart would be so helpful here.
3:03 how have we covered all the statements in the -ve values for a and b , we only covered 6/7 statements becuase we wont cover the data inside of If statement since its < 0.
The main idea of "statement coverage" is to cover as many statements (declarations, lines) as possible, so, checking the false part of the decision is necessary to achieve 100% of "statement coverage"
Thanks! It is very helpful! Can you please clear that how to find out the total number of statements suppose we have while loop Ex..( a = 10; while (int i=0;i=5;i++) {print a}, do we also count the iterations in the loop as well?? Please any one Thanks!
I am curios to know what people think to achieving 100% code coverage? You think it is not possible in the given time or is that because you do not have good test infrastructure to inject fault and cover error branches?
printSum(int a, int b){ --- --- } printSum(int a, int b) { --- --- } Are we considering same statement count in these two scenarios or do we have to reformat it before doing this process?
For the print sum example , isn't the answer 84% , as the statement printcol("red", result); is not executed and jumps to elseif statement
same thought.
Best explanation I have ever seen!!!!
Agreed
In second case executed statements are 6 not 7. so 6/7*100=85%.
The goal is not to execute all statements in one case, but in all test cases together. Therefor, if you combine the two cases, you cover 100% of the statements.
@@Halfkroon But he skipped the line no.4 in second test case.Then how come statement coverage is 100%.??????
@@DeepakKumar2105 Because he used negative numbers in the TC2, which means the statement is in the 3rd line is FALSE, therefore we can jump to line 5. And he already covered line 4 in the TC1 which was the TRUE path. A flow chart would be so helpful here.
3:03 how have we covered all the statements in the -ve values for a and b , we only covered 6/7 statements becuase we wont cover the data inside of If statement since its < 0.
i think its because both test cases add up and executes all statement
even if test case 2 doesnt cover the statement in the if loop the first one did
could someone explain why he chk again false condition because in statment coverage we dont need to chk false condition
The main idea of "statement coverage" is to cover as many statements (declarations, lines) as possible, so, checking the false part of the decision is necessary to achieve 100% of "statement coverage"
Thank you for the clear video
The video sound is pretty good, beyond my imagination
Very very helpful!! Thank you!!
Thanks! It is very helpful! Can you please clear that how to find out the total number of statements suppose we have while loop Ex..( a = 10; while (int i=0;i=5;i++) {print a}, do we also count the iterations in the loop as well?? Please any one Thanks!
total number of statements is the number of lines of code, counted only once
I am curios to know what people think to achieving 100% code coverage? You think it is not possible in the given time or is that because you do not have good test infrastructure to inject fault and cover error branches?
This should be the video in the Udacity Course explaining test coverage
nice video but that cliff hanger is crazy
in the statement coverage, why line 4 is executed?
Oh! Is it because it’s the combination of the two cases together?
@@zefengwang4777 ohh ! thank u , man
What if your value is 0? Thats not covered in the code? So surely its not 100% covered
Combining test cases 1 and 2 exercises all statements in the code, thus 100% statement coverage.
But why do we say Statement coverage covers only the Ture conditions, It cannot test the false conditions?
yes i got same doubt. but he ran false loop here as well. .
There are 2 test cases the aim is to cover the whole code so with TC#1 we cover one part of it, with TC#2 we cover the remaining part of it ...
Good explanation
printSum(int a, int b){
---
---
}
printSum(int a, int b)
{
---
---
}
Are we considering same statement count in these two scenarios or do we have to reformat it before doing this process?