Test File Structure
Metlo tests are written in YAML format with the following structure:Basic Components
Test ID
Each test must have a unique identifier:Metadata
Provide context about the test:CRITICAL- High-risk security vulnerabilitiesHIGH- Significant security issuesMEDIUM- Moderate security concernsLOW- Minor security issues
Environment Variables
Define variables to use across test steps:Test Steps
Making Requests
GraphQL Requests
For GraphQL endpoints:Assertions
Assertions verify that the response meets expectations.Equal Assertion
Check if a value equals an expected value:JavaScript Assertions
Use JavaScript expressions for complex assertions:Regular Expression Assertions
Match values against patterns:Assertion Keys
Access different parts of the response:resp.status- HTTP status coderesp.statusText- HTTP status messageresp.data- Response body (parsed JSON)resp.data.field- Specific field in responseresp.headers.header-name- Response header value
Extractors
Extract values from responses to use in subsequent requests:VALUE- Extract a direct value from the responseJS- Use JavaScript to extract a valueREGEXP- Extract using a regular expressionHTML- Extract from HTML responses
Complete Example: Broken Authentication Test
This test verifies that authentication is properly enforced:Test Options
Control test execution behavior:Payloads
Use predefined payloads for testing common vulnerabilities:XSS- Cross-site scripting payloadsSQLI- SQL injection payloadsSQLI_AUTH_BYPASS- SQL auth bypass payloadsSQLI_TIME- Time-based SQL injection payloads
Best Practices
Use descriptive test names
Use descriptive test names
Choose clear, specific names that describe what the test validates:
Test both positive and negative cases
Test both positive and negative cases
Verify that requests work when they should AND fail when they should:
Use environment variables for sensitive data
Use environment variables for sensitive data
Never hardcode credentials or tokens in test files:
Set appropriate severity levels
Set appropriate severity levels
- Use
CRITICALfor authentication/authorization issues - Use
HIGHfor data exposure or injection vulnerabilities - Use
MEDIUMfor security misconfigurations - Use
LOWfor information disclosure
Tag tests appropriately
Tag tests appropriately
Use tags to organize and filter tests:
Next Steps
Running Tests
Learn how to execute your tests using the Metlo CLI
CI/CD Integration
Integrate tests into your deployment pipeline