0

So I have a scenario outline where I need to repeat those steps in the other scenarios of this feature and I don't want to duplicate the steps manually in feature file.

I tried Background but without success yet.

Here is the scenario:

Scenario Outline: Adding an item to shopping cart
Given I am on home page
When i browse to category
And i click on the product
And I add <x> product to the bag
Then I should see the <x> in my mini-bag
And I click on the basket to verify if I have <x> items
Examples:
|x|
|1|

Second scenario:

Scenario Outline: ...
[I want the steps in the scenario above until 
 "Then I should see the <x> in my mini-bag" to be executed here.]
Given I am on the basket
When I edit the quantity to <y>
And I click the apply button
Then I should the quantity <y>
Examples:
|x|
|1|

I don't want to use execute_steps for all the scenario's which is duplicating in all the steps.

Louis
  • 146,715
  • 28
  • 274
  • 320
Raj
  • 1
  • Your question needed editing so I've edited it. You should take a look at my edit of your second scenario to check whether I understood correctly what you want. It is still not a complete question though. You should add what exactly you tried with `Background` and tell us exactly why it failed. – Louis Nov 13 '15 at 12:31
  • Hi, I just added the background like this Background: Given I am on home page When i browse to category And i click on the product And I add product to the bag Then I should see the in my mini-bag Scenario Outline: – Raj Nov 16 '15 at 23:44

0 Answers0