UI Test Case not show code coverage
This happens if you have only UI test target. Add a Unit Test Target. And then run tests again. This time you will see the code coverage.
UITestcase does not provide coverage data without Unit testing code. You could try this. Have a button in your Viewcontroller, attach an IBAction to it. And create UITestcase to it. Check the code coverage with and without UITestcases. You would see the difference. The difference would give you the code coverage by the UITestcase. As of now, Xcode doesnt provide, code coverage data seperately. It is dependant on the Unit Testcases.
Test coverage without UI TestCase
---With your codeI have commented out your
func testStepper() {
let steppersQuery = app.steppers steppersQuery.buttons["Increment"].tap() steppersQuery.buttons["Decrement"].tap()}func testSegmented() { app.buttons["Second"].tap() app.buttons["Fourth"].tap() app.buttons["Third"].tap() app.buttons["First"].tap()}
from TestDemoUITests and the result was this
And with your UITestcase it is as follows
It is pretty much evident now that UITestcase adds to the Unit Testcase for code coverage.