Search in sources :

Example 11 with SquashTMApi

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

the class TestSquashTMApi method testCreateIteration.

@Test(groups = { "ut" })
public void testCreateIteration() {
    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();
    Iteration iteration3 = spy(new Iteration("http://localhost:4321/iterations/3", 3, "myIteration"));
    PowerMockito.when(Iteration.create(campaign1, "myIteration")).thenReturn(iteration3);
    Assert.assertEquals(api.createIteration(campaign1, "myIteration"), iteration3);
    // check campaign creation has been called
    PowerMockito.verifyStatic(Iteration.class);
    Iteration.create(campaign1, "myIteration");
}
Also used : SquashTMApi(com.seleniumtests.connectors.tms.squash.SquashTMApi) Iteration(com.seleniumtests.connectors.tms.squash.entities.Iteration) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 12 with SquashTMApi

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

the class TestSquashTMApi method testServerInError.

@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testServerInError() {
    createServerMock("GET", "/api/rest/latest/projects", 500, "{}");
    PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
    SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "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 13 with SquashTMApi

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

the class TestSquashTMApi method testGetExistingProject.

@Test(groups = { "ut" })
public void testGetExistingProject() {
    PowerMockito.when(Project.getAll()).thenReturn(Arrays.asList(project1, project2));
    SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
    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 14 with SquashTMApi

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

the class TestSquashTMApi method testCreateCampaignWithFolder.

/**
 * Check that folders are created when they to not exist for this project
 */
@Test(groups = { "ut" })
public void testCreateCampaignWithFolder() {
    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", null)).thenReturn(myCampaign);
    SquashTMApi api = new SquashTMApi("http://localhost:4321", "user", "password", "project1");
    Campaign newCampaign = api.createCampaign("mycampaign", "myFolder/folder1");
    Assert.assertEquals(newCampaign, myCampaign);
    // check campaign creation has been called
    PowerMockito.verifyStatic(Campaign.class);
    Campaign.create(project1, "mycampaign", null);
    // check 2 folders has been created
    PowerMockito.verifyStatic(CampaignFolder.class);
    CampaignFolder.create(eq(project1), any(), eq("myFolder"));
    PowerMockito.verifyStatic(CampaignFolder.class);
    CampaignFolder.create(eq(project1), any(), eq("folder1"));
}
Also used : Campaign(com.seleniumtests.connectors.tms.squash.entities.Campaign) SquashTMApi(com.seleniumtests.connectors.tms.squash.SquashTMApi) 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