Test layers
Allure TestOps allows you to organize your test cases into distinct testing layers, such as UI tests, integration tests, unit tests, etc. A test case can belong to only one testing layer at a time.
By default, Allure TestOps provides three testing layers that you can use: API Tests, UI Tests, and Unit Tests. To modify the list of available testing layers, you need to sign in to Allure TestOps as administrator.
You can use test layers to filter the test cases (using filters or AQL queries) and to create test plans.
Test layers can be assigned manually using the web interface or automatically from the test results you upload to Allure TestOps. If you want to set test layers for automated test cases manually, you need to change your project's upload policy.
Managing available test layers
- Log in to Allure TestOps using an administrator account.
- Click on your avatar and go to Administration → Test Layer.
- To create a new test layer, click the Create button and enter a name for the new layer.
To rename a previously created layer, click the pencil icon on the right side of the layer. To delete a layer, click the trash bin icon.
Assigning layers manually
- Go to the Test cases section of your project.
- Select a test case.
- In the top right corner of the page, click
⋮
and select Change layer. - Select a test layer and click Submit.
Assigning layers automatically from test results
Test layers can be assigned to test cases automatically when you upload test results to Allure TestOps. For this to work, you need to specify the required layers in your integration code and create mappings in your project settings.
Specifying layers in 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
@Layer("ui_tests")
@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 @Layer. This line sets "ui_tests" as the testing layer for the test case.
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": "layer",
"value": "ui_tests"
},
...
You can read more about using labels in the corresponding article.
Creating mappings
- Go to the project page.
- In the menu on the left, click Settings → Test Layers.
- Click the Create button.
- As the Key, specify the value you use in your code. For the example above, it is ui_tests.
- As the Test Layer, select the test layer you want to associate with the entered key. For the example above, it is UI Tests.
- Click Submit.
Changing upload policy
If you want to assign test layers to automated test cases using the web interface instead of specifying them in test results, you can change your upload policy to ignore layers from test results.
- Go to the project page.
- In the menu on the left, click Settings → Upload.
- Click the Create button.
- Under Field, select test_layer.
- Under Policy, select from_test_case.
- Click Submit.