Your SlideShare is downloading. ×
0
Knowledge share on code coverage
Knowledge share on code coverage
Knowledge share on code coverage
Knowledge share on code coverage
Knowledge share on code coverage
Knowledge share on code coverage
Knowledge share on code coverage
Knowledge share on code coverage
Knowledge share on code coverage
Knowledge share on code coverage
Knowledge share on code coverage
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Knowledge share on code coverage

5,026

Published on

Knowledge share on code coverage

Knowledge share on code coverage

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,026
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
98
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Knowledge Share on Code Coverage<br />Magus Chen<br />maguschen@hotmail.com<br />http://magustest.com/blog/<br />
  • 2. Agenda<br />What is Code Coverage<br />How it Works<br />Common Mistakes<br />Some Thoughts<br />References<br />2<br />
  • 3. What is Code Coverage<br />Code coverage is a measure used in software testing. It describes the degree to which the source code of a program has been tested. <br />3<br />
  • 4. What is Code Coverage<br />Statement coverage<br />Decision(Branch) coverage<br />Condition coverage<br />Condition/decision coverage<br />Function coverage<br />http://en.wikipedia.org/wiki/Code_coverage<br />http://www.javaranch.com/journal/2004/01/IntroToCodeCoverage.html<br />http://www.exampler.com/testing-com/writings/coverage-terminology.html<br />4<br />
  • 5. How does Code Coverage Works<br />Essentially all code coverage tools instrument the code in order to check which parts of the code were executed.<br />When test executed, code coverage tool will collect <br />Usually there are some tools can parse the coverage result data file and generate a report<br />http://www.bullseye.com/paper.html<br />5<br />
  • 6. Common Mistakes<br />Try to reach 100% coverage<br />Some part of the code is hard to reach<br />Non-critical code should be set low priority<br />Follow the idea of the code<br />The existence code looks good and we get 100% coverage, the problem is that feature cannot be found in the code(never written) <br />Confuse high coverage with high quality<br />The most useful information of code coverage report can tell us is which lines in the application were not being test.<br />6<br />
  • 7. Some Thoughts<br />Run the test against AUT<br />Check code coverage report and retest<br />Phase I<br />Target on simple feature test<br />Filter current feature related code and indentify the untest code (Line coverage)<br />Add more test case to cover those untest code<br />Phase II<br />Target on most critical feature test<br />Filter current feature related code and indentify the untest code (Branch coverage)<br />Add more test case to fulfill the branch coverage<br />7<br />
  • 8. References on Tools<br />http://ltp.sourceforge.net/coverage/lcov.php<br />http://gcc.gnu.org/onlinedocs/gcc/Gcov.html<br />http://www.bobah.net/d4d/tools/code-coverage-with-gcov<br />http://www.network-theory.co.uk/docs/gccintro/gccintro_81.html<br />http://open-tube.com/10-code-coverage-tools-c-c<br />8<br />
  • 9. Other Tool Candidates<br />http://www.testcocoon.org/ (OPRE SOURCE)<br />http://covtool.sourceforge.net/ (OPRE SOURCE)<br />http://www.testwell.fi/ctcdesc.html (commercial)<br />http://www.bullseye.com/productInfo.html (commercial)<br />9<br />
  • 10. Q &amp; A<br />10<br />
  • 11. Thank you<br />

×