Configuration file in automation framework | JAVA properties file | Selenium Java

preview_player
Показать описание
In this video we are going to see that how to add configuration file in the framework.

We can create our configuration file in any format, it might be a text file, properties file or can be a json file.

Add below code to read the properties file.
Properties property = new Properties();
try {
InputStream instm = new FileInputStream(configpath);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}

Now using the property object , we can use the configuration settings in our framework to make things configurable.
e.g.

{
driver = new FirefoxDriver();
}
{
driver = new ChromeDriver();
}
{
driver = new InternetExplorerDriver();
}

***********Please comment in case of any query.***************

Also, please see other videos as well.

Рекомендации по теме
Комментарии
Автор

how to write into config.properties file ?

ansaritaha