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