Performance Testing with Apache JMeterΒΆ
A comprehensive performance testing suite for the Simple CRUD Apps - Full-Stack Product Management System API using Apache JMeter. This project includes automated CI/CD pipelines, custom test runners, and detailed performance reporting.
π― OverviewΒΆ
This repository contains JMeter test plans and automation scripts for load testing and performance monitoring of the Product Management API. The tests simulate real-world CRUD operations and provide detailed metrics on application performance under various load conditions.
π Project StructureΒΆ
performance-test/
βββ .github/
β βββ workflows/
β βββ jmeter-ci.yml # CI pipeline configuration
β βββ jmeter-report-deployment.yml # Report deployment workflow
βββ jmeter-test-plan/
β βββ simple-crud.jmx # Main JMeter test plan
βββ reports/
β βββ HTML/ # Generated HTML reports
β βββ report.jtl # Test results data
β βββ jmeter.log # JMeter execution logs
βββ jmeter-runner.bat # Simple test runner script
βββ jmeter-custom-runner.bat # Interactive test runner
βββ .gitignore
βββ LICENSE
βββ README.md
π FeaturesΒΆ
- Automated CRUD Testing: Complete Create, Read, Update, Delete operation tests
- Parameterized Test Execution: Flexible configuration for threads, ramp-up time, duration, and loops
- CI/CD Integration: GitHub Actions workflows for automated testing
- HTML Reporting: Beautiful, interactive performance reports
- Custom Test Runners: Windows batch scripts for easy local execution
- GitHub Pages Deployment: Automated report publishing
- Performance Test Repository: JMeter Automation
- Performance Test Live Report: Performance Test
π Test ConfigurationΒΆ
Default Test ParametersΒΆ
The test plan supports the following configurable parameters:
| Parameter | Default | Description |
|---|---|---|
threads |
3 | Number of concurrent users |
rampup |
1 | Ramp-up period in seconds |
loop |
1 | Number of iterations per thread (-1 for infinite) |
duration |
60 | Test duration in seconds |
startup_delay |
5 | Delay before starting tests |
Test ScenariosΒΆ
- Create Product: POST request with product details
- Read Product: GET request to retrieve created product
- Update Product: PUT request to modify product data
- Delete Product: DELETE request to remove product
π οΈ Local SetupΒΆ
PrerequisitesΒΆ
- Apache JMeter 5.5 or higher
- Java JDK 17 or higher
- Windows OS (for batch scripts) or modify scripts for your OS
InstallationΒΆ
-
Clone the Repository
-
Install Apache JMeter
- Download JMeter from the official website
- Extract to your preferred location
- Add JMeter's
bindirectory to your system PATH
-
Verify Installation
πββοΈ Running TestsΒΆ
Option 1: Simple Test RunnerΒΆ
Use the basic runner for quick tests with default parameters:
This executes the test with default settings and generates HTML reports in the reports/HTML directory.
Option 2: Custom Test RunnerΒΆ
Use the interactive custom runner for parameterized testing:
The script will prompt you for: - Number of threads (users) - Ramp-up period (seconds) - Loop count (0 for infinite) - Duration (seconds, 0 to ignore) - Startup delay (seconds)
Option 3: Command LineΒΆ
Run tests directly with JMeter CLI:
jmeter -n -t jmeter-test-plan/simple-crud.jmx \
-l reports/report.jtl \
-e -o reports/HTML \
-j reports/jmeter.log \
-Jthreads=5 -Jrampup=10 -Jloop=5 -Jduration=60 -Jstartup_delay=5
π CI/CD IntegrationΒΆ
GitHub Actions WorkflowsΒΆ
1. JMeter CI PipelineΒΆ
File: .github/workflows/jmeter-ci.yml
Triggers:
- Push to master branch
- Daily at 02:00 AM UTC+7 (19:00 UTC)
Features: - Automated test execution with predefined parameters - Artifact upload (JTL reports and logs) - 3-day artifact retention
Configuration:
2. Report Deployment PipelineΒΆ
File: .github/workflows/jmeter-report-deployment.yml
Triggers:
- Push to master branch
Features: - Automated HTML report generation - GitHub Pages deployment - Public accessibility of test results
Live Reports: The latest test reports are automatically deployed to GitHub Pages.
π Understanding ReportsΒΆ
Key MetricsΒΆ
The HTML reports include comprehensive performance metrics:
- Response Time: Average, median, 90th, 95th, 99th percentiles
- Throughput: Requests per second
- Error Rate: Percentage of failed requests
- Network Traffic: Sent and received bytes
- APDEX Score: Application Performance Index
Report SectionsΒΆ
- Dashboard: Overview of test execution and key statistics
- Statistics: Detailed metrics for each request type
- Over Time Charts: Response time and throughput trends
- Throughput: Requests and data transfer rates
- Response Times: Distribution and percentile analysis
- Errors: Error counts and types
π§ Test Plan ConfigurationΒΆ
User Defined VariablesΒΆ
BASE_URL: simple-crud-apps.vercel.app
PRODUCT_NAME: Pecak Bandeng
PRODUCT_PRICE: 48000
PRODUCT_QTY: 4
UPD_NAME: Bandeng Presto
UPD_PRICE: 45000
UPD_QTY: 5
Thread Group SettingsΒΆ
The thread group is configured with property placeholders for dynamic configuration:
Threads: ${__P(threads,3)}
Ramp-up: ${__P(rampup,1)}
Duration: ${__P(duration,60)}
Startup Delay: ${__P(startup_delay,5)}
Loop Count: ${__P(loop,1)}
π― Performance BenchmarksΒΆ
Recommended Load ProfilesΒΆ
Light Load Testing:
Medium Load Testing:
Heavy Load Testing:
Stress Testing:
π TroubleshootingΒΆ
Common IssuesΒΆ
Issue: JMeter not found
# Solution: Add JMeter to PATH or update batch script with full path
set JMETER_PATH=C:\path\to\apache-jmeter-5.5\bin\jmeter.bat
Issue: No JTL file generated
Issue: Empty HTML report
Issue: Connection timeouts
π Best PracticesΒΆ
Load Testing GuidelinesΒΆ
- Start Small: Begin with light load and gradually increase
- Monitor Resources: Watch server CPU, memory, and network usage
- Baseline Testing: Establish performance baselines before optimization
- Incremental Testing: Test after each optimization
- Real-world Scenarios: Simulate actual user behavior patterns
Test Execution TipsΒΆ
- Run tests during off-peak hours for production environments
- Use consistent test data for reproducible results
- Document test configurations and results
- Archive historical reports for trend analysis
- Validate API responses in test assertions
π Related ResourcesΒΆ
- Target API: Simple CRUD Apps
- API Repository: GitHub - simple-crud-apps
- API Testing Suite: Newman Automation
- JMeter Documentation: Apache JMeter User Manual
π€ ContributingΒΆ
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
π LicenseΒΆ
This project is licensed under the MIT License.
π AcknowledgmentsΒΆ
- Apache JMeter team for the excellent testing tool
- Simple CRUD Apps project for providing the API to test
- GitHub Actions for CI/CD automation
Happy Performance Testing! π