use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testPrepareLoadArgumentsWithAlmTest.
/**
* Check we add ALM parameters if they are set on loading
*/
@Test(groups = { "ut" })
public void testPrepareLoadArgumentsWithAlmTest() {
Uft uft = new Uft("http://almserver/qcbin", "usr", "pwd", "dom", "proj", "[QualityCenter]Subject\\Tools\\Tests\\test1");
uft.setKillUftOnStartup(false);
List<String> args = uft.prepareArguments(true, false);
Assert.assertEquals(args.size(), 8);
Assert.assertTrue(args.get(0).startsWith(System.getProperty("java.io.tmpdir")));
Assert.assertTrue(args.get(0).endsWith("uft.vbs"));
Assert.assertTrue(args.get(1).equals("[QualityCenter]Subject\\Tools\\Tests\\test1"));
Assert.assertTrue(args.get(2).equals("/server:http://almserver/qcbin"));
Assert.assertTrue(args.get(3).equals("/user:usr"));
Assert.assertTrue(args.get(4).equals("/password:pwd"));
Assert.assertTrue(args.get(5).equals("/domain:dom"));
Assert.assertTrue(args.get(6).equals("/project:proj"));
Assert.assertTrue(args.get(7).equals("/load"));
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testPrepareLoadArgumentsWithKillOnStartup.
@Test(groups = { "ut" })
public void testPrepareLoadArgumentsWithKillOnStartup() {
Uft uft = new Uft("D:\\Subject\\Tools\\Tests\\test1");
uft.setKillUftOnStartup(true);
List<String> args = uft.prepareArguments(true, false);
Assert.assertEquals(args.size(), 4);
Assert.assertTrue(args.get(0).startsWith(System.getProperty("java.io.tmpdir")));
Assert.assertTrue(args.get(0).endsWith("uft.vbs"));
Assert.assertTrue(args.get(1).equals("D:\\Subject\\Tools\\Tests\\test1"));
Assert.assertTrue(args.get(2).equals("/load"));
Assert.assertTrue(args.get(3).equals("/clean"));
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testExecuteWithBom.
/**
* Adding a character before XML report simulates the BOM
* @throws Exception
*/
@Test(groups = { "ut" })
public void testExecuteWithBom() throws Exception {
String report = GenericTest.readResourceToString("tu/uftReport.xml");
report = "some comments\n_____OUTPUT_____B\n" + report + "\n_____ENDOUTPUT_____\nsome other comments";
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(5, new HashMap<>());
// check a step is returned
Assert.assertNotNull(testSteps);
Assert.assertEquals(testSteps.get(0).getName(), "UFT: IP_Config_Poste_W10 [IP_Config_Poste_W10]");
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testLoad.
@Test(groups = { "ut" })
public void testLoad() 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);
Map<String, String> args = new HashMap<>();
args.put("User", "toto");
Uft uft = new Uft("[QualityCenter]Subject\\OUTILLAGE\\Tests_BHE\\test1");
uft.setParameters(args);
uft.loadScript(false);
ArgumentCaptor<String[]> argsArgument = ArgumentCaptor.forClass(String[].class);
PowerMockito.verifyStatic(TestTasks.class);
TestTasks.executeCommand(eq("cscript.exe"), eq(60), isNull(), argsArgument.capture());
// test parameters are not copied
Assert.assertEquals(argsArgument.getAllValues().size(), 3);
Assert.assertEquals(argsArgument.getAllValues().get(1), "[QualityCenter]Subject\\OUTILLAGE\\Tests_BHE\\test1");
Assert.assertEquals(argsArgument.getAllValues().get(2), "/load");
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testExecuteNoLoad.
/**
* Check we cannot execute a test if it's not loaded
* @throws Exception
*/
@Test(groups = { "ut" }, expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Test script has not been loaded. Call 'loadScript' before")
public void testExecuteNoLoad() 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.executeScript(5, new HashMap<>());
}
Aggregations