这是我们在面对问题时的设置方法。
问题陈述:
迁移到 xcode12 后,jenkins 管道无法生成
Coverage.profdata
文件,而 Slather
将使用该文件来导出代码覆盖率指标。是的,运行 xcode11 时没有发生。
我们在将
xcodebuild
命令指向适当的命令行工具版本后使用它(在本例中为 12.4)。
首先我们使用(获取模拟器 ID 后)构建应用程序
xcodebuild build-for-testing -workspace Example.xcworkspace -scheme ExampleUITests -derivedDataPath ./derivedData -destination 'platform=iOS Simulator,id=<simulator_id>'
然后我们使用
运行测试xcodebuild test-without-building -workspace Example.xcworkspace -scheme ExampleUITests -enableCodeCoverage YES -destination 'platform=iOS Simulator,id=<simulator_id>' -derivedDataPath ./derivedData
所有 UI 测试都成功运行,但在测试套件完成时最终出现以下语句。
warning: <Path_to_derived_data>/Build/ProfileData/<Some_UUID>/<Filename>.profraw: Invalid instrumentation profile data (file header is corrupt)
error: No profiles could be merged.
P.S:这不会发生在我的本地计算机上。仅在 Jenkins ec2 实例中的 mac 上。
Evan 我在覆盖范围中遇到了问题...我们有 10 个软件包,但我想测试并获得到目前为止仅 1 个软件包的覆盖范围..但是 corbertura.xml 显示了其他软件包的数据,而这些数据在 slather 文件中未提及..为什么它没有创建适当的包?因为声纳没有获取/发布覆盖统计数据