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 asprompt
entries.
Example
testdriver/test_123.yaml
Step 3: Save and organize test files
- The generated YAML files will be saved in the
testdriver/
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/
) to manage your test files.