Search in sources :

Example 1 with TestPlanItemExecution

use of com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution in project seleniumRobot by bhecquet.

the class SquashTMApi method setExecutionResult.

/**
 * Add an execution result to the test case
 * @param testPlanItem	the IterationTestPlanItem which has been executed
 * @param result		Execution status of the test
 */
public void setExecutionResult(IterationTestPlanItem testPlanItem, ExecutionStatus result) {
    TestPlanItemExecution execution = testPlanItem.createExecution();
    execution.setResult(result);
}
Also used : TestPlanItemExecution(com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution)

Example 2 with TestPlanItemExecution

use of com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution 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 3 with TestPlanItemExecution

use of com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution 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)

Example 4 with TestPlanItemExecution

use of com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution in project seleniumRobot by bhecquet.

the class TestTestPlanItemExecution method testSetResultWithError.

@Test(groups = { "ut" }, expectedExceptions = ScenarioException.class)
public void testSetResultWithError() {
    RequestBodyEntity patchRequest = (RequestBodyEntity) createServerMock("PATCH", "/executions/83", 200, "{}", "requestBodyEntity");
    when(patchRequest.asJson()).thenThrow(UnirestException.class);
    TestPlanItemExecution execution = new TestPlanItemExecution("http://localhost:4321/executions/83", 83, "execution");
    execution.setResult(ExecutionStatus.SUCCESS);
}
Also used : RequestBodyEntity(kong.unirest.RequestBodyEntity) 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 5 with TestPlanItemExecution

use of com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution in project seleniumRobot by bhecquet.

the class TestTestPlanItemExecution method testFromJson.

@Test(groups = { "ut" })
public void testFromJson() {
    JSONObject json = new JSONObject();
    json.put("_type", "execution");
    json.put("id", 83);
    json.put("name", "foo");
    json.put("_links", new JSONObject("{\"self\" : {" + "          \"href\" : \"http://localhost:8080/api/rest/latest/executions/83\"" + "        }}"));
    TestPlanItemExecution iteration = TestPlanItemExecution.fromJson(json);
    Assert.assertEquals(iteration.getId(), 83);
    Assert.assertEquals(iteration.getName(), "foo");
    Assert.assertEquals(iteration.getUrl(), "http://localhost:8080/api/rest/latest/executions/83");
}
Also used : JSONObject(kong.unirest.json.JSONObject) 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

TestPlanItemExecution (com.seleniumtests.connectors.tms.squash.entities.TestPlanItemExecution)6 ConnectorsTest (com.seleniumtests.ConnectorsTest)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 Test (org.testng.annotations.Test)5 HttpRequestWithBody (kong.unirest.HttpRequestWithBody)3 IterationTestPlanItem (com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem)2 TestCase (com.seleniumtests.connectors.tms.squash.entities.TestCase)2 JSONObject (kong.unirest.json.JSONObject)2 RequestBodyEntity (kong.unirest.RequestBodyEntity)1