Prerequisites
- Test results in CSV format with required columns
- Anthropic API key (direct or via AWS Bedrock)
- Merit Analyzer installed (
pip install git+https://github.com/appMerit/merit.git)
Step 1: Prepare Test Results
Create or export a CSV file with your test results:results.csv
case_input- Test inputreference_value- Expected outputoutput_for_assertions- Actual outputpassed- Boolean (true/false)error_message- Error description (can be empty for passing tests)
Step 2: Configure API Keys
Set up your Anthropic credentials:.env file:
.env
Step 3: Run the Analyzer
Basic usage:- Read your CSV file
- Cluster similar errors
- Analyze problematic code
- Generate
merit_report.html
Custom Output Location
Specify a custom report path:Override Provider Settings
Override environment variables via CLI:Step 4: View the Report
Open the generated HTML report:Complete Example
Integration with Merit Tests (TODO)
TODO: Document direct export from Merit test runner Expected workflow:Large Datasets
For large CSV files with many failures:- Analyzer processes failures only (ignores passing tests)
- Clustering is optimized for performance
- LLM calls are batched when possible
CI/CD Integration
Run analyzer in CI/CD pipelines:.github/workflows/analyze.yml
Troubleshooting
Missing Columns Error
case_inputreference_valueoutput_for_assertionspassederror_message
API Key Not Found
Empty Error Messages
The analyzer can generate error messages if they’re missing:error_message is empty for a failed test, the analyzer will use an LLM to generate a descriptive error message.
Cost Considerations
Merit Analyzer makes Anthropic API calls:- Clustering: ~$0.10-0.50 per 100 failures
- Code analysis: ~$0.05-0.20 per cluster
- Total: Typically < $5 for most test suites
- Number of failures
- Model used
- Provider (Direct Anthropic vs AWS Bedrock pricing)