use of com.seleniumtests.connectors.tms.squash.SquashTMApi in project seleniumRobot by bhecquet.
the class TestSquashTMApi method testCreateCampaignWithExistingFolder.
@Test(groups = { "ut" })
public void testCreateCampaignWithExistingFolder() {
PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
doReturn(Arrays.asList(campaign1, campaign2)).when(project1).getCampaigns();
PowerMockito.when(CampaignFolder.getAll()).thenReturn(Arrays.asList(campaignFolder1, campaignFolder2));
Campaign myCampaign = new Campaign("http://localhost:4321/campaigns/3", 3, "mycampaign");
PowerMockito.when(Campaign.create(project1, "mycampaign", campaignFolder2)).thenReturn(myCampaign);
SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
Campaign newCampaign = api.createCampaign("mycampaign", "campaignFolder1/campaignFolder2");
Assert.assertEquals(newCampaign, myCampaign);
// check campaign creation has been called
PowerMockito.verifyStatic(Campaign.class);
Campaign.create(project1, "mycampaign", campaignFolder2);
// check the 2 folders has not been created
PowerMockito.verifyStatic(CampaignFolder.class, never());
CampaignFolder.create(eq(project1), any(), eq("campaignFolder1"));
PowerMockito.verifyStatic(CampaignFolder.class, never());
CampaignFolder.create(eq(project1), any(), eq("campaignFolder2"));
}
use of com.seleniumtests.connectors.tms.squash.SquashTMApi in project seleniumRobot by bhecquet.
the class TestSquashTMApi method testCreateUnexistingCampaign.
@Test(groups = { "ut" })
public void testCreateUnexistingCampaign() {
PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
doReturn(Arrays.asList(campaign1, campaign2)).when(project1).getCampaigns();
Campaign myCampaign = new Campaign("http://localhost:4321/campaigns/3", 3, "mycampaign");
PowerMockito.when(Campaign.create(project1, "mycampaign", null)).thenReturn(myCampaign);
SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
Campaign newCampaign = api.createCampaign("mycampaign", null);
Assert.assertEquals(newCampaign, myCampaign);
// check campaign creation has been called
PowerMockito.verifyStatic(Campaign.class);
Campaign.create(project1, "mycampaign", null);
// check no folder has been created
PowerMockito.verifyStatic(CampaignFolder.class, never());
CampaignFolder.create(eq(project1), any(), anyString());
}
use of com.seleniumtests.connectors.tms.squash.SquashTMApi in project seleniumRobot by bhecquet.
the class TestSquashTMApi method testServerInError2.
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testServerInError2() {
GetRequest getRequest = (GetRequest) createServerMock("GET", "/api/rest/latest/projects", 200, "{}");
when(getRequest.asJson()).thenThrow(UnirestException.class);
PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
}
use of com.seleniumtests.connectors.tms.squash.SquashTMApi 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));
}
use of com.seleniumtests.connectors.tms.squash.SquashTMApi in project seleniumRobot by bhecquet.
the class TestSquashTMApi method testDoNotCreateExistingCampaign.
/**
* Check that we do not recreate a campaign if it already exist
*/
@Test(groups = { "ut" })
public void testDoNotCreateExistingCampaign() {
PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
doReturn(Arrays.asList(campaign1, campaign2)).when(project1).getCampaigns();
SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
Campaign newCampaign = api.createCampaign("campaign1", "");
Assert.assertEquals(newCampaign, campaign1);
// check campaign creation has been called
PowerMockito.verifyStatic(Campaign.class, never());
Campaign.create(project1, "campaign1", null);
// check no folder has been created
PowerMockito.verifyStatic(CampaignFolder.class, never());
CampaignFolder.create(eq(project1), any(), anyString());
}
Aggregations