Publishes Cypress runs on TestRail.
- Solve the problem of the last test not beeing send as mocha evaluates process.exit without waiting for async calls to finish :(
- Currently solved as adding one test on the end of the test suite that will contain commands:
#COMMAND:closeRun#
and#COMMAND:noReport#
- Currently solved as adding one test on the end of the test suite that will contain commands:
$ npm install deepcrawl/cypress-testrail-reporter --save-dev
$ yarn add deepcrawl/cypress-testrail-reporter --dev
Add reporter to your cypress.json
:
...
"reporter": "@deepcrawl/cypress-testrail-reporter",
"reporterOptions": {
"host": "https://yourdomain.testrail.com",
"username": "username",
"password": "password",
"projectId": 1,
"suiteId": 1,
"runIdFileLocation": "myFile.txt",
"environmentName": <string>,
"cypressProjectId": <string>
}
This reporter automatically looks for a test case with same name and if there is one it uploads the results. If there is no such test case it will make new one and then upload the results.
This command notifies the reporter that at AT THE BEGINNING of the test execution the reporter should call test rail to close the run.
describe("Test Rail synchronization test", function () {
it("this test will call for closing the run #COMMAND:closeRun#", async function () {
await cy.wait(10000);
expect(1).equal(1);
});
});
This command notifies the reporter that this test should not be reported.
describe("Test Rail synchronization test", function () {
it("this test will call for closing the run #COMMAND:noReport#", async function () {
await cy.wait(10000);
expect(1).equal(1);
});
});
host: string host of your TestRail instance (e.g. for a hosted instance https://instance.testrail.com).
username: string email of the user under which the test run will be created.
password: string password or the API key for the aforementioned user.
projectId: number project with which the tests are associated in Test Rail.
runIdFileLocation: string name of the file from where the runId should be taken as a priority. If no such file exists than new run will be created and this file will be overrided and the content of the file will be just id of the run. ( This is a solution for cypress to not to create run for each test suite file. )
suiteId: number suite with which the tests are associated.
To increase security, the TestRail team suggests using an API key instead of a password. You can see how to generate an API key here.
If you maintain your own TestRail instance on your own server, it is recommended to enable HTTPS for your TestRail installation.
For TestRail hosted accounts maintained by Gurock, all accounts will automatically use HTTPS.
You can read the whole TestRail documentation here.
Deepcrawl internal copy!
This project is licensed under the MIT license.
- Web & Mobile development company, owner of the mocha-testrail-reporter repository that was forked.