I’m using Projucer to create a custom project which I run in xcode. For unit testing my code I turned to these classes JUCE: UnitTest Class Reference and they are doing the job for now.
I’d like to have a coverage report (to more easily spot which lines/cases of a given class aren’t tested) but i can’t seem to find any way to export a proper XML from these tests, is there a way to generate a coverage report?
Is the answer to switch to some other UT solution for obtaining any kind of a report?
I think that the usual way of generating these coverage reports is to compile the unit-test binary with some instrumentation flags. This will put special instructions into the binary, which will emit the coverage information at runtime. Here’s how we do it:
Compile the unit-test target with the following flags: -fprofile-instr-generate -fcoverage-mapping
Run the unit test
Locate the generated default.profraw file in the working directory
This is a intermediate coverage format that will need to be converted in order to be human-readable: