简体   繁体   English

如何在没有 XCTest/XCUITest 的情况下获取代码覆盖率报告(仅用于手动运行)

[英]How to get code coverage report without XCTest/XCUITest(only for manual run)

Code coverage report generate for unit test and UI Test only.仅为单元测试和 UI 测试生成代码覆盖率报告。 In my case I need without written unit and UI test to generate code coverage for manual run the app.在我的情况下,我需要在没有书面单元和 UI 测试的情况下生成手动运行应用程序的代码覆盖率。

class SampleUITests: XCTestCase { class SampleUITests:XCTestCase {

override func setUpWithError() throws {

    continueAfterFailure = false 
    let app = XCUIApplication()
    app.launch()
}

func testExample() throws {
    sleep(60)
    XCTAssertTrue(true)
}

We can run XCUItest and whatever we want to do with your app between the sleep time end.我们可以在睡眠时间结束之间运行 XCUItest 以及我们想要对您的应用程序执行的任何操作。 After that Xcode generate the.xcresult in the derived data path.之后 Xcode 在派生数据路径中生成.xcresult。 There you can find your code coverage report.在那里你可以找到你的代码覆盖率报告。

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

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