Adding and issue information to a test case
You can add an issue link from the issue tracker to a test case or test result manually or you can set up automatic adding issue links to the test cases.
Issues' information in test cases and in launches is used by Allure TestOps to jump directly to an issue in issue tracker and keep link between developers' tasks and tests managed with Allure TestOps.
Prerequisites
To be able to add links to an issue tracker, you need to integrate Allure TestOps with an issue tracker.
Adding issue information to a test case
We'll have 2 scenarios here - for manual and automated test cases.
Manual test cases
In the Test cases section, select a test case.
On the Overview tab, go to the test case Issues section and click Edit button (looks like a pencil).
Select Tracker and Key from the drop-down lists, and then click Submit.
You can add issue links to a test results using the same way.
Automated test cases
For automated test cases there are two options available:
- You can provide the information about the issues in your code.
- You can manage issues information in Allure TestOps.
Issue information from the code
You can configure automatic provisioning of issues information to the test cases using annotations.
Annotations allow usage of Allure Framework's labels. Labels are described here in detail.
- In the tests code, create an annotation as follows.
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import io.qameta.allure.LabelAnnotation;
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@LabelAnnotation(name = "jira")
public @interface JiraIssue {
String value();
}
JiraIssue is the name of annotation in the example.
@LabelAnnotation declares label parameter with the key
jira
and itsvalue()
will be defined by you in the code of a test case and Allure will use this information - the pair of key-value for displaying issue information in a test case.
- Mark all required test cases with the created annotation
JiraIssue
.
@JiraIssue("AE-2")
@Test
void testEveryting() {
...
}
- Configure labels' mapping for issue information in your Allure TestOps project.
Go to the Settings tab of required project, then to the Issues section.
Add a key with the value from @LabelAnnotation (name = "jira")
, i.e. you need to add jira
key.
- From now on the test cases in Allure TestOps will contain links to issues.
Issue information management in Allure TestOps
Managing the issues information for automated test cases by Allure TestOps means requires additional configuration to be made in the settings of a project.
In your project...
- Go to the settings
- Navigate to Upload section in the settings and click +Create to create upload policy.
- Select parameters for tags:
- Field: issue
- Policy: from_test_case
- Click Submit
The field Issue of automated test cases will become editable and you will be able to add issues information manually.