Package io.qameta.allure
Class Allure
java.lang.Object
io.qameta.allure.Allure
The class contains some useful methods to work with
AllureLifecycle.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceStep context.static interfaceRunnable that allows to throw an exception and return any type.static interfaceCallable that allows to throw an exception and return void.static interfaceRunnable that allows to throw an exception and return any type.static interfaceRunnable that allows to throw an exception and return void. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddHttpExchange(String name, HttpExchange exchange) Adds an HTTP exchange attachment.static voidattachment(String name, InputStream content) Adds attachment.static voidattachment(String name, String content) Adds attachment.static voidattachment(String name, String type, InputStream content, AttachmentOptions options) Adds attachment.static voidattachment(String name, String type, String content) Adds attachment.static voidattachment(String name, String type, String content, AttachmentOptions options) Adds attachment.static CompletableFuture<Void> attachmentAsync(String name, String type, CompletionStage<? extends InputStream> body) Adds an async attachment and waits for its content before the owning executable ends.static CompletableFuture<Void> attachmentAsync(String name, String type, CompletionStage<? extends InputStream> body, AttachmentOptions options) Adds an async attachment and waits for its content before the owning executable ends.static voiddescription(String description) Adds description to current test if any.static voiddescriptionHtml(String descriptionHtml) Adds descriptionHtml to current test if any.static voidAdds epic label to current test if any.static voidAdds feature label to current test if any.static AllureLifecycleReturnsAllureLifecyclefor low level operations with results.static voidglobalError(io.qameta.allure.model.StatusDetails statusDetails) Adds an error with the given status details that belongs to the test run rather than to a test or fixture.static voidglobalError(Throwable throwable) Adds an error from the given throwable that belongs to the test run rather than to a test or fixture.static voidAdds issue link to current test if any.static voidAdds label to current test if any.static voidAdds link to current test if any.static voidAdds link to current test if any.static voidAdds link to current test if any.static <T> TAdds parameter to current test if any.static <T> TAdds parameter to current test if any.static <T> TAdds parameter to current test if any.static <T> TAdds parameter to current test if any.static voidsetLifecycle(AllureLifecycle lifecycle) Sets the process-wideAllureLifecycle.static voidStarts a stage — a lightweight marker for a semantic test phase, rendered as a regular step.static <T> Tstep(Allure.ThrowableContextRunnable<T, Allure.StepContext> runnable) Run providedAllure.ThrowableRunnableas step with given name.static voidSyntax sugar forstep(ThrowableContextRunnable).static voidAdds passed step with provided name in current test or step (or test fixture).static <T> Tstep(String name, Allure.ThrowableContextRunnable<T, Allure.StepContext> runnable) Syntax sugar forstep(ThrowableContextRunnable).static voidstep(String name, Allure.ThrowableContextRunnableVoid<Allure.StepContext> runnable) Syntax sugar forstep(ThrowableContextRunnable).static <T> Tstep(String name, Allure.ThrowableRunnable<T> runnable) Syntax sugar forstep(ThrowableContextRunnable).static voidstep(String name, Allure.ThrowableRunnableVoid runnable) Syntax sugar forstep(String, ThrowableRunnable).static voidAdds step with provided name and status in current test or step (or test fixture).static voidAdds story label to current test if any.static voidAdds suite label to current test if any.static voidAdds tms link to current test if any.
-
Method Details
-
getLifecycle
ReturnsAllureLifecyclefor low level operations with results.- Returns:
- the lifecycle.
-
setLifecycle
Sets the process-wideAllureLifecycle. -
step
Adds passed step with provided name in current test or step (or test fixture). Takes no effect if no test run at the moment. Shortcut forstep(String, Status).- Parameters:
name- the name of step.
-
step
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.- Parameters:
name- the name of step.status- the step status.
-
step
Syntax sugar forstep(String, ThrowableRunnable).- Parameters:
name- the name of step.runnable- the step's body.
-
step
Syntax sugar forstep(ThrowableContextRunnable).- Parameters:
name- the name of step.runnable- the step's body.
-
step
Syntax sugar forstep(ThrowableContextRunnable).- Parameters:
runnable- the step's body.
-
step
public static void step(String name, Allure.ThrowableContextRunnableVoid<Allure.StepContext> runnable) Syntax sugar forstep(ThrowableContextRunnable).- Parameters:
name- the name of step.runnable- the step's body.
-
step
public static <T> T step(String name, Allure.ThrowableContextRunnable<T, Allure.StepContext> runnable) Syntax sugar forstep(ThrowableContextRunnable).- Parameters:
name- the name of step.runnable- the step's body.
-
step
Run providedAllure.ThrowableRunnableas step with given name. Takes no effect if no test run at the moment.- Parameters:
runnable- the step's body.
-
stage
Starts a stage — a lightweight marker for a semantic test phase, rendered as a regular step. A stage has no explicit stop: it stays open, collecting the steps and attachments that follow, until the next stage starts or the enclosing step, test, or fixture ends. A stage started inside a step becomes a child of that step. Takes no effect if no test run at the moment.Allure.stage("prepare data"); final Customer customer = createCustomer(); Allure.stage("submit order"); final Order order = submitOrder(customer); Allure.stage("verify result"); assertThat(order.getStatus()).isEqualTo("created");- Parameters:
name- the name of the stage.
-
epic
Adds epic label to current test if any. Takes no effect if no test run at the moment. Shortcut forlabel(String, String).- Parameters:
value- the value of label.
-
feature
Adds feature label to current test if any. Takes no effect if no test run at the moment. Shortcut forlabel(String, String).- Parameters:
value- the value of label.
-
story
Adds story label to current test if any. Takes no effect if no test run at the moment. Shortcut forlabel(String, String).- Parameters:
value- the value of label.
-
suite
Adds suite label to current test if any. Takes no effect if no test run at the moment. Shortcut forlabel(String, String).- Parameters:
value- the value of label.
-
label
Adds label to current test if any. Takes no effect if no test run at the moment.- Parameters:
name- the name of label.value- the value of label.
-
parameter
Adds parameter to current test if any. Takes no effect if no test run at the moment.Shortcut for
parameter(String, Object, Boolean, Parameter.Mode).- Parameters:
name- the name of parameter.value- the value of parameter.
-
parameter
Adds parameter to current test if any. Takes no effect if no test run at the moment.Shortcut for
parameter(String, Object, Boolean, Parameter.Mode).- Parameters:
name- the name of parameter.value- the value of parameter.excluded- true if parameter should be excluded from history key calculation, false otherwise.- Returns:
- the specified value.
-
parameter
Adds parameter to current test if any. Takes no effect if no test run at the moment.Shortcut for
parameter(String, Object, Boolean, Parameter.Mode).- Parameters:
name- the name of parameter.value- the value of parameter.mode- the parameter mode.- Returns:
- the specified value.
-
parameter
public static <T> T parameter(String name, T value, Boolean excluded, io.qameta.allure.model.Parameter.Mode mode) Adds parameter to current test if any. Takes no effect if no test run at the moment.- Parameters:
name- the name of parameter.value- the value of parameter.excluded- true if parameter should be excluded from history key calculation, false otherwise.mode- the parameter mode.- Returns:
- the specified value.
-
issue
Adds issue link to current test if any. Takes no effect if no test run at the moment. Shortcut forlink(String, String, String).- Parameters:
name- the name of link.url- the link's url.
-
tms
Adds tms link to current test if any. Takes no effect if no test run at the moment. Shortcut forlink(String, String, String).- Parameters:
name- the name of link.url- the link's url.
-
link
Adds link to current test if any. Takes no effect if no test run at the moment. Shortcut forlink(String, String)- Parameters:
url- the link's url.
-
link
Adds link to current test if any. Takes no effect if no test run at the moment. Shortcut forlink(String, String, String)- Parameters:
name- the name of link.url- the link's url.
-
link
Adds link to current test if any. Takes no effect if no test run at the moment.- Parameters:
name- the name of link.type- the type of link, used to display link icon in the report.url- the link's url.
-
description
Adds description to current test if any. Takes no effect if no test run at the moment. Expecting description provided in Markdown format.- Parameters:
description- the description in markdown format.- See Also:
-
descriptionHtml
Adds descriptionHtml to current test if any. Takes no effect if no test run at the moment. Note that description will take no effect if descriptionHtml is specified.- Parameters:
descriptionHtml- the description in html format.- See Also:
-
globalError
Adds an error from the given throwable that belongs to the test run rather than to a test or fixture. The error is passed synchronously to the configured results writer before this method returns. Writers that support globals store it in a new globals artifact.- Parameters:
throwable- the error to add
-
globalError
public static void globalError(io.qameta.allure.model.StatusDetails statusDetails) Adds an error with the given status details that belongs to the test run rather than to a test or fixture. The error is passed synchronously to the configured results writer before this method returns. Writers that support globals store it in a new globals artifact. The status detail fields are copied without normalization, and the timestamp is assigned when this method is called.- Parameters:
statusDetails- the error details to add
-
attachment
Adds attachment.- Parameters:
name- the name of attachment.content- the attachment content.
-
attachment
Adds attachment.- Parameters:
name- the name of attachment.content- the stream that contains attachment content.
-
attachment
Adds attachment.- Parameters:
name- the name of attachment.type- the content type of attachment.content- the attachment content.
-
attachment
Adds attachment.- Parameters:
name- the name of attachment.type- the content type of attachment.content- the attachment content.options- the attachment options.
-
attachment
public static void attachment(String name, String type, InputStream content, AttachmentOptions options) Adds attachment.- Parameters:
name- the name of attachment.type- the content type of attachment.content- the stream that contains attachment content.options- the attachment options.
-
attachmentAsync
public static CompletableFuture<Void> attachmentAsync(String name, String type, CompletionStage<? extends InputStream> body) Adds an async attachment and waits for its content before the owning executable ends.- Parameters:
name- the name of attachment.type- the content type of attachment.body- the future stream that contains attachment content.- Returns:
- future completed when attachment content is written.
-
attachmentAsync
public static CompletableFuture<Void> attachmentAsync(String name, String type, CompletionStage<? extends InputStream> body, AttachmentOptions options) Adds an async attachment and waits for its content before the owning executable ends.- Parameters:
name- the name of attachment.type- the content type of attachment.body- the future stream that contains attachment content.options- the attachment options.- Returns:
- future completed when attachment content is written.
-
addHttpExchange
Adds an HTTP exchange attachment.Build the exchange with the desired capture options before calling this method. This method only writes the already captured exchange.
- Parameters:
name- the attachment nameexchange- the HTTP exchange payload
-