@jest-reporters/testrail v1.0.1
Testrail reporter for Jest
Description
It can automatically create a new test runs on TestRail for multiple suites and send results.
Install
npm i @jest-reporters/testrail
Example - jest-config.js
The Reporter must be specified in the Jest config file (jest-config.js), under 'reporters'. Parameter is defined as 'project_id', which is the id of your project on TestRail.
module.exports = {
...
reporters: [
["testrail", { project_id: "1" }]
]
};
Example - tests
The Suite ID from TestRail must be added to the start of top describe() description, ID should be in TestRailID.
The Case ID from TestRail must be added to the start of each it() description, ID should be in TestRailID.
// "1:" this is Suite ID from Test Rail (Will work only for top)
describe("TestRail[1] Suite", () => {
// "11:" this is Case ID from Test Rail
it("TestRail[11] Test success", async () => {
expect(1).toBe(1);
});
it("TestRail[12] Test fail", async () => {
expect(1).toBe(0);
});
xit("TestRail[13] Test skip", async () => {
expect(1).toBe(1);
});
});
Note: The Case ID is a unique and permanent ID of every test case (e.g. C125), and shoudn'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: Test run will not be added if Case ID/Suite ID is incorrect.
ENV requirements
Project needs 3 parameters to work correctly with testrail
TESTRAIL_URL = https://<YourProjectURL>.testrail.io
TESTRAIL_USERNAME = email address
TESTRAIL_PASSWORD = password or API key
License
This project is licensed under the MIT License - see the LICENSE file for details.