Search in sources :

Example 1 with Uft

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

the class SeleniumRobotTestPlan method loadUftScript.

/**
 * Load a UFT script locally or remotely via a VBS script called through csscript.exe
 * @param almServer		ALM server address
 * @param almUser
 * @param almPassword
 * @param almDomain
 * @param almProject
 * @param scriptPath	path to ALM script. e.g: '[QualityCenter]Subject\TOOLS\TestsFoo\foo'
 * @param killUftOnStartup	if true, UFT will be killed before starting the UFT test
 */
public Uft loadUftScript(String almServer, String almUser, String almPassword, String almDomain, String almProject, String scriptPath, boolean killUftOnStartup) {
    Uft uft = new Uft(almServer, almUser, almPassword, almDomain, almProject, scriptPath);
    uft.loadScript(killUftOnStartup);
    return uft;
}
Also used : Uft(com.seleniumtests.connectors.extools.Uft)

Example 2 with Uft

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

the class TestSeleniumRobotTestPlan method testLoadUftScript.

@Test(groups = { "ut" })
public void testLoadUftScript() throws Exception {
    PowerMockito.whenNew(Uft.class).withAnyArguments().thenReturn(uft);
    Uft uftInstance = new SeleniumRobotTestPlan().loadUftScript("", "", "", "", "", "", false);
    Assert.assertEquals(uftInstance, uft);
    verify(uft).loadScript(false);
}
Also used : Uft(com.seleniumtests.connectors.extools.Uft) SeleniumRobotTestPlan(com.seleniumtests.core.runner.SeleniumRobotTestPlan) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with Uft

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

the class TestUft method testPrepareArgumentsWithAlmTest.

/**
 * Check we add ALM parameters if they are set
 */
@Test(groups = { "ut" })
public void testPrepareArgumentsWithAlmTest() {
    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, true);
    Assert.assertEquals(args.size(), 9);
    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("/server:http://almserver/qcbin"));
    Assert.assertTrue(args.get(4).equals("/user:usr"));
    Assert.assertTrue(args.get(5).equals("/password:pwd"));
    Assert.assertTrue(args.get(6).equals("/domain:dom"));
    Assert.assertTrue(args.get(7).equals("/project:proj"));
    Assert.assertTrue(args.get(8).equals("/load"));
    ;
}
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)

Example 4 with Uft

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

the class TestUft method testPrepareExecutionArgumentsWithAlmTest.

/**
 * Check we do not add ALM parameters if they are set on execution
 */
@Test(groups = { "ut" })
public void testPrepareExecutionArgumentsWithAlmTest() {
    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"));
}
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)

Example 5 with Uft

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

the class TestUft method testReadReportListActions.

@Test(groups = { "ut" })
public void testReadReportListActions() throws IOException, DataConversionException {
    String report = GenericTest.readResourceToString("tu/Results.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.size(), 2);
    Assert.assertEquals(stepList.get(0).getName(), "UFT: DebutTest [DebutTest]");
    Assert.assertEquals(stepList.get(1).getName(), "UFT: Choixproduit [Choixproduit]");
    // check the while content
    Assert.assertEquals(stepList.get(0).getStepStatus(), StepStatus.FAILED);
    Assert.assertEquals(stepList.get(1).getStepStatus(), StepStatus.SUCCESS);
    Assert.assertEquals(stepList.get(1).toString(), "Step UFT: Choixproduit [Choixproduit]\n" + "  - Choix du produit\n" + "						: Permet de sélectionner le produit à traiter dans l'arbre produit\n" + "  - Step P9\n" + "						: Local Browser\n" + "    - Step P9 - Agence\n" + "							: Page\n" + "      - Step Onglets\n" + "								: Frame\n" + "        - Particulier.Exist\n" + "									: \"Object does not exist\"\n" + "      - Step Menu\n" + "								: Frame\n" + "        - Assurance.Click\n" + "									:");
}
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)

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