QtWS17 - Test coverage of Qt C++ and QML, Harri Porten, froglogic
Channel: Qt Group
Date: 25/10/2017

Code coverage is a metric for the degree of testing that is being done. This talk will explain the various metrics from Statement Coverage to Modified Condition/Decision Coverage (MC/DC), depict their strengths and drawbacks and show how to deal with the challenges posed by Qt C++ and QML code. Software safety standards like ISO 26262 (road vehicles), EN 50128 (railway applications) an DO-178 C (airborne systems) and others require software developers to ensure software quality through analysis of code coverage achieved through their tests. Among other measures.

This talk will define what this metric means and – equally important – what it does not mean. Standard levels measured are statement coverage, branch coverage, decision coverage and the more complex modified/condition decision coverage (MC/DC) or multiple condition coverage (MCC). We’ll look at the advantages and drawbacks of these levels and what kind of testing efforts they require.

Qt applications pose several special challenges for measurement of code coverage: first, usage of the Meta Object Compiler (MOC), the User Interface Compiler (UIC) and various macros leads to automatically generated code that can sometimes be hard to fully cover. Secondly, the language QML includes both static declaration and dynamic JavaScript code. Above topics will be illustrated through some live demonstrations with different tools. The automated Qt tests will serve as a relatively large real-world example for viewing test coverage. Based on selected spots in the code we’ll investigate gaps in current QA measures. Dynamic analysis like code coverage has to be distinguished from static analysis. Nevertheless, some classic static code metrics will be listed as their monitoring is also recommended by the safety standards listed at the beginning. At the end efforts and benefits of code coverage will be compared with pragmatic recommendations for every day usage.