Answer the question
In order to leave comments, you need to log in
How to optimize a test?
I have a set of tests that are completely independent of each other and have a common logging item. How can I remove this logging and where, so that when I change the login, I don’t change 10 tests, but change only in one block?
Answer the question
In order to leave comments, you need to log in
If we are talking about Java, then I advise PropertyLoader
public class PropertyLoader {
private static final String PROP_FILE = "/application.properties";
private PropertyLoader() {}
public static String loadProperty(String name) {
Properties props = new Properties();
try {
props.load(PropertyLoader.class.getResourceAsStream(PROP_FILE));
} catch (IOException e) {
e.printStackTrace();
}
String value = "";
if (name != null) {
value = props.getProperty(name);
}
return value;
}
}
you also need to create a file anyname.properties
and there set whatever you want an example:
user.username=${user.username}
user.password=${user.password}
grid2.hub= localhost:5555/wd/hub
site.url= yoursite.ru
browser.name= chrome
admin.login=anyuser
admin. pass=anypass
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question