Search in sources :

Example 11 with Uft

use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.

the class TestUft method testPrepareArgumentsWithAlmTestAndParamAndClean.

@Test(groups = { "ut" })
public void testPrepareArgumentsWithAlmTestAndParamAndClean() {
    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.setKillUftOnStartup(false);
    uft.setParameters(params);
    List<String> args = uft.prepareArguments(true, true);
    Assert.assertEquals(args.size(), 10);
    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"));
}
Also used : Uft(com.seleniumtests.connectors.extools.Uft) HashMap(java.util.HashMap) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) GenericTest(com.seleniumtests.GenericTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 12 with Uft

use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.

the class TestUft method testReadReport.

/**
 * Check report file is correctly read
 *
 * @throws IOException
 */
@Test(groups = { "ut" })
public void testReadReport() throws IOException {
    String report = GenericTest.readResourceToString("tu/uftReport.xml");
    Uft uft = new Uft("[QualityCenter]Subject\\Tools\\Tests\\test1");
    List<TestStep> stepList = uft.readXmlResult(report);
    // check all content has been read
    Assert.assertEquals(stepList.get(0).getName(), "UFT: IP_Config_Poste_W10 [IP_Config_Poste_W10]");
    // check all content has been read
    Assert.assertEquals(stepList.size(), 1);
    // check the while content
    Assert.assertEquals(stepList.get(0).toString(), "Step UFT: IP_Config_Poste_W10 [IP_Config_Poste_W10]");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) Uft(com.seleniumtests.connectors.extools.Uft) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) GenericTest(com.seleniumtests.GenericTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 13 with Uft

use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.

the class TestUft method testPrepareLoadArgumentsWithAlmTestMissingDomainValues.

@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testPrepareLoadArgumentsWithAlmTestMissingDomainValues() {
    Uft uft = new Uft("http://almserver/qcbin", "usr", "pwd", null, "proj", "[QualityCenter]Subject\\Tools\\Tests\\test1");
    uft.setKillUftOnStartup(false);
    uft.prepareArguments(true, false);
}
Also used : Uft(com.seleniumtests.connectors.extools.Uft) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) GenericTest(com.seleniumtests.GenericTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 14 with Uft

use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.

the class TestUft method testReadNoReport.

/**
 * Test when no report is available
 * the main test step is still present
 * @throws IOException
 */
@Test(groups = { "ut" })
public void testReadNoReport() throws IOException {
    String report = "some bad report";
    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);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) Uft(com.seleniumtests.connectors.extools.Uft) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) GenericTest(com.seleniumtests.GenericTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 15 with Uft

use of com.seleniumtests.connectors.extools.Uft in project seleniumRobot by bhecquet.

the class TestUft method testPrepareArgumentsWithLocalTest.

/**
 * Check uft.vbs file is copied to temp folder test is stored locally
 */
@Test(groups = { "ut" })
public void testPrepareArgumentsWithLocalTest() {
    Uft uft = new Uft("D:\\Subject\\Tools\\Tests\\test1");
    uft.setKillUftOnStartup(false);
    List<String> args = uft.prepareArguments(true, true);
    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("/execute"));
}
Also used : Uft(com.seleniumtests.connectors.extools.Uft) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) GenericTest(com.seleniumtests.GenericTest) MockitoTest(com.seleniumtests.MockitoTest)

Aggregations

Uft (com.seleniumtests.connectors.extools.Uft)27 MockitoTest (com.seleniumtests.MockitoTest)26 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)26 Test (org.testng.annotations.Test)26 GenericTest (com.seleniumtests.GenericTest)25 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)20 TestStep (com.seleniumtests.reporter.logger.TestStep)8 TestTasks (com.seleniumtests.core.TestTasks)7 HashMap (java.util.HashMap)7 SeleniumRobotTestPlan (com.seleniumtests.core.runner.SeleniumRobotTestPlan)1