Is there anyway where we can use if/else concept in feature file? For example:
Scenario: User should be able to check login page
Given I am on login pag
What about if we are using Gherkin in a smoke test type situation and we need to ensure something exists in the database using only the UI?
Scenario: I need to create one (and only one) Box before I run the rest of my smoke tests
Given I login as Admin
When I am on the Box list Page
Then the test passes if the Box named "QA SmokeTest" exists
When I click the Add New Box Button
And enter the details for a New Box
And press Save New Box
Then the test passes if the Box named "QA SmokeTest" exists
The re-use of the same Then
step twice is essentially an if-else that will make sure my Box exists so that I can run my other tests in the smoke test suite that require a Box.
But that is dependent on being able to stop the Scenario execution in the test runner or doing something extraneous like:
ScenarioContext.Current["TestPassed"] = true;
and then in each of the steps
if(ScenarioContext.Current.Get