Does it still make the concept available in the properties file (orgchin language)?

In any case, can we use the if / else concept in the function file? For instance:

Scenario: User should be able to check login page Given I am on login page When I click on SignIn button Then I should be in home page If yes Then I will create a new profile Else Then I will logout from page 
+5
source share
4 answers

Not that I know. Cucumbers (and cucumbers) are best used when they indicate discreet business cases, and must be repeatable, otherwise it becomes difficult for them to follow and check. It looks like you have two stories, at least:

 Scenario: A new user should be asked to sign in Given I am a new user And I navigate to the login page When I click on SignIn button I should not be able to get to the home page Scenario: An existing user should be able to log in Given I am an existing user And I navigate to the login page And I submit valid credentials When I click on SignIn button I should be taken to the home page 
+7
source

No, you cannot and should not. Function files are for business, not programming.

From your scenario, I think you are trying to deal with other behavior, depending on whether you are registered or not. For this you have to write two scripts

 Given I am registered When I Then I should .... Given I am a new user When I ... Then I should be asked to register 

Note that these scenarios do not describe how things are done. All I like about β€œI click on foo” in a function is smell and should be avoided.

+4
source

How about if we use Gherkin in a situation like smoke test, and we need to make sure that something exists in the database using only the user interface?

 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 

Reusing the same Then step twice is essentially an if-else that ensures that my box exists so that I can run my other tests in the smoke test package, which requires a field.

But it depends on the ability to stop the script from running in the test runner or do something extraneous:
ScenarioContext.Current["TestPassed"] = true;
and then at each stage if(ScenarioContext.Current.Get<bool>("TestPassed")) return;

0
source

You can use the parameter in the properties file and implement If else in the code based on the passed parameter.

-1
source

All Articles