use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testReadBadReport.
/**
* Check that with wrong formatted report, the main test step is still present
* but without content
*/
@Test(groups = { "ut" })
public void testReadBadReport() throws IOException {
String report = GenericTest.readResourceToString("tu/wrongUftReport.xml");
Uft uft = new Uft("[QualityCenter]Subject\\Tools\\Tests\\test1");
List<TestStep> testSteps = uft.readXmlResult(report);
Assert.assertEquals(testSteps.get(0).getStepActions().size(), 1);
Assert.assertEquals(((TestMessage) testSteps.get(0).getStepActions().get(0)).getMessageType(), MessageType.ERROR);
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testPrepareArgumentsWithAlmTestAndParam.
@Test(groups = { "ut" })
public void testPrepareArgumentsWithAlmTestAndParam() {
Map<String, String> params = new HashMap<>();
params.put("User", "toto");
Uft uft = new Uft("http://almserver/qcbin", "usr", "pwd", "dom", "proj", "[QualityCenter]Subject\\Tools\\Tests\\test1");
uft.setParameters(params);
List<String> args = uft.prepareArguments(true, true);
Assert.assertEquals(args.size(), 11);
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("/execute"));
Assert.assertTrue(args.get(3).equals("\"User=toto\""));
Assert.assertTrue(args.get(4).equals("/server:http://almserver/qcbin"));
Assert.assertTrue(args.get(5).equals("/user:usr"));
Assert.assertTrue(args.get(6).equals("/password:pwd"));
Assert.assertTrue(args.get(7).equals("/domain:dom"));
Assert.assertTrue(args.get(8).equals("/project:proj"));
Assert.assertTrue(args.get(9).equals("/load"));
Assert.assertTrue(args.get(10).equals("/clean"));
Assert.assertTrue(uft.isKillUftOnStartup());
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testExecute.
@Test(groups = { "ut" })
public void testExecute() 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.loadScript(false);
List<TestStep> testSteps = uft.executeScript(120, args);
// check a step is returned
Assert.assertNotNull(testSteps);
ArgumentCaptor<String[]> argsArgument = ArgumentCaptor.forClass(String[].class);
PowerMockito.verifyStatic(TestTasks.class);
TestTasks.executeCommand(eq("cscript.exe"), eq(120), isNull(), argsArgument.capture());
Assert.assertEquals(argsArgument.getAllValues().size(), 4);
Assert.assertEquals(argsArgument.getAllValues().get(1), "[QualityCenter]Subject\\OUTILLAGE\\Tests_BHE\\test1");
Assert.assertEquals(argsArgument.getAllValues().get(2), "/execute");
Assert.assertEquals(argsArgument.getAllValues().get(3), "\"User=toto\"");
}
use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.
the class TestUft method testPrepareLoadArgumentsWithAlmTestMissingServerValues.
/**
* If some ALM values are missing, throw a configuration exception
*/
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testPrepareLoadArgumentsWithAlmTestMissingServerValues() {
Uft uft = new Uft(null, "usr", "pwd", "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 testExecuteNothingReturned.
@Test(groups = { "ut" })
public void testExecuteNothingReturned() throws Exception {
String report = "";
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, args);
// check a step is returned
Assert.assertFalse(testSteps.isEmpty());
Assert.assertEquals(testSteps.get(0).getName(), "UFT: test1");
}
Aggregations