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);
}
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: (******)");
}
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());
}
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: (******)");
}
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"));
}
Aggregations