private Step convert(final Path source, final ResultsVisitor visitor, final ru.yandex.qatools.allure.model.Step s, final Status testStatus, final String message, final String trace) { final Status status = convert(s.getStatus()); final Step current = new Step() .setName(s.getTitle() == null ? s.getName() : s.getTitle()) .setTime(new Time() .setStart(s.getStart()) .setStop(s.getStop()) .setDuration(s.getStop() - s.getStart())) .setStatus(status) .setSteps(convert(s.getSteps(), step -> convert(source, visitor, step, testStatus, message, trace))) .setAttachments(convert(s.getAttachments(), attach -> convert(source, visitor, attach))); //Copy test status details to each step set the same status if (Objects.equals(status, testStatus)) { current.setStatusMessage(message); current.setStatusMessage(trace); } return current; }
/** * Create an instance of {@link Step } * */ public Step createStep() { return new Step(); }
public Step withName(String value) { setName(value); return this; }
@Override public void process(Step context) { Iterator<Attachment> iterator = context.getAttachments().listIterator(); while (iterator.hasNext()) { Attachment attachment = iterator.next(); if (pattern.matcher(attachment.getSource()).matches()) { deleteAttachment(attachment); iterator.remove(); } } for (Step step : context.getSteps()) { process(step); } } }
public Step createRootStep() { return new Step() .withName("Root step") .withTitle("Allure step processing error: if you see this step something went wrong.") .withStart(System.currentTimeMillis()) .withStatus(Status.BROKEN); } }
public Step withSteps(Step... values) { if (values!= null) { for (Step value: values) { getSteps().add(value); } } return this; }
private List<TestStep> addTestSteps(List<Step> steps, int level) { List<TestStep> result = new ArrayList<TestStep>(steps.size()); for (Step step : steps) { TestStep testStep = new TestStep(); testStep.setDescription(step.getName()); testStep.setSteps(addTestSteps(step.getSteps(), level + 1)); result.add(testStep); } return result; } }
public Step withAttachments(Collection<Attachment> values) { if (values!= null) { getAttachments().addAll(values); } return this; }
public Step withStart(long value) { setStart(value); return this; }
/** * Remove attachments matches pattern from step and all step substeps * * @param context from which attachments will be removed */ @Override public void process(Step context) { Iterator<Attachment> iterator = context.getAttachments().listIterator(); while (iterator.hasNext()) { Attachment attachment = iterator.next(); if (pattern.matcher(attachment.getSource()).matches()) { deleteAttachment(attachment); iterator.remove(); } } for (Step step : context.getSteps()) { process(step); } } }
/** * Construct new root step. Used for inspect problems with Allure lifecycle * * @return new root step marked as broken */ public Step createRootStep() { return new Step() .withName("Root step") .withTitle("Allure step processing error: if you see this step something went wrong.") .withStart(System.currentTimeMillis()) .withStatus(Status.BROKEN); } }
public Step withSteps(Collection<Step> values) { if (values!= null) { getSteps().addAll(values); } return this; }
public Step withAttachments(Attachment... values) { if (values!= null) { for (Attachment value: values) { getAttachments().add(value); } } return this; }
lhsName = this.getName(); String rhsName; rhsName = that.getName(); if (!strategy.equals(LocatorUtils.property(thisLocator, "name", lhsName), LocatorUtils.property(thatLocator, "name", rhsName), lhsName, rhsName)) { return false; lhsTitle = this.getTitle(); String rhsTitle; rhsTitle = that.getTitle(); if (!strategy.equals(LocatorUtils.property(thisLocator, "title", lhsTitle), LocatorUtils.property(thatLocator, "title", rhsTitle), lhsTitle, rhsTitle)) { return false; lhsAttachments = this.getAttachments(); List<Attachment> rhsAttachments; rhsAttachments = that.getAttachments(); if (!strategy.equals(LocatorUtils.property(thisLocator, "attachments", lhsAttachments), LocatorUtils.property(thatLocator, "attachments", rhsAttachments), lhsAttachments, rhsAttachments)) { return false; lhsSteps = this.getSteps(); List<Step> rhsSteps; rhsSteps = that.getSteps(); if (!strategy.equals(LocatorUtils.property(thisLocator, "steps", lhsSteps), LocatorUtils.property(thatLocator, "steps", rhsSteps), lhsSteps, rhsSteps)) { return false; lhsStart = this.getStart(); long rhsStart; rhsStart = that.getStart(); if (!strategy.equals(LocatorUtils.property(thisLocator, "start", lhsStart), LocatorUtils.property(thatLocator, "start", rhsStart), lhsStart, rhsStart)) { return false;
public void fire(TestCaseFinishedEvent event) { TestCaseResult testCase = testCaseStorage.get(); event.process(testCase); Step root = stepStorage.pollLast(); if (Status.PASSED.equals(testCase.getStatus())) { new RemoveAttachmentsEvent(AllureReportConfig.newInstance().getRemoveAttachments()).process(root); } testCase.getSteps().addAll(root.getSteps()); testCase.getAttachments().addAll(root.getAttachments()); stepStorage.remove(); testCaseStorage.remove(); }
/** * Move last step to children of previous step. How it works: * <pre> * before: step1(...) -> step2(child1 -> ... -> childN) -> step3(...) -> ... -> null * after: step2(child1 -> ... -> childN -> step1(...)) -> step3(...) -> ... -> null * </pre> * @return ex-last step */ public Step adopt() { Step step = pollLast(); synchronized (LOCK) { getLast().getSteps().add(step); } return step; }
/** * Write attachment from event using * {@link ru.yandex.qatools.allure.utils.AllureResultsUtils#writeAttachmentSafely(byte[], String, String)} * Then add attachment to step attachments. * * @param step to change */ @Override public void process(Step step) { Attachment attachment = writeAttachmentSafely(getAttachment(), getTitle(), getType()); step.getAttachments().add(attachment); }
public void fire(StepStartedEvent event) { Step step = new Step(); event.process(step); stepStorage.put(step); }