Skip to content

Multiple step definition files #23

Discussion options

You must be logged in to vote

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("") { }
    }
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jakohans76
Comment options

@Tyler-Keith-Thompson
Comment options

Answer selected by Tyler-Keith-Thompson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants