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

Viewed 315

Code coverage report generate for unit test and UI Test only. In my case I need without written unit and UI test to generate code coverage for manual run the app.

1 Answers

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. After that Xcode generate the .xcresult in the derived data path. There you can find your code coverage report.

Related