Enabling the Record Button in Xcode UI Test Target

Enabling the Record Button in Xcode UI Test Target

11 April 2024 Stephan Petzl Leave a comment Tech-Help

Integrating UI tests into an existing Xcode Objective-C project can sometimes present challenges, one of which includes a disabled record button within the UI test target. This guide offers a step-by-step solution to enable the record button, ensuring you can properly conduct UI tests for your app.

Initial Checklist

Before proceeding with the troubleshooting steps, ensure that you have:

  • Created a new UI Test target within your project.
  • Set ‘Enable Testability’ to YES for the target you are testing.
  • Performed a clean build, and if necessary, a clean build folder action.
  • Rebuilt the app.
  • Restarted Xcode.

Activating the Record Button

If the record button remains greyed out after completing the initial checklist, follow these troubleshooting steps:

Step 1: Verify Function Naming

Ensure that you are within a function body and the function is properly named to be recognized as a test:

  • The function name must start with the word test, such as testExample().
  • After renaming, wait a few seconds for the run icon to appear in the gutter next to your test function.

This should enable the record button for your UI test.

Step 2: Check Your File Location

Confirm you are in the correct XCTestCase subclass file:

  • If you organize tests in extension files, make sure to open the main XCTestCase subclass file (e.g., YourAppUItests) to enable the record button.

Step 3: Build for the Test Target

Ensure you can successfully build for the test target:

  • Go to Product > Test to run the UI Testing test case, even if it’s empty.
  • Verify that the test cases appear under Test Navigator or in the app target scheme.

Step 4: Cursor Placement

Place your cursor inside the test function you wish to record:

  • Clicking inside the desired test function should enable the record button.

Step 5: Select the Correct Scheme

Lastly, ensure you’ve selected the UI test scheme in Xcode.


By following these steps, the record button in your Xcode UI Test Target should now be enabled, allowing you to record UI tests and improve the quality assurance process for your app. Should you encounter further issues, consider revisiting these steps to confirm all settings are correctly configured.

Like this article? there’s more where that came from!