Skip to content

Repository files navigation

k6 Performance Testing

This project is focused on learning and practicing performance testing with k6.


Performance Testing Workflow

My general performance-testing workflow is:

1. Understand Requirements
        ↓
2. Identify Critical User Scenarios
        ↓
3. Define Performance Goals / SLAs
        ↓
4. Select Test Type
        ↓
5. Create k6 Test Script
        ↓
6. Configure Load Profile
        ↓
7. Organize Requests Using Groups
        ↓
8. Add Tags
        ↓
9. Define Thresholds
        ↓
10. Execute Test
        ↓
11. Monitor Application & Infrastructure
        ↓
12. Analyze Metrics
        ↓
13. Identify Bottlenecks
        ↓
14. Report Results

Project Structure

k6-performance-testing/
│
├── Building HTTP requests for APIs/
│   ├── http-get.js
│   ├── http-post.js
│   ├── http-put.js
│   └── login.js
│
├── K6 Fundamentals/
│   ├── first-script.js
│   ├── smoke-test.js
│   ├── load-test.js
│   ├── group-test.js
│   ├── custome-metrics.js
│   └── test-tags.js
│
├── k6 Scenarios/
|   ├── scenario-eg1.js
|   ├── gracefulStop-test.js
|   ├── production-workload.js
│
├── k6 Cloud/
│
├── Using parameters in k6 scripts/
|   ├── external-json.js
|   ├── external-csv.js
│   └── users.json
│
└── README.md

What I Learned

Through this project, I have gained practical experience with k6 and performance testing, including:

  • Creating and structuring k6 performance test scripts
  • Building HTTP GET, POST, and PUT requests
  • Working with JSON request bodies and payloads
  • Configuring HTTP request headers
  • Implementing API authentication
  • Working with Bearer tokens
  • Extracting data from API responses
  • Sending authenticated API requests
  • Configuring Virtual Users (VUs) and test duration
  • Running Smoke and Load tests
  • Understanding different types of performance testing
  • Working with k6 built-in metrics
  • Creating and using custom metrics
  • Understanding Trend, Counter, Gauge, and Rate metrics
  • Analyzing Average, Median, P90, P95, and P99
  • Defining performance requirements using thresholds
  • Organizing requests and business flows using groups
  • Measuring complete business-flow performance using group_duration
  • Categorizing and filtering metrics using tags
  • Using tags with thresholds
  • Understanding the difference between individual request performance and complete business-flow performance
  • Building a structured and reusable performance-testing workflow

Next Steps

I plan to continue extending this project by learning and implementing:

  • Advanced k6 CLI usage
  • Parameterizing k6 scripts
  • Environment-based configuration
  • Advanced authentication flows
  • Data-driven performance testing
  • More complex API business flows
  • Advanced k6 scenarios and executors
  • CI/CD integration
  • GitHub Actions integration
  • Jenkins integration
  • k6 Cloud
  • Distributed load testing
  • Performance regression testing
  • Advanced performance reporting and result analysis

Goal

The goal of this project is to build a strong practical understanding of performance testing with k6.

I am gradually progressing from writing basic HTTP requests to:

HTTP Requests
      ↓
API Authentication
      ↓
Test Scripts
      ↓
Performance Test Types
      ↓
Metrics & Analysis
      ↓
Groups & Tags
      ↓
Thresholds
      ↓
Advanced Scenarios
      ↓
CI/CD Integration
      ↓
Cloud & Distributed Load Testing

Ultimately, I aim to build realistic, maintainable, and reusable performance tests and integrate them into CI/CD pipelines and cloud-based performance-testing environments.

About

build a strong practical understanding of performance testing with k6.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages