Search in sources :

Example 11 with IterationTestPlanItem

use of com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem 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);
}
Also used : IterationTestPlanItem(com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem) TestCase(com.seleniumtests.connectors.tms.squash.entities.TestCase) HttpRequestWithBody(kong.unirest.HttpRequestWithBody) TestPlanItemExecution(com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 12 with IterationTestPlanItem

use of com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem 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();
}
Also used : IterationTestPlanItem(com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem) TestCase(com.seleniumtests.connectors.tms.squash.entities.TestCase) HttpRequestWithBody(kong.unirest.HttpRequestWithBody) TestPlanItemExecution(com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

IterationTestPlanItem (com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem)12 Test (org.testng.annotations.Test)11 ConnectorsTest (com.seleniumtests.ConnectorsTest)10 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)10 TestCase (com.seleniumtests.connectors.tms.squash.entities.TestCase)7 Iteration (com.seleniumtests.connectors.tms.squash.entities.Iteration)5 SquashTMApi (com.seleniumtests.connectors.tms.squash.SquashTMApi)4 HttpRequestWithBody (kong.unirest.HttpRequestWithBody)3 JSONObject (kong.unirest.json.JSONObject)3 Campaign (com.seleniumtests.connectors.tms.squash.entities.Campaign)2 TestPlanItemExecution (com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution)2 GenericTest (com.seleniumtests.GenericTest)1 SquashTMConnector (com.seleniumtests.connectors.tms.squash.SquashTMConnector)1 ConfigurationException (com.seleniumtests.customexception.ConfigurationException)1 ScenarioException (com.seleniumtests.customexception.ScenarioException)1