Search in sources :

Example 1 with SeleniumRobotTestPlan

use of com.seleniumtests.core.runner.SeleniumRobotTestPlan in project seleniumRobot by bhecquet.

the class TestSeleniumRobotTestPlan method testExecuteUftScriptFailure.

@Test(groups = { "ut" }, expectedExceptions = ScenarioException.class, expectedExceptionsMessageRegExp = "UFT execution failed on script null")
public void testExecuteUftScriptFailure() throws Exception {
    Map<String, String> params = new HashMap<>();
    params.put("foo", "bar");
    TestStep step = new TestStep("step", null, new ArrayList<String>(), false);
    step.setFailed(true);
    when(uft.executeScript(5, params)).thenReturn(Arrays.asList(step));
    new SeleniumRobotTestPlan().executeUftScript(uft, 5, params);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) HashMap(java.util.HashMap) SeleniumRobotTestPlan(com.seleniumtests.core.runner.SeleniumRobotTestPlan) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with SeleniumRobotTestPlan

use of com.seleniumtests.core.runner.SeleniumRobotTestPlan 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 SeleniumRobotTestPlan

use of com.seleniumtests.core.runner.SeleniumRobotTestPlan in project seleniumRobot by bhecquet.

the class TestSeleniumRobotTestPlan method testExecuteUftScriptSuccess.

@Test(groups = { "ut" })
public void testExecuteUftScriptSuccess() throws Exception {
    Map<String, String> params = new HashMap<>();
    params.put("foo", "bar");
    TestStep step = new TestStep("step", null, new ArrayList<String>(), false);
    when(uft.executeScript(5, params)).thenReturn(Arrays.asList(step));
    new SeleniumRobotTestPlan().executeUftScript(uft, 5, params);
    verify(uft).executeScript(5, params);
    // check test step is recorded
    // 1 call before the step, 1 call after
    PowerMockito.verifyStatic(TestStepManager.class, times(2));
    TestStepManager.logTestStep(TestStepManager.getCurrentRootTestStep());
    PowerMockito.verifyStatic(TestStepManager.class);
    TestStepManager.setCurrentRootTestStep(step);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) HashMap(java.util.HashMap) SeleniumRobotTestPlan(com.seleniumtests.core.runner.SeleniumRobotTestPlan) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

MockitoTest (com.seleniumtests.MockitoTest)3 SeleniumRobotTestPlan (com.seleniumtests.core.runner.SeleniumRobotTestPlan)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 Test (org.testng.annotations.Test)3 TestStep (com.seleniumtests.reporter.logger.TestStep)2 HashMap (java.util.HashMap)2 Uft (com.seleniumtests.connectors.extools.Uft)1