Search in sources :

Example 36 with SeleniumRobotVariableServerConnector

use of com.seleniumtests.connectors.selenium.SeleniumRobotVariableServerConnector in project seleniumRobot by bhecquet.

the class TestSeleniumRobotVariableServerConnector method testVariableUpdateExistingVariableWithNetworkError.

@Test(groups = { "ut" }, expectedExceptions = SeleniumRobotServerException.class)
public void testVariableUpdateExistingVariableWithNetworkError() throws UnirestException {
    configureMockedVariableServerConnection();
    HttpRequest<HttpRequest> req = createServerMock(SERVER_URL, "PATCH", String.format(SeleniumRobotVariableServerConnector.EXISTING_VARIABLE_API_URL, 12), 200, "{}");
    when(req.asString()).thenThrow(UnirestException.class);
    SeleniumRobotVariableServerConnector connector = new SeleniumRobotVariableServerConnector(true, SERVER_URL, "Test1", null);
    TestVariable existingVariable = new TestVariable(12, "key", "value", false, TestVariable.TEST_VARIABLE_PREFIX + "key");
    connector.upsertVariable(existingVariable, true);
}
Also used : HttpRequest(kong.unirest.HttpRequest) TestVariable(com.seleniumtests.core.TestVariable) SeleniumRobotVariableServerConnector(com.seleniumtests.connectors.selenium.SeleniumRobotVariableServerConnector) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

SeleniumRobotVariableServerConnector (com.seleniumtests.connectors.selenium.SeleniumRobotVariableServerConnector)36 ConnectorsTest (com.seleniumtests.ConnectorsTest)34 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)34 Test (org.testng.annotations.Test)34 TestVariable (com.seleniumtests.core.TestVariable)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 HttpRequest (kong.unirest.HttpRequest)2 ScenarioException (com.seleniumtests.customexception.ScenarioException)1 ArrayList (java.util.ArrayList)1 SkipException (org.testng.SkipException)1 BeforeMethod (org.testng.annotations.BeforeMethod)1