Xcode 7 UI test cases for pre Xcode 7 projects
Asked Answered
E

3

9

Apple simplified iOS UI testing in Xcode 7.

With new Xcode 7 projects, all you have to do to get the complete configuration for iOS UI testing is to check "Include UI tests" when creating a project.

What are the steps to get the same in Xcode 7 for projects that were created before Xcode 7 existed?

Excitor answered 17/6, 2015 at 8:43 Comment(3)
Try to search under File > NewMoonshine
Ok: File > New > Target > Test > Cocoa Touch UI Testing Bundle seems to work at first glance. Thanks for the hint :-)Excitor
creating a new UI test target seems to be not enough for an existing project. In a newly created project I can record a UI test via the red dot. When I add a UI test target to an existing project, the red dot is pale and does not work. No error message.Excitor
E
13

After testing several older projects:

Adding a new UI test target is sufficient as suggested by a-live in a comment to the question:

File > New > Target > Test > Cocoa Touch UI Testing Bundle

With Xcode 7 beta1, all of my projects habe been unstable after adding this target with different symptoms:

  • Compiler not able to import XCTest
  • red recording button greyed out and not working (even with cursor in the method)
  • Xcode crashing after pressing record button

Most problems were fixed after rebuilding the project, exiting XCode, restarting XCode with the project, rebuilding again. All were fixed after repeating this.

Excitor answered 18/6, 2015 at 18:42 Comment(1)
Agreed it's very important to rebuild the project after restarting XCode. I tried all the incremental steps along the way.Buoyancy
W
4

New UI testing framework requires your simulator running on iOS version 9.0. I encountered the issue of recording button being disabled for version below 9.0, like 8.4 etc.

Warwick answered 14/9, 2015 at 5:36 Comment(0)
S
-1

The steps to add UI tests to an old project are also the same. Add a UI Testing bundle as suggested by Gerd, above. Then:

  • Take the cursor to a method in the .m test file.

  • When you take the cursor there, you will see the record button is enabled, which is on the top of the debug console.

  • Press record. This will start up your simulator and start writing code as per your actions.

You can find detailed steps here - https://krausefx.com/blog/run-xcode-7-ui-tests-from-the-command-line

Spongin answered 28/7, 2015 at 8:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.