Cross-platform software libraries and APIs
Qt Creator IDE and productivity tools
UI Design tool for UI composition
for Qt projects
Digital advertising for UI apps
Usage intelligence for embedded devices
GUI test automation
Code coverage analysis
Test results management and analysis
Software static code analysis
Software architecture verification
The latest version of Qt.
Make the most of Qt tools, with options for commercial licensing, subscriptions, or open-source.
Explore Qt features, the Framework essentials, modules, tools & add-ons.
The project offers PySide6 - the official Python bindings that enhance Python applications.
Qt empowers productivity across the entire product development lifecycle, from UI design and software development to quality assurance and deployment. Find the solution that best suits your needs.
Insight into the evolution and importance of user-centric trends and strategies.
Learn how to shorten development times, improve user experience, and deploy anywhere.
Tips on efficient development, software architecture, and boosting team happiness.
Get the latest resources, check out upcoming events, and see who’s innovating with Qt.
A wealth of Qt knowledge at your fingertips—discover your ideal learning resource or engage with the community.
Whether you're a beginner or a seasoned Qt pro, we have all the help and support you need to succeed.
The Line Coverage of a program is the number of executed lines divided by the total number of lines. Only lines that contain executable statements are considered, not those with pure declarations.
Line Coverage is very suitable for both communicating and visualizing a coverage overview. A developer’s statement “I have 80% of my software’s lines covered through unit tests.” is easy to understand for the human recipient. Especially if it goes along with a view of the source code that has the lines colored in green and red, respectively.
The simplicity that is good for conveying a first impression has its drawbacks in terms of precision however. See the following sections for details.
Line coverage is an unstable coverage measure since it depends strongly on the code formatting. Two variations of a simple C function will serve as an example:
Variant 1: Concise version with two lines of executable code:
double kelvin_to_celcius(double kelvin)
{
if (kelvin < 0.0) return -1;
return kelvin - 273.15;
}
Variant 2: Reformatted version that got expanded to three lines of executable code:
double kelvin_to_celcius(double kelvin)
{
if (kelvin < 0.0)
return -1;
return kelvin - 273.15;
}
A simple change of the coding style leads to a coverage change from 50% to 66.7% for a call like
kelvin_to_celcius(-10.0);
that tests the error handling!
Let’s assume an invocation of Variant 1 with a succesful conversion:
kelvin_to_celcius(250.0);
Both lines will be executed thus resulting in 100% coverage. Have we completed our testing? Nay! The error case needs as a test as well. Alas, the possible branching of the code flow is not part of what Line Coverage cares about.
None. Due to the limitations described above Line Coverage does not provide any value over levels like Branch Coverage or – more importantly – MC/DC. Common standards like ISO 26262 for functional safety therefore speak out recommendations for the levels like the latter.
The formatting dependency is remediated by Statement Coverage. One needs to switch to Branch Coverage to address execution flow branching. If one also cares about logic expressed through boolean expressions (leading to branching) we recommend to measure a Condition Coverage metric like MC/DC.
Qt Group includes The Qt Company Oy and its global subsidiaries and affiliates.