use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.
the class TestConfigReader method mergeIniAndXmlConfiguration.
/**
* Check that parameters in XML (which are not identified as a seleniumRobot option) are also put in testConfiguration
* @param testNGCtx
* @param xmlTest
*/
@Test(groups = { "ut context" })
public void mergeIniAndXmlConfiguration(final ITestContext testNGCtx, final XmlTest xmlTest) {
initThreadContext(testNGCtx);
SeleniumTestsContext seleniumTestsCtx = SeleniumTestsContextManager.getThreadContext();
Assert.assertEquals(seleniumTestsCtx.getConfiguration().get("variable1").getValue(), "value1", "Value has not been get from xml file");
}
use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.
the class TestConfigReader method testLoadMultipleFiles.
/**
* Last file variables take precedence
* @param testNGCtx
*/
@Test(groups = { "ut" })
public void testLoadMultipleFiles(final ITestContext testNGCtx) {
try {
System.setProperty(SeleniumTestsContext.LOAD_INI, "envSpecific.ini,spec/envSpecific2.ini");
initThreadContext(testNGCtx);
SeleniumTestsContext seleniumTestsCtx = SeleniumTestsContextManager.getThreadContext();
// check variable overwriting is also OK from last loaded files
Assert.assertEquals(seleniumTestsCtx.getConfiguration().get("key10").getValue(), "value100");
// check values are overwritten by first loaded ini file
Assert.assertEquals(seleniumTestsCtx.getConfiguration().get("key2").getValue(), "value20");
// check that if value is not present in additional file, it's taken from env.ini/config.ini
Assert.assertEquals(seleniumTestsCtx.getConfiguration().get("proxyType").getValue(), "direct");
} finally {
System.clearProperty(SeleniumTestsContext.LOAD_INI);
}
}
use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.
the class TestConfigReader method testVariableOverwriteByEnvironment.
/**
* Check that through context, configuration is correctly read
* @param testNGCtx
*/
@Test(groups = { "ut" })
public void testVariableOverwriteByEnvironment(final ITestContext testNGCtx) {
initThreadContext(testNGCtx);
SeleniumTestsContext seleniumTestsCtx = SeleniumTestsContextManager.getThreadContext();
// check value from a loaded additional ini file is present in configuration
Assert.assertEquals(seleniumTestsCtx.getConfiguration().get("key1").getValue(), "value4");
}
use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.
the class TestConfigReader method testLoadFileSubFolder.
/**
* Check we can read files in sub folders of config
* @param testNGCtx
*/
@Test(groups = { "ut" })
public void testLoadFileSubFolder(final ITestContext testNGCtx) {
try {
System.setProperty(SeleniumTestsContext.LOAD_INI, "spec/envSpecific2.ini");
initThreadContext(testNGCtx);
SeleniumTestsContext seleniumTestsCtx = SeleniumTestsContextManager.getThreadContext();
// check variable overwriting is also OK on loaded files
Assert.assertEquals(seleniumTestsCtx.getConfiguration().get("key10").getValue(), "value100");
} finally {
System.clearProperty(SeleniumTestsContext.LOAD_INI);
}
}
use of com.seleniumtests.core.SeleniumTestsContext in project seleniumRobot by bhecquet.
the class TestSeleniumTestContext method testProxyPresetExcludeCaptureNetworkWithAutoDetect.
@Test(groups = "ut context", expectedExceptions = ConfigurationException.class)
public void testProxyPresetExcludeCaptureNetworkWithAutoDetect(final ITestContext testNGCtx, final XmlTest xmlTest) {
SeleniumTestsContextManager.generateApplicationPath(testNGCtx.getCurrentXmlTest().getSuite());
SeleniumTestsContext seleniumContext = new SeleniumTestsContext();
seleniumContext.setCaptureNetwork(true);
seleniumContext.setWebProxyType("AUTODETECT");
seleniumContext.setConfiguration(new HashMap<>());
seleniumContext.setTestConfiguration();
seleniumContext.updateProxyConfig();
}
Aggregations