Search in sources :

Example 6 with TestMessage

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

the class TestTestStep method testPasswordMaskingHtmlEncodedMainStep.

@Test(groups = { "ut" })
public void testPasswordMaskingHtmlEncodedMainStep() {
    TestStep step = new TestStep("step1 with args: (bar, passwd)", null, Arrays.asList("passwd"), true);
    TestAction action = new TestAction("action in step1 with args: (foo, passwd)", false, new ArrayList<>());
    TestMessage message = new TestMessage("everything OK on passwd", MessageType.INFO);
    TestStep substep = new TestStep("substep with args: (passwd)", null, new ArrayList<>(), true);
    step.addAction(action);
    step.addMessage(message);
    step.addStep(substep);
    Assert.assertEquals(step.encode("html").getName(), "step1 with args: (bar, ******)");
    Assert.assertEquals(action.encode("html").getName(), "action in step1 with args: (foo, ******)");
    Assert.assertEquals(message.encode("html").getName(), "everything OK on ******");
    Assert.assertEquals(substep.encode("html").getName(), "substep with args: (******)");
    Assert.assertEquals(step.encode("html").toString(), "Step step1 with args: (bar, ******)\n" + "  - action in step1 with args: (foo, ******)\n" + "  - everything OK on ******\n" + "  - Step substep with args: (******)");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) TestMessage(com.seleniumtests.reporter.logger.TestMessage) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 7 with TestMessage

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

the class TestTestStep method testPasswordMaskingXmlEncodedMainStepWithSpecialCharacters.

@Test(groups = { "ut" })
public void testPasswordMaskingXmlEncodedMainStepWithSpecialCharacters() {
    TestStep step = new TestStep("step1 with args: (bar, passwd§~$µ)", null, Arrays.asList("passwd§~$µ"), true);
    TestAction action = new TestAction("action in step1 with args: (foo, passwd§~$µ)", false, new ArrayList<>());
    TestMessage message = new TestMessage("everything OK on passwd§~$µ", MessageType.INFO);
    TestStep substep = new TestStep("substep with args: (passwd§~$µ)", null, new ArrayList<>(), true);
    step.addAction(action);
    step.addMessage(message);
    step.addStep(substep);
    Assert.assertEquals(step.encode("xml").getName(), "step1 with args: (bar, ******)");
    Assert.assertEquals(action.encode("xml").getName(), "action in step1 with args: (foo, ******)");
    Assert.assertEquals(message.encode("xml").getName(), "everything OK on ******");
    Assert.assertEquals(substep.encode("xml").getName(), "substep with args: (******)");
    Assert.assertEquals(step.encode("xml").toString(), "Step step1 with args: (bar, ******)\n" + "  - action in step1 with args: (foo, ******)\n" + "  - everything OK on ******\n" + "  - Step substep with args: (******)");
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) TestMessage(com.seleniumtests.reporter.logger.TestMessage) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 8 with TestMessage

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

the class Uft method addStepWithoutXml.

private void addStepWithoutXml(List<TestStep> listStep, String messageException, Exception e) {
    logger.error(messageException + e.getMessage());
    TestStep readStep = new TestStep("UFT: " + scriptName, Reporter.getCurrentTestResult(), new ArrayList<>(), false);
    readStep.addMessage(new TestMessage(messageException + e.getMessage(), MessageType.ERROR));
    listStep.add(readStep);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) TestMessage(com.seleniumtests.reporter.logger.TestMessage)

Example 9 with TestMessage

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

the class StubTestClassForEncoding method testAndSubActions.

@Test(groups = "stub", description = "a test with steps")
public void testAndSubActions() throws IOException {
    TestStep step1 = new TestStep("step 1 <>\"'&/", Reporter.getCurrentTestResult(), new ArrayList<>(), true);
    step1.addAction(new TestAction("click button  <>\"'&", false, new ArrayList<>()));
    step1.addMessage(new TestMessage("a message <>\"'&", MessageType.LOG));
    TestStepManager.logTestStep(step1);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) ArrayList(java.util.ArrayList) TestMessage(com.seleniumtests.reporter.logger.TestMessage) TestAction(com.seleniumtests.reporter.logger.TestAction) Test(org.testng.annotations.Test)

Example 10 with TestMessage

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

the class ReporterControler method createTestStepForComparisonResult.

/**
 * Create a step with the comparison result
 * @param testResult
 * @param snapshotComparisonResult
 * @return
 */
private void createTestStepForComparisonResult(ITestResult testResult, int snapshotComparisonResult, String errorMessage) {
    // create a step for snapshot comparison
    TestStep testStep = new TestStep("Snapshot comparison", testResult, new ArrayList<>(), false);
    if (snapshotComparisonResult == ITestResult.FAILURE) {
        testStep.addMessage(new TestMessage("Comparison failed: " + errorMessage, MessageType.ERROR));
        testStep.setFailed(true);
    } else if (snapshotComparisonResult == ITestResult.SUCCESS) {
        testStep.addMessage(new TestMessage("Comparison successful", MessageType.INFO));
    } else if (snapshotComparisonResult == ITestResult.SKIP && !errorMessage.isEmpty()) {
        testStep.addMessage(new TestMessage("Comparison skipped: " + errorMessage, MessageType.ERROR));
        testStep.setFailed(true);
    } else if (snapshotComparisonResult == ITestResult.SKIP && errorMessage.isEmpty()) {
        testStep.addMessage(new TestMessage("No comparison to do (no snapshots)", MessageType.LOG));
    }
    getAllTestSteps(testResult).add(testStep);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) TestMessage(com.seleniumtests.reporter.logger.TestMessage)

Aggregations

TestMessage (com.seleniumtests.reporter.logger.TestMessage)20 Test (org.testng.annotations.Test)17 TestStep (com.seleniumtests.reporter.logger.TestStep)16 GenericTest (com.seleniumtests.GenericTest)14 TestAction (com.seleniumtests.reporter.logger.TestAction)12 ArrayList (java.util.ArrayList)7 GenericFile (com.seleniumtests.reporter.logger.GenericFile)2 HarCapture (com.seleniumtests.reporter.logger.HarCapture)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 ScreenShot (com.seleniumtests.driver.screenshots.ScreenShot)1 Snapshot (com.seleniumtests.reporter.logger.Snapshot)1 ScenarioLogger (com.seleniumtests.util.logging.ScenarioLogger)1 File (java.io.File)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 Document (org.jdom2.Document)1 Element (org.jdom2.Element)1 JDOMException (org.jdom2.JDOMException)1