Search in sources :

Example 66 with TestVariable

use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.

the class TestSeleniumTestContext method testAttributeFoundInVariableButNotRequested.

@Test(groups = "ut context")
public void testAttributeFoundInVariableButNotRequested(final ITestContext testNGCtx, final XmlTest xmlTest) {
    initThreadContext(testNGCtx);
    SeleniumTestsContextManager.getThreadContext().getConfiguration().put("foo2", new TestVariable("foo2", "bar2"));
    SeleniumTestsContextManager.getThreadContext().setAttribute("foo", "bar");
    Assert.assertEquals(SeleniumTestsContextManager.getThreadContext().getAttribute("foo2"), null);
}
Also used : TestVariable(com.seleniumtests.core.TestVariable) Test(org.testng.annotations.Test) XmlTest(org.testng.xml.XmlTest) GenericTest(com.seleniumtests.GenericTest)

Example 67 with TestVariable

use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.

the class TestSeleniumTestContext method testAttributeFoundInVariablePriority.

@Test(groups = "ut context")
public void testAttributeFoundInVariablePriority(final ITestContext testNGCtx, final XmlTest xmlTest) {
    initThreadContext(testNGCtx);
    SeleniumTestsContextManager.getThreadContext().getConfiguration().put("foo", new TestVariable("foo", "bar2"));
    SeleniumTestsContextManager.getThreadContext().setAttribute("foo", "bar");
    Assert.assertEquals(SeleniumTestsContextManager.getThreadContext().getAttribute("foo", true), "bar");
}
Also used : TestVariable(com.seleniumtests.core.TestVariable) Test(org.testng.annotations.Test) XmlTest(org.testng.xml.XmlTest) GenericTest(com.seleniumtests.GenericTest)

Example 68 with TestVariable

use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.

the class TestFixture method testGetValueWithKnownParam.

@Test(groups = { "ut" })
public void testGetValueWithKnownParam() {
    SeleniumTestsContextManager.getGlobalContext().setCucumberImplementationPackage("com.seleniumtests.ut.core.runner.cucumber");
    SeleniumTestsContextManager.getThreadContext().getConfiguration().put("foo", new TestVariable("foo", "bar"));
    Assert.assertEquals(new Fixture().getValue("{{ foo }}"), "bar");
}
Also used : TestVariable(com.seleniumtests.core.TestVariable) Fixture(com.seleniumtests.core.runner.cucumber.Fixture) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 69 with TestVariable

use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.

the class TestStringUtility method testInterpolateStringVariableInVariable.

/**
 * Test the case where a variable contains a reference to an other one
 */
@Test(groups = { "ut" })
public void testInterpolateStringVariableInVariable() {
    SeleniumTestsContextManager.getThreadContext().getConfiguration().put("url", new TestVariable("url", "http://mysite${path}"));
    SeleniumTestsContextManager.getThreadContext().getConfiguration().put("path", new TestVariable("path", "/foo/bar${param}"));
    SeleniumTestsContextManager.getThreadContext().getConfiguration().put("param", new TestVariable("param", "?key=value"));
    Assert.assertEquals(StringUtility.interpolateString("connect to ${url}", SeleniumTestsContextManager.getThreadContext()), "connect to http://mysite/foo/bar?key=value");
}
Also used : TestVariable(com.seleniumtests.core.TestVariable) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 70 with TestVariable

use of com.seleniumtests.core.TestVariable in project seleniumRobot by bhecquet.

the class TestStringUtility method testInterpolateStringMaskPassword3.

@Test(groups = { "ut" })
public void testInterpolateStringMaskPassword3() {
    SeleniumTestsContextManager.getThreadContext().setMaskPassword(true);
    SeleniumTestsContextManager.getThreadContext().getConfiguration().put("pwd", new TestVariable("pwd", "abc"));
    Assert.assertEquals(StringUtility.interpolateString("connect with ${pwd}", SeleniumTestsContextManager.getThreadContext()), "connect with ****");
}
Also used : TestVariable(com.seleniumtests.core.TestVariable) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Aggregations

TestVariable (com.seleniumtests.core.TestVariable)72 Test (org.testng.annotations.Test)66 GenericTest (com.seleniumtests.GenericTest)53 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)38 XmlTest (org.testng.xml.XmlTest)34 ConnectorsTest (com.seleniumtests.ConnectorsTest)19 MockitoTest (com.seleniumtests.MockitoTest)19 ITestResult (org.testng.ITestResult)14 HashMap (java.util.HashMap)13 SeleniumRobotVariableServerConnector (com.seleniumtests.connectors.selenium.SeleniumRobotVariableServerConnector)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)10 SeleniumTestsContext (com.seleniumtests.core.SeleniumTestsContext)7 File (java.io.File)3 ArrayList (java.util.ArrayList)3 JSONObject (kong.unirest.json.JSONObject)3 BrowserExtension (com.seleniumtests.browserfactory.BrowserExtension)2 ConfigReader (com.seleniumtests.core.config.ConfigReader)2 ConfigurationException (com.seleniumtests.customexception.ConfigurationException)2 IOException (java.io.IOException)2 HttpRequest (kong.unirest.HttpRequest)2