TestRail
Import test cases from TestRail into TestDriver.
This guide explains how to extract test cases from TestRail and convert them into TestDriver YAML test files. By automating this process, you can ensure that your TestRail test cases are directly translated into actionable tests for TestDriver.
Workflow overview
- Export Test Cases from TestRail: Use the TestRail API to fetch test cases.
- Convert Test Cases to TestDriver YAML: Transform the test cases into YAML test files.
- Save and Organize Test Files: Store the generated YAML files in a structured directory.
- Run Tests with TestDriver: Execute the tests using the TestDriver CLI.
Step 1: Export test cases from TestRail
Prerequisites
- TestRail API Key: Obtain your API key from TestRail.
- TestRail Base URL: Your TestRail instance URL (for example,
https://yourcompany.testrail.io
). - Node.js: Ensure Node.js is installed on your system.
Script: Export test cases from TestRail
The following script fetches TestRail test cases and extracts the title and steps.
Install dependencies:
Node.js script (export-testrail-test-cases.js
):
Step 2: Convert test cases to TestDriver YAML
The script above generates a YAML file for each TestRail test case. Each file contains the steps as prompt
entries.
Example YAML file (testdriver_tests/test_123.yaml
):
Step 3: Save and organize test files
- The generated YAML files will be saved in the
testdriver_tests/
directory. - Ensure the directory is part of your TestDriver project structure.
Step 4: Run tests with TestDriver
Use the TestDriver CLI to execute the generated test files.
Run a Single test file:
Best practices
- Field Mapping: Ensure the correct TestRail field ID (for example,
custom_steps
) is used for test steps. - Secure Credentials: Store TestRail API credentials in environment variables or secrets.
- Review Generated Files: Manually review the YAML files to ensure they align with your testing requirements.
- Organize Tests: Use a structured directory (for example,
testdriver_tests/
) to manage your test files.
Summary
By following this guide, you can automate the process of importing test cases from TestRail into TestDriver test files. This ensures that your test steps are directly translated into actionable tests, streamlining your testing workflows and improving coverage.