use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCreateTestCaseInSessionNoSession.
// test case in session creation
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testCreateTestCaseInSessionNoSession() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = spy(configureMockedSnapshotServerConnection());
connector.createTestCaseInSession(null, connector.createTestCase("Test 1"), "Test 1");
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testGetStepReferenceSnapshot.
@Test(groups = { "ut" })
public void testGetStepReferenceSnapshot() throws UnirestException, IOException {
SeleniumRobotSnapshotServerConnector connector = spy(configureMockedSnapshotServerConnection());
Integer sessionId = connector.createSession("Session1");
Integer testCaseId = connector.createTestCase("Test 1");
Integer testCaseInSessionId = connector.createTestCaseInSession(sessionId, testCaseId, "Test 1");
Integer testStepId = connector.createTestStep("Step 1", testCaseInSessionId);
Integer stepResultId = connector.recordStepResult(true, "", 1, sessionId, testCaseInSessionId, testStepId);
createServerMock("GET", String.format("%s%d/", SeleniumRobotSnapshotServerConnector.STEP_REFERENCE_API_URL, stepResultId), 200, createImageFromResource("tu/ffLogo1.png"));
File picture = connector.getReferenceSnapshot(stepResultId);
Assert.assertNotNull(picture);
Assert.assertTrue(picture.length() > 0);
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCreateSnapshotInError.
@Test(groups = { "ut" }, expectedExceptions = SeleniumRobotServerException.class)
public void testCreateSnapshotInError() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = configureMockedSnapshotServerConnection();
HttpRequest<HttpRequest> req = createServerMock("POST", SeleniumRobotSnapshotServerConnector.SNAPSHOT_API_URL, 200, "{'id': '9'}", "body");
when(req.asString()).thenThrow(UnirestException.class);
Integer sessionId = connector.createSession("Session1");
Integer testCaseId = connector.createTestCase("Test 1");
Integer testCaseInSessionId = connector.createTestCaseInSession(sessionId, testCaseId, "Test 1");
Integer testStepId = connector.createTestStep("Step 1", testCaseInSessionId);
Integer stepResultId = connector.recordStepResult(true, "", 1, sessionId, testCaseInSessionId, testStepId);
Integer snapshotId = connector.createSnapshot(snapshot, sessionId, testCaseInSessionId, stepResultId);
Assert.assertNull(snapshotId);
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testAddAlreadyLinkedTestStepToTestCase.
@Test(groups = { "ut" })
public void testAddAlreadyLinkedTestStepToTestCase() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = spy(configureMockedSnapshotServerConnection());
createServerMock("GET", SeleniumRobotSnapshotServerConnector.TESTCASEINSESSION_API_URL + "15", 200, "{'testSteps': ['1', '14']}");
Integer sessionId = connector.createSession("Session1");
Integer testCaseId = connector.createTestCase("Test 1");
Integer testCaseInSessionId = connector.createTestCaseInSession(sessionId, testCaseId, "Test 1");
Integer testStepId = connector.createTestStep("Step 1", testCaseInSessionId);
verify(connector).addTestStepsToTestCases(Arrays.asList("1", "14"), testCaseInSessionId);
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCreateStepResultNoStep.
// step result creation
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testCreateStepResultNoStep() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = spy(configureMockedSnapshotServerConnection());
connector.recordStepResult(true, "", 1, 1, 1, null);
}
Aggregations