use of com.seleniumtests.connectors.tms.TestManager in project seleniumRobot by bhecquet.
the class TestSeleniumTestContext3 method testInitTestManager.
@Test(groups = "ut")
public void testInitTestManager(final ITestContext testNGCtx, final XmlTest xmlTest) throws Exception {
try {
System.setProperty(SeleniumTestsContext.TMS_TYPE, "squash");
System.setProperty(SeleniumTestsContext.TMS_URL, "http://localhost:1234");
System.setProperty(SeleniumTestsContext.TMS_USER, "user");
System.setProperty(SeleniumTestsContext.TMS_PASSWORD, "password");
System.setProperty(SeleniumTestsContext.TMS_PROJECT, "project");
// check that any parameter starting with "tms" will be used for configuration
System.setProperty("tmsDomain", "domain");
PowerMockito.mockStatic(TestManager.class);
PowerMockito.when(TestManager.getInstance(argThat(config -> config.getString("tmsType").equals("squash") && config.getString("tmsDomain").equals("domain")))).thenReturn(testManager);
ITestResult testResult = GenericTest.generateResult(testNGCtx, getClass());
initThreadContext(testNGCtx, "myTest", testResult);
// check test manager has been created
Assert.assertEquals(SeleniumTestsContextManager.getThreadContext().getTestManagerInstance(), testManager);
} finally {
System.clearProperty(SeleniumTestsContext.TMS_TYPE);
System.clearProperty(SeleniumTestsContext.TMS_URL);
System.clearProperty(SeleniumTestsContext.TMS_USER);
System.clearProperty(SeleniumTestsContext.TMS_PASSWORD);
System.clearProperty(SeleniumTestsContext.TMS_PROJECT);
System.clearProperty("tmsDomain");
}
}
use of com.seleniumtests.connectors.tms.TestManager 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.TestManager in project seleniumRobot by bhecquet.
the class TestTestManager method testTmsSelectionHpAlm.
@Test(groups = { "ut" })
public void testTmsSelectionHpAlm() {
String config = "{'tmsType': 'hp', 'tmsRun': '3'}";
TestManager manager = TestManager.getInstance(new JSONObject(config));
Assert.assertTrue(manager instanceof HpAlmConnector);
}
use of com.seleniumtests.connectors.tms.TestManager in project seleniumRobot by bhecquet.
the class SeleniumTestsContext method initTestManager.
public TestManager initTestManager() {
if (getTmsType() != null && getTmsUrl() != null) {
// build configuration
JSONObject jsonConfig = new JSONObject();
jsonConfig.put(TMS_TYPE, getTmsType());
jsonConfig.put(TMS_URL, getTmsUrl());
jsonConfig.put(TMS_USER, getTmsUser());
jsonConfig.put(TMS_PASSWORD, getTmsPassword());
jsonConfig.put(TMS_PROJECT, getTmsProject());
// add non standard configurations
for (String key : getConfiguration().keySet()) {
if (key.startsWith("tms")) {
jsonConfig.put(key, getConfiguration().get(key).getValue());
}
}
TestManager tms = TestManager.getInstance(jsonConfig);
tms.init(jsonConfig);
return tms;
}
return null;
}
use of com.seleniumtests.connectors.tms.TestManager in project seleniumRobot by bhecquet.
the class TestManagerReporter method generateReport.
@Override
protected void generateReport(Map<ITestContext, Set<ITestResult>> resultSet, String outdir, boolean optimizeResult, boolean finalGeneration) {
// record only when all tests are executed so that intermediate results (a failed test which has been retried) are not present in list
if (!finalGeneration) {
return;
}
// Record test method reports for each result which has not already been recorded
for (Map.Entry<ITestContext, Set<ITestResult>> entry : resultSet.entrySet()) {
for (ITestResult testResult : entry.getValue()) {
SeleniumTestsContext testContext = SeleniumTestsContextManager.setThreadContextFromTestResult(testResult.getTestContext(), testResult);
TestManager testManager = testContext.getTestManagerInstance();
if (testManager == null) {
return;
}
testManager.login();
// do not record twice the same result
if (!TestNGResultUtils.isTestManagerReportCreated(testResult)) {
testManager.recordResult(testResult);
testManager.recordResultFiles(testResult);
TestNGResultUtils.setTestManagereportCreated(testResult, true);
}
testManager.logout();
}
}
}
Aggregations