Xcode UITest Record button is disabled
Asked Answered
R

8

6

Has anyone seen this happen before? I can not run UITests because the button is disabled. I have not found any help online. I have deleted and added a new test target, restarted Xcode and deleted derived data. None of these worked and I have no idea what to try next.

Revolver answered 25/11, 2015 at 16:28 Comment(1)
I never found a fix for this but all of a sudden one day it worked and it worked again ever since.Revolver
A
11
You have to create a new target in your project.
Steps:
1) File > New > Target
2) Select in left box: iOS > Test
3) In right box: iOS UI Testing Bundle
4) Run your aplication
5) Record your actions
6) Make assertions
Amalgam answered 13/1, 2016 at 22:53 Comment(1)
I'm not entirely sure what the problem was. I think a bit of a derived data bug. A few days later after rebooting my macbook this was working again. No other changes made. I'm going to accept your answer because in most situations that is exactly the cause of a greyed out button :)Revolver
E
3

Another possible cause could be that the UI testing target was not build/run successfully.

Go to Product > Test and make sure no errors. You should also see the test cases in the Test Navigator (if you don't see, then it is not recognised).

Elaelaborate answered 24/2, 2016 at 14:42 Comment(0)
N
2

I had the same issue and finally found a solution.

  1. Write a new UI test in a file which is linked to the UI test target.
  2. In the new test write XCTFail("") (which will fail the test)
  3. Run your UI tests and they should fail.
  4. Remove XCTFail("") you added and the red button is now enabled.
Notum answered 16/8, 2016 at 14:54 Comment(0)
P
1

For me it was Deleting ~/Library/Developer/Xcode/DerivedData/ as above, and letting Xcode reindex the project, but I had to make sure to not interrupt the index. Indexing took a while, and if its interrupted, it seems to not pick pack up where it left off. At least for XCUITest targets.

Phonometer answered 11/8, 2016 at 18:51 Comment(0)
D
0

Try to delete ~/Library/Developer/Xcode/DerivedData/ and let xcode to reindex your project. This should do the trick

Dishpan answered 15/3, 2016 at 0:9 Comment(0)
G
0

Make sure the name of the UI Test file is the same as its class.

Gussy answered 24/2, 2017 at 15:9 Comment(0)
S
0

I just fixed this by commenting out a failing test in my test class. Ran the test so it's green, and then put my cursor on a new line (below commented out test), and the Record button is red again.

You can have other failing tests in your app, but not in the file that is active in Xcode.

In Xcode 9.0

Sleepless answered 26/10, 2017 at 5:42 Comment(0)
D
0

Click inside test function. You should select test method first. Usually when the button is not active, that means that xcode does not know which test to rec.

Dolan answered 20/11, 2017 at 14:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.