Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
testrail-jest-reporter
Advanced tools
Readme
This package allows you to use Jest and report your test results to TestRail.
Please use with combination with the default reporter
npm i testrail-jest-reporter --save-dev
As per Jest's documentation,
the Reporter must be specified in the jest-config.js or package.json file as part of the reporters
array.
suite mode
id as parameter 'suite_mode' (recommended). If that parameter is not specified, the Reporter will get this automatically.
single repository for all cases -
suite_mode:1
single repository with baseline support -suite_mode:2
multiple test suites to manage cases -suite_mode:3
// this is the part of the jest-config.js
module.exports = {
...,
reporters: [
"default",
[
"testrail-jest-reporter",
{ project_id: 1,
baseUrl: 'http://localhost',
milestone: '<milestone_name>',
suite_mode: 3,
statuses: {pending: 7}
},
]
],
...
};
// this is the "jest" part of the package.json
{
"jest": {
"reporters": [
"default",
[
"testrail-jest-reporter",
{
"project_id": "1",
"baseUrl": 'http://localhost',
"milestone": '<milestone_name>',
"suite_mode": "3",
"statuses": {"pending": "7"}
}
]
]
}
}
The testrail.conf.js file needs to be created in your project's root folder.
baseUrl
parameter, or /[C][?\d]{3,6}/gm
)The first version of the Reporter requires you to use a milestone.
module.exports = {
'baseUrl': 'http://localhost',
'user': 'user@example.com',
'pass': 'some-password',
'milestone': '<milestone_name>',
'regex': /[C][?\d]{3,6}/gm
}
In order to use TestRail API, it needs to be enabled by an administrator
in your own TestRail Site Settings.
Also, if you want to use API authentication instead of your password,
enable session authentication for API in the TestRail Site Settings,
and add an API key in your User settings (This is recommended).
You can add a TestRail tests Runs or tests Plan with all tests you want to automate.
If you don't, the Reporter will publish Jest tests results into the new TestRail test Run.
Each time the Jest runs tests the Reporter parse all TestRail tests Plans
and tests Runs of the Milestone to collect testcases.
The Reporter collects only unique testcases,
if you have several tests Runs with one testcase
then The Reporter push the test result only to one of that Runs.
The Case ID from TestRail may be added to it() description each test result you want to push to TestRail. You can specify several cases in one it() description.
describe("Tests suite", () => {
// "C123" this is Case ID from Test Rail
it("C123 test success", async () => {
expect(1).toBe(1);
});
it("Test fail C124 C125", async () => {
expect(1).toBe(0);
});
xit("Another success test", async () => {
expect(1).toBe(1);
});
});
Note: The Case ID is a unique and permanent ID of every test case (e.g. C125),
and shouldn't be confused with a Test Case ID,
which is assigned to a test case when a new run is created (e.g. T325).
Note: The first and second it() test result will be reported, and the last - not.
This version:
Version 2:
Version 3:
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Custom Jest reporter for Testrail synchronization
The npm package testrail-jest-reporter receives a total of 1,680 weekly downloads. As such, testrail-jest-reporter popularity was classified as popular.
We found that testrail-jest-reporter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.