Socket
Book a DemoInstallSign in
Socket

@increff/load-runner

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@increff/load-runner

A powerful CLI wrapper around k6 for load testing with JSON configuration, variable substitution, custom ramping patterns, and comprehensive logging

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Load Runner for k6 🚀

A powerful CLI wrapper around k6 for load testing with JSON configuration, variable substitution, custom ramping patterns, and comprehensive logging.

✨ Features

  • 🎯 JSON-Based Configuration: Define your API tests in simple JSON files
  • 📈 Custom Ramping Patterns: Create complex load testing scenarios with custom VU ramping
  • 🔄 Variable Substitution: Dynamic values with built-in and custom variables
  • 📊 Comprehensive Logging: Request/response logging, CSV output, and detailed metrics
  • ⚡ Parallel Execution: Run multiple test scenarios simultaneously
  • 🎭 Multiple Test Stages: Predefined stages (smoke, load, stress, spike) or custom ones
  • 🔧 Easy CLI: Simple commands with interactive options

🚀 Quick Start

Installation

npm install -g load-runner-k6

Prerequisites

Make sure you have k6 installed on your system.

Basic Usage

# Run with JSON configuration
load-runner config test-config.json

# Run with custom ramping pattern
load-runner ramp test-config.json custom-ramp.json

# Run multiple scenarios in parallel
load-runner scenarios ./test-scenarios

# Get help
load-runner --help

📋 Commands

CommandDescription
config <file>Run k6 using JSON configuration file
ramp <config> <ramp-config>Run with custom ramping pattern
scenarios <folder>Run multiple JSON files in parallel
stagesList available test stages
create-configCreate sample configuration file
create-rampCreate sample custom ramping configuration
interactiveInteractive configuration mode

🎨 Custom Ramping Patterns

Create sophisticated load testing patterns with custom ramping configurations:

{
  "name": "Spike Testing Pattern",
  "stages": [
    { "duration": "1m", "target": 10 },
    { "duration": "30s", "target": 100 },
    { "duration": "1m", "target": 100 },
    { "duration": "30s", "target": 10 },
    { "duration": "2m", "target": 0 }
  ]
}

Common Patterns

  • Simple Ramp: Gradual increase/decrease in VUs
  • Spike Testing: Sudden traffic spikes to test system resilience
  • Endurance Testing: Sustained load for stability testing
  • Multi-Phase Testing: Complex scenarios with multiple phases

📝 Configuration Examples

Basic API Test

{
  "url": "https://api.example.com/users",
  "method": "GET",
  "request_headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer ${token}"
  },
  "variables": {
    "token": "your-jwt-token-here"
  },
  "log_failed_responses": true
}

POST Request with Payload

{
  "url": "https://api.example.com/orders",
  "method": "POST",
  "request_headers": {
    "Content-Type": "application/json"
  },
  "payload": {
    "order_id": "${$randomInt}",
    "timestamp": "${$timestamp}",
    "items": ["item1", "item2"]
  },
  "variables": {
    "customer_id": "12345"
  }
}

🔧 Built-in Variables

VariableDescriptionExample
${$timestamp}Unix timestamp1703123456
${$randomString}Random stringabc123def
${$randomInt}Random integer1234567
${$localDateTime}Local datetime2025-08-27 10:30:45.123000
${$isoTimestamp}ISO timestamp2025-08-27T10:30:45.123

📊 Test Stages

Predefined Stages

  • Smoke: Quick validation (1 VU, 1m)
  • Load: Normal expected load (10 VUs, 5m)
  • Stress: System limits testing (50 VUs, 10m)
  • Spike: Sudden traffic spike (100 VUs, 2m)

Custom Stages

Define your own stages in k6-config.json:

{
  "stages": {
    "custom": [
      { "duration": "2m", "target": 10 },
      { "duration": "5m", "target": 10 },
      { "duration": "2m", "target": 0 }
    ]
  }
}

🚀 Advanced Features

Parallel Scenario Execution

Run multiple test scenarios simultaneously:

load-runner scenarios ./test-scenarios --max-parallel 5

CSV Logging

Enable CSV output for detailed analysis:

{
  "log_orders_to_csv": true,
  "log_requests": true,
  "log_failed_responses": true
}

Custom Thresholds

Define performance thresholds:

{
  "thresholds": {
    "http_req_duration": ["p(95)<500"],
    "http_req_failed": ["rate<0.01"]
  }
}

📚 Documentation

🛠️ Development

Prerequisites

  • Node.js >= 16.0.0
  • k6 installed

Setup

git clone https://github.com/increff/load-runner.git
cd load-runner
npm install

Local Development

# Run locally
node bin/load-runner.js --help

# Create sample files
node bin/load-runner.js create-config
node bin/load-runner.js create-ramp

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built on top of k6 - the modern load testing tool
  • Inspired by the need for easier load testing configuration and execution

📞 Support

Made with ❤️ by Increff

Keywords

k6

FAQs

Package last updated on 15 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts