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?
The easiest way to add a unit test target to your project is to select the Include Tests checkbox when you create the project. Selecting the checkbox creates targets for unit tests and UI tests. To add a unit test target to an existing Xcode project, choose File > New > Target.
The really short version is that unit tests have access to the code in your app (or whatever kind of module you are building) and UI tests do not have access to the code. A unit test only tests one single class per test.
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:
Most problems were fixed after rebuilding the project, exiting XCode, restarting XCode with the project, rebuilding again. All were fixed after repeating this.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With