We're using Cucumber as our test harness
We have a folder structure like this:
- automation
- api
- api1.feature
- api2.feature
- gui
- gui1.feature
- gui2.feature
- step_definitions
- api_steps.rb
- gui.steps.rb
- support
- hooks.rb
- cucumber.yml
- env.rb
- Gemfile
- Rakefile
I need to have different actions occurring in my hooks.rb file (or support directory in general) for the api tests vs. the gui tests. For my api tests, I need to authorize through our restapi and get an auth cookie. For my gui tests, I need create a selenium browser instance.
I need this to work both when I execute everything by issuing 'cucumber' alone from the 'automation' level of this folder structure AND when I execute a single feature file by doing:
$ cucumber gui/gui1.feature -r features
So my questions are regarding how best to do that.
- Can I/should I create some kind of conditional within my hooks.rb file in the 'Before do' block to perform different before actions based on which directory the feature is executing from?
- OR Can I/should I create separate support/hooks.rb directories/files within each of the directories 'api' and 'gui'? (effectively will Cucumber recognize and selectively utilize multiple support directories?)
Thanks!
Aucun commentaire:
Enregistrer un commentaire