cucumber/cucumber-jvm — Issue #209: Scneario Outlines appear to ignore tagged hooks
Author: restagner
Created: 2012-02-17 02:58:30+00:00
State: open

I've attempted to use a tagged hook within a given step definition class and then reused one of the Given steps contained in the same class as the tagged hook across 2 feature files. I've tagged a Scenario outline expecting to see the Before hook called prior to executing the Given step, but this does not appear to be happening.

It's a bit difficult to explain. Please see the public gist I've shared at https://gist.github.com/1850089 for the feature files and accompanying step definition classes, along with what I would expect the outcome to be and what the actual result is.

### First feature file

```cucumber
@feature_1
Feature: Feature one

Scenario: A
Given a step in A
When an action in A
Then the expected outcome is X

@feature_2
Scenario Outline: B
Given a step in C
When an action in B
Then the outline's expected outcome is

Examples:
| result |
| Y |
| W |
```

### Second feature file

```cucumber
Feature: Feature 2

@feature_2
Scenario: C
Given a step in C
When an action in C
Then the expected outcome is Z
```

*EXPECTED OUTPUT*

```
[class org.stag.hello.StepDefsForFeature_1]: Inside GIVEN step A
[class org.stag.hello.StepDefsForFeature_1]: Inside WHEN step A
[class org.stag.hello.StepDefsForFeature_1]: Inside THEN step X
[class org.stag.hello.StepDefsForFeature_2]: Inside tagged BEFORE hook -- tag = @feature_2
[class org.stag.hello.StepDefsForFeature_2]: Inside GIVEN step C
[class org.stag.hello.StepDefsForFeature_1]: Inside WHEN step B
[class org.stag.hello.StepDefsForFeature_1]: Inside THEN step Y
[class org.stag.hello.StepDefsForFeature_2]: Inside tagged BEFORE hook -- tag = @feature_2
[class org.stag.hello.StepDefsForFeature_2]: Inside GIVEN step C
[class org.stag.hello.StepDefsForFeature_1]: Inside WHEN step B
[class org.stag.hello.StepDefsForFeature_1]: Inside THEN step W
[class org.stag.hello.StepDefsForFeature_2]: Inside tagged BEFORE hook -- tag = @feature_2
[class org.stag.hello.StepDefsForFeature_2]: Inside GIVEN step C
[class org.stag.hello.StepDefsForFeature_2]: Inside WHEN step C
[class org.stag.hello.StepDefsForFeature_2]: Inside THEN step Z
```

*ACTUAL OUTPUT*

```
[class org.stag.hello.StepDefsForFeature_1]: Inside GIVEN step A
[class org.stag.hello.StepDefsForFeature_1]: Inside WHEN step A
[class org.stag.hello.StepDefsForFeature_1]: Inside THEN step X
[class org.stag.hello.StepDefsForFeature_2]: Inside GIVEN step C
[class org.stag.hello.StepDefsForFeature_1]: Inside WHEN step B
[class org.stag.hello.StepDefsForFeature_1]: Inside THEN step Y
[class org.stag.hello.StepDefsForFeature_2]: Inside GIVEN step C
[class org.stag.hello.StepDefsForFeature_1]: Inside WHEN step B
[class org.stag.hello.StepDefsForFeature_1]: Inside THEN step W
[class org.stag.hello.StepDefsForFeature_2]: Inside tagged BEFORE hook -- tag = @feature_2
[class org.stag.hello.StepDefsForFeature_2]: Inside GIVEN step C
[class org.stag.hello.StepDefsForFeature_2]: Inside WHEN step C
[class org.stag.hello.StepDefsForFeature_2]: Inside THEN step Z
```