I have written a number of Rest Assured Cucumber tests to test my API. I have written cucumber feature/step definition files do the following:-
Add a new category Update the category Delete the Category.
So I have a single step definition class with three scenarios.
The first scenario creates a new category and I store the category ID in a global scope variable (this variable was declared at the top of the class file). I wrote the variable to the console to make sure it has a value (it did) after the new category is deleted. After the scenario has finished it moves onto scenario 2 where it tries to update the category. The problem is that value of the global variable has now become empty and the test fails.
Does anyone know if its possible to share the content of global variables between different scenarios in the same step definition class file?