Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share backgrounds between Cucumber files?

I have some Cucumber scenarios, for which I created the following files:

  • create_extended_search.feature
  • activate_extended_search.feature
  • edit_extended_search.feature
  • delete_extended_search.feature

Within these files, I have several scenarios.

Three of the files use the same background, and it would be nice to be able to place it into one file (e.g. support/backgrounds.rb) and then reference it from the feature files.

Is this possible somehow? Thanks.

like image 925
Joshua Muheim Avatar asked Oct 17 '25 10:10

Joshua Muheim


1 Answers

I believe you would have to create a step that is made up of the steps in your current background. Then call that step in the background for each feature.

like image 131
Justin Ko Avatar answered Oct 19 '25 13:10

Justin Ko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!