Skip to content

Targeting existing issues⚓︎

The plugin does not upload any results unless you reuse existing Jira issues to not clutter up your projects with unnecessary test case (or test execution) issues. This section teaches you everything you need to know to target such existing issues.


Reuse Cypress issues⚓︎

To link Cypress tests to Jira issues, simply add the test case issue's key anywhere in the name of the innermost it() function (or corresponding alternatives like specify()):

1
2
3
4
5
describe("a suite", () => {
    it("PRJ-123 has a test case", () => {
        // ...
    });
});

retrieving test case issue numbers retrieving test case issue numbers The plugin parses all test case names and looks for sequences of the form <projectKey>-<number>, with <projectKey> being the configured project key and <number> the issue number.


Reuse Cucumber issues⚓︎

To link your Cucumber feature files to existing Jira issues, you need to tag both scenario (outlines) and backgrounds. The tagging schemes follow the schemes Xray expects when importing feature files (see here or here).

Test issues⚓︎

In feature files, you must annotate scenarios (or scenario outlines) with a tag containing the corresponding test case issue key. The tag's prefix must match the one configured in your Xray settings (see here).

1
2
3
4
5
6
7
Feature: Example page redirection

@MyTestPrefix:CYP-129
Scenario: Redirect by clicking
    Given the example page
    When the link is clicked
    Then a redirect should occur
1
2
3
4
5
6
7
await configureXrayPlugin(on, config, {
    cucumber: {
        prefixes: {
            test: "MyTestPrefix:"
        }
    },
});
1
2
3
4
5
6
7
Feature: Example page redirection

@CYP-129
Scenario: Redirect by clicking
    Given the example page
    When the link is clicked
    Then a redirect should occur
1
2
3
4
5
6
7
await configureXrayPlugin(on, config, {
    cucumber: {
        prefixes: {
            test: undefined // or omit it entirely
        }
    },
});

Precondition issues⚓︎

In feature files, you must add a comment to a background's very first step containing the tag for a corresponding precondition issue key. The tag's prefix must match the one configured in your Xray settings (see here).

Note

You can find more information about preconditions here for Xray server and here for Xray cloud.

1
2
3
4
5
6
Feature: Big feature on lovely page

Background:
    #@MyPreconditionPrefix:CYP-332
    Given a browser
    Then the lovely page should open
1
2
3
4
5
6
7
await configureXrayPlugin(on, config, {
    cucumber: {
        prefixes: {
            precondition: "MyPreconditionPrefix:"
        }
    },
});
1
2
3
4
5
6
Feature: Big feature on lovely page

Background:
    #CYP-332
    Given a browser
    Then the lovely page should open
1
2
3
4
5
6
7
await configureXrayPlugin(on, config, {
    cucumber: {
        prefixes: {
            precondition: undefined // or omit it entirely
        }
    },
});

Reuse test execution issues⚓︎

By default, the plugin will always create a new test execution issue whenever you upload test results.

You can prevent that from happening by specifying the test execution issue key you want to attach the results to.