Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i calculate code coverage of a static library in XCode 5 using a project that links to this static library?

I have an Xcode5 project that builds a static library as its product. While building this library i had turned on the Code coverage settings i.e. "Generate Test Coverage files" and " Instrument Program Flow". As a result, when library was built, gcno files were created for all the files correspondingly in the same directory.

And in order to calculate its code coverage i have another project which links to this library and creates an executable. This project was also built with "Generate Test Coverage files" and " Instrument Program Flow" as YES.

Now, upon executing this product, only the gcda files for the files in the project of my test executable are generated.

How can i generate the gcda files for the static library that was linked into my project while building it.

like image 236
yadip Avatar asked Nov 01 '22 05:11

yadip


1 Answers

You can do it now with Xcode 7.3.

Put the library project and the test project into the same workspace and configure the test project to link to the product of the library project. Turn on "Gather Code Coverage" in both the framework scheme in the library project and the test scheme in the test project. After that you'll be able to see the code coverage for the library in the coverage tab in Xcode.

like image 72
Yue Wang Avatar answered Nov 15 '22 05:11

Yue Wang