Cucumber Order of Execution - Ruby

非 Y 不嫁゛ 提交于 2021-01-29 05:53:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!