dochia replay
The replay command allows you to re-execute previously run Dochia tests. This is useful for debugging, regression testing, and validating fixes after issues have been identified.
Basic Usage
dochia replay <tests>[,<tests>...] [OPTIONS]
Required Parameters
<tests>- Test identifiers to replay (comma-separated list)
Quick Examples
# Replay a single test from default report folder
dochia replay Test1
# Replay multiple tests
dochia replay Test1,Test5,Test12
# Replay with custom JSON file
dochia replay /path/to/Test1.json
# Replay against different server
dochia replay Test1 -s http://staging.api.com
# Replay all errors from the previous run
dochia replay --errors
# Replay all warnings from the previous run
dochia replay --warnings
# Replay both errors and warnings from the previous run
dochia replay --errors --warnings
Replaying by Result Type
Instead of specifying individual test IDs, you can instruct Dochia to automatically replay all tests that produced errors or warnings in a previous run.
Replay All Errors
# Replay every test that ended with an error result
dochia replay --errors
# Replay all errors against a different server
dochia replay --errors -s https://staging.api.com
# Replay all errors and save updated results
dochia replay --errors --output ./error-recheck
Replay All Warnings
# Replay every test that ended with a warning result
dochia replay --warnings
# Replay all warnings with updated authentication
dochia replay --warnings -H "Authorization=Bearer $NEW_TOKEN"
Replay Errors and Warnings Together
# Replay all tests that were not fully successful
dochia replay --errors --warnings --output ./recheck-results
When --errors or --warnings is used:
- The source folder defaults to
dochia-report(overridable with-i, --input <folder>) - Explicit test IDs and
--errors/--warningsflags are mutually exclusive
Test Identification
Default Report Folder
When you provide test names without file extensions, Dochia looks for them in the default dochia-report folder:
# These look in ./dochia-report/ folder
dochia replay Test1
dochia replay Test1,Test5,Test12
Custom JSON Files
When you provide paths with .json extension, Dochia treats them as file paths:
# Replay from specific JSON file
dochia replay /path/to/Test1.json
# Replay from multiple JSON files
dochia replay results1.json,results2.json,/full/path/results3.json
Finding Test Names
To find available test names, check your report folder:
# List available tests in default report folder
ls dochia-report/
# Look for Test*.json files
ls dochia-report/Test*.json
Server Override
Change Target Server
Replay tests against a different server than the original:
# Original tests ran against localhost, replay against staging
dochia replay Test1,Test2 -s https://staging-api.example.com
# Replay against production for validation
dochia replay Test1 -s https://api.production.com
This is particularly useful for:
- Environment Testing - Run the same tests across dev/staging/prod
- Load Balancer Testing - Test different server instances
- Migration Validation - Verify behavior after server changes
Header Override
Authentication Updates
Override headers from the original test, commonly used for authentication:
# Update authentication token
dochia replay Test1 -H "Authorization=Bearer new-token-123"
# Update multiple headers
dochia replay Test1 \
-H "Authorization=Bearer new-token" \
-H "X-API-Version=v2" \
-H "X-Client-ID=new-client"
Header Precedence
Headers specified with -H take precedence over headers stored in the replay files:
# This will override any existing Authorization header
dochia replay Test1 -H "Authorization=Bearer updated-token"
Authentication Options
Basic Authentication
# Username/password authentication
dochia replay Test1 -u "username:password"
Dynamic Authentication
# Refresh authentication periodically
dochia replay Test1,Test2,Test3 \
--auth-refresh 1800 \
--auth-refresh-script ./get-fresh-token.sh
SSL/TLS Configuration
# Client certificate authentication
dochia replay Test1 \
--ssl-keystore client-cert.p12 \
--ssl-keystore-password "$KEYSTORE_PASS" \
--ssl-key-password "$KEY_PASS"
Proxy Settings
# Full proxy URL
dochia replay Test1 --proxy http://proxy.company.com:8080
# Separate host and port
dochia replay Test1 --proxy-host proxy.company.com --proxy-port 8080
Output Options
Save Updated Results
Save the replay results to a new location:
# Save to custom output folder
dochia replay Test1 --output ./replay-results
# Save with timestamp for comparison
dochia replay Test1 --output ./replay-$(date +%Y%m%d-%H%M%S)
The output folder will contain TestXXX.json files with updated responses from the replay.
Verbose Output
# Detailed execution information
dochia replay Test1 -v
Practical Use Cases
Debugging Failed Tests
# Replay a failed test with verbose output to debug
dochia replay Test5 -v
# Replay with updated authentication
dochia replay Test5 -H "Authorization=Bearer fresh-token" -v
# Replay all errors from the last run with verbose output
dochia replay --errors -v
Environment Validation
# Test the same scenarios across environments
dochia replay Test1,Test2,Test3 -s https://dev-api.example.com --output ./dev-results
dochia replay Test1,Test2,Test3 -s https://staging-api.example.com --output ./staging-results
dochia replay Test1,Test2,Test3 -s https://prod-api.example.com --output ./prod-results
Regression Testing
# After fixing bugs, replay all previously failing tests in one command
dochia replay --errors \
-s http://localhost:8080 \
--output ./post-fix-results \
-v
# Or target specific tests if you prefer
dochia replay Test8,Test15,Test23 \
-s http://localhost:8080 \
--output ./post-fix-results \
-v
Load Balancer Testing
# Test against different server instances
dochia replay Test1 -s https://api-server-1.example.com --output ./server1-results
dochia replay Test1 -s https://api-server-2.example.com --output ./server2-results
dochia replay Test1 -s https://api-server-3.example.com --output ./server3-results
Authentication Token Refresh
# Replay tests with fresh authentication
dochia replay Test1,Test2,Test3 \
--auth-refresh-script ./refresh-oauth-token.sh \
--output ./fresh-auth-results
Advanced Examples
Complete Environment Migration Test
# Replay critical tests against new environment
dochia replay Test1,Test5,Test12,Test18 \
-s https://new-api-environment.com \
-H "Authorization=Bearer $NEW_ENV_TOKEN" \
-H "X-Environment=production" \
--output ./migration-validation \
--ssl-keystore ./new-env-cert.p12 \
--ssl-keystore-password "$NEW_CERT_PASS" \
-v
Automated Regression Testing
#!/bin/bash
# Script for automated regression testing using --errors flag
# Replay all errors automatically — no need to grep for test IDs
dochia replay --errors \
-s http://localhost:8080 \
--output ./regression-test-$(date +%Y%m%d-%H%M%S) \
-v
Multi-Environment Comparison
# Compare API behavior across environments
for env in dev staging prod; do
echo "Testing $env environment..."
dochia replay Test1,Test2,Test3 \
-s https://$env-api.example.com \
-H "Authorization=Bearer ${env^^}_TOKEN" \
--output ./comparison-$env \
-v
done
Result Analysis
Comparing Results
After replaying tests, you can compare results:
# Compare original vs replay results
diff dochia-report/Test1.json replay-results/Test1.json
# Compare across environments
diff dev-results/Test1.json staging-results/Test1.json
Automated Validation
# Check if replay results match expectations
jq '.response.statusCode' replay-results/Test*.json | sort | uniq -c
Best Practices
Test Selection
- Start Small - Replay individual tests first to verify setup
- Failed Tests First - Focus on previously failed tests for debugging
- Critical Path - Prioritize business-critical functionality tests
- Environment Specific - Select tests relevant to target environment
Authentication Management
- Fresh Tokens - Always use current authentication tokens
- Environment Tokens - Use appropriate tokens for each environment
- Token Refresh - Use
--auth-refresh-scriptfor long-running replays - Security - Never hardcode credentials in scripts
Output Organization
- Timestamped Folders - Use timestamps in output folder names
- Environment Labels - Include environment names in output paths
- Comparison Structure - Organize results for easy comparison
- Cleanup - Regularly clean up old replay results
Exit Codes
| Code | Meaning |
|---|---|
0 | Successful execution — all replayed tests passed |
1 | One or more replayed tests produced errors |
2 | Usage error or internal error (invalid arguments, missing files, internal fault) |
Related Commands
dochia test- Run original tests that generate replay datadochia fuzz- Continuous fuzzing that can also be replayeddochia list- List available paths and playbooksdochia info- System information