use of com.seleniumtests.connectors.tms.squash.entities.TestCase in project seleniumRobot by bhecquet.
the class TestIterationTestPlanItem method testAsJson.
@Test(groups = { "ut" })
public void testAsJson() {
TestCase testCase = new TestCase(3, "http://localhost:8080/api/rest/latest/test-cases/3");
IterationTestPlanItem itpi = new IterationTestPlanItem("http://localhost:8080/api/rest/latest/iteration-test-plan-items/6", 6, testCase);
JSONObject json = itpi.asJson();
Assert.assertEquals(json.getInt("id"), 6);
Assert.assertEquals(json.getString("_type"), "iteration-test-plan-item");
}
use of com.seleniumtests.connectors.tms.squash.entities.TestCase in project seleniumRobot by bhecquet.
the class TestIterationTestPlanItem method testCreateIterationTestPlanItem.
@Test(groups = { "ut" })
public void testCreateIterationTestPlanItem() {
HttpRequestWithBody postRequest = (HttpRequestWithBody) createServerMock("POST", "/iterations/4/test-plan", 200, "{" + " \"_type\" : \"iteration-test-plan-item\"," + " \"id\" : 38," + " \"execution_status\" : \"READY\"," + " \"referenced_test_case\" : {" + " \"_type\" : \"test-case\"," + " \"id\" : 25," + " \"_links\" : {" + " \"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/test-cases/25\"" + " }" + " }" + " }," + " \"referenced_dataset\" : {" + " \"_type\" : \"dataset\"," + " \"id\" : 3," + " \"_links\" : {" + " \"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/datasets/3\"" + " }" + " }" + " }," + " \"last_executed_by\" : null," + " \"last_executed_on\" : null," + " \"assigned_to\" : \"User-1\"," + " \"executions\" : [ ]," + " \"iteration\" : {" + " \"_type\" : \"iteration\"," + " \"id\" : 4," + " \"_links\" : {" + " \"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/4\"" + " }" + " }" + " }," + " \"_links\" : {" + " \"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iteration-test-plan-items/38\"" + " }," + " \"project\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/projects/14\"" + " }," + " \"test-case\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/test-cases/25\"" + " }," + " \"dataset\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/datasets/3\"" + " }," + " \"iteration\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/4\"" + " }," + " \"executions\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iteration-test-plan-items/38/executions\"" + " }" + " }" + "}", "request");
Iteration iteration = new Iteration("http://localhost:8080/api/rest/latest/iterations/4", 4, "my_iteration");
IterationTestPlanItem itpi = IterationTestPlanItem.create(iteration, new TestCase(25, "http://localhost:8080/api/rest/latest/test-cases/25"));
verify(postRequest).body(new JSONObject("{\"_type\":\"iteration-test-plan-item\",\"test_case\":{\"id\":25,\"_type\":\"test-case\"}}"));
Assert.assertEquals(itpi.getId(), 38);
}
use of com.seleniumtests.connectors.tms.squash.entities.TestCase in project seleniumRobot by bhecquet.
the class TestTestCase method testFromJson.
@Test(groups = { "ut" })
public void testFromJson() {
JSONObject json = new JSONObject();
json.put("_type", "test-case");
json.put("id", 1);
json.put("name", "foo");
json.put("_links", new JSONObject("{\"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/test-case/1\"" + " }}"));
TestCase testCase = TestCase.fromJson(json);
Assert.assertEquals(testCase.getId(), 1);
Assert.assertEquals(testCase.getUrl(), "http://localhost:8080/api/rest/latest/test-case/1");
}
use of com.seleniumtests.connectors.tms.squash.entities.TestCase in project seleniumRobot by bhecquet.
the class TestIterationTestPlanItem method testCreateExecution.
@Test(groups = { "ut" })
public void testCreateExecution() {
HttpRequestWithBody postRequest = (HttpRequestWithBody) createServerMock("POST", "/iteration-test-plan-items/1/executions", 200, "{" + " \"_type\" : \"iteration\"," + " \"id\" : 22," + " \"name\" : \"new iteration\"," + " \"reference\" : \"NEW_IT\"," + " \"description\" : \"<p>A new iteration</p>\"," + " \"parent\" : {" + " \"_type\" : \"campaign\"," + " \"id\" : 2," + " \"name\" : \"parent campaign\"," + " \"_links\" : {" + " \"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/campaigns/2\"" + " }" + " }" + " }," + " \"created_by\" : \"User-A\"," + " \"created_on\" : \"2017-04-07T10:00:00.000+0000\"," + " \"last_modified_by\" : \"User-B\"," + " \"last_modified_on\" : \"2017-04-15T10:00:00.000+0000\"," + " \"scheduled_start_date\" : \"2017-04-09T10:00:00.000+0000\"," + " \"scheduled_end_date\" : \"2017-04-14T10:00:00.000+0000\"," + " \"actual_start_date\" : \"2017-04-10T10:00:00.000+0000\"," + " \"actual_end_date\" : \"2017-04-15T10:00:00.000+0000\"," + " \"actual_start_auto\" : false," + " \"actual_end_auto\" : true," + " \"custom_fields\" : [ {" + " \"code\" : \"CUF\"," + " \"label\" : \"cuf\"," + " \"value\" : \"value\"" + " } ]," + " \"test_suites\" : [ ]," + " \"attachments\" : [ ]," + " \"_links\" : {" + " \"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/22\"" + " }," + " \"project\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/projects/4\"" + " }," + " \"campaign\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/campaigns/2\"" + " }," + " \"test-suites\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/22/test-suites\"" + " }," + " \"test-plan\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/22/test-plan\"" + " }," + " \"attachments\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/22/attachments\"" + " }" + " }" + "}", "request");
TestCase testCase = new TestCase(3, "http://localhost:8080/api/rest/latest/test-cases/3");
IterationTestPlanItem itpi = new IterationTestPlanItem("http://localhost:8080/api/rest/latest/iteration-test-plan-items/1", 1, testCase);
TestPlanItemExecution execution = itpi.createExecution();
Assert.assertEquals(execution.getId(), 22);
}
use of com.seleniumtests.connectors.tms.squash.entities.TestCase in project seleniumRobot by bhecquet.
the class TestIterationTestPlanItem method testCreateExecutionWithError.
@Test(groups = { "ut" }, expectedExceptions = ScenarioException.class)
public void testCreateExecutionWithError() {
HttpRequestWithBody postRequest = (HttpRequestWithBody) createServerMock("POST", "/iteration-test-plan-items/1/executions", 200, "{}", "request");
when(postRequest.asJson()).thenThrow(UnirestException.class);
TestCase testCase = new TestCase(3, "http://localhost:8080/api/rest/latest/test-cases/3");
IterationTestPlanItem itpi = new IterationTestPlanItem("http://localhost:8080/api/rest/latest/iteration-test-plan-items/1", 1, testCase);
TestPlanItemExecution execution = itpi.createExecution();
}
Aggregations