Android apps to use in appium android test examples

Breaking

Friday, September 22, 2017

Reading Site URL From properties File In Selenium WebDriver DDF

In selenium WebDriver Datadriven Framework Creation, We cause got Implemented functionality of running assay cases In unlike browsers In Previous Step. And for that, you lot cause got to alter your assay browser refer at ane house only. So instantly you lot tin gear upward your assay browser In Param.properties file. Now adjacent pace Is reading site URL from Param.properties file.

STEP 25

Prerequisite : All previous 24 steps of Selenium WebDriver DDF creation should endure Implemented. Find all steps link on THIS PAGE.

Why involve to read site URL from properties file?
Supposing you lot cause got a assay site amongst evolution as well as staging surroundings as well as you lot cause got created 100 unlike assay instance files for your project.

Assume -> Right instantly you lot are running your webdriver assay cases on development environment site. But later on few days you lot cause got to run all webdriver assay cases on phase surroundings site. How volition you lot produce It? You volition instruct for changing site URL In all 100 assay cases? It volition cause got every bit good much fourth dimension as well as It Is non perfect way.

To handgrip this sort of situation, We tin shop site URL In Param.properties file as well as and thence nosotros tin utilisation that URL's key In all our assay cases. So whenever you lot wants to run your assay cases on staging environment, you lot cause got to alter site URL key value exclusively In Param.properties file. This Is ane sort of URL centralization.

How to produce It?
For that, We cause got to modify our all 4 assay cases files. We volition shop our assay site's URL In Param.properties file amongst key siteURL and as well as thence nosotros volition access Its value In our all 4 assay cases. Right now, Our all 4 assay cases has bellow given syntax.

//To navigate to URL. driver.get("http://only-testing-blog.blogspot.com");

Now you lot involve to supersede inwards a higher house syntax. Remove inwards a higher house syntax as well as add together bellow given syntax In all 4 assay cases.

//To navigate to URL. It volition read site URL from Param.properties file driver.get(Param.getProperty("siteURL"));

Now It volition read siteURL key's value from Param.properties file. You tin download Param.properties file as well as ane modified assay instance for your illustration from bellow given link. 


Note : In naught folder, You volition instruct exclusively ane modified assay case. But you lot cause got to modify your all 4 assay cases accordingly.

  • Paste SuiteOneCaseOne.java file on com.stta.SuiteOne Package.
  • Paste Param.properties file on com.stta.property Package.
Running assay to verify result

Double click on Shortcut to Run Test.bat file to run your assay cases. It volition firstly executing your assay cases. Now It volition read URL from Param.properties file In all 4 assay cases. You tin verify It past times changing siteURL key's value in  Param.properties file.


More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/

No comments:

Post a Comment