Skip to content

Tag outline scenarios - it runs only one scenario #195

Closed
akania opened this Issue Jun 15, 2014 · 8 comments

3 participants

@akania
akania commented Jun 15, 2014

Given a Feature with scenario:

Feature: test
    @sometag
    Scenario Outline: Scenario outline - run this scenario with different examples
                      To run one scenario with different set of values use scenario outlines

        Given There is initial <value>
        When I subsctract <subsctractValue>
        Then I should have <resultValue>

    Examples:
    | value | subsctractValue | resultValue |
    |  12   |  5              |  7          |
    |  20   |  5              |  15         |

And step definition

var testSteps = function() {
  var Given  = When = Then = this.defineStep;


  Given(/^There is initial (\d+)$/, function(value, callback) {
      this.value = value;
      callback();
  });
  When(/^I subsctract (\d+)$/, function(substractValue, callback) {
      this.result = this.value - substractValue;
      callback();
  });
  Then(/^I should have (\d+)$/, function(result, callback) {
      if (parseInt(result) === this.result) {
          callback();
      } else {
          callback.fail();    
      }
  });
};
module.exports = testSteps;

When i run 'cucumber-js --tags @sometag'

Scenario is executed only once with first row of examples

cucumber.js --tags @sometag
....

1 scenario (1 passed)
4 steps (4 passed)

Expected - scenario should be executed for all examples

@akania
akania commented Jun 15, 2014
  • it doesn't matter where i put my tag - over scenario outline or over examples
@akania
akania commented Jun 15, 2014

So it looks like tags are removed here

revealTags: function revealTags() {
      var revealedTags = stashedTags;
      stashedTags      = []; // <- empty array

I'm trying to understand logic behind this, commenting this line helps but all scenarios inherit all tags then..

@akania akania added a commit to akania/cucumber-js that referenced this issue Jun 15, 2014
@akania akania tag support for outline scenario examples , #195 5b9994a
@akania akania added a commit to akania/cucumber-js that referenced this issue Jun 17, 2014
@akania akania #195 - tag every scenario from scenario outline with scenario outline…
… tags
3aadc0b
@akania
akania commented Jun 17, 2014

pull request in #197

@jbpros jbpros added a commit that closed this issue Jun 30, 2014
@akania akania Properly tag scenario outlines (close #195 #197)
This fixes tag filtering on scenario outlines.
cb5249d
@jbpros jbpros closed this in cb5249d Jun 30, 2014
@XxJChavezxX

I run into a similar issue, but in my case, only the last row on the table gets run. Any feedback of how to approach this would be great

@charlierudolph
Cucumber member

What version of cucumber-js are you running? This feature encompasses the current behavior and was added in 0.9.1.

@XxJChavezxX

I'm using cucumberjs version: 0.9.2 with nightwatchjs and the cucumber plugin version - 0.6.7. Not sure if the latest help.

Table looks like this:
Examples:
| extension |
| MLB |
| NASCAR |
| SOCCER |
| NBA |

and the step that uses it:
When I click on link ""

I'm adding additional info just in case it helps.

@charlierudolph
Cucumber member

Based on the cucumber plugin changelog scenario outlines weren't supported until 1.2.0.

@XxJChavezxX

Yeah, it works now, after updating to a newer version. Apologies I should have checked the changelog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.