英文:
How can I enable code coverage in Xcode 14.3? (It appears different from other versions)
问题
Normally I would follow these steps. Basically I would tap on my scheme, then edit, then Test, then I'd have a nice neat enable code coverage box I can tick. However, with 14.3, I don't see the info | options etc tabs, instead I see this view. And enable code coverage isn't there. Usually, it would be between Build configuration and Debugger.
14.3
I don't see show code coverage here either:
英文:
Normally I would follow these steps. Basically I woult tap on my scheme, then edit, then Test, then I'd have a nice neat enable code coverage box I can tick. However, with 14.3, I don't see the info | options etc tabs, instead I see this view. And enable code coverage isn't there. Usually, it would be between Build configuration and Debugger.
14.3
I don't see show code coverage here either:
答案1
得分: 13
Enabling Code Coverage has moved to Test Plan configuration which are designed to manage your tests and were introduced in Xcode 11 at WWDC 2019.
Do the following steps to enable it:
-
按下 Command + Option + u 打开编辑方案窗口
-
将鼠标悬停在自动创建的测试计划上以显示披露按钮,然后单击它。
-
转到配置选项卡:
-
查找代码覆盖并启用它:
英文:
Enabling Code Coverage has moved to Test Plan configuration which are designed to manage your tests and were introduced in Xcode 11 at WWDC 2019.
Do the following steps to enable it:
- Press Command + Option + u to bring the Edit Scheme window
- Hover over the Autocreated test plan to show the disclosure button and click it.
答案2
得分: 5
你可以在测试计划配置中启用它。转到测试导航器。点击“测试计划”下拉菜单,然后选择“编辑测试计划”。你将能够更新测试计划的共享配置,包括代码覆盖启用:
英文:
You can enable it on the test plans configuration. Go to the Test navigator. Click on the "Test Plan" dropdown and then select "Edit test plan"
You will be able to update the shared configs of your test plans, including conde coverage enabling:
答案3
得分: 1
Edit your schema
-> 编辑您的架构
Enable Code Coverage
-> 启用代码覆盖
Make sure that .xctestplan has been created.
-> 确保已创建.xctestplan文件。
Verify the file is in your project.
-> 验证文件是否在您的项目中。
Run tests
-> 运行测试
英文:
Edit your schema
-> Test Plan
as suggested by @Mehdi Ijadnazar more above and then:
答案4
得分: 0
一旦启用代码覆盖率,请检查您的文件.xctestplan是否已创建并添加到您的项目中。然后,在Xcode左侧面板的最后一个选项卡上,选择“显示报告导航器”,一旦启动您的测试,您应该会看到一个“覆盖率”行,它将为您提供所有覆盖率的访问。
xcode-screenshot-code-coverage
英文:
Once you turn on the code coverage, check that your file .xctestplan has been created and added to your project. Then on the last tab of left panel of Xcode, the 'Show the report navigator', once your test has been launched you should have a 'coverage' line that will give you access of all your coverage
xcode-screenshot-code-coverage
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论