Tyler-Keith-Thompson / CucumberSwift

A lightweight swift Cucumber implementation
https://tyler-keith-thompson.github.io/CucumberSwift/documentation/cucumberswift/
MIT License
75 stars 19 forks source link

Ability to define Execution Order of Hooks #27

Closed cody1024d closed 3 years ago

cody1024d commented 3 years ago

Hello again,

Another nice-to-have feature (that is available on the Java side of things) would be to be able to define the execution order of the hooks.

For example:

BeforeScenario(Int.Max_Value) { scenario in
....
}

BeforeScenario(1) { scenario in
.....
}

In the above case, the contents of the first hook would be run after the contents of the second. This is more of a nice-to-have, especially at a frame-work use case.

If you're open to PRs, this is something I could probably easily tackle :)

Tyler-Keith-Thompson commented 3 years ago

I'm totally open to PRs! The contributing guide is a little sparse...all I care about is that there are tests around whatever we do and that CucumberSwift doesn't start to make assumptions about where it is run (for example, it should not assume it is run in XCUITests vs unit tests).

For this particular feature I'd also recommend you sanity check that randomizing executing order or parallelizing tests in XCode doesn't affect your ordering....it shouldn't, but just to be safe.

Tyler-Keith-Thompson commented 3 years ago

The latest version of CucumberSwift adds this capability. Check out the docs for more info!

cody1024d commented 3 years ago

Hey thanks for this @Tyler-Keith-Thompson. I got side-tracked with other work stuff and this totally fell off my radar, but will be a nice improvement for my use-case! So thanks again