代码覆盖率

For embedded software development projects, code coverage has always played an important role in order to show that all parts of the code have been tested. In particular, the ISO 26262 standard requires to fulfill coverage metrics like statement coverage, decision coverage or MC/DC.

Although an analysis of code coverage is performed in almost all development projects, the handling is often not very efficient. As the code coverage is mostly measured during test execution using instrumented code, the user has to explicitly run a simulation to obtain the desired metrics. In addition, the tests typically need to be executed a second time on the non-instrumented code in order obtain the test results for the code that goes into production.

Code coverage in BTC EmbeddedTester – Integrated, automated and certified

In BTC EmbeddedTester, the code coverage is calculated and reported automatically whenever a new test case is created or imported. As this happens completely in the background, no interaction or manual test execution is needed to update the corresponding report. The coverage calculation in BTC EmbeddedTester is also addressed by the ISO 26262 certificate from TÜV Süd, showing its suitability for the use in safety critical projects up to ASIL D.

The coverage report is structured in three main sections. While the first section provides an overview of the different metrics, the second section contains a detailed list of all individual coverage goals. The third section shows the source code incl. additional information regarding the coverage status of each line of code.

If the production code has been generated by dSPACE TargetLink, the code coverage report also provides a traceability to the original model, making it easy to identify the corresponding model element for a particular coverage goal.

We’ve got you covered

The coverage metrics that BTC EmbeddedTester addresses go far beyond standard goals like Statement or Decision Coverage. Structural metrics with an even finer granularity like Condition Coverage and MC/DC make the tool ideal for safety critical ASIL D projects. The “Domain Coverage” goal allows you to flexibly define slices of a variables data range as individual coverage goals, e.g. in order to address the ISO 26262 objectives for equivalence classes. In addition, robustness goals like “Range Violation”, “Division by 0” or “Downcast” provide information about critical events in the code which ideally should be reached by any test case.

Intelligent analysis and automatic test generation for structural coverage goals

BTC EmbeddedTester is not only able to calculate the achieved coverage for test data which has been imported or manually created. Powerful analysis engines based on Model-Checking technology are able to analyze all coverage goals fully automatically and generate corresponding structural test data to achieve full coverage. For parts of the code that can’t be covered, the tool will provide a mathematical proof to show that they are unreachable. For structural goals this allows you to reveal dead code, while for the robustness goals it proves that the corresponding critical event can never occur.