いくつかのクラスで使用されるいくつかのグローバル変数を設定する必要があります。
プロパティ ファイルから静的変数を割り当てるのに問題があります。
変数を呼び出す方法は次のようなものです: String url = WebdriverConfiguration.getBaseUrl();
public class WebDriverConfiguration
{
private static Properties testProperties;
private static String instaceUrl;
testProperties = loadProperties();
public static final String DEFAULT_BASEURL = testProperties.getProperty("confluence.base.url","");
private static final int DEFAULT_HTTP_PORT = 8080;
private static final String DEFAULT_CONTEXT_PATH = "/";
public static final String TEST_SPACE_KEY = "SMOKE";
public static final String TEST_PAGE = "XXX";
private static final String BASE_URL = System.getProperty("baseurl", DEFAULT_BASEURL);
public static String getBaseUrl()
{
return BASE_URL;
}
private Properties loadProperties() throws IOException
{
InputStream testPropertiesInput = getClass().getClassLoader().getResourceAsStream("webtester.properties");
Properties testProperties = new Properties();
if (null != testPropertiesInput)
{
try
{
testProperties.load(testPropertiesInput);
}
finally
{
IOUtils.closeQuietly(testPropertiesInput);
}
}
return testProperties;
}
}