Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber tags for scenario outline examples

In the project I am currently working we are using cucumber for integration testing and to keep the regular daily builds from getting too big we use profiles using tags to have a smaller daily test and a larger weekly build test suite.

Now I have a scenario outline with example inputs that I want to split up so that one example is in the daily build and others in the weekly.

Something in the spirit of

Scenario Outline: Doing some tests
  Given a step
  When I do some <input>
  Then I should get some <output>

Examples:
  |input     |output    |
  @daily
  |daily 1   |daily 2 o |
  @weekly
  |week 1    |week 1 o  |
  |week 2    |week 3 o  |
      .           .
      .           .     
      .           .
  |week 999  |week 999 o|

Is this possible in any way? Should it be? Or is it a dumb idea to do it this way?

like image 495
Martin Larsson Avatar asked Jun 24 '13 13:06

Martin Larsson


People also ask

How do you tag a Cucumber example?

We can define each scenario with a useful tag. Later, in the runner file, we can decide which specific tag (and so as the scenario(s)) we want Cucumber to execute. Tag starts with “@”. After “@” you can have any relevant text to define your tag.

What are the tags in Cucumber?

In Cucumber, tags are used to associate a test like smoke, regression etc. with a particular scenario.


1 Answers

After some research I found out that this is already supported from out of the box. You just have to add two Example headers to the test. Using my own example from the question to illustrate

Scenario Outline: Doing some tests
  Given a step
  When I do some <input>
  Then I should get some <output>

@daily
Examples:
  |input     |output    |
  |daily 1   |daily 2 o |

@weekly
Examples:
  |input     |output    |
  |week 1    |week 1 o  |
  |week 2    |week 3 o  |
      .           .
      .           .     
      .           .
  |week 999  |week 999 o|
like image 112
Martin Larsson Avatar answered Sep 18 '22 17:09

Martin Larsson