Learn how to seamlessly integrate automated test results into TestRail using the code-first approach. This workflow is perfect for teams designing and managing test cases directly in their codebase, bypassing the need for test management tools while leveraging TestRail’s robust reporting and analytics capabilities.
Key Steps:
- Setup in TestRail:
- Enable the API via Site Settings.
- Create a project to house test results (e.g., "Code First Approach Examples").
- Add a custom field named Automation ID to map automated tests to TestRail cases.
- Execute Tests:
- Implement test cases in your codebase and execute them locally or via CI/CD tools like Jenkins or TravisCI.
- Generate JUnit-style XML reports for test results.
- Upload Results with TRCLI:
- Install TestRail CLI using pip install TRCLI (requires Python).
- Configure the TRCLI.yaml file with TestRail instance details, including host, credentials, and project name.
- Use the CLI command to upload results: trcli -Y -C <config_path> parse-junit -F <xml_path>.
Benefits:
- Automatically maps and creates test cases in TestRail, ensuring comprehensive visibility.
- Uploads results in seconds, offering detailed dashboards, error messages, and insights.
- Maintains a seamless connection between automation code and TestRail using the Automation ID field, reducing redundancy.
This efficient integration enables teams to centralize manual and automated testing efforts, providing complete test coverage and actionable insights.