Multiple step definition files #23
Answered
by
Tyler-Keith-Thompson
jakohans76
asked this question in
Q&A
-
Hi again. In the Ruby and .js Cucumber versions, it is possible to have multiple step definition files to separate by feature and create a better overview as your project becomes bigger. How do I do that with CucumberSwift? If we use your sample project as an example:
Thanks in advance (Remember I'm a Swift Newbie but very happy with this library already). |
Beta Was this translation helpful? Give feedback.
Answered by
Tyler-Keith-Thompson
Feb 2, 2021
Replies: 1 comment 2 replies
-
So I normally handle this by creating multiple files and just using functions. Example: CucumberTests.swift extension Cucumber: StepImplementation {
public var bundle: Bundle {
class Findme { }
return Bundle(for: Findme.self)
}
public func setupSteps() {
let app = XCUIApplication()
BeforeScenario { (_) in
app.launch()
}
AfterScenario { _ in
app.terminate()
}
setupStepsForFeature1(app) //this declared in File 2
}
} FILE 2: import XCTest
extension Cucumber {
func setupStepsForFeature1(app:XCUIApplication) {
Given("") { }
When("") { }
Then("") { }
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Tyler-Keith-Thompson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I normally handle this by creating multiple files and just using functions. Example:
CucumberTests.swift
FILE 2: