use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.
the class TestTestTasks method testParamDoesNotExist.
/**
* Check empty string is returned if parameter is not known
*/
@Test(groups = { "ut" })
public void testParamDoesNotExist() {
SeleniumTestsContextManager.getThreadContext().getConfiguration().put("foo", new TestVariable("foo", "bar"));
SeleniumTestsContextManager.getGlobalContext().getConfiguration().put("foo", new TestVariable("foo", "bar2"));
Assert.assertEquals(TestTasks.param("foo2"), "");
}
use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.
the class TestTestTasks method testParamKeyPattern.
/**
* Check we get parameters with pattern on key from the thread context
*/
@Test(groups = { "ut" })
public void testParamKeyPattern() {
SeleniumTestsContextManager.getThreadContext().getConfiguration().put("foofoo", new TestVariable("foofoo", "bar"));
SeleniumTestsContextManager.getGlobalContext().getConfiguration().put("foofoo", new TestVariable("foofoo", "bar_global"));
Assert.assertEquals(TestTasks.param(Pattern.compile("ofo")), "bar");
}
use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.
the class TestTestVariable method testSimpleConstructor.
@Test(groups = { "ut" })
public void testSimpleConstructor() {
TestVariable var = new TestVariable("key", "value");
Assert.assertNull(var.getId());
Assert.assertEquals(var.getInternalName(), var.getName());
Assert.assertFalse(var.isReservable());
}
use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.
the class TestTestVariable method testFromJSonCustomVariable.
@Test(groups = { "ut" })
public void testFromJSonCustomVariable() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", 1);
jsonObject.put("name", "custom.test.variable.key");
jsonObject.put("value", "value");
jsonObject.put("reservable", false);
jsonObject.put("environment", 1);
jsonObject.put("application", 2);
jsonObject.put("version", 3);
TestVariable var = TestVariable.fromJsonObject(jsonObject);
Assert.assertEquals(var.getId(), (Integer) 1);
Assert.assertEquals(var.getName(), "key");
Assert.assertEquals(var.getValue(), "value");
Assert.assertEquals(var.isReservable(), false);
Assert.assertEquals(var.getInternalName(), "custom.test.variable.key");
Assert.assertNull(var.getCreationDate());
}
use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.
the class TestConfigReader method readConfigurationWithoutValueOverride.
@Test(groups = { "ut" })
public void readConfigurationWithoutValueOverride() {
Map<String, TestVariable> config = new ConfigReader("VNR", null).readConfig(Thread.currentThread().getContextClassLoader().getResourceAsStream("tu/env.ini"));
Assert.assertEquals(config.get("key1").getValue(), "value1", "Key should not be overriden");
}
Aggregations