2

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.

Rama Krish
  • 373
  • 1
  • 13
  • 1
    Coverage refers to [how much of your source code is tested](https://www.atlassian.com/continuous-delivery/software-testing/code-coverage), and you need to [execute tests to measure it](https://stackoverflow.com/questions/195008/what-is-code-coverage-and-how-do-you-measure-it). You need to elaborate what you mean by **coverage for manual run** without unit test or UI test. – Swapnil Luktuke Jan 07 '21 at 17:00
  • For android doing the same they generate the report for manual run app. Trying to the same in the iOS part. – Rama Krish Jan 08 '21 at 02:09
  • What do you want to be the contents of this report? – Swapnil Luktuke Jan 11 '21 at 10:21
  • How much code covered in source code of the swift file. It shown as a percentage. File format is .xcresult – Rama Krish Jan 12 '21 at 16:40
  • But if you do not execute a `test` how do you get `coverage`? Code coverage refers to the amount of code that is `tested`. – Swapnil Luktuke Jan 13 '21 at 22:08

1 Answers1

1

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.

Rama Krish
  • 373
  • 1
  • 13