0

I have to automate following scenario using swift and XCTestCase on iOS simulator.

  • Step1: Launch the app
  • Step2: Performa some actions on the app
  • Step3: Kill the app
  • Step4: Re-launch the app and check if the actions performed are persistent

I found in one of our questions to use the below snippet.

    XCUIDevice.shared().press(XCUIDeviceButton.home)
    sleep(60)
    XCUIDevice.shared().siriService.activate(voiceRecognitionText: "Open {appName}")

It did not work for me, can some one please suggest any different approach.

thanks,

user1244546
  • 79
  • 1
  • 9

1 Answers1

3

To launch or re-launch use launch:

XCUIApplication().launch()

To terminate application use terminate(). But according to the documentation:

If the application is already running, this call will terminate the existing instance, to ensure a clean launch state for the newly launched instance.

Shortly. Your test could look like:

XCUIApplication().launch()
// some actions
XCUIApplication().launch()
// some action
Paulo Mattos
  • 18,845
  • 10
  • 77
  • 85
Bartosz Janda
  • 1,611
  • 11
  • 10