Zack Leonidas Hamblen
Zack Leonidas Hamblen

Reputation: 61

Continue after XCUITest

Instruments(automator) is no longer a thing for Xcode 8.x, so I'm looking for a way to automate input with XCUITests. I'm able to get the input I want, but then the test succeeds and the app exits in the simulator. Is there any way to run the script and then continue to an idle state rather than quitting?

Upvotes: 0

Views: 321

Answers (1)

h.w.powers
h.w.powers

Reputation: 860

Each XCTest file has a setup and a teardown method.

The template files come with an XCUIApplication().launch() in the setup method. Try wrapping that in an if statement like so:

if XCUIApplication().exists {
//do nothing
} else {
  XCUIApplication().launch()
}

Now when you run this suite of tests, it will only launch the app if its not already on screen, but if you already ran a test and the app is still running it will just go to the next one.

Upvotes: 0

Related Questions