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.
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
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).
I had the same issue and finally found a solution.
- Write a new UI test in a file which is linked to the UI test target.
- In the new test write XCTFail("") (which will fail the test)
- Run your UI tests and they should fail.
- Remove XCTFail("") you added and the red button is now enabled.
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.
Try to delete
~/Library/Developer/Xcode/DerivedData/
and let xcode to reindex your project. This should do the trick
Make sure the name of the UI Test file is the same as its class.
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
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.
© 2022 - 2024 — McMap. All rights reserved.