@Override protected AllureLifecycle initialValue() { return Allure.getLifecycle(); } };
@Override protected AllureLifecycle initialValue() { return Allure.getLifecycle(); } };
StepUtils(final Feature feature, final Scenario scenario) { this.lifecycle = Allure.getLifecycle(); this.feature = feature; this.scenario = scenario; }
@SuppressWarnings("unused") public AllureCucumberJvm() { this(Allure.getLifecycle()); }
@SuppressWarnings("unused") public AllureCucumber2Jvm() { this(Allure.getLifecycle()); }
@SuppressWarnings("PMD.UseObjectForClearerAPI") public static void addAttachment(final String name, final String type, final String content, final String fileExtension) { getLifecycle().addAttachment(name, type, fileExtension, content.getBytes(StandardCharsets.UTF_8)); }
@SuppressWarnings("PMD.UseObjectForClearerAPI") public static void addAttachment(final String name, final String type, final InputStream content, final String fileExtension) { getLifecycle().addAttachment(name, type, fileExtension, content); }
public static CompletableFuture<byte[]> addByteAttachmentAsync( final String name, final String type, final String fileExtension, final Supplier<byte[]> body) { final String source = getLifecycle().prepareAttachment(name, type, fileExtension); return supplyAsync(body).whenComplete((result, ex) -> getLifecycle().writeAttachment(source, new ByteArrayInputStream(result))); }
public static void addAttachment(final String name, final String content) { getLifecycle().addAttachment(name, TEXT_PLAIN, TXT_EXTENSION, content.getBytes(StandardCharsets.UTF_8)); }
public static void stepFinish() { getLifecycle().stopStep(STEP_UUID_STACK.get().removeFirst()); } }
/** * @deprecated use {@link #label(String, String)} instead. */ @Deprecated public static void addLabels(final Label... labels) { getLifecycle().updateTestCase(testResult -> testResult.getLabels().addAll(asList(labels))); }
/** * @deprecated use {@link #link(String, String, String)} instead. */ @Deprecated public static void addLinks(final Link... links) { getLifecycle().updateTestCase(testResult -> testResult.getLinks().addAll(asList(links))); }
public static void stepStart(String stepName) { StepResult result = new StepResult().setName(stepName); String uuid = UUID.randomUUID().toString(); getLifecycle().startStep(uuid, result); STEP_UUID_STACK.get().addFirst(uuid); }
/** * Adds step with provided name and status in current test or step (or test fixture). Takes no effect * if no test run at the moment. * * @param name the name of step. * @param status the step status. */ public static void step(final String name, final Status status) { final String uuid = UUID.randomUUID().toString(); getLifecycle().startStep(uuid, new StepResult().setName(name).setStatus(status)); getLifecycle().stopStep(uuid); }
/** * Adds descriptionHtml to current test or step (or fixture) if any. Takes no effect * if no test run at the moment. Note that description will take no effect if descriptionHtml is * specified. * * @param descriptionHtml the description in html format. * @see #description(String) */ public static void descriptionHtml(final String descriptionHtml) { getLifecycle().updateTestCase(executable -> executable.setDescriptionHtml(descriptionHtml)); }
/** * Adds description to current test or step (or fixture) if any. Takes no effect * if no test run at the moment. Expecting description provided in Markdown format. * * @param description the description in markdown format. * @see #descriptionHtml(String) */ public static void description(final String description) { getLifecycle().updateTestCase(executable -> executable.setDescription(description)); }
/** * Adds label to current test or step (or fixture) if any. Takes no effect * if no test run at the moment. * * @param name the name of label. * @param value the value of label. */ public static void label(final String name, final String value) { final Label label = new Label().setName(name).setValue(value); getLifecycle().updateTestCase(testResult -> testResult.getLabels().add(label)); }
/** * Adds parameter to current test or step (or fixture) if any. Takes no effect * if no test run at the moment. * * @param name the name of parameter. * @param value the value of parameter. */ public static <T> T parameter(final String name, final T value) { final Parameter parameter = new Parameter().setName(name).setValue(ObjectUtils.toString(value)); getLifecycle().updateTestCase(testResult -> testResult.getParameters().add(parameter)); return value; }
/** * Adds link to current test or step (or fixture) if any. Takes no effect * if no test run at the moment. * * @param name the name of link. * @param type the type of link, used to display link icon in the report. * @param url the link's url. */ public static void link(final String name, final String type, final String url) { final Link link = new Link().setName(name).setType(type).setUrl(url); getLifecycle().updateTestCase(testResult -> testResult.getLinks().add(link)); }
@Override public <T> T parameter(final String name, final T value) { final Parameter param = new Parameter().setName(name).setValue(ObjectUtils.toString(value)); getLifecycle().updateStep(uuid, stepResult -> stepResult.getParameters().add(param)); return value; } }