Severity
In Allure reports, you can determine the severity of each test case. This helps you to prioritize the test cases and to determine the impact of a failed test case. The severity can be one of the following values: blocker, critical, normal, minor, trivial. The default severity is normal.
There are two ways to define the severity of a test case:
- declaratively, via
@severity
JSDoc annotation; - programmatically, via
$Severity
annotation function.
The severity can be defined in the following places:
- on a test file level;
- on a test suite level;
- on a test case level.
Test file
In a test file, you can define the severity for all test cases in the file.
This is especially useful for test files that contain multiple top-level describe
blocks.
- Docblocks
- DSL
- Preview
/**
* @severity critical
*/
describe('Sanity: Login flow', () => {
it('should login with valid credentials', () => {
/* ... test code ... */
});
});
describe('Sanity: Dashboard', () => {
it('should show the dashboard', () => {
/* ... test code ... */
});
});
import { allure } from 'jest-allure2-reporter/api';
allure.severity('critical');
describe('Sanity: Login flow', () => {
it('should login with valid credentials', () => {
/* ... test code ... */
});
});
describe('Sanity: Dashboard', () => {
it('should show the dashboard', () => {
/* ... test code ... */
});
});
TODO: add screenshot
Test suite
You can define the severity for each test suite individually.
- Docblocks
- DSL
- Preview
describe('Sanity: Login flow', () => {
/**
* @severity critical
*/
it('should login with valid credentials', () => {
/* ... test code ... */
});
});
describe('Dashboard', () => {
/**
* @severity minor
*/
it('should show the dashboard', () => {
/* ... test code ... */
});
});
Please note that you have to put the JSDoc comment inside the test suite function body.
import { $Severity } from 'jest-allure2-reporter/api';
$Severity('blocker')
describe('Sanity: Login flow', () => {
it('should login with valid credentials', () => {
/* ... test code ... */
});
});
$Severity('minor')
describe('Sanity: Dashboard', () => {
it('should show the dashboard', () => {
/* ... test code ... */
});
});
TODO: add screenshot
Test case
You can define the severity for each test case individually.
- Docblocks
- DSL
- Preview
it('should login with valid credentials', () => {
/**
* @severity critical
*/
/* ... test code ... */
});
Please note that you have to put the JSDoc comment inside the test function body.
$Severity('critical')
it('should login with valid credentials', () => {
/* ... */
});
TODO: add screenshot
About severity levels
Keep in mind that the meaning of each severity level is subjective and varies from project to project. It is merely a convention that you can use to communicate the importance of a test case or an issue.
- Blocker: This is the highest severity level. A blocker issue or a test case failure is something that completely prevents further testing or use of the product or system. It must be addressed immediately.
- Critical: A critical issue is a major problem that significantly impacts the functionality of the product or system, but does not entirely prevent its use or testing. It should be addressed as soon as possible after any blocker issues.
- Normal: A normal severity issue is a moderate problem. It impacts the product or system in a noticeable way, but it's not as crucial as blocker or critical issues. It should be addressed in the course of normal workflow.
- Minor: A minor issue has a small impact on the product or system. It might cause some inconvenience or confusion, but it doesn't significantly affect the overall functionality. These are usually lower priority issues.
- Trivial: A trivial issue is a very minor problem, often related to aesthetics, user experience, deprecated features, or aspects of the product still in alpha or beta stages rather than core functionality. Trivial issues are the lowest priority and are typically addressed last, if at all.