Halting test after XCTAssert fails

While it can be useful to have a test continue after an assertion failure, if you have code following the XCTAssert then it mustn’t depend on the condition being successful.

If you need each test method to stop if there is a failure, set this flag to false:

Swift 3.1
self.continueAfterFailure = false

You can set this in any test and it will be reset between tests to true. That way it is in effect for that test only. You can set it for the whole test class in the setUp function:

Swift 3.1
override func setUp() {
    super.setUp()
    self.continueAfterFailure = false
}

h/t