Thanks:  0
Likes:  0
Dislikes:  0

1. Statement, branch coverage?

i got a some basic doubts

1.Definition of Statement coverage,Branch coverage, Decision coverage (its very help full to explain with small code)

2..How many test case need a some basic loop (if loop, while loop), and how can we calculate the Number of test case for Statement coverage, Branch coverage

regards
prabu

2. Re: Statement, branch coverage?

Branch coverage

if (a&gt;b)
{
print "a";
}
else
{
print "b";
}
•The statement must be true on one occasion and false on another

3. Re: Statement, branch coverage?

Statement coverage - Has each line of the source code been executed?

IF A &gt; B THEN
C = A – B
ELSE
C = A + B
ENDIF

The second line tests both statement and branch coverage

4. Re: Statement, branch coverage?

With statementcoverage you make sure that every executable line of code was executed. If you look at the second example of testking123 the executable lines are the 2nd and 4th line. In order to excute both you will need 2 testcases: one with A&gt;B and one where A&lt;=B.

For branchcoverage, it is slightly more difficult. You could better draw the code out in nodes: consider the following code:

1. If A = B Then
2. Message "Equal"
3. Else
4. If B = C Then
5. Message "something else"
6. Else
7. Message "Not equal"
8. End If
9. End If

The first node is on line 1, from this you get 2 possible outcomes (2 lines) one leads to the end (A=B) and one to another node (on line 4) with also 2 possile outcomes. Your drawing should show 2 nodes and 3 lines to the end. THese 3 lines are your brances. In order to test them, you will need 3 testcases: A=B, A&lt;&gt;B and B = C, A&lt;&gt;B and B&lt;&gt;C.

In decisioncoverage you look at the drawing again, take all the nodes and make sure that you have covered every possible outcome.

5. Re: Statement, branch coverage?

I would strongly suggest that if you are looking to apply these techniques that you either get some books on the subject or that you attend a course on there application especially if you have your doubts.

With simple examples this all appears easy to apply the same is not true when working with complex source code. On the plus side there are tools depending on which languages you are working with that can produce this information for you (I believe). This could allow you to provide this service much quicker.

6. Re: Statement, branch coverage?

Statement Coverage:
In this the test case is executed in such a way that every statement of the code is executed at least once.
Branch/Decision Coverage:
Test coverage criteria requires enough test cases such that each condition in a decision takes on all possible outcomes at least once, and each point of entry to a program or
subroutine is invoked at least once. That is, every branch (decision) taken each way,true and false. It helps in validating all the branches in the code making sure that no
branch leads to abnormal behavior of the application.
Best example of statement coverage and Branch/Decision Coverage is given in http://ajoysingha.info/Documents/Bra...20Coverage.pdf

7. Re: Statement, branch coverage?

I see you're still copying stuff from other sites without attribution, Priyankaa, let alone reviving 3-year-old threads.

8. Re: Statement, branch coverage?

Yup, there about 5 of them from Mindfire Solutions that are all doing the same thing.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.