简体   繁体   English

如何使用链接到此静态库的项目计算XCode 5中静态库的代码覆盖率?

[英]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. 我有一个Xcode5项目,它构建了一个静态库作为其产品。 While building this library i had turned on the Code coverage settings ie " 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. 因此,在构建库时,为相应目录中的所有文件创建了gcno文件。

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. 该项目还使用“ 生成测试覆盖率文件”和“仪器程序流程”构建为YES。

Now, upon executing this product, only the gcda files for the files in the project of my test executable are generated. 现在,在执行此产品时,仅生成我的测试可执行文件的项目中的文件的gcda文件。

How can i generate the gcda files for the static library that was linked into my project while building it. 如何为构建它时链接到我的项目的静态库生成gcda文件。

You can do it now with Xcode 7.3. 你现在可以用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. 之后,您将能够在Xcode的coverage选项卡中看到该库的代码覆盖率。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xcode 7中没有静态库的代码覆盖 - No code coverage for static library in Xcode 7 Xcode项目模板:如何指定静态库依赖项? - Xcode project templates: How can I specify a static library dependency? 如何将现有的xcode项目转换为静态库 - how to convert existing xcode project to static library 将xcode项目转换为静态库 - Converting xcode project to static library 我可以在不使用Xcode IDE的情况下为iOS构建静态库吗? - Can I build a static library for iOS without using the Xcode IDE? 如何更改静态库的代码.a文件Xcode项目的另一个Xcode项目? - How to change code of static library .a file Xcode Project for another Xcode project? 如何在不使用静态库的情况下将xcode项目中的资源共享到工作区中的其他xcode项目中? - How to share resources from xcode project into other xcode project within a workspace with out using static library? 如何将Xcode项目重用到新项目中? 静态库,框架,目标? - How to reuse an Xcode project into a new project? Static library, Framework, Targets? 我可以将库包含为静态库,并可以在iOS项目中进行编译吗? - Can I include a library as a static library and compile it inside a iOS project? 在Xcode iOS项目中使用C ++静态库(CCFits) - Using a c++ static library (CCFits) in Xcode iOS Project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM