Cypress to TestRail Reporter Plugin Configuration
In order to begin writing your execution records from your Cypress e2e tests into related test cases in TestRail you will need the following configurations --
TestRail API Key
Log in to TestRail
In the upper right of the interface find your name and click it to spawn a menu
Select
My Settings
Select the
API KEYS
tabClick
Add Key
linkUse
Add API Key
dialog to name the key something relevant like 'Cypress Integration'Click
Generate Key
Copy the displayed key out and save it somewhere secure
Click
Add Key
Verify that key was added to list of API Keys
Click
Save Settings
THIS IS VERY IMPORTANT. DON'T FORGET THIS STEP!
Corresponding TestRail Objects
Navigate to project dashboard
Verify
projectID
in URLNavigate to 'Test Cases' tab
Verify
suiteID
in URLTag test cases in your Cypress test file by using the unique identifier of the test case in the test title
In order to run a subset of tests available in your project's test suite, you will need to organize them into a section in TestRail and discover that section's
groupId
.
Environment Variables Set
TR_USER
: the email address for your TestRail accountTR_API_KEY
: the API key that you created for use by Cypress to TestRail reporter in TestRailTR_PROJECTID
: the unique identifier for your TestRail projectTR_SUITEID
: the unique identifier for the test suite from your project (by default a project is set up with only one test suite)TR_RUN_NAME
: the name that you would like to see in TestRail for this runTR_INCLUDE_ALL
: true if you want to run all test cases in the test suite || false if you want to run a subset of test cases available in your test suiteTR_GROUPID
: the unique identifier of your section/group of automated tests in your test suiteTR_FILTER
: a string to match the names of your test cases to (even if you don't want to filter, you must include this variable set to an empty string)
export TR_USER="your-testrail-email-here" TR_API_KEY="your-API-key" TR_PROJECTID="your-projectid" TR_SUITEID="your-suiteid" TR_RUN_NAME="human readable name" TR_INCLUDE_ALL="TRUE/FALSE" TR_GROUPID="subset of test cases collected into group" TR_FILTER="a string to filter on (can be blank)"
Invoke Cypress with Custom Reporter Options
yarn cy:testrail-run --spec src/applications/<your app>/tests/e2e/<your test file>
The above yarn script is using your previously set environment variables to set the reporter options --
"cy:testrail-run": "cypress run --config-file config/cypress-testrail.json --reporter-options host=<https://dsvavsp.testrail.io/,username=$TR_USER,password=$TR_API_KEY,projectId=$TR_PROJECTID,suiteId=$TR_SUITEID,runName=$TR_RUN_NAME,includeAllInTestRun=$TR_INCLUDE_ALL,groupId=$TR_GROUPID,filter=$TR_FILTER",>
Help and feedback
Get help from the Platform Support Team in Slack.
Submit a feature idea to the Platform.