iosxcodeui-testing

Record button disabled in Xcode UI Test Target


I know similar questions have been posted, but from my investigating, there has not been a solution posted, at least not one that works. I have successfully run UI tests only from sample projects in both Swift and Obj-C.

I am trying (unsuccessfully) to integrate UI tests into an existing Xcode Obj-C project, which seems to be another issue altogether. Here are the steps I have taken:

  1. Created a new UI Test target within my project
  2. Ensured that 'Enable Testability' has been set to YES for the target I am testing
  3. Cleaned, cleaned build folder, rebuilt the app, restarted Xcode and everything else I could think of.

When I do this, the test target is available but the record button is greyed out (disabled) and there are no play buttons in the gutter to execute the tests. There is nothing visual about the test class that would indicate that it is a test class. When I place my cursor in the test method, the record button remains disabled.

Is there anything I've left out? Anything else to check that might be preventing UI tests?


Solution

  • Make sure you are in the correct XCTestCase subclass file.

    After researching for a time, I found that I was all the time in a extension file (I'm been ordering the flows in extension files). So when I opened the main XCTestCase subclass file (like "YourAppUItests") the record test button has been enabled.