Product
Solutions
Resources
Company
Download Trial Book a Demo

Code Coverage for the Visual Studio IDE

Generate code coverage for your application directly inside the Visual Studio IDE with RKTracer. Integrate the tool, turn RKTracer ON from the Tools menu, rebuild and run your tests, then generate the HTML reports.

Use this guide to generate code coverage for an application in the Visual Studio IDE. The workflow is a three-step process: enable the RKTracer tool and rebuild the application, test the instrumented application and save the coverage data, then generate the code coverage reports.

In short

Integrate RKTracer with rktracer -vs -integrate, turn RKTracer ON from the Tools menu, rebuild and run your tests, then generate the reports with RKTracer Report.

Code Coverage tool integration with Visual Studio IDE

To integrate the RKTracer tool, open a command prompt and execute the integration command:

command prompt
rktracer -vs -integrate

Upon successful integration, open the Visual Studio IDE and access the RKTracer options in the Tools menu:

  • RKTracer ON: Will enable the RKTracer tool for instrumentation.
  • RKTracer OFF: Will disable the RKTracer tool.
  • RKTracer Reports: Will generate reports in HTML format.

Enable Code Coverage Tool

Navigate to ToolsRKTracer ON to activate the tool.

Rebuild application and run tests

Rebuild your application with RKTracer enabled and execute your unit and functional tests on either a host or server machine.

Generate Code Coverage Reports

Go to the Tools menu → RKTracer Report to generate the HTML reports. The RKTracer tool will internally convert the data in rk-coverage.txt and map it with the JSON files created during instrumentation. You can manually open the HTML report using index.html.

Enable coverage for selected files

You can scope coverage to specific folders, files, or functions by editing rktracer.config in the RKTracer installation folder. For folder-based coverage, add lines like:

rktracer.config
ignore *.c
instrument */power/* */core/* */keys/*
never */firmware_loader/* */lockdown/*

For function-level coverage, configure:

rktracer.config
ignore *.c
instrument *source-file-X.c *source-file-Y.c *source-file-Z.c
function-ignore *
function-instrument fun_X() fun_Y() fun_Z()

Next steps

Once your Visual Studio project reports coverage, the same RKTracer workflow applies across other build systems and IDEs. Browse the rest of the documentation, or read more about how RKTracer measures coverage through MC/DC.

Stuck on your build?

Open a support ticket and an engineer who knows your toolchain will help. You get a tracked ticket ID by email.