Modern load testing framework using k6 with Infrastructure as Code principles. Manage your performance tests as code, version control them, and integrate with your CI/CD pipelines.
- Node.js 18+
- k6 (can be installed with the commands below)
macOS (Homebrew):
brew install k6
Linux:
sudo gpg -k
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install k6
Windows (Chocolatey):
choco install k6
npm install
Basic functionality check (low load, short duration):
npm run test
Performance testing under normal load:
npm run test:load
Testing system limits and breaking points:
npm run test:stress
Testing sudden load increases:
npm run test:spike
Detailed API endpoint testing:
npm run test:api
npm run test:all
├── tests/
│ ├── smoke-test.js # Smoke testing
│ ├── load-test.js # Load testing
│ ├── stress-test.js # Stress testing
│ ├── spike-test.js # Spike testing
│ └── api-test.js # API testing
├── utils/
│ ├── config.js # Test configurations
│ ├── helpers.js # Helper functions
│ └── data/ # Test data
├── scenarios/
│ ├── user-journey.js # User scenarios
│ └── business-flows.js # Business workflows
└── reports/ # Test reports
Configure test parameters in utils/config.js
:
- Virtual Users (VUs): Number of concurrent users
- Duration: Test duration
- Thresholds: Success criteria
- Base URL: Target system URL
# Save results to InfluxDB
npm run dashboard
For k6 Cloud integration:
k6 login cloud
k6 cloud tests/load-test.js
Pipeline files are added to .github/workflows/
directory.
Jenkins integration available via Jenkinsfile
.
Test results are automatically saved to reports/
directory:
- HTML reports
- JSON metrics
- Graphical representations
To add your own tests:
- Add new JS file to
tests/
directory - Add npm script to
package.json
- Add test scenarios to
scenarios/
directory
- Start with smoke tests before running load tests
- Use realistic test data for accurate results
- Monitor system resources during tests
- Set appropriate thresholds for your SLAs
- Run tests in CI/CD for continuous performance validation
stages: [
{ duration: '2m', target: 10 },
{ duration: '5m', target: 20 },
{ duration: '2m', target: 0 },
]
stages: [
{ duration: '10s', target: 10 },
{ duration: '30s', target: 100 }, // Sudden spike
{ duration: '10s', target: 10 },
]
Feel free to open issues or check the documentation for questions.
Made with ❤️ for Performance Engineering