Skip to main content

Links

In Allure reports, you can add different types of links to your test cases for better context and traceability, e.g.:

  • links to issues in your issue tracker (e.g. JIRA, GitHub, etc.);
  • links to test cases in your Test Management System (TMS);
  • links to any custom URL.

There are two ways to add links to your test cases:

  • declaratively, using JSDoc annotations such as @link, @issue, and @tms;
  • programmatically, using annotation functions from the 'jest-allure2-reporter/api' package such as $Link, $Issue, and $TmsLink.

You can link an issue in your issue tracker to a test case.

it('should validate non-ASCII passwords', () => {
/**
* A customer ticket from our Support team.
* @issue AUTH-123
*/

/* ... test code ... */
});

You can link a test case in your Test Management System (TMS) to a test case as shown below.

it('should be connected to TMS', () => {
/**
* @tms TMS-123
*/

/* ... test code ... */
});

You can link an arbitrary URL to a test case:

it('should demonstrate how the links work', () => {
/**
* @link https://example.com/custom
*/

/* ... test code ... */
});

Advanced users can also specify a custom link type and configure the URL pattern for it.

it('should demonstrate how the links work', () => {
/**
* @link docs features/links
*/

/* ... test code ... */
});

Configuration

Work in progress

To handle link generation for custom link types, TMS, and issue ids, you need to configure the 'jest-allure2-reporter' in your jest.config.js file.

You can specify URL patterns for each type of link. When generating the Allure report, the annotation function or JSDoc will replace the ID in the URL pattern with the actual ID provided in your test case.

Below is an example configuration:

module.exports = {
reporters: [
[
"jest-allure2-reporter",
{
issueLinkTemplate: "http://your-tracker.com/issue/{}",
tmsLinkTemplate: "http://your-tms.com/case/{}",
customLinkTemplate: "https://your-custom-url/{}"
}
]
]
}

In this example, {} will be replaced with the issue id, tms id, or custom id you've specified