Search in sources :

Example 6 with SquashTMApi

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

the class TestSquashTMApi method testDoNotCreateIteration.

/**
 * Iteration already exist, do not recreate it
 */
@Test(groups = { "ut" })
public void testDoNotCreateIteration() {
    PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
    SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
    doReturn(Arrays.asList(iteration1, iteration2)).when(campaign1).getIterations();
    PowerMockito.when(Iteration.create(campaign1, "myIteration")).thenReturn(iteration1);
    Assert.assertEquals(api.createIteration(campaign1, "iteration1"), iteration1);
    // check campaign creation has been called
    PowerMockito.verifyStatic(Iteration.class, never());
    Iteration.create(campaign1, "iteration1");
}
Also used : SquashTMApi(com.seleniumtests.connectors.tms.squash.SquashTMApi) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 7 with SquashTMApi

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

the class TestSquashTM method testCreateCampaign.

@Test(groups = "no-ti", enabled = false, attributes = { @CustomAttribute(name = "testId", values = "12") })
public void testCreateCampaign(ITestContext testContext) {
    SquashTMConnector tm = new SquashTMConnector("http://localhost:8080/squash", "admin", "admin", "Test Project-1");
    SquashTMApi api = tm.getApi();
    Campaign campaign = api.createCampaign("AutoTest", "SubFolder/foo");
    Iteration iteration = api.createIteration(campaign, "myiteration");
    IterationTestPlanItem tpi = api.addTestCaseInIteration(iteration, 239);
    api.setExecutionResult(tpi, ExecutionStatus.FAILURE);
}
Also used : SquashTMApi(com.seleniumtests.connectors.tms.squash.SquashTMApi) Campaign(com.seleniumtests.connectors.tms.squash.entities.Campaign) IterationTestPlanItem(com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem) Iteration(com.seleniumtests.connectors.tms.squash.entities.Iteration) SquashTMConnector(com.seleniumtests.connectors.tms.squash.SquashTMConnector) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 8 with SquashTMApi

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

the class TestSquashTMApi method testDoNotAddTestCase.

/**
 * Iteration already exist, do not recreate it
 */
@Test(groups = { "ut" })
public void testDoNotAddTestCase() {
    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, 2);
    Assert.assertEquals(itpi, testPlanItem2);
    // check test case has been added
    verify(iteration1, never()).addTestCase(any(TestCase.class));
}
Also used : SquashTMApi(com.seleniumtests.connectors.tms.squash.SquashTMApi) IterationTestPlanItem(com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem) TestCase(com.seleniumtests.connectors.tms.squash.entities.TestCase) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 9 with SquashTMApi

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

the class TestSquashTMApi method testGetNoExistingProject.

/**
 * Project does not exist on Squash TM => raise error
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testGetNoExistingProject() {
    PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
    SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project3");
    Assert.assertEquals(api.getCurrentProject(), project1);
}
Also used : SquashTMApi(com.seleniumtests.connectors.tms.squash.SquashTMApi) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 10 with SquashTMApi

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

the class TestSquashTMApi method testCannotAddTestCaseDoesNotExist.

/**
 * Check exception is raised if test case does not exist
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testCannotAddTestCaseDoesNotExist() {
    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.doThrow(new ScenarioException("")).when(TestCase.class);
    TestCase.get(3);
    doReturn(testPlanItem1).when(iteration1).addTestCase(any(TestCase.class));
    IterationTestPlanItem itpi = api.addTestCaseInIteration(iteration1, 3);
}
Also used : SquashTMApi(com.seleniumtests.connectors.tms.squash.SquashTMApi) IterationTestPlanItem(com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem) TestCase(com.seleniumtests.connectors.tms.squash.entities.TestCase) ScenarioException(com.seleniumtests.customexception.ScenarioException) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

SquashTMApi (com.seleniumtests.connectors.tms.squash.SquashTMApi)14 Test (org.testng.annotations.Test)14 ConnectorsTest (com.seleniumtests.ConnectorsTest)13 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)13 Campaign (com.seleniumtests.connectors.tms.squash.entities.Campaign)5 IterationTestPlanItem (com.seleniumtests.connectors.tms.squash.entities.IterationTestPlanItem)4 TestCase (com.seleniumtests.connectors.tms.squash.entities.TestCase)3 Iteration (com.seleniumtests.connectors.tms.squash.entities.Iteration)2 GenericTest (com.seleniumtests.GenericTest)1 SquashTMConnector (com.seleniumtests.connectors.tms.squash.SquashTMConnector)1 ScenarioException (com.seleniumtests.customexception.ScenarioException)1 GetRequest (kong.unirest.GetRequest)1