Use a TestRail YAML Connection Credentials file to provide TestRail credentials and related settings when executing a compiled Ranorex test suite. This article explains how to pass the file at execution time, how priority resolution works, and provides ready-to-use examples for common CI/CD systems.
TestRail YAML Connection Credentials with -tryamlfile
The -tryamlfile command-line parameter allows you to specify a custom YAML configuration file at runtime when executing your compiled Ranorex test suite. This is particularly useful for:
- CI/CD Pipelines: Different configuration files for different environments
- Portable Executables: Configuration files separate from the executable
- Team Collaboration: Each team member can have their own configuration
- Security: Keep sensitive credentials outside the project directory
Priority Order
Before you choose how to configure credentials, it helps to understand how Ranorex resolves them at runtime. When executing a test suite, TestRail credentials are loaded in this priority order:
- -tryamlfile parameter (HIGHEST PRIORITY) - TestRail YAML Connection Credentials
- Auto-sync configuration - Studio-configured settings with Windows Credential Manager
Usage
This section shows basic invocation patterns and how to combine the parameter with other common execution options, such as run configurations and reporting.
Basic Syntax
# Using full parameter name
MyTestSuite.exe -tryamlfile="C:\Users\<username>\Documents\Ranorex\RanorexStudio Projects\<solution-name>\TestRail.yaml”With Other Parameters
# Combine with run configuration
MyTestSuite.exe -runconfig:"Release" -tryamlfile="C:\configs\prod-testrail.yaml"
# Combine with report settings
MyTestSuite.exe -reportfile:"results.rxlog" -tryamlfile=".\testrail.yaml"TestRail YAML Connection Credentials
Use the examples below as a starting point for your configuration.
Complete Example
credentials:
use_environment_variables: false
url: https://yourcompany.testrail.io/
username: api-user@example.com
password: your_api_key_here
project_id: 10
test_suite_id: 17
test_case_id: 34
automatic_sync_enabled: true
proxy:
enabled: false
use_environment_variables: true
address: TESTRAIL_PROXY_ADDRESS
username: TESTRAIL_PROXY_USERNAME
password: TESTRAIL_PROXY_PASSWORD
bypass_on_local: trueUsing Environment Variables
Use this variant when you want to avoid storing credentials in files.
credentials:
use_environment_variables: true
url: TESTRAIL_URL
username: TESTRAIL_USERNAME
password: TESTRAIL_PASSWORD
project_id: 10
test_suite_id: 17
automatic_sync_enabled: trueThen set environment variables before running:
# PowerShell
$env:TESTRAIL_URL = "https://yourcompany.testrail.io/"
$env:TESTRAIL_USERNAME = "api-user@example.com"
$env:TESTRAIL_PASSWORD = "your_api_key"
# Run test
.\MyTestSuite.exe -tryamlfile="config.yaml"
# Bash/Linux
export TESTRAIL_URL="https://yourcompany.testrail.io/"
export TESTRAIL_USERNAME="api-user@example.com"
export TESTRAIL_PASSWORD="your_api_key"
# Run test
./MyTestSuite.exe -tryamlfile="config.yaml"Path Resolution
You can pass either absolute or relative paths. UNC paths are supported for shared locations.
The -tryamlfile parameter supports:
-
Absolute paths:
C:\configs\testrail.yaml -
Relative paths:
.\configs\testrail.yaml(relative to executable location) -
UNC paths:
\\server\share\configs\testrail.yaml
Security Best Practices
Follow these recommendations to keep credentials secure and maintain clean version control practices.
1. Use Environment Variables in CI/CD
credentials:
use_environment_variables: true # Recommended for CI/CD
url: TESTRAIL_URL
username: TESTRAIL_USERNAME
password: TESTRAIL_PASSWORD
2. Protect Configuration Files
- Add
*.yamlto.gitignoreto avoid committing credentials - Use CI/CD secrets for environment variables
- Set appropriate file permissions (read-only for execution user)
3. Template Configuration
Provide a template without credentials:
testrail-config.template.yaml:
credentials:
use_environment_variables: true
url: TESTRAIL_URL # Set via environment variable
username: TESTRAIL_USERNAME # Set via environment variable
password: TESTRAIL_PASSWORD # Set via environment variable
project_id: 10 # Update with your project ID
test_suite_id: 17 # Update with your test suite ID
automatic_sync_enabled: trueTroubleshooting
If your configuration is not being applied or credentials are not resolved, work through the checks below:
Configuration Not Loaded
Check 1: File Path
# Verify file exists
Test-Path "C:\configs\testrail.yaml"Check 2: YAML Syntax
- Ensure proper indentation (use spaces, not tabs)
- Validate YAML format using online validators
Check 3: Environment Variables
# Check if environment variables are set
Get-ChildItem Env: | Where-Object { $_.Name -like "TESTRAIL_*" }Command-Line Parameter Reference
Use this quick reference when adding parameters to your execution commands.
| Parameter | Description |
-tryamlfile |
Path to TestRail YAML Connection Credentials |
Example:
MyTestSuite.exe -tryamlfile="C:\config\testrail.yaml"
Notes
- The -tryamlfile parameter has absolute priority over all other credential sources
- Studio configuration (auto-sync) is used as a fallback if YAML file is not specified or fails to load
- The YAML file is only used at runtime - Studio still uses its own configuration
- All fields in the YAML file (project_id, test_suite_id, etc.) are loaded, but only credentials are currently used for runtime execution