Search in sources :

Example 16 with TestAction

use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.

the class StubTestClass method testWithExceptionOnFirstExec.

/**
 * Test which fails only on first execution
 */
@Test(groups = "stub")
public void testWithExceptionOnFirstExec() {
    TestStep step1 = new TestStep("step 10", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
    step1.addAction(new TestAction(String.format("played %d times", count), false, new ArrayList<>()));
    step1.addAction(new TestAction("click button", false, new ArrayList<>()));
    TestStepManager.logTestStep(step1);
    if (!failed) {
        failed = true;
        throw new DriverExceptions("some exception");
    }
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) DriverExceptions(com.seleniumtests.customexception.DriverExceptions) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test)

Example 17 with TestAction

use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.

the class StubTestClass method testWithExceptionAndMaxRetryIncreased.

/**
 * Increase max retry
 */
@Test(groups = "stub")
public void testWithExceptionAndMaxRetryIncreased() {
    count++;
    TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
    step1.addAction(new TestAction(String.format("played %d times", count), false, new ArrayList<>()));
    step1.addAction(new TestAction("click button", false, new ArrayList<>()));
    TestStepManager.logTestStep(step1);
    try {
        throw new DriverExceptions("some exception");
    } finally {
        if (count < 3) {
            increaseMaxRetry();
        }
    }
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) DriverExceptions(com.seleniumtests.customexception.DriverExceptions) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test)

Example 18 with TestAction

use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.

the class StubTestClass method testWithExceptionAndDataProvider.

@Test(groups = "stub", dataProvider = "data")
public void testWithExceptionAndDataProvider(String data) {
    count++;
    TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
    step1.addAction(new TestAction(String.format("played %d times", count), false, new ArrayList<>()));
    step1.addAction(new TestAction("click button", false, new ArrayList<>()));
    TestStepManager.logTestStep(step1);
    throw new DriverExceptions("some exception");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) DriverExceptions(com.seleniumtests.customexception.DriverExceptions) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test)

Example 19 with TestAction

use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.

the class StubTestClass method testWithInfo2.

@Test(groups = "stub", description = "a test with infos")
public void testWithInfo2() throws IOException {
    TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
    step1.addAction(new TestAction("click button", false, new ArrayList<>()));
    step1.addAction(new TestAction("sendKeys to text field", true, new ArrayList<>()));
    TestStepManager.logTestStep(step1);
    addTestInfo("user ID", new HyperlinkInfo("12345", "http://foo/bar/12345"));
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) HyperlinkInfo(com.seleniumtests.reporter.info.HyperlinkInfo) Test(org.testng.annotations.Test)

Example 20 with TestAction

use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.

the class StubTestClass method testWithInfo1.

@Test(groups = "stub", description = "a test with infos")
public void testWithInfo1() throws IOException {
    TestStep step1 = new TestStep("step 1", Reporter.getCurrentTestResult(), new ArrayList<>(), maskPassword);
    step1.addAction(new TestAction("click button", false, new ArrayList<>()));
    step1.addAction(new TestAction("sendKeys to text field", true, new ArrayList<>()));
    TestStepManager.logTestStep(step1);
    addTestInfo("bugé <\"ID\">", new StringInfo("12"));
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) StringInfo(com.seleniumtests.reporter.info.StringInfo) ArrayList(java.util.ArrayList) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test)

Aggregations

TestAction (com.seleniumtests.reporter.logger.TestAction)56 TestStep (com.seleniumtests.reporter.logger.TestStep)47 Test (org.testng.annotations.Test)44 ArrayList (java.util.ArrayList)38 GenericTest (com.seleniumtests.GenericTest)24 TestMessage (com.seleniumtests.reporter.logger.TestMessage)12 DriverExceptions (com.seleniumtests.customexception.DriverExceptions)8 ScreenShot (com.seleniumtests.driver.screenshots.ScreenShot)5 Snapshot (com.seleniumtests.reporter.logger.Snapshot)5 File (java.io.File)5 HashMap (java.util.HashMap)5 GenericFile (com.seleniumtests.reporter.logger.GenericFile)3 Element (org.jdom2.Element)3 WebDriverException (org.openqa.selenium.WebDriverException)3 HarCapture (com.seleniumtests.reporter.logger.HarCapture)2 PageObject (com.seleniumtests.uipage.PageObject)2 Instant (java.time.Instant)2 Har (net.lightbody.bmp.core.har.Har)2 HarLog (net.lightbody.bmp.core.har.HarLog)2 HarPage (net.lightbody.bmp.core.har.HarPage)2