Prerequisites
Before running tests, ensure you have:- Metlo CLI installed
- Test files written in YAML format
- Metlo backend configured (if using cloud features)
Basic Usage
Run a Single Test
Execute a specific test file:Run Multiple Tests
Run multiple test files at once:Run Tests from a Directory
Run all tests in a directory:Command Options
Verbose Output
Get detailed information about test execution:- Full request and response details
- Context variables at each step
- Complete error stack traces
Environment Variables
Provide environment variables from a file:.env file:
Filter by Endpoint
Run tests for specific endpoints (when using Metlo backend):Test Output
Successful Test
When all assertions pass:Failed Test
When assertions fail:Failed Request
When a request fails:Understanding Test Results
Test Execution
Each test step is executed sequentially. The test runner:
- Makes the HTTP request
- Extracts variables from the response
- Runs all assertions
Assertion Validation
For each assertion, the test runner:
- Evaluates the assertion condition
- Records pass/fail status
- Continues to next assertion or step
Running Auto-Generated Tests
Generate Tests
Generate a test from a template:BOLA- Broken Object Level AuthorizationBROKEN_AUTHENTICATION- Authentication bypass testingBOLA_ADMIN- Admin-specific BOLA testingBOLA_MULTI_TENANT- Multi-tenant BOLA testingSQLI_TIME- Time-based SQL injectionHSTS- HTTP Strict Transport Security validationCSP- Content Security Policy validationGENERIC- Generic security test
Run Auto-Generated Auth Tests
Automatically generate and run authentication tests:- Fetches endpoints from the Metlo backend
- Generates authentication tests for each endpoint
- Runs all tests
- Reports results
Working with Test Estimates
For tests with many steps or payload permutations, Metlo estimates the number of requests:Exit Codes
The CLI returns standard exit codes:0- All tests passed1- One or more tests failed
Debugging Failed Tests
Check the assertion type
Check the assertion type
Ensure you’re using the correct assertion type:
Verify response structure
Verify response structure
Use verbose mode to see the actual response:Check that your assertion keys match the response structure:
Check environment variables
Check environment variables
Ensure all required variables are defined:
Verify request format
Verify request format
Check that headers and data are formatted correctly:
Test connectivity
Test connectivity
Verify the API is reachable:
Advanced Usage
Custom Test Templates
Run tests generated from custom templates:Fuzzing
Run fuzz testing on endpoints:Global Environment Variables
When connected to Metlo backend, tests automatically have access to global environment variables defined in the Metlo UI. These are available under theglobal namespace:
Performance Considerations
Request Limits
Tests with more than 300 estimated requests will prompt for confirmation. Consider:
- Breaking large tests into smaller, focused tests
- Using
stopOnFailure: trueto halt on first failure - Running subsets of tests in parallel in CI/CD
Next Steps
CI/CD Integration
Integrate tests into your deployment pipeline
Custom Templates
Create custom test templates for your needs