3

Basically what I need is to stop the UITests when the first one fails. I'm using Jenkins with Fastlane Scan.

I have the option to continue after failure disabled (but it only prevents this specific test to continue):

override func setUp() {
...        
    continueAfterFailure = false
...
}

My scan file contains the option to "fail_build" true.

But it keeps running even when the first on fails.

Thanks in advance.

brduca
  • 3,573
  • 2
  • 22
  • 30

1 Answers1

4

continueAfterFailure means that the current test does not continue after a failure, but the test run will continue onto the next test.

If you want tests to stop after a single failure, you can observe the failure state of the test in tearDown() and throw a fatal error to abort the run.

override func tearDown() {
  super.tearDown()
  if !testRun?.hasSucceeded {
    fatalError()
  }
}
Oletha
  • 7,324
  • 1
  • 26
  • 46