Integrating JMeter API Client with CI/CD Pipelines
This guide explains how to integrate the LoadFocus JMeter API Client with popular CI/CD platforms like CircleCI, Azure DevOps, and GitHub Actions for automated performance testing as part of your deployment pipeline.
Table of Contents
- General Approach
- CircleCI Integration
- Azure DevOps Integration
- GitHub Actions Integration)
- GitLab CI/CD Integration
- Jenkins Integration
- Best Practices
- Troubleshooting
General Approach
Regardless of the CI/CD platform, there are common steps to integrate the LoadFocus JMeter API Client:
- Install the client: Install
@loadfocus/loadfocus-api-client
at the start of your workflow - Configure credentials: Set up your API key and team ID securely
- Execute tests: Run the tests as part of your pipeline
- Process results: Collect and analyze test results
- Make decisions: Based on test results, determine whether to proceed with deployment
Best Practices
When integrating LoadFocus JMeter API Client with your CI/CD pipeline, consider these best practices:
Security
- Never hardcode your API key or team ID in your pipeline configuration
- Use your CI/CD platform's secrets management system
- Restrict access to your performance test results to authorized personnel
Performance Test Configuration
- Use descriptive test names that include the branch/environment being tested
- Set appropriate thresholds based on your application's performance requirements
- Consider running different test profiles for different environments (e.g., lighter tests for dev, full tests for staging)
Pipeline Integration
- Run performance tests after functional tests have passed
- Consider running performance tests in parallel with other non-blocking tasks
- Set up notifications for performance test failures
Results Analysis
- Store performance test results as artifacts for historical comparison
- Consider implementing trend analysis to detect performance degradation over time
- Document baseline performance metrics for comparison
Troubleshooting
Common Issues
Test Execution Fails
- Verify your API key and team ID are correctly configured
- Check if you have reached your account's concurrent test limit
- Verify the test name exists in your LoadFocus account
Thresholds Not Working as Expected
- Ensure threshold syntax is correct (e.g.,
avgresponse<=200,errors==0
) - Check if the metrics you're evaluating are relevant to your test
- Verify that the test is generating enough load to produce meaningful results
Pipeline Times Out
- Adjust the timeout settings in your CI/CD configuration
- Consider using the
--waitTimeout
parameter to limit test execution time - For long-running tests, implement a polling mechanism instead of waiting in the pipeline
For platform-specific integration details, see the dedicated guides for CircleCI, Azure DevOps, GitHub Actions, Jenkins, and GitLab CI/CD.