CLI Usage¶
TestAgent provides a powerful command-line interface for testing.
graph LR
subgraph "CLI Commands"
A[testagent] --> B[main]
A --> C[accuracy]
A --> D[criteria]
A --> E[run]
A --> F[collect]
A --> G[cache-clear]
A --> H[cache-stats]
A --> I[version]
end
classDef cmd fill:#6366F1,stroke:#7C90A0,color:#fff
class A,B,C,D,E,F,G,H,I cmd
Commands¶
Main Command¶
Test any output with AI:
Options:
| Option | Short | Description |
|---|---|---|
--criteria |
-c |
Criteria to evaluate against |
--expected |
-e |
Expected output for accuracy |
--threshold |
-t |
Score threshold (default: 7.0) |
--model |
-m |
LLM model to use |
--verbose |
-v |
Verbose output |
--json |
Output as JSON |
accuracy¶
Test output accuracy:
criteria¶
Test against custom criteria:
run¶
Run AI tests with pytest-like options:
# Run all tests
testagent run tests/
# Show slowest tests
testagent run tests/ --durations=5
# Stop on first failure
testagent run tests/ -x
# Verbose output
testagent run tests/ -v
Options:
| Option | Short | Description |
|---|---|---|
--pattern |
-p |
File pattern (e.g., 'test_*.py') |
--durations |
Show N slowest tests | |
--durations-min |
Minimum duration to show | |
--exitfirst |
-x |
Exit on first failure |
--verbose |
-v |
Verbose output |
collect¶
Discover tests without running:
cache-clear¶
Clear the test cache:
cache-stats¶
Show cache statistics:
version¶
Show version:
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | All tests passed |
| 1 | Some tests failed |
| 2 | Error occurred |
| 5 | No tests collected |