问题
Is there a way to specify order of execution inside cucumber? For example, rather than running
cucumber feature/foo/foo.feature feature/foo/bar.feature
to have those execute in that order... I want to run bundle exec cucumber
and run in that specified order.
I know that features/scenarios should be independent of each other but for the current tests I'm running it's not practical. If there is no "official way" (which seems to be the case) does anyone recommend a good design to implement such functionality?
回答1:
Copying my own answer from here:
As mentioned here, Cucumber scenarios should not be dependent on each other.
According to the Cucumber best practices, there shouldn’t be any sort of coupling between scenarios. Or in other words, there should be no state that persists between scenarios.
Just as an example why this is a bad practice consider a case when one scenario step adds a record to a database, while the subsequent scenarios depend on the existence of that record. This may work, but will create a problem if the order in which scenarios run changes, or they are run in parallel.
Try to review your approach and see how can you define your scenarios differently to avoid coupling. Good luck.
来源:https://stackoverflow.com/questions/38572465/cucumber-order-of-execution-ruby