Skip to content

Djones-qa/k6-load-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

k6-load-testing

Performance test suite built with k6 and JavaScript, covering smoke, load, stress, spike, and soak testing scenarios with a full CI pipeline via GitHub Actions.

CI Language Tool


Overview

This project demonstrates a structured performance testing framework using k6. It covers five core test types to validate system behavior under different load conditions against the JSONPlaceholder REST API, with automated execution via GitHub Actions.


Test Types

Type VUs Duration Purpose
Smoke 1 30s Verify system works under minimal load
Load up to 50 ~2m Validate normal expected traffic
Stress up to 200 ~3m Find the breaking point
Spike up to 500 ~50s Test sudden extreme traffic surges
Soak 20 ~14m Catch degradation over sustained load

Project Structure

k6-load-testing/
├── .github/
│   └── workflows/         # GitHub Actions CI configuration
├── config/
│   └── config.js          # Shared BASE_URL and thresholds
├── tests/
│   ├── smoke/             # Smoke test - 1 VU, 30s
│   ├── load/              # Load test - ramp to 50 VUs
│   ├── stress/            # Stress test - ramp to 200 VUs
│   ├── spike/             # Spike test - burst to 500 VUs
│   └── soak/              # Soak test - sustained 20 VUs for 10m
├── utils/
│   └── helpers.js         # Reusable check functions
└── .gitignore

Prerequisites

  • k6 installed locally
# Windows (via Chocolatey)
choco install k6

# Or download from https://k6.io/docs/getting-started/installation/

Running Tests

# Smoke
k6 run tests/smoke/smoke.test.js

# Load
k6 run tests/load/load.test.js

# Stress
k6 run tests/stress/stress.test.js

# Spike
k6 run tests/spike/spike.test.js

# Soak
k6 run tests/soak/soak.test.js

# Save results to JSON
k6 run tests/load/load.test.js --out json=reports/load-results.json

API Coverage

Endpoint Methods Tested
/posts GET, POST, PUT, PATCH, DELETE
/posts/:id GET
/users GET
/users/:id GET
/comments?postId=1 GET
/albums GET
/photos?albumId=1 GET
/todos/:id GET

Key Features

  • 5 test types — smoke, load, stress, spike, and soak scenarios
  • Full CRUD coverage — GET, POST, PUT, PATCH, DELETE all tested
  • Shared config — centralized thresholds and BASE_URL in config/config.js
  • Reusable helpers — checkStatus, checkBody, checkArray in utils/helpers.js
  • GitHub Actions CI — automated runs on every push
  • Response validation — status codes, body fields, and array lengths all asserted

Author

Darrius Jones — QA Automation Engineer GitHub · LinkedIn

About

k6 performance suite with smoke, load, stress, spike, and soak tests. Full CRUD API coverage with GitHub Actions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors