Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 7 UI Tests, Recording button is greyed out

I am trying to add UI tests to my existing project using Xcode 7. However the UI test recording button is always greyed out. What I am missing here?

I tried restarting Xcode, cleaning and rebuilding the project and adding a new UI test target. Does anyone else experience the same behaviour?

like image 709
rustylepord Avatar asked Aug 07 '15 09:08

rustylepord


3 Answers

To enable the red button, you have to have the cursor on the test method:

enter image description here

like image 168
pableiros Avatar answered Nov 19 '22 16:11

pableiros


I got stuck on this for a while too. In order to record, you have to be in a class that Xcode recognizes as containing tests. Add a file to your UI testing target with something like:

import Foundation
import XCTest

class MyTests: XCTestCase {
    func testSomething() {

    }
}

Save the file, clean your project, and switch to another file then back to this one. Record button should be available then.

like image 36
Maldron Avatar answered Nov 19 '22 17:11

Maldron


FWIW: I had this problem and it turns out I was trying to run the simulator in the wrong OS.

I was trying to use iOS 8, and UITesting only works in iOS 9+.

Switch the simulator version, and the record button appears.

like image 14
Le Mot Juiced Avatar answered Nov 19 '22 17:11

Le Mot Juiced