简体   繁体   中英

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. 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 . 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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