use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testExecuteWithReport2.
/**
* Check the case where UFT produces an invalid file
* @throws Exception
*/
@Test(groups = { "ut" })
public void testExecuteWithReport2() throws Exception {
String report = GenericTest.readResourceToString("tu/uftResult.txt");
PowerMockito.when(TestTasks.class, "executeCommand", eq("cscript.exe"), anyInt(), nullable(Charset.class), any()).thenReturn(report);
Map<String, String> args = new HashMap<>();
args.put("User", "toto");
Uft uft = new Uft("[QualityCenter]Subject\\OUTILLAGE\\Tests_BHE\\test1");
uft.loadScript(false);
List<TestStep> testSteps = uft.executeScript(120, new HashMap<>());
// check a step is returned
Assert.assertNotNull(testSteps);
Assert.assertEquals(testSteps.get(0).getName(), "UFT: Risques [Risques]");
// check no HTML code is returned
Assert.assertFalse(testSteps.toString().contains("<table>"));
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testPrepareLoadArgumentsWithAlmTestMissingPasswordValues.
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testPrepareLoadArgumentsWithAlmTestMissingPasswordValues() {
Uft uft = new Uft("http://almserver/qcbin", "usr", null, "dom", "proj", "[QualityCenter]Subject\\Tools\\Tests\\test1");
uft.setKillUftOnStartup(false);
uft.prepareArguments(true, false);
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testPrepareLoadArgumentsWithAlmTestMissingProjectValues.
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testPrepareLoadArgumentsWithAlmTestMissingProjectValues() {
Uft uft = new Uft("http://almserver/qcbin", "usr", "pwd", "dom", null, "[QualityCenter]Subject\\Tools\\Tests\\test1");
uft.setKillUftOnStartup(false);
uft.prepareArguments(true, false);
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testExecuteNoLoadBeforeSecondExecution.
/**
* Check we cannot execute the same test twice if loading has not been done before the second execution
* @throws Exception
*/
@Test(groups = { "ut" }, expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Test script has not been loaded. Call 'loadScript' before")
public void testExecuteNoLoadBeforeSecondExecution() throws Exception {
String report = GenericTest.readResourceToString("tu/uftReport.xml");
report = "some comments\n_____OUTPUT_____\n" + report + "\n_____ENDOUTPUT_____\nsome other comments";
PowerMockito.when(TestTasks.class, "executeCommand", eq("cscript.exe"), anyInt(), nullable(Charset.class), any()).thenReturn(report);
Uft uft = new Uft("[QualityCenter]Subject\\OUTILLAGE\\Tests_BHE\\test1");
uft.loadScript(false);
uft.executeScript(5, new HashMap<>());
// try a second execution, it's not possible
uft.executeScript(5, new HashMap<>());
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testPrepareArgumentsForGridNotThere.
/**
* Test when grid is not present
*/
@Test(groups = { "ut" }, expectedExceptions = ScenarioException.class)
public void testPrepareArgumentsForGridNotThere() {
SeleniumTestsContextManager.getThreadContext().setSeleniumGridConnector(null);
SeleniumTestsContextManager.getThreadContext().setRunMode("grid");
when(connector.uploadFileToNode(anyString(), eq(true))).thenReturn("D:\\file\\uft.vbs");
Uft uft = new Uft("D:\\Subject\\Tools\\Tests\\test1");
List<String> args = uft.prepareArguments(true, true);
}
Aggregations