use of com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem in project seleniumRobot by bhecquet.
the class TestIteration method testGetAllNoTestCases.
/**
* Check case where no campaigns are available
*/
@Test(groups = { "ut" })
public void testGetAllNoTestCases() {
createServerMock("GET", "/iterations/1/test-plan", 200, "{" + " \"_links\" : {" + " \"first\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/1/test-plan?page=0&size=2\"" + " }," + " \"prev\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/1/test-plan?page=0&size=2\"" + " }," + " \"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/1/test-plan?page=1&size=2\"" + " }," + " \"next\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/1/test-plan?page=2&size=2\"" + " }," + " \"last\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iterations/1/test-plan?page=2&size=2\"" + " }" + " }," + " \"page\" : {" + " \"size\" : 2," + " \"totalElements\" : 6," + " \"totalPages\" : 3," + " \"number\" : 1" + " }" + "}");
Iteration iteration = new Iteration("http://localhost:8080/api/rest/latest/iterations/1", 1, "my_iteration");
List<IterationTestPlanItem> testCases = iteration.getAllTestCases();
Assert.assertEquals(testCases.size(), 0);
}
use of com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem in project seleniumRobot by bhecquet.
the class TestIterationTestPlanItem method testFromJson.
@Test(groups = { "ut" })
public void testFromJson() {
JSONObject json = new JSONObject();
json.put("_type", "iteration-test-plan-item");
json.put("id", 6);
json.put("name", "foo");
json.put("_links", new JSONObject("{\"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/iteration-test-plan-items/6\"" + " }}"));
json.put("referenced_test_case", new JSONObject("{" + " \"_type\" : \"test-case\"," + " \"id\" : 25," + " \"_links\" : {" + " \"self\" : {" + " \"href\" : \"http://localhost:8080/api/rest/latest/test-cases/25\"" + " }" + " }" + " }"));
IterationTestPlanItem iteration = IterationTestPlanItem.fromJson(json);
Assert.assertEquals(iteration.getId(), 6);
Assert.assertEquals(iteration.getTestCase().getId(), 25);
Assert.assertEquals(iteration.getUrl(), "http://localhost:8080/api/rest/latest/iteration-test-plan-items/6");
}
use of com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem 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.IterationTestPlanItem 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.IterationTestPlanItem in project seleniumRobot by bhecquet.
the class TestSquashTMApi method testAddTestCaseInIteration.
@Test(groups = { "ut" })
public void testAddTestCaseInIteration() {
PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
doReturn(Arrays.asList(testPlanItem1, testPlanItem2)).when(iteration1).getAllTestCases();
PowerMockito.when(TestCase.get(3)).thenReturn(testCase1);
doReturn(testPlanItem1).when(iteration1).addTestCase(testCase1);
IterationTestPlanItem itpi = api.addTestCaseInIteration(iteration1, 3);
Assert.assertEquals(itpi, testPlanItem1);
// check test case has been added
verify(iteration1).addTestCase(any(TestCase.class));
}
Aggregations