Play Video
1
Adding code coverage to your Team Build
Adding code coverage to your Team Build
::2011/10/03::
Play Video
2
What is Code Coverage and Unit Testing?
What is Code Coverage and Unit Testing?
::2012/09/08::
Play Video
3
5 Code Coverage
5 Code Coverage
::2009/10/14::
Play Video
4
Features of a code coverage tool
Features of a code coverage tool
::2013/10/07::
Play Video
5
Hitler Reacts to Low Code Coverage
Hitler Reacts to Low Code Coverage
::2012/12/10::
Play Video
6
Advanced Software Testing:  Code Coverage
Advanced Software Testing: Code Coverage
::2011/08/12::
Play Video
7
.NET Code Coverage for Continuous Integration using TeamCity and dotCover
.NET Code Coverage for Continuous Integration using TeamCity and dotCover
::2014/06/12::
Play Video
8
CodeCoverage in Visual Studio 2010
CodeCoverage in Visual Studio 2010
::2012/05/06::
Play Video
9
Code Coverage - New Capabilities in Mainframe Application Development
Code Coverage - New Capabilities in Mainframe Application Development
::2014/04/02::
Play Video
10
Javascript CI and Code Coverage with Jenkins, QUnit, Grunt and Istanbul
Javascript CI and Code Coverage with Jenkins, QUnit, Grunt and Istanbul
::2014/03/30::
Play Video
11
Comparison of code coverage tools
Comparison of code coverage tools
::2013/11/18::
Play Video
12
Visual Studio 2010 ALM for Absolute Beginners - Lesson 14 : Unit Testing and Code Coverage
Visual Studio 2010 ALM for Absolute Beginners - Lesson 14 : Unit Testing and Code Coverage
::2012/07/17::
Play Video
13
UPHPU - 11/21/2013 - PHPUnit Code Coverage by Joseph Scott
UPHPU - 11/21/2013 - PHPUnit Code Coverage by Joseph Scott
::2014/01/22::
Play Video
14
New in NetBeans IDE 8.0.1: Karma Istanbul Code Coverage
New in NetBeans IDE 8.0.1: Karma Istanbul Code Coverage
::2014/09/15::
Play Video
15
Rational Developer for System z (v9.1): Using Code Coverage
Rational Developer for System z (v9.1): Using Code Coverage
::2014/08/28::
Play Video
16
Code Coverage and ISO 26262
Code Coverage and ISO 26262
::2014/10/10::
Play Video
17
Code Coverage Tools to Help You Meet Structural Coverage Analysis Objectives
Code Coverage Tools to Help You Meet Structural Coverage Analysis Objectives
::2013/11/28::
Play Video
18
Code Coverage Visualization With NCover Bolt
Code Coverage Visualization With NCover Bolt
::2014/02/05::
Play Video
19
(PHPStorm + Laravel) Part 23 - Code Coverage
(PHPStorm + Laravel) Part 23 - Code Coverage
::2014/10/12::
Play Video
20
Code coverage integration with Rational Team Concert in Rational Application Developer V8.0 beta
Code coverage integration with Rational Team Concert in Rational Application Developer V8.0 beta
::2010/06/25::
Play Video
21
Python code coverage in NetBeans
Python code coverage in NetBeans
::2008/12/16::
Play Video
22
Testing and Code Coverage in OVSDB project
Testing and Code Coverage in OVSDB project
::2014/08/12::
Play Video
23
Code Coverage Levels and Security Standards
Code Coverage Levels and Security Standards
::2014/09/10::
Play Video
24
Code Coverage in Active-HDL
Code Coverage in Active-HDL
::2012/05/15::
Play Video
25
Running your own code coverage tools in Python - Allison Kaptur
Running your own code coverage tools in Python - Allison Kaptur
::2014/08/21::
Play Video
26
Глеб Смирнов — Мутационное тестирование, или О чём молчит Code Coverage
Глеб Смирнов — Мутационное тестирование, или О чём молчит Code Coverage
::2013/12/29::
Play Video
27
Verifysoft: Code Coverage und statische Analyse für Anspruchsvolle
Verifysoft: Code Coverage und statische Analyse für Anspruchsvolle
::2014/12/10::
Play Video
28
Dead Code and Code Coverage
Dead Code and Code Coverage
::2014/06/24::
Play Video
29
DevPartner Code Coverage Analysis Demo
DevPartner Code Coverage Analysis Demo
::2012/01/24::
Play Video
30
Analyzing code coverage in .NET applications with JetBrains dotCover
Analyzing code coverage in .NET applications with JetBrains dotCover
::2010/07/01::
Play Video
31
Code Coverage C#
Code Coverage C#
::2014/06/25::
Play Video
32
Q&A Training   Unit Testing and Code Coverage
Q&A Training Unit Testing and Code Coverage
::2014/08/04::
Play Video
33
Code Coverage With Eclipse and gcov for Embedded System
Code Coverage With Eclipse and gcov for Embedded System
::2014/12/26::
Play Video
34
Code Coverage and ISO 26262
Code Coverage and ISO 26262
::2014/10/10::
Play Video
35
TeamCity User Guide (Part 6 of 9) - Code Analysis
TeamCity User Guide (Part 6 of 9) - Code Analysis
::2013/05/13::
Play Video
36
VSTS 2008 Code Coverage 1 of 1
VSTS 2008 Code Coverage 1 of 1
::2009/11/06::
Play Video
37
NCover Creating A New Code Coverage Project
NCover Creating A New Code Coverage Project
::2013/06/26::
Play Video
38
Ruby code coverage in NetBeans
Ruby code coverage in NetBeans
::2008/12/16::
Play Video
39
Yii, NetBeans 7.3, PHPUnit, CodeCoverage és SkeletonGenerator Windows 8-ra (part 2)
Yii, NetBeans 7.3, PHPUnit, CodeCoverage és SkeletonGenerator Windows 8-ra (part 2)
::2013/05/05::
Play Video
40
Yii, NetBeans 7.3, PHPUnit, CodeCoverage és SkeletonGenerator Windows 8-ra (part 4)
Yii, NetBeans 7.3, PHPUnit, CodeCoverage és SkeletonGenerator Windows 8-ra (part 4)
::2013/05/05::
Play Video
41
Squish Coco Webinar: How to Improve Testing Coverage with Automated Code Coverage Analysis HD
Squish Coco Webinar: How to Improve Testing Coverage with Automated Code Coverage Analysis HD
::2014/05/08::
Play Video
42
Yii, NetBeans 7.3, PHPUnit, CodeCoverage és SkeletonGenerator Windows 8-ra (part 1)
Yii, NetBeans 7.3, PHPUnit, CodeCoverage és SkeletonGenerator Windows 8-ra (part 1)
::2013/06/06::
Play Video
43
code coverage
code coverage
::2011/06/23::
Play Video
44
Code coverage visualization by vim + omake + gcov
Code coverage visualization by vim + omake + gcov
::2011/08/29::
Play Video
45
StorTrack - How to Set Zip Code Coverage
StorTrack - How to Set Zip Code Coverage
::2014/03/14::
Play Video
46
Raspberry Pi Code Coverage with the LDRA tool suite
Raspberry Pi Code Coverage with the LDRA tool suite
::2013/11/28::
Play Video
47
Using Thresholds To Manage Code Coverage Levels With NCover
Using Thresholds To Manage Code Coverage Levels With NCover
::2013/06/26::
Play Video
48
Code Dx - Software Assurance and Complete Code Coverage Tool | SAST
Code Dx - Software Assurance and Complete Code Coverage Tool | SAST
::2013/10/30::
Play Video
49
KPI - Percent Code Coverage #1
KPI - Percent Code Coverage #1
::2006/07/19::
Play Video
50
KPI - Percent Code Coverage #4
KPI - Percent Code Coverage #4
::2006/07/19::
NEXT >>
RESULTS [51 .. 101]
From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computer science, code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite. A program with high code coverage has been more thoroughly tested and has a lower chance of containing software bugs than a program with low code coverage. Many different metrics can be used to calculate code coverage; some of the most basic are the percent of program subroutines and the percent of program statements called during execution of the test suite.

Code coverage was among the first methods invented for systematic software testing. The first published reference was by Miller and Maloney in Communications of the ACM in 1963.[1]

Coverage criteria[edit]

To measure what percentage of code has been exercised by a test suite, one or more coverage criteria are used. Coverage criteria is usually defined as a rule or requirement, which test suite needs to satisfy.[2]

Basic coverage criteria[edit]

There are a number of coverage criteria, the main ones being:[3]

  • Function coverage - Has each function (or subroutine) in the program been called?
  • Statement coverage - Has each statement in the program been executed?
  • Branch coverage - Has each branch (a.k.a. DD-path) of each control structure (such as in if and case statements) been executed? For example, given an if statement, have both the true and false branches been executed? Another way of saying this is, has every edge in the program been executed?
  • Condition coverage (or predicate coverage) - Has each Boolean sub-expression evaluated both to true and false?

For example, consider the following C function:

int foo (int x, int y)
{
    int z = 0;
    if ((x>0) && (y>0))
    {
        z = x;
    }
    return z;
}

Assume this function is a part of some bigger program and this program was run with some test suite.

  • If during this execution function 'foo' was called at least once, then function coverage for this function is satisfied.
  • Statement coverage for this function will be satisfied if it was called e.g. as foo(1,1), as in this case, every line in the function is executed including z = x;.
  • Tests calling foo(1,1) and foo(0,1) will satisfy branch coverage because, in the first case, the 2 if conditions are met and z = x; is executed, while in the second case, the first condition (x>0) is not satisfied, which prevents executing z = x;.
  • Condition coverage can be satisfied with tests that call foo(1,1), foo(1,0) and foo(0,0). These are necessary because in the first two cases, (x>0) evaluates to true, while in the third, it evaluates false. At the same time, the first case makes (y>0) true, while the second and third make it false.

Condition coverage does not necessarily imply branch coverage. For example, consider the following fragment of code:

if a and b then

Condition coverage can be satisfied by two tests:

  • a=true, b=false
  • a=false, b=true

However, this set of tests does not satisfy branch coverage since neither case will meet the if condition.

Fault injection may be necessary to ensure that all conditions and branches of exception handling code have adequate coverage during testing.

Modified condition/decision coverage[edit]

Combination of function coverage and branch coverage is sometimes also called decision coverage. This criterion requires that every point of entry and exit in the program have been invoked at least once, and every decision in the program have taken on all possible outcomes at least once. In this context the decision is a boolean expression composed of conditions and zero or more boolean operators. This definition is not the same as branch coverage,[4] however, some do use the term decision coverage as a synonym for branch coverage.[5]

Condition/decision coverage requires that both decision and condition coverage been satisfied. However, for safety-critical applications (e.g., for avionics software) it is often required that modified condition/decision coverage (MC/DC) be satisfied. This criterion extends condition/decision criteria with requirements that each condition should affect the decision outcome independently. For example, consider the following code:

if (a or b) and c then

The condition/decision criteria will be satisfied by the following set of tests:

  • a=true, b=true, c=true
  • a=false, b=false, c=false

However, the above tests set will not satisfy modified condition/decision coverage, since in the first test, the value of 'b' and in the second test the value of 'c' would not influence the output. So, the following test set is needed to satisfy MC/DC:

  • a=false, b=false, c=true
  • a=true, b=false, c=true
  • a=false, b=true, c=true
  • a=false, b=true, c=false

Multiple condition coverage[edit]

This criterion requires that all combinations of conditions inside each decision are tested. For example, the code fragment from the previous section will require eight tests:

  • a=false, b=false, c=false
  • a=false, b=false, c=true
  • a=false, b=true, c=false
  • a=false, b=true, c=true
  • a=true, b=false, c=false
  • a=true, b=false, c=true
  • a=true, b=true, c=false
  • a=true, b=true, c=true

Parameter value coverage[edit]

Parameter value coverage (PVC) requires that in a method taking parameters, all the common values for such parameters been considered. The idea is that all common possible values for a parameter are tested.[6] For example, common values for a string are: 1) null, 2) empty, 3) whitespace (space, tabs, newline), 4) valid string, 5) invalid string, 6) single-byte string, 7) double-byte string. It may also be appropriate to use very long strings. Failure to test each possible parameter value may leave a bug. Testing only one of these could result in 100% code coverage as each line is covered, but as only one of seven options are tested, there is only 14.2% PVC.

Other coverage criteria[edit]

There are further coverage criteria, which are used less often:

  • Linear Code Sequence and Jump (LCSAJ) coverage a.k.a. JJ-Path coverage - has every LCSAJ/JJ-path been executed?[7]
  • Path coverage - Has every possible route through a given part of the code been executed?
  • Entry/exit coverage - Has every possible call and return of the function been executed?
  • Loop coverage - Has every possible loop been executed zero times, once, and more than once?
  • State coverage - Has each state in a finite-state machine been reached and explored?

Safety-critical applications are often required to demonstrate that testing achieves 100% of some form of code coverage.

Some of the coverage criteria above are connected. For instance, path coverage implies decision, statement and entry/exit coverage. Decision coverage implies statement coverage, because every statement is part of a branch.

Full path coverage, of the type described above, is usually impractical or impossible. Any module with a succession of n decisions in it can have up to 2^n paths within it; loop constructs can result in an infinite number of paths. Many paths may also be infeasible, in that there is no input to the program under test that can cause that particular path to be executed. However, a general-purpose algorithm for identifying infeasible paths has been proven to be impossible (such an algorithm could be used to solve the halting problem).[8] Basis path testing is for instance a method of achieving complete branch coverage without achieving complete path coverage.[9]

Methods for practical path coverage testing instead attempt to identify classes of code paths that differ only in the number of loop executions, and to achieve "basis path" coverage the tester must cover all the path classes.[citation needed][clarification needed]

In practice[edit]

The target software is built with special options or libraries and/or run under a special environment such that every function that is exercised (executed) in the program(s) is mapped back to the function points in the source code. This process allows developers and quality assurance personnel to look for parts of a system that are rarely or never accessed under normal conditions (error handling and the like) and helps reassure test engineers that the most important conditions (function points) have been tested. The resulting output is then analyzed to see what areas of code have not been exercised and the tests are updated to include these areas as necessary. Combined with other code coverage methods, the aim is to develop a rigorous, yet manageable, set of regression tests.

In implementing code coverage policies within a software development environment, one must consider the following:

  • What are coverage requirements for the end product certification and if so what level of code coverage is required? The typical level of rigor progression is as follows: Statement, Branch/Decision, Modified Condition/Decision Coverage(MC/DC), LCSAJ (Linear Code Sequence and Jump)
  • Will code coverage be measured against tests that verify requirements levied on the system under test (DO-178B)?
  • Is the object code generated directly traceable to source code statements? Certain certifications, (i.e. DO-178B Level A) require coverage at the assembly level if this is not the case: "Then, additional verification should be performed on the object code to establish the correctness of such generated code sequences" (DO-178B) para-6.4.4.2.[10]

Test engineers can look at code coverage test results to help them devise test cases and input or configuration sets that will increase the code coverage over vital functions. Two common forms of code coverage used by testers are statement (or line) coverage and branch (or edge) coverage. Line coverage reports on the execution footprint of testing in terms of which lines of code were executed to complete the test. Edge coverage reports which branches or code decision points were executed to complete the test. They both report a coverage metric, measured as a percentage. The meaning of this depends on what form(s) of code coverage have been used, as 67% branch coverage is more comprehensive than 67% statement coverage.

Generally, code coverage tools incur computation and logging in addition to the actual program thereby slowing down the application, so typically this analysis is not done in production. As one might expect, there are classes of software that cannot be feasibly subjected to these coverage tests, though a degree of coverage mapping can be approximated through analysis rather than direct testing.

There are also some sorts of defects which are affected by such tools. In particular, some race conditions or similar real time sensitive operations can be masked when run under code coverage environments; and conversely, and reliably, some of these defects may become easier to find as a result of the additional overhead of the testing code.

Usage in industry[edit]

Code coverage is one consideration in the safety certification of avionics equipment. The guidelines by which avionics gear is certified by the Federal Aviation Administration (FAA) is documented in DO-178B[10] and the recently released DO-178C.[11]

Code coverage is also a requirement in part 6 of the automotive safety standard ISO 26262 Road Vehicles - Functional Safety.[12]

See also[edit]

References[edit]

  1. ^ Joan C. Miller, Clifford J. Maloney (February 1963). "Systematic mistake analysis of digital computer programs". Communications of the ACM (New York, NY, USA: ACM) 6 (2): 58–63. doi:10.1145/366246.366248. ISSN 0001-0782. 
  2. ^ Paul Ammann, Jeff Offutt (2013). Introduction to Software Testing. Cambridge University Press. 
  3. ^ Glenford J. Myers (2004). The Art of Software Testing, 2nd edition. Wiley. ISBN 0-471-46912-2. 
  4. ^ Position Paper CAST-10 (June 2002). What is a “Decision” in Application of Modified Condition/Decision Coverage (MC/DC) and Decision Coverage (DC)?
  5. ^ MathWorks. Types of Model Coverage.
  6. ^ Unit Testing with Parameter Value Coverage (PVC)
  7. ^ M. R. Woodward, M. A. Hennell, "On the relationship between two control-flow coverage criteria: all JJ-paths and MCDC", Information and Software Technology 48 (2006) pp. 433-440
  8. ^ Dorf, Richard C.: Computers, Software Engineering, and Digital Devices, Chapter 12, pg. 15. CRC Press, 2006. ISBN 0-8493-7340-9, ISBN 978-0-8493-7340-4; via Google Book Search
  9. ^ Y.N. Srikant; Priti Shankar (2002). The Compiler Design Handbook: Optimizations and Machine Code Generation. CRC Press. p. 249. ISBN 978-1-4200-4057-9. 
  10. ^ a b RTCA/DO-178B, Software Considerations in Airborne Systems and Equipment Certification, Radio Technical Commission for Aeronautics, December 1, 1992
  11. ^ RTCA/DO-178C, Software Considerations in Airborne Systems and Equipment Certification, Radio Technical Commission for Aeronautics, January, 2012.
  12. ^ ISO 26262-6:2011(en) Road vehicles -- Functional safety -- Part 6: Product development at the software level. International Standardization Organization. 
Wikipedia content is licensed under the GFDL License
Powered by YouTube
MASHPEDIA
LEGAL
  • Mashpedia © 2015