Record Button Disabled in Xcode UI Test

I know that similar questions have been published, but from my investigation the decision was not published, at least not one that works. I only successfully run user interface tests 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. Here are the steps I took:

  • Created a new UI testing goal in my project
  • Make sure Enable Health Check is set to YES for the target I'm testing.
  • A cleaned, cleaned up build folder, a rebuilt application, a restarted Xcode, and everything else I could think of.

When I do this, the test object is available, but the record button is inaccessible (disabled), and there are no play buttons in the gutter to run the tests. There is nothing visual in the test class indicating that it is a test class. When I place the cursor in the test method, the record button remains disabled.

Is there something I forgot? Anything else to check that might hinder user interface testing? Thanks!

+6
source share
6 answers

Make sure you are in the XCTestCase subclass file.

After researching for some time, I found that all the time in the extension file (I order streams in extension files). Therefore, when I opened the main XCTestCase subclass file (for example, "YourAppUItests"), the record verification button was activated.

+5
source
  • The record button is activated only inside the function body.

  • The function name must begin with test . Like testExample() .

  • After changing the function name, wait a few seconds for the start icon to appear in the gutter.

The record button should now appear.

+3
source

Make sure you have successfully created a test target.

Go to Product> Test and verify that the test case for testing the user interface is running (this is normal if the test scenario is empty). You should also see test cases in the Test Navigator or in the target application diagram.

+1
source

Make sure you have at least one test function in your ui testing class. For example, func testExample () {}. You can then write to this function, since you can only run functions as tests if they have the test as a prefix.

0
source

I realized that you must have a cursor inside the test function for which you want to write. I just clicked inside the test function and the record button was activated.

0
source
  1. create function in yourfileUITests.swift

enter image description here

  1. running program from TEST

enter image description here

  1. Your function can record user interface testing, the button is already on

enter image description here

0
source

Source: https://habr.com/ru/post/1241075/


All Articles