Reputation: 139
I have a feature file Product.feature .I have two Scenarios Create Product and Update Product. I have created a product in Scenario :Create Product. In the following scenario(Scenario :Update Product) I want to update the details of the product created in the Scenario : Create Product using the account id which will be in the response of the Scenario :Create Product .
Upvotes: 1
Views: 332
Reputation: 58153
You have to merge the Scenario
-s into one. It looks like you have mis-understood how they have to be used. This is explained clearly in the documentation:
Variables set using
def
in the Background will be re-set before every Scenario. If you are looking for a way to do something only once per Feature, take a look atcallonce
. On the other hand, if you are expecting a variable in theBackground
to be modified by oneScenario
so that later ones can see the updated value - that is not how you should think of them, and you should combine your 'flow' into one scenario. Keep in mind that you should be able to comment-out aScenario
or skip some via tags without impacting any others.
Upvotes: 1