Passing variable between different scenarios in cucumber | Selenium Forum
E
ermohit.chawla Posted on 29/12/2020

Hi,

I am using cucumber(java) framework in my project. The scenario where I am stuck is below:

1.) We first create a ticket using the cucumber scenario. This is TicketID.

2.) In the next scenario we want to use the same "TicketID" as the input to update certain fields.

3.) In the third scenario, the ticket needs to be deleted using "TicketID"

I searched online forums as well but could not find a way to pass the variables from one scenario to another in cucumber. Can you please help me how can I resolve this issue.

 

 


E
ermohit.chawla Replied on 04/01/2021

Can I please get a response on this query?


A
Ashish Replied on 07/01/2021

As per cucumber guys - Every scenario should be indenpendent of each other

They do not support this

May be you can write a variable to the file and read it