Code coverage in Xcode without tests (for manual launch)

Code cover is commonly used with tests in Xcode. I would like to use it to start manually. Can I do this, perhaps using third-party tools?

For example: I create and run the application on the device, perform some actions with it, and then view the results of code coverage.

+6
source share
2 answers

Code coverage will record which parts of your code are executed by your test. But you could create some UITests that, as you said, would lay some actions. The user interface can record user interface tests to repeat the steps you take on the simulator, and then when you run the test, it will repeat what you did. Then the coverage will show which parts of the code are excited during UITests.

Find information on UITesting in Xcode 7. One of the developer sessions has a good demo from wwdc15

https://developer.apple.com/videos/wwdc/2015/?id=406

0
source

You may have already figured this out, but it was possible before Xcode7. We accomplished this by setting the flags "Program Workflow" and "Create Test Coverages" to "Yes" in your project, and then adding flash code somewhere inside your application to write coverage data files. This β€œflushing” part actually records coverage data files that can later be used by other tools, such as gcovr or lcov, to get your coverage data. After you interact with the application, either manually or using automatic tests, coverage data will be recorded.

However, with Xcode7, it seems that coverage data is limited only to Xcode unit tests. I'm still trying to figure out if there is a way to collect coverage data by interacting with the application manually or using automated tests.

0
source

All Articles