SmartTest CLI - Execute test scenarios with secure credential handling
Project description
SmartTest CLI
Enterprise-ready CLI for executing test scenarios with secure, zero-credential-exposure architecture.
Features
๐ Zero Credential Exposure: Auth tokens never leave your network โก Concurrent Execution: Run up to 5 scenarios simultaneously ๐ฏ Continue-on-Error: Individual failures don't stop execution ๐ Real-time Progress: Live progress updates with rich terminal output ๐ CI Integration: JUnit XML reports for CI/CD pipelines ๐ Network Aware: Proxy and custom CA support for enterprise networks
Installation
Install the CLI from PyPI:
pip install smarttest-cli
Get Your PAT Token
- Visit the SmartTest platform: https://ai-smart-test.vercel.app/
- Sign up or log in to your account
- Navigate to Settings โ API Tokens
- Click Generate PAT Token
- Copy your Personal Access Token (PAT)
What is a PAT Token? A Personal Access Token (PAT) authenticates the CLI with the SmartTest backend. It allows the CLI to fetch test scenarios and submit results securely. This token is separate from any credentials needed to test your APIs.
Quick Start
1. Set Your PAT Token
export SMARTTEST_TOKEN=your_pat_token_here
2. Run Test Scenarios
# Run a specific scenario
python smarttest.py run --scenario-id 123
# Run all scenarios for an endpoint
python smarttest.py run --endpoint-id 456
# Run all scenarios for a system
python smarttest.py run --system-id 789
# With JUnit XML report for CI
python smarttest.py run --system-id 789 --report junit.xml
Configuration
Optional Configuration File
Create .smarttest.yml in your project root for advanced configuration:
# API Configuration
api_url: "https://api.smarttest.com"
# Execution Settings
concurrency: 5
timeout: 30
# Enterprise Network Settings
proxy:
http_proxy: "http://proxy.company.com:8080"
https_proxy: "https://proxy.company.com:8080"
tls:
ca_bundle_path: "/path/to/ca-bundle.pem"
verify_ssl: true
Configuration Options:
api_url: SmartTest API endpoint (default: https://api.smarttest.com)concurrency: Number of scenarios to run in parallel (default: 5)timeout: Request timeout in seconds (default: 30)proxy: HTTP/HTTPS proxy settings for corporate networkstls: Custom CA bundle and SSL verification options
Authentication
SmartTest Authentication (Required)
The CLI requires a Personal Access Token (PAT) to authenticate with SmartTest:
export SMARTTEST_TOKEN=your_pat_token_here
How to get your PAT token:
- Visit https://ai-smart-test.vercel.app/
- Go to Settings โ API Tokens
- Generate a new PAT token
- Copy and save it securely
Zero-Credential Exposure (Advanced)
When testing APIs that require authentication, SmartTest uses a zero-credential-exposure model to keep your API credentials secure.
How It Works
- SmartTest backend sends auth config references (metadata only, no actual credentials)
- CLI resolves credentials locally from your environment variables
- Credentials never leave your network or reach SmartTest servers
- Requests are made directly from your environment to the target API
Setting Up Target API Credentials
Only needed if you're testing APIs that require authentication:
# Bearer Token Authentication
export AUTH_CONFIG_123_TOKEN=your_api_bearer_token
# Basic Authentication
export AUTH_CONFIG_456_USERNAME=api_username
export AUTH_CONFIG_456_PASSWORD=api_password
# API Key Authentication
export AUTH_CONFIG_789_API_KEY=your_api_key
Pattern: AUTH_CONFIG_{ID}_{CREDENTIAL_TYPE}
{ID}: Auth configuration ID from SmartTest dashboard{CREDENTIAL_TYPE}: TOKEN, USERNAME, PASSWORD, or API_KEY
Example Scenario:
- You're testing your company's API at
https://api.company.com - The API requires a bearer token for authentication
- SmartTest knows the API needs auth (config ID: 123)
- You set:
export AUTH_CONFIG_123_TOKEN=company_bearer_token_xyz - CLI resolves the token locally and includes it in requests
- SmartTest never sees
company_bearer_token_xyz
CI/CD Integration
GitHub Actions
- name: Run SmartTest
env:
SMARTTEST_TOKEN: ${{ secrets.SMARTTEST_TOKEN }}
API_TOKEN: ${{ secrets.API_TOKEN }}
run: |
python smarttest.py run --system-id 123 --report junit.xml
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install SmartTest CLI
run: pip install smarttest-cli
- name: Run API Tests
env:
# PAT token for SmartTest authentication
SMARTTEST_TOKEN: ${{ secrets.SMARTTEST_TOKEN }}
run: |
smarttest --system-id 123 --report junit.xml
- name: Publish Test Results
uses: dorny/test-reporter@v1
if: always()
with:
name: SmartTest Results
path: junit.xml
reporter: java-junit
Jenkins
Basic Pipeline:
pipeline {
agent any
environment {
// PAT token for SmartTest authentication
SMARTTEST_TOKEN = credentials('smarttest-token')
API_TOKEN = credentials('api-token')
}
stages {
stage('Test') {
steps {
sh 'python smarttest.py run --system-id 123 --report junit.xml'
}
post {
always {
junit 'junit.xml'
}
}
}
}
}
Example Output
$ python smarttest.py run --system-id 123
๐ Found 25 scenarios (3 skipped - no validations)
โก Executing scenarios... โ
18 passed, โ 3 failed, โ ๏ธ 1 errors [โโโโโโโโโโโโโโโโโโโโโโโโ] 22/22 โข 0:00:15
Results:
โ
18 passed
โ 3 failed (validation errors)
โ ๏ธ 1 error (network timeout)
Failed scenarios:
- user_login_invalid: Expected status 401, got 200
- payment_process: Response missing required field 'transaction_id'
Error scenarios:
- webhook_callback: Connection timeout after 30s
Summary: 18/22 scenarios passed (81.8% success rate)
Execution time: 15.2s
Error Handling
The CLI provides comprehensive error classification:
- โ Success: HTTP request succeeded, all validations passed
- โ Failed: HTTP request succeeded, but validations failed
- โ ๏ธ Network Timeout: Request timed out
- โ ๏ธ Network Error: Connection failed
- โ ๏ธ Auth Error: Authentication resolution failed
- โ ๏ธ Unknown Error: Unexpected error occurred
Architecture
โโ Scenario Discovery (API with rate limiting)
โโ Skip scenarios without validations
โโ Concurrent Execution (max 5)
โ โโ Fetch definition (auth config references only)
โ โโ Resolve auth locally (zero credential exposure)
โ โโ Execute HTTP request (with comprehensive error handling)
โ โโ Submit results (continue on any error)
โโ Generate reports and exit
Troubleshooting
Authentication Issues
SmartTest Authentication:
# Verify your PAT token is set
echo $SMARTTEST_TOKEN
# Test connection to SmartTest
curl -H "Authorization: Bearer $SMARTTEST_TOKEN" https://api.smarttest.com/health
Target API Authentication:
# Verify target API credentials are set
echo $AUTH_CONFIG_123_TOKEN
# Check which auth configs your scenarios use in the SmartTest dashboard
Network Issues
# Test with custom config
python smarttest.py run --scenario-id 123 --config .smarttest.yml
# Enable request debugging
SMARTTEST_DEBUG=1 python smarttest.py run --scenario-id 123
Rate Limiting
The CLI automatically handles rate limiting with exponential backoff. If you encounter persistent rate limiting:
- Reduce concurrency in
.smarttest.yml - Contact support to increase rate limits
- Spread execution across longer time periods
Support
- ๐ Platform: https://ai-smart-test.vercel.app/
- ๐ Documentation: https://ai-smart-test.vercel.app/docs
- ๐ฌ Support: ai.smart.test.contact@gmail.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smarttest_cli-0.1.3.tar.gz.
File metadata
- Download URL: smarttest_cli-0.1.3.tar.gz
- Upload date:
- Size: 85.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4a80db01abd0400387d09e20b8c41aa379af5e6b062d01e74c99fbffadb5eff
|
|
| MD5 |
3bf18787011b6c4cef14c8b80be56c7c
|
|
| BLAKE2b-256 |
8d5cf61550d83aceeaa1785032ad04d8f34a1fc085bb1efc17857c30cc7491c8
|
File details
Details for the file smarttest_cli-0.1.3-py3-none-any.whl.
File metadata
- Download URL: smarttest_cli-0.1.3-py3-none-any.whl
- Upload date:
- Size: 26.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f4f0105d452c7a84adce3b1343b4ab92e572753bc78cb2da6373de1f73ce27f
|
|
| MD5 |
98914d37b957e498e445388bf4fc5005
|
|
| BLAKE2b-256 |
16e41e6578eb74f3d779323d730637d702b8a7e818ae9e3e2dab023a80c2e3cf
|