Class ResultsUtils
Use these helpers when custom integrations need labels, links, parameters, names, descriptions, status details, or test plan identifiers in the same format as the built-in adapters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringEnvironment variable name for allure host name.static final StringSystem property name for allure host name.static final StringAllure label name for allure id.static final StringSystem property name for allure separate lines.static final StringEnvironment variable name for allure thread name.static final StringSystem property name for allure thread name.static final StringAllure link type for custom.static final StringAllure label name for epic.static final StringAllure label name for feature.static final StringAllure label name for framework.static final StringAllure label name for host.static final StringAllure link type for issue.static final StringAllure label name for language.static final StringAllure label name for lead.static final StringAllure label name for owner.static final StringAllure label name for package.static final StringAllure label name for parent suite.static final StringAllure label name for severity.static final StringAllure label name for story.static final StringAllure label name for sub suite.static final StringAllure label name for suite.static final StringAllure label name for tag.static final StringAllure label name for test class.static final StringAllure label name for test method.static final StringAllure label name for thread.static final StringAllure link type for tms. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbytesToHex(byte[] bytes) Returns the bytes to hex.static io.qameta.allure.model.LabelcreateEpicLabel(String epic) Creates and returns the epic label.static io.qameta.allure.model.LabelcreateFeatureLabel(String feature) Creates and returns the feature label.static io.qameta.allure.model.LabelcreateFrameworkLabel(String framework) Creates and returns the framework label.static io.qameta.allure.model.GlobalscreateGlobalError(String context, Throwable throwable) Returns the globals artifact for a failure that belongs to the test run rather than to any test result.static io.qameta.allure.model.LabelCreates and returns the host label.static io.qameta.allure.model.LinkcreateIssueLink(String value) Creates and returns the issue link.static io.qameta.allure.model.LabelcreateLabel(Epic epic) Creates and returns the label.static io.qameta.allure.model.LabelcreateLabel(Feature feature) Creates and returns the label.static io.qameta.allure.model.LabelcreateLabel(Owner owner) Creates and returns the label.static io.qameta.allure.model.LabelcreateLabel(Severity severity) Creates and returns the label.static io.qameta.allure.model.LabelcreateLabel(Story story) Creates and returns the label.static io.qameta.allure.model.LabelcreateLabel(String name, String value) Creates and returns the label.static io.qameta.allure.model.LabelcreateLanguageLabel(String language) Creates and returns the language label.static io.qameta.allure.model.LinkcreateLink(Issue link) Creates and returns the link.static io.qameta.allure.model.LinkcreateLink(Link link) Creates and returns the link.static io.qameta.allure.model.LinkcreateLink(TmsLink link) Creates and returns the link.static io.qameta.allure.model.LinkcreateLink(String value, String name, String url, String type) Creates and returns the link.static io.qameta.allure.model.LabelcreateOwnerLabel(String owner) Creates and returns the owner label.static io.qameta.allure.model.LabelcreatePackageLabel(String packageName) Creates and returns the package label.static io.qameta.allure.model.ParametercreateParameter(String name, Object value) Creates and returns the parameter.static io.qameta.allure.model.ParametercreateParameter(String name, Object value, Boolean excluded, io.qameta.allure.model.Parameter.Mode mode) Creates and returns the parameter.static io.qameta.allure.model.LabelcreateParentSuiteLabel(String suite) Creates and returns the parent suite label.static io.qameta.allure.model.LabelcreateSeverityLabel(SeverityLevel severity) Creates and returns the severity label.static io.qameta.allure.model.LabelcreateSeverityLabel(String severity) Creates and returns the severity label.static io.qameta.allure.model.LabelcreateStoryLabel(String story) Creates and returns the story label.static io.qameta.allure.model.LabelcreateSubSuiteLabel(String suite) Creates and returns the sub suite label.static io.qameta.allure.model.LabelcreateSuiteLabel(String suite) Creates and returns the suite label.static io.qameta.allure.model.LabelcreateTagLabel(String tag) Creates and returns the tag label.static io.qameta.allure.model.LabelcreateTestClassLabel(String testClass) Creates and returns the test class label.static io.qameta.allure.model.LabelcreateTestMethodLabel(String testMethod) Creates and returns the test method label.static io.qameta.allure.model.LabelCreates and returns the thread label.createTitlePath(String... values) Creates and returns the title path.createTitlePath(Collection<String> values) Creates and returns the title path.createTitlePathFromJavaClass(Class<?> clazz) Creates and returns the title path from java class.createTitlePathFromPackage(String packageName) Creates and returns the title path from package.createTitlePathFromPackageAndClass(String packageName, String className) Creates and returns the title path from package and class.createTitlePathFromQualifiedClassName(String className) Creates and returns the title path from qualified class name.createTitlePathFromSourcePath(String sourcePath) Creates and returns the title path from source path.static io.qameta.allure.model.LinkcreateTmsLink(String value) Creates and returns the tms link.firstNonEmpty(String... items) Returns the first non empty.static StringgenerateMethodSignatureHash(String className, String methodName, List<String> parameterTypes) Generates and returns the method signature hash.static StringReturns the host name.getJavadocDescription(ClassLoader classLoader, Method method) Returns the javadoc description.getLambdaName(Object lambda) Returns the lambda name.static StringReturns the link type pattern property name.static MessageDigestReturns the md5 digest.static Set<io.qameta.allure.model.Label> Returns the provided labels.static Optional<io.qameta.allure.model.Status> Returns the status.static Optional<io.qameta.allure.model.StatusDetails> Returns the status details.static StringReturns the thread name.static StringReturns the md5.static voidprocessDescription(ClassLoader classLoader, Method method, Consumer<String> setDescription, Consumer<String> setDescriptionHtml) Handles the process description callback.
-
Field Details
-
ALLURE_HOST_NAME_SYSPROP
System property name for allure host name.- See Also:
-
ALLURE_HOST_NAME_ENV
Environment variable name for allure host name.- See Also:
-
ALLURE_THREAD_NAME_SYSPROP
System property name for allure thread name.- See Also:
-
ALLURE_THREAD_NAME_ENV
Environment variable name for allure thread name.- See Also:
-
ALLURE_SEPARATE_LINES_SYSPROP
System property name for allure separate lines.- See Also:
-
ISSUE_LINK_TYPE
Allure link type for issue.- See Also:
-
TMS_LINK_TYPE
Allure link type for tms.- See Also:
-
CUSTOM_LINK_TYPE
Allure link type for custom.- See Also:
-
ALLURE_ID_LABEL_NAME
Allure label name for allure id.- See Also:
-
SUITE_LABEL_NAME
Allure label name for suite.- See Also:
-
PARENT_SUITE_LABEL_NAME
Allure label name for parent suite.- See Also:
-
SUB_SUITE_LABEL_NAME
Allure label name for sub suite.- See Also:
-
EPIC_LABEL_NAME
Allure label name for epic.- See Also:
-
FEATURE_LABEL_NAME
Allure label name for feature.- See Also:
-
STORY_LABEL_NAME
Allure label name for story.- See Also:
-
SEVERITY_LABEL_NAME
Allure label name for severity.- See Also:
-
TAG_LABEL_NAME
Allure label name for tag.- See Also:
-
OWNER_LABEL_NAME
Allure label name for owner.- See Also:
-
LEAD_LABEL_NAME
Allure label name for lead.- See Also:
-
HOST_LABEL_NAME
Allure label name for host.- See Also:
-
THREAD_LABEL_NAME
Allure label name for thread.- See Also:
-
TEST_METHOD_LABEL_NAME
Allure label name for test method.- See Also:
-
TEST_CLASS_LABEL_NAME
Allure label name for test class.- See Also:
-
PACKAGE_LABEL_NAME
Allure label name for package.- See Also:
-
FRAMEWORK_LABEL_NAME
Allure label name for framework.- See Also:
-
LANGUAGE_LABEL_NAME
Allure label name for language.- See Also:
-
-
Method Details
-
createParameter
Creates and returns the parameter.- Parameters:
name- the display name or logical name to usevalue- the value to set- Returns:
- the parameter
-
createParameter
public static io.qameta.allure.model.Parameter createParameter(String name, Object value, Boolean excluded, io.qameta.allure.model.Parameter.Mode mode) Creates and returns the parameter.- Parameters:
name- the display name or logical name to usevalue- the value to setexcluded- the excludedmode- the mode- Returns:
- the parameter
-
createSuiteLabel
Creates and returns the suite label.- Parameters:
suite- the TestNG suite callback argument- Returns:
- the suite label
-
createParentSuiteLabel
Creates and returns the parent suite label.- Parameters:
suite- the TestNG suite callback argument- Returns:
- the parent suite label
-
createSubSuiteLabel
Creates and returns the sub suite label.- Parameters:
suite- the TestNG suite callback argument- Returns:
- the sub suite label
-
createTestMethodLabel
Creates and returns the test method label.- Parameters:
testMethod- the test method- Returns:
- the test method label
-
createTestClassLabel
Creates and returns the test class label.- Parameters:
testClass- the test class- Returns:
- the test class label
-
createPackageLabel
Creates and returns the package label.- Parameters:
packageName- the package name- Returns:
- the package label
-
createTitlePath
Creates and returns the title path.- Parameters:
values- the values- Returns:
- the title path
-
createTitlePath
Creates and returns the title path.- Parameters:
values- the values- Returns:
- the title path
-
createTitlePathFromPackageAndClass
Creates and returns the title path from package and class.- Parameters:
packageName- the package nameclassName- the class name- Returns:
- the title path from package and class
-
createTitlePathFromQualifiedClassName
Creates and returns the title path from qualified class name.- Parameters:
className- the class name- Returns:
- the title path from qualified class name
-
createTitlePathFromJavaClass
Creates and returns the title path from java class.- Parameters:
clazz- the clazz- Returns:
- the title path from java class
-
createTitlePathFromPackage
Creates and returns the title path from package.- Parameters:
packageName- the package name- Returns:
- the title path from package
-
createTitlePathFromSourcePath
Creates and returns the title path from source path.- Parameters:
sourcePath- the source path- Returns:
- the title path from source path
-
createEpicLabel
Creates and returns the epic label.- Parameters:
epic- the epic- Returns:
- the epic label
-
createFeatureLabel
Creates and returns the feature label.- Parameters:
feature- the feature- Returns:
- the feature label
-
createStoryLabel
Creates and returns the story label.- Parameters:
story- the story- Returns:
- the story label
-
createTagLabel
Creates and returns the tag label.- Parameters:
tag- the tag- Returns:
- the tag label
-
createOwnerLabel
Creates and returns the owner label.- Parameters:
owner- the owner- Returns:
- the owner label
-
createSeverityLabel
Creates and returns the severity label.- Parameters:
severity- the severity- Returns:
- the severity label
-
createSeverityLabel
Creates and returns the severity label.- Parameters:
severity- the severity- Returns:
- the severity label
-
createHostLabel
public static io.qameta.allure.model.Label createHostLabel()Creates and returns the host label.- Returns:
- the host label
-
createThreadLabel
public static io.qameta.allure.model.Label createThreadLabel()Creates and returns the thread label.- Returns:
- the thread label
-
createFrameworkLabel
Creates and returns the framework label.- Parameters:
framework- the framework- Returns:
- the framework label
-
createLanguageLabel
Creates and returns the language label.- Parameters:
language- the language- Returns:
- the language label
-
createLabel
Creates and returns the label.- Parameters:
name- the display name or logical name to usevalue- the value to set- Returns:
- the label
-
createLabel
Creates and returns the label.- Parameters:
owner- the owner- Returns:
- the label
-
createLabel
Creates and returns the label.- Parameters:
severity- the severity- Returns:
- the label
-
createLabel
Creates and returns the label.- Parameters:
story- the story- Returns:
- the label
-
createLabel
Creates and returns the label.- Parameters:
feature- the feature- Returns:
- the label
-
createLabel
Creates and returns the label.- Parameters:
epic- the epic- Returns:
- the label
-
createIssueLink
Creates and returns the issue link.- Parameters:
value- the value to set- Returns:
- the issue link
-
createTmsLink
Creates and returns the tms link.- Parameters:
value- the value to set- Returns:
- the tms link
-
createLink
Creates and returns the link.- Parameters:
link- the link- Returns:
- the link
-
createLink
Creates and returns the link.- Parameters:
link- the link- Returns:
- the link
-
createLink
Creates and returns the link.- Parameters:
link- the link- Returns:
- the link
-
createLink
public static io.qameta.allure.model.Link createLink(String value, String name, String url, String type) Creates and returns the link.- Parameters:
value- the value to setname- the display name or logical name to useurl- the request URL or service method nametype- the event or label type- Returns:
- the link
-
getProvidedLabels
Returns the provided labels.- Returns:
- the provided labels
-
getHostName
Returns the host name.- Returns:
- the host name
-
getThreadName
Returns the thread name.- Returns:
- the thread name
-
getStatus
Returns the status.- Parameters:
throwable- the throwable- Returns:
- the status
-
getStatusDetails
Returns the status details.- Parameters:
e- the e- Returns:
- the status details
-
createGlobalError
Returns the globals artifact for a failure that belongs to the test run rather than to any test result.Adapters use this for failures they cannot attribute to a test without inventing one: a configuration method that failed outside any test, or a data provider that failed before the invocations it would have produced were known. A test result invented for such a failure carries a history id that no execution ever produces, so it distorts the run statistics and no retry can ever replace it.
Write the result with
AllureLifecycle.writeGlobals(Globals)on the adapter's own lifecycle rather than through theAllurefacade, so that the error reaches the lifecycle the adapter reports to.- Parameters:
context- the description of what failed, and of what did not run when the failure kept tests from runningthrowable- the failure, may be null- Returns:
- the globals artifact holding a single error
-
getJavadocDescription
Returns the javadoc description.- Parameters:
classLoader- the class loader to use for resource lookupmethod- the framework or Java method to inspect- Returns:
- the javadoc description
-
firstNonEmpty
Returns the first non empty.- Parameters:
items- the map entries to convert- Returns:
- the first non empty
-
getLinkTypePatternPropertyName
Returns the link type pattern property name.- Parameters:
type- the event or label type- Returns:
- the link type pattern property name
-
generateMethodSignatureHash
public static String generateMethodSignatureHash(String className, String methodName, List<String> parameterTypes) Generates and returns the method signature hash.- Parameters:
className- the class namemethodName- the method nameparameterTypes- the parameter types- Returns:
- the generated method signature hash
-
md5
Returns the md5.- Parameters:
source- the source- Returns:
- the md5
-
getLambdaName
Returns the lambda name.- Parameters:
lambda- the lambda- Returns:
- the lambda name
-
bytesToHex
Returns the bytes to hex.- Parameters:
bytes- the bytes- Returns:
- the bytes to hex
-
getMd5Digest
Returns the md5 digest.- Returns:
- the md5 digest
-
processDescription
public static void processDescription(ClassLoader classLoader, Method method, Consumer<String> setDescription, Consumer<String> setDescriptionHtml) Handles the process description callback.- Parameters:
classLoader- the class loader to use for resource lookupmethod- the framework or Java method to inspectsetDescription- the set descriptionsetDescriptionHtml- the set description html
-