Reporter for Jest to create test runs in TestRail, link test cases and update their status automatically.
To install the library in your project, use below command:
npm install jest-testrail-reporter2 --save-dev
# or using Yarn
yarn add jest-testrail-reporter2 --dev
You need to add the case ID in your test title anywhere (preferable in the beginning).
// C001 is the case ID below
test("C001 - This is an example test", () => {
// ... your assertions
});
// or you can put it in the end
test("This is an example test - C001", () => {
// ... your assertions
});
// or maybe anywhere, first match to C\d+ will be used
test("This is C001 test", () => {
// ... your assertions
});
Finally, include the reporter in your jest.config.js
as follows:
{
reporters: [
// ... other reporters
["jest-testrail-reporter2", {
host: 'https://yourorg.testrail.io',
username: '[email protected]',
password: 'password' || 'api key',
project: { id: 1 },
testRun: {
name() {
return "Test Run #" + new Date().getTime();
},
},
}],
]
}
Possible options and their respective types/values are as below:
Name | Type | Required | Default value |
---|---|---|---|
host | string |
✅ | |
username | string |
✅ | |
password | string |
✅ | |
project | map |
✅ | |
project.id | number |
✅ | |
statusIds | map |
❌ | see below |
statusIds.disabled | number |
✅ | 2 |
statusIds.failed | number |
✅ | 5 |
statusIds.passed | number |
✅ | 1 |
statusIds.pending | number |
✅ | 4 |
statusIds.skipped | number |
✅ | 3 |
statusIds.todo | number |
✅ | 3 |
testRun | map |
✅ | |
testRun.name | string, function |
✅ | |
testRun.description | string, function |
❌ | |
testSuite | map |
❌ | |
testSuite.id | number |
❌ |
See LICENSE file.