简体   繁体   中英

How do I show code coverage in Swift Packages?

On my M1 mac, using Xcode 13.3, I created a package and displayed the code coverage bar (Editor menu –> Code Coverage).

After running tests, there is no indication of code coverage at all in the source code.

How do I get code coverage when testing a package?

The problem is that you didn't turn on Code Coverage for the library's scheme. Turn it on:

在此处输入图像描述

See the checkbox at the bottom: Code Coverage? Check that checkbox.

Now run the package test and coverage will be gathered. The best way to see it, in my experience, is actually in the report navigator:

在此处输入图像描述

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