Skip to main content
Added several breaks
Source Link

You will have to change the environment based on the parameter from the Gherkin file. For example: Given The actor logs in the "environment" environment with "username" and "password".  
I do not know how to escape tags in these posts, so change the " with tags. 
Examples: | firstname | username | password | environment | | Cam | Newton | 12345dev | DEV | | Mac | Oldton | 12345stage | STAGE |
Then in the Steps file the implementation will be:

@Given("The actor logs in the ".*" environment with ".*" and ".*"") public void theGameIsRunning(string environment, string username, string password) { if(environment == "Dev") { string devUrl = ConfigurationManager.AppSettings["DevUrl"]; driver.Navigate().GoToUrl(devUrl); } else if (environment == "Stage") { string stageUrl = ConfigurationManager.AppSettings["StageUrl"]; driver.Navigate().GoToUrl(stageUrl); } }  

Every test will be executed but on a different environment.

When you only want to test on Dev or Stage you will have to switch environments in the app.config.

You will have to change the environment based on the parameter from the Gherkin file. For example: Given The actor logs in the "environment" environment with "username" and "password". I do not know how to escape tags in these posts, so change the " with tags. Examples: | firstname | username | password | environment | | Cam | Newton | 12345dev | DEV | | Mac | Oldton | 12345stage | STAGE |
Then in the Steps file the implementation will be:

@Given("The actor logs in the ".*" environment with ".*" and ".*"") public void theGameIsRunning(string environment, string username, string password) { if(environment == "Dev") { string devUrl = ConfigurationManager.AppSettings["DevUrl"]; driver.Navigate().GoToUrl(devUrl); } else if (environment == "Stage") { string stageUrl = ConfigurationManager.AppSettings["StageUrl"]; driver.Navigate().GoToUrl(stageUrl); } }
Every test will be executed but on a different environment.

When you only want to test on Dev or Stage you will have to switch environments in the app.config.

You will have to change the environment based on the parameter from the Gherkin file. For example: Given The actor logs in the "environment" environment with "username" and "password".  
I do not know how to escape tags in these posts, so change the " with tags. 
Examples: | firstname | username | password | environment | | Cam | Newton | 12345dev | DEV | | Mac | Oldton | 12345stage | STAGE |
Then in the Steps file the implementation will be:

@Given("The actor logs in the ".*" environment with ".*" and ".*"") public void theGameIsRunning(string environment, string username, string password) { if(environment == "Dev") { string devUrl = ConfigurationManager.AppSettings["DevUrl"]; driver.Navigate().GoToUrl(devUrl); } else if (environment == "Stage") { string stageUrl = ConfigurationManager.AppSettings["StageUrl"]; driver.Navigate().GoToUrl(stageUrl); } }  

Every test will be executed but on a different environment.

When you only want to test on Dev or Stage you will have to switch environments in the app.config.

Source Link

You will have to change the environment based on the parameter from the Gherkin file. For example: Given The actor logs in the "environment" environment with "username" and "password". I do not know how to escape tags in these posts, so change the " with tags. Examples: | firstname | username | password | environment | | Cam | Newton | 12345dev | DEV | | Mac | Oldton | 12345stage | STAGE |
Then in the Steps file the implementation will be:

@Given("The actor logs in the ".*" environment with ".*" and ".*"") public void theGameIsRunning(string environment, string username, string password) { if(environment == "Dev") { string devUrl = ConfigurationManager.AppSettings["DevUrl"]; driver.Navigate().GoToUrl(devUrl); } else if (environment == "Stage") { string stageUrl = ConfigurationManager.AppSettings["StageUrl"]; driver.Navigate().GoToUrl(stageUrl); } }
Every test will be executed but on a different environment.

When you only want to test on Dev or Stage you will have to switch environments in the app.config.