Search code examples
cypresstestrail

cypress-testrail-reporter creates separate runs for each of my test files in TestRail instead of one test run


I currently have 2 test files that get ran on every build. It seems that for each test file, it creates its own test run in TestRail. So it reports a test run with 4 test cases and another test run with 7 test cases.

What I need and what used to happen before is to have only 1 test run with all 11 cases reported to TestRail.

Here is my cypress.json

  "reporterOptions": {
    "host": "https://yourdomain.testrail.com/",
    "username": "email",
    "password": "CYPRESS_TESTRAIL_REPORTER_PASSWORD",
    "projectId": 32,
    "suiteId": 103769,
    "runName":"Cypress Automated Test Run"

During the build, I can see that after each test file it prints out - Test run closed successfully

This did not happen before. Is there anything that changed, or what do I need to do to get only 1 test run.


Solution

  • There's an option includeAllInTestRun: true, or make sure that the case codes in the test title are actually in the same project/suite.

    it("C123 C124 Can authenticate a valid user", ...
    it("Can authenticate a valid user C321", ...
    

    Case IDs are extracted as any separate word starting "T" or "C" followed by digits,

    let testCaseIdRegExp: RegExp = /\bT?C(\d+)\b/g;