use of com.seleniumtests.connectors.tms.squash.SquashTMConnector in project seleniumRobot by bhecquet.
the class TestTestManager method testTmsSelectionSquashTm.
@Test(groups = { "ut" })
public void testTmsSelectionSquashTm() {
String config = "{'tmsType': 'squash'}";
TestManager manager = TestManager.getInstance(new JSONObject(config));
Assert.assertTrue(manager instanceof SquashTMConnector);
}
use of com.seleniumtests.connectors.tms.squash.SquashTMConnector 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);
}
use of com.seleniumtests.connectors.tms.squash.SquashTMConnector in project seleniumRobot by bhecquet.
the class TestSquashTMConnector method testInitWithoutProjectParameter.
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testInitWithoutProjectParameter() {
JSONObject connect = new JSONObject();
connect.put(SquashTMConnector.TMS_SERVER_URL, "http://myServer");
connect.put(SquashTMConnector.TMS_USER, "user");
connect.put(SquashTMConnector.TMS_PASSWORD, "password");
SquashTMConnector squash = new SquashTMConnector();
squash.init(connect);
}
use of com.seleniumtests.connectors.tms.squash.SquashTMConnector in project seleniumRobot by bhecquet.
the class TestSquashTMConnector method testRecordResultTestWrongTestId.
/**
* Check that if the testID is not valid, we raise an error
* @param testContext
*/
@Test(groups = { "ut" })
public void testRecordResultTestWrongTestId(ITestContext testContext) {
JSONObject connect = new JSONObject();
connect.put(SquashTMConnector.TMS_SERVER_URL, "http://myServer");
connect.put(SquashTMConnector.TMS_PROJECT, "project");
connect.put(SquashTMConnector.TMS_USER, "user");
connect.put(SquashTMConnector.TMS_PASSWORD, "password");
SquashTMConnector squash = spy(new SquashTMConnector());
squash.init(connect);
doReturn(api).when(squash).getApi();
CustomAttribute testIdAttr = new CustomAttribute() {
@Override
public Class<? extends Annotation> annotationType() {
return null;
}
@Override
public String[] values() {
return new String[] { "1" };
}
@Override
public String name() {
return "testId";
}
};
// customize test result so that it has attributes
when(testResult.getMethod()).thenReturn(testMethod);
when(testResult.isSuccess()).thenReturn(true);
when(testResult.getName()).thenReturn("MyTest");
when(testResult.getTestContext()).thenReturn(testContext);
when(testResult.getParameters()).thenReturn(new Object[] {});
when(testResult.getAttribute("testContext")).thenReturn(SeleniumTestsContextManager.getThreadContext());
when(testMethod.getAttributes()).thenReturn(new CustomAttribute[] { testIdAttr });
when(api.createCampaign(anyString(), anyString())).thenReturn(campaign);
when(api.createIteration(any(Campaign.class), anyString())).thenReturn(iteration);
when(api.addTestCaseInIteration(iteration, 1)).thenReturn(iterationTestPlanItem);
squash.recordResult(testResult);
// check we call all necessary API methods to record the result
verify(api).createCampaign("Selenium " + testContext.getName(), "");
verify(api).createIteration(campaign, SeleniumTestsContextManager.getThreadContext().getApplicationVersion());
verify(api).addTestCaseInIteration(iteration, 1);
verify(api).setExecutionResult(iterationTestPlanItem, ExecutionStatus.SUCCESS);
}
use of com.seleniumtests.connectors.tms.squash.SquashTMConnector in project seleniumRobot by bhecquet.
the class TestSquashTMConnector method testRecordResultTestInSuccess.
@Test(groups = { "ut" })
public void testRecordResultTestInSuccess(ITestContext testContext) {
JSONObject connect = new JSONObject();
connect.put(SquashTMConnector.TMS_SERVER_URL, "http://myServer");
connect.put(SquashTMConnector.TMS_PROJECT, "project");
connect.put(SquashTMConnector.TMS_USER, "user");
connect.put(SquashTMConnector.TMS_PASSWORD, "password");
SquashTMConnector squash = spy(new SquashTMConnector());
squash.init(connect);
doReturn(api).when(squash).getApi();
CustomAttribute testIdAttr = new CustomAttribute() {
@Override
public Class<? extends Annotation> annotationType() {
return null;
}
@Override
public String[] values() {
return new String[] { "1" };
}
@Override
public String name() {
return "testId";
}
};
// customize test result so that it has attributes
when(testResult.getMethod()).thenReturn(testMethod);
when(testResult.isSuccess()).thenReturn(true);
when(testResult.getName()).thenReturn("MyTest");
when(testResult.getTestContext()).thenReturn(testContext);
when(testResult.getParameters()).thenReturn(new Object[] {});
when(testResult.getAttribute("testContext")).thenReturn(SeleniumTestsContextManager.getThreadContext());
when(testMethod.getAttributes()).thenReturn(new CustomAttribute[] { testIdAttr });
when(api.createCampaign(anyString(), anyString())).thenReturn(campaign);
when(api.createIteration(any(Campaign.class), anyString())).thenReturn(iteration);
when(api.addTestCaseInIteration(iteration, 1)).thenReturn(iterationTestPlanItem);
squash.recordResult(testResult);
// check we call all necessary API methods to record the result
verify(api).createCampaign("Selenium " + testContext.getName(), "");
verify(api).createIteration(campaign, SeleniumTestsContextManager.getThreadContext().getApplicationVersion());
verify(api).addTestCaseInIteration(iteration, 1);
verify(api).setExecutionResult(iterationTestPlanItem, ExecutionStatus.SUCCESS);
}
Aggregations