Saturday, March 28, 2020

Read proprieties file in java


Read properties file using ResourceBundle

package testngpractice;

import java.util.ResourceBundle;

import org.testng.annotations.Test;

public class PropertiesDemo {

@Test
public void showProp() {

ReadProperiesFile.getProperties("config", "name");

}
}

class ReadProperiesFile {

public static void getProperties(String filename, String key) {

ResourceBundle bundle = ResourceBundle.getBundle(filename);

System.out.println(bundle.getString(key));

}
}



Create a config.properties file in the Resource folder

Add Extent report to selenium TestNG and attache screenshots