简体   繁体   English

如何使用终端+ Xcode 9.1获得单元测试代码覆盖率

[英]How to get unit test Code Coverage using terminal + Xcode 9.1

I have create simple demo project for getting code coverage whine I run in Xcode I am getting this coverage. 我已经创建了一个简单的演示项目,以获取在Xcode中运行的代码覆盖率,而我正在获取此覆盖率。 look in to image 查看图像

在此处输入图片说明

But when I run from command using terminal I can't show code coverage 但是当我使用终端从命令运行时,无法显示代码覆盖率

xcodebuild -scheme Mock -destination 'platform=iOS Simulator,name=iPhone X,OS=11.1' -enableCodeCoverage YES -derivedDataPath . clean build test

After create report I am using this 创建报告后,我正在使用此

xcrun llvm-cov report -instr-profile=/Users/nikhil.makwana/Downloads/Mock/Build/ProfileData/70053ED1-6A92-49BB-B445-A16CF615C615/Coverage.profdata  /Users/nikhil.makwana/Downloads/Mock/Build/Products/Debug-iphonesimulator/Mock.app   >  jikstest.report

where is the problem here? 问题出在哪里?

This questioned was asked a long time ago. 这个问题是很久以前问的。 But I ran into this issue and found that you need to point to the actual file Mock inside the folder Mock.app . 但是我遇到了这个问题,发现您需要指向文件夹Mock.app的实际文件Mock Here is the answer: 答案是:

xcrun llvm-cov report -instr-profile=/Users/nikhil.makwana/Downloads/Mock/Build/ProfileData/70053ED1-6A92-49BB-B445-A16CF615C615/Coverage.profdata  /Users/nikhil.makwana/Downloads/Mock/Build/Products/Debug-iphonesimulator/Mock.app/Mock   >  jikstest.report

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM