-
Notifications
You must be signed in to change notification settings - Fork 19
XCTest Integration
It's important to understand that Cucumber simply provides a way to tie into Gherkin. CucumberSwift is coupled with XCode but does not require a specific kind of target. You can run it with a UI testing bundle, or a Unit testing bundle, whatever makes sense.
There have been a couple of instances where people have requested that CucumberSwift give a lot of the same control that you get with an XCTestCase so here we go:
CucumberSwift defines a way to create expectations just like XCTestCase
Given("some precondition") { _, _ in
let expectation = self.expectation(description: "waiting")
self.wait(for: [expectation], timeout: 3)
}
This can be a hot button topic, should a step stop executing as soon as it hits a failure, or should it keep going.
NOTE: This applies on a per-scenario basis. Because Scenario's are all designed to be independently executable.
NOTE: After
hooks will still be executed regardless of this setting
There are 2 ways of defining this:
extension Cucumber: StepImplementation {
public var continueTestingAfterFailure:Bool {
return true
}
}
Given("some precondition") { _, step in //this ignores the global definition, but only for this step
step.continueTestingAfterFailure = false
}