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));
}
}
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