Search in sources :

Example 1 with TestMessage

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

the class TestTestLogging method testInfo.

@Test(groups = { "ut" })
public void testInfo() {
    TestStepManager.setCurrentRootTestStep(new TestStep("step", null, new ArrayList<>(), true));
    logger.info("message");
    Assert.assertEquals(TestStepManager.getParentTestStep().getStepActions().size(), 1);
    Assert.assertTrue(TestStepManager.getParentTestStep().getStepActions().get(0) instanceof TestMessage);
    Assert.assertEquals(((TestMessage) (TestStepManager.getParentTestStep().getStepActions().get(0))).getMessageType(), MessageType.INFO);
}
Also used : TestStep(com.seleniumtests.reporter.logger.TestStep) ArrayList(java.util.ArrayList) TestMessage(com.seleniumtests.reporter.logger.TestMessage) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 2 with TestMessage

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

the class TestTestStep method testPasswordMaskingSubStep.

/**
 * Check that if a substep adds password values, parent step is not impacted
 */
@Test(groups = { "ut" })
public void testPasswordMaskingSubStep() {
    TestStep step = new TestStep("step1 with args: (bar, passwd)", null, new ArrayList<>(), true);
    TestStep substep = new TestStep("substep with args: (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);
    step.addAction(substep);
    substep.addAction(action);
    substep.addMessage(message);
    Assert.assertEquals(step.getName(), "step1 with args: (bar, passwd)");
    Assert.assertEquals(action.getName(), "action in step1 with args: (foo, ******)");
    Assert.assertEquals(message.getName(), "everything OK on ******");
    Assert.assertEquals(substep.getName(), "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 3 with TestMessage

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

the class TestTestStep method testTestMessageEncodeXmlErrorMessage.

@Test(groups = { "ut" })
public void testTestMessageEncodeXmlErrorMessage() {
    TestMessage msg = new TestMessage("everything OK \"'<>&", MessageType.ERROR);
    TestMessage encodedMsg = msg.encode("xml");
    Assert.assertTrue(encodedMsg.getFailed());
}
Also used : TestMessage(com.seleniumtests.reporter.logger.TestMessage) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 4 with TestMessage

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

the class TestTestStep method testPasswordMaskingMainStep.

/**
 * Check that if main step contains masking, they are reported in messages /
 * action / step below
 */
@Test(groups = { "ut" })
public void testPasswordMaskingMainStep() {
    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.getName(), "step1 with args: (bar, ******)");
    Assert.assertEquals(action.getName(), "action in step1 with args: (foo, ******)");
    Assert.assertEquals(message.getName(), "everything OK on ******");
    Assert.assertEquals(substep.getName(), "substep with args: (******)");
    Assert.assertEquals(step.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 5 with TestMessage

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

the class TestTestStep method testTestMessageEncodeXmlPasswordKept.

@Test(groups = { "ut" })
public void testTestMessageEncodeXmlPasswordKept() {
    TestMessage msg = new TestMessage("everything OK \"'<>&", MessageType.INFO);
    msg.getPwdToReplace().add("myPassword");
    TestMessage encodedMsg = msg.encode("xml");
    Assert.assertTrue(encodedMsg.getPwdToReplace().contains("myPassword"));
}
Also used : TestMessage(com.seleniumtests.reporter.logger.TestMessage) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

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