Scenario hooks only valid on scenario outlines?


We're using Cucumber and Selenium with Ruby. After reading the <a href="https://github.com/cucumber/cucumber/wiki/Hooks" rel="nofollow">documentation on hooks</a> I've tried my hand at setting a few tags to set (for example) some environment variables.

Here's a contrived example that demonstrates the problem.

When I establish a Before hook like so:

Before('@tag1', '@tag2') do puts "in the before hook!" end

It'll take effect with a scenario defined like so:

@tag1 @tag2 Scenario Outline: This is a test scenario Given I run my first step for "<user>" Then I complete my test @firstrun Scenarios: |user| |fred| @secondrun Scenarios: |user| |barney|

..however if I move @tag1 and @tag2 to the individual scenarios and not the scenario outline, the hook is never called, for instance:

@secondrun @tag1 @tag2 Scenarios: |user| |barney|

Is it possible to 'hook in' individual scenarios, or just the outlines?


Typically with scenario outlines the table of values you're testing is tied to that, not separate scenarios.


ScenarioOutline Given I am on gmails website When I login as <user> with <password> Then I am able to view my primary inbox Example: | user | password | | Fred | xd13#%& |


  • Check for bad enum with rspec
  • How can I hide extra divs with an ellipsis?
  • How to read CDATA from an XML file in Node Sax
  • Stored procedure to handle null parameter
  • How can I combine multiple rows into one column using PostgreSQL?
  • How to test a multi-threaded TCPServer with rspec
  • Processing (too) many XML files (with TagSoup)
  • ember js subviews and didinsertelement event
  • C# foreach - Is collection computed with each iteration? [duplicate]
  • Does argparse support multiple exclusive arguments?
  • Codeigniter Hooks advance
  • Sending rails errors to rspec output
  • coldfusion variables into powershell
  • CKeditor stripping font tags instead of converting to span
  • Spring security - same page to deliver different content based on user role
  • Highcharts - Column chart with empty columns for date in x-axis
  • Ionic Slide Up Slide Down Animation for only one view in sidebar
  • Why cout is producing no output on Code Blocks?
  • LESS CSS how to modify parent property in mixin
  • Prevent Tomcat from caching request during starup
  • Debugging VB6 Code From Visual Studio 2010
  • Diff between two dataframes in pandas
  • Loading .coffee files via a view in Rails
  • Why Encoding.ASCII != ASCIIEncoding.Default in C#?
  • one Local Olampyad Questions on Informatic in 2011
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Allowing both email and username for authentication
  • Handling un-mapped Rest path
  • How to add a column to a Pandas dataframe made of arrays of the n-preceding values of another column
  • KeystoneJS: Relationships in Admin UI not updating
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF