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 interface
Step context.static interface
Runnable that allows to throw an exception and return any type.static interface
Callable that allows to throw an exception and return void.static interface
Runnable that allows to throw an exception and return any type.static interface
Runnable that allows to throw an exception and return void. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAttachment
(String name, InputStream content) static void
addAttachment
(String name, String content) static void
addAttachment
(String name, String type, InputStream content, String fileExtension) static void
addAttachment
(String name, String type, String content) static void
addAttachment
(String name, String type, String content, String fileExtension) static CompletableFuture<byte[]>
addByteAttachmentAsync
(String name, String type, String fileExtension, Supplier<byte[]> body) static CompletableFuture<byte[]>
addByteAttachmentAsync
(String name, String type, Supplier<byte[]> body) static void
addDescription
(String description) Deprecated.static void
addDescriptionHtml
(String descriptionHtml) Deprecated.usedescriptionHtml(String)
instead.static void
addLabels
(io.qameta.allure.model.Label... labels) Deprecated.uselabel(String, String)
instead.static void
addLinks
(io.qameta.allure.model.Link... links) Deprecated.uselink(String, String, String)
instead.static CompletableFuture<InputStream>
addStreamAttachmentAsync
(String name, String type, String fileExtension, Supplier<InputStream> body) static CompletableFuture<InputStream>
addStreamAttachmentAsync
(String name, String type, Supplier<InputStream> body) static void
attachment
(String name, InputStream content) Adds attachment.static void
attachment
(String name, String content) Adds attachment.static void
description
(String description) Adds description to current test if any.static void
descriptionHtml
(String descriptionHtml) Adds descriptionHtml to current test if any.static void
Adds epic label to current test if any.static void
Adds feature label to current test if any.static AllureLifecycle
ReturnsAllureLifecycle
for low level operations with results.static void
Adds issue link to current test if any.static void
Adds label to current test if any.static void
Adds link to current test if any.static void
Adds link to current test if any.static void
Adds link to current test if any.static <T> T
Adds parameter to current test if any.static <T> T
Adds parameter to current test if any.static <T> T
Adds parameter to current test if any.static <T> T
Adds parameter to current test if any.static void
setLifecycle
(AllureLifecycle lifecycle) SetsAllureLifecycle
.static <T> T
step
(Allure.ThrowableContextRunnable<T, Allure.StepContext> runnable) Run providedAllure.ThrowableRunnable
as step with given name.static void
Syntax sugar forstep(ThrowableContextRunnable)
.static void
Adds passed step with provided name in current test or step (or test fixture).static <T> T
step
(String name, Allure.ThrowableContextRunnable<T, Allure.StepContext> runnable) Syntax sugar forstep(ThrowableContextRunnable)
.static void
step
(String name, Allure.ThrowableContextRunnableVoid<Allure.StepContext> runnable) Syntax sugar forstep(ThrowableContextRunnable)
.static <T> T
step
(String name, Allure.ThrowableRunnable<T> runnable) Syntax sugar forstep(ThrowableContextRunnable)
.static void
step
(String name, Allure.ThrowableRunnableVoid runnable) Syntax sugar forstep(String, ThrowableRunnable)
.static void
Adds step with provided name and status in current test or step (or test fixture).static void
Adds story label to current test if any.static void
Adds suite label to current test if any.static void
Adds tms link to current test if any.
-
Method Details
-
getLifecycle
ReturnsAllureLifecycle
for low level operations with results.- Returns:
- the lifecycle.
-
setLifecycle
SetsAllureLifecycle
. -
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.ThrowableRunnable
as step with given name. Takes no effect if no test run at the moment.- Parameters:
runnable
- the step's body.
-
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:
-
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.
-
addLabels
Deprecated.uselabel(String, String)
instead. -
addLinks
Deprecated.uselink(String, String, String)
instead. -
addDescription
Deprecated.usedescription(String)
instead. -
addDescriptionHtml
Deprecated.usedescriptionHtml(String)
instead. -
addAttachment
-
addAttachment
-
addAttachment
-
addAttachment
-
addAttachment
public static void addAttachment(String name, String type, InputStream content, String fileExtension) -
addByteAttachmentAsync
public static CompletableFuture<byte[]> addByteAttachmentAsync(String name, String type, Supplier<byte[]> body) -
addByteAttachmentAsync
public static CompletableFuture<byte[]> addByteAttachmentAsync(String name, String type, String fileExtension, Supplier<byte[]> body) -
addStreamAttachmentAsync
public static CompletableFuture<InputStream> addStreamAttachmentAsync(String name, String type, Supplier<InputStream> body) -
addStreamAttachmentAsync
public static CompletableFuture<InputStream> addStreamAttachmentAsync(String name, String type, String fileExtension, Supplier<InputStream> body)
-
description(String)
instead.