If you want to learn about TestRail read the Complete Guide on TestRail as a Test Management Tool and you can also read about How to install Cypress on Windows and perform Automation. In this guide, I will be showing you how to integrate TestRail with Cypress in five steps. You can further read more on performance testing using tools like Apache JMeter Load Testing: Test Mobile Apps on Windows and how to Install and conduct performance testing using Apache JMeter on your Web App.
If it is automation for functional testing, you can read how to install Cypress on Windows and perform Automation testing and if its security testing you can read How to install and use Burp Suite for Web Application Security Testing.
Five Steps on How to Integrate TestRail with Cypress
1. Install test project
You can open your project folder with VScode or any IDE of your choice. Run
npm install cypress to install cypress and all the node package for your new cypress project.
2. Run tests
After setting up the cypress project with a test case, run the test. One of the tests is about the automation of the launching of
To integrate with TestRail CLI run this command inside the cypress project folder:
npx cypress run --reporter "junit" --reporter-options "mochaFile=reports/junit-[hash].xml"
After running this command you will see the following result which will be sent as a report to TestRail.
This image shows there was a problem with the test when launching the website. The screenshot of the issue is also sent to the screenshots folder inside the Cypress project folder.
The following shows all the tests carried out with the outcome in that single run of that command.
This is the result that will be sent to TestRail as a report.
3. Install TestRail CLI
Enter this command to install TestRail CLI:
pip install trcli
Please note that you might get the below message. In case you see this message you can install Python and use Powershell to run the command.
You can also read this article: How to Fix Python was not found run without arguments to install from the Microsoft Store
You can download the latest Python version here with Windows installer.
4. Configuring TestRail
Login into your TestRail environment and configure these:
1: Enable the TestRail API by Navigating to Administration > Site Settings, click on the API Icon and check the Enable API option and Save.
2. In other to map your automated test cases code to your actual TestRail cases then you will need to create a Custom Field. Navigate to Administration > Customizations and click Add Field. Then enter these custom fields:
a. The System Name must be automation_id
b. The Type must be Text.
5. Merge and Upload reports
Use the below command to merge the reports in Cypress to TestRail. Please see how to schedule and join meetings with Microsoft Teams
junitparser merge --glob "reports/junit-*""reports/junit-report.xml"
Once the results are merged it will upload the results on TestRail which will serve as a test report.
FAQs on How to Integrate TestRail with Cypress
You can now integrate TestRail test cases with your Cypress tests. Make sure you use the TestRail case ID as a prefix inside the Cypress test title. The installed plugin will automatically extract it, and forward the results to TestRail. Use the Case ID at the beginning and separate it with an : from the rest of the title.
API is part of TestRail and can be enabled in TestRail’s administration section under Administration > Site Settings > API. This API can be used to submit test results from an application like Cypress which carry out automated tests.
I hope you found this blog post on how to Integrate TestRail with Cypress. Interesting and helpful. In case you have any questions do not hesitate to ask in the comment section.