Knowledge share on code coverage

  • 4,699 views
Uploaded on

Knowledge share on code coverage

Knowledge share on code coverage

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
4,699
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

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