Tags
Tags are custom labels that you can add to your test cases to help organize and filter them.
For example, you can add a smoke
tag to a test case to indicate that this test case is part of your smoke test suite. Or, add a web
tag to mark the test case as being part of the web application testing process.
Test cases can have multiple tags. You can use the tags you created to filter the test cases (using filters or AQL queries) and to create test plans. You can also simply click on a tag when viewing a test case to display all test cases with that tag.
Tags can be added manually using the web interface or automatically from the test results you upload to Allure TestOps. If you want to add tags to automated test cases manually, you need to change your project's upload policy.
Adding tags manually
- Go to Test cases.
- Open a test case.
- On the right side of the screen, find Tags and click the pencil icon next to it.
- Enter a new tag or select an existing tag from the drop-down list.
- When you are finished selecting tags, click Submit.
Setting tags automatically from test results
Tags can be applied to test cases automatically when you upload test results to Allure TestOps. For this to work, you need to specify the required tags in your integration code.
The exact implementation will depend on the testing framework you use, but as an example, here is what it might look like if you are using JUnit 5:
@Test
@Tags({@Tag("web"), @Tag("critical")})
@DisplayName("Creating new issue by authorized user")
public void shouldCreateIssue() {
steps.openIssuesPage(OWNER, REPO);
steps.createIssueWithTitle(ISSUE_TITLE);
steps.shouldSeeIssueWithTitle(ISSUE_TITLE);
}
Notice the line starting with @Tags. This line applies two tags to the test case: web
and critical
.
The code above will generate a test result file with the field "labels". This field contains the properties that will be applied to the test case when the file is uploaded to Allure TestOps.
...
"labels": [
{
"name": "tag",
"value": "web"
},
{
"name": "tag",
"value": "critical"
},
...
You can read more about using labels in the corresponding article.
Changing upload policy
If you want to set tags for automated test cases using the web interface instead of specifying them in test results, you can change your upload policy to ignore tags from test results.
- Open your project.
- Go to Settings → Upload.
- Click the + Create button.
- Under Field, select tag.
- Under Policy, select from_test_case.
- Click Submit.