Saturday, 6 October 2012

Selenium - Create CONFIG file and read it (java)

One of the challenges we face while creating test suite is to put common settings into a file and read it from code as and when neccessary. I did struggle a bit so thought sharing this might help any one who encounters similar problem.


1) Create a file say in ur src folder or create a new package config and put a file called
2) From the file where you want to read create a varaiable like

static Properties CONFIG = new Properties();
3) Then load the content into it from the file you have created

FileInputStream fn = new
FileInputStream("path to project"+ \\src\\configure\\;


4) Put a value into file which has to be read 

5) To read value from file
Some more system properties can be read from system as well
ex: System.getproperty("user.dir") for project

Wil share a sample code some time later but the above steps should help.

1 comment:

  1. Best place to learn Appium Android IOS Automation Testing Training in Chennai
    Go for Appium training in chennai for real time mobile automation testing training with real time project support.
    UI Automation Tools with real time scenarios You can contact 8122241286 for Best APPIUM and selenium Training in Chennai