use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.
the class Uft method readStep.
/**
* Read a step element
* @param parentStep
* @param stepElement
*/
private void readStep(TestStep parentStep, Element stepElement) {
List<Element> stepList = stepElement.getChildren("Step");
org.jsoup.nodes.Document htmlDoc = Jsoup.parseBodyFragment(stepElement.getChildText("Details"));
String details = htmlDoc.text();
String stepDescription = String.format("%s: %s", stepElement.getChildText("Obj"), details);
if (stepList.isEmpty()) {
TestAction action = new TestAction(stepDescription, false, new ArrayList<>());
parentStep.addAction(action);
} else {
TestStep stepStep = new TestStep(stepDescription, Reporter.getCurrentTestResult(), new ArrayList<>(), false);
parentStep.addStep(stepStep);
for (Element subStepElement : stepElement.getChildren("Step")) {
readStep(stepStep, subStepElement);
}
}
}
use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.
the class LogAction method logCompositeAction.
/**
* Log composite action when they are declared
* @param joinPoint
*/
@After("this(com.seleniumtests.uipage.PageObject) && " + "call(public org.openqa.selenium.interactions.Actions org.openqa.selenium.interactions.Actions.* (..))")
public void logCompositeAction(JoinPoint joinPoint) {
List<String> pwdToReplace = new ArrayList<>();
String actionName = String.format("%s %s", joinPoint.getSignature().getName(), buildArgString(joinPoint, pwdToReplace, new HashMap<>()));
TestAction currentAction = new TestAction(actionName, false, pwdToReplace);
if (TestStepManager.getParentTestStep() != null) {
TestStepManager.getParentTestStep().addAction(currentAction);
}
}
use of com.seleniumtests.reporter.logger.TestAction in project seleniumRobot by bhecquet.
the class TestStepManager method logTestStep.
/**
* Logs the testStep for this test
* Once logging is done, parentTestStep and currentRootTestStep are reset to avoid storing new data in them
* @param testStep
* @param storeStep
*/
public static void logTestStep(TestStep testStep, boolean storeStep) {
List<TestAction> actionList = testStep.getStepActions();
if (!actionList.isEmpty()) {
for (TestAction action : actionList) {
if (action instanceof TestStep) {
logTestStep((TestStep) action, false);
}
}
}
if (storeStep) {
// notify each TestStepManager about the new test step (useful for AfterClass / AfterTest configuration methods)
for (SeleniumTestsContext testContext : SeleniumTestsContextManager.getContextForCurrentTestState()) {
TestStepManager stepManager = testContext.getTestStepManager();
stepManager.getTestSteps().add(testStep);
stepManager.setRootTestStep(null);
stepManager.setRunningTestStep(null);
}
}
}
use of com.seleniumtests.reporter.logger.TestAction 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.TestAction in project seleniumRobot by bhecquet.
the class TestTestStep method testTestActionEncodeXml.
@Test(groups = { "ut" })
public void testTestActionEncodeXml() {
TestAction action = new TestAction("action2 \"'<>&", false, new ArrayList<>());
TestAction encodedAction = action.encode("xml");
Assert.assertEquals(encodedAction.toString(), "action2 "'<>&");
}
Aggregations