Skip to content
| Marketplace
Sign in
Visual Studio Code>Testing>Locust Single RunnerNew to Visual Studio Code? Get it now.
Locust Single Runner

Locust Single Runner

ciceksepeti

|
2 installs
| (0) | Free
Run individual Locust test methods directly from VSCode with a single click
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Locust Single Runner

A professional VSCode extension that adds "Run Test" buttons to individual Locust test methods, enabling efficient single-scenario testing with a single click.

✨ Features

  • 🎯 Single Click Testing: Execute individual Locust test methods without running the entire test suite
  • 🔍 Smart Detection: Automatically detects Locust files in ci-test/loadtests directories
  • 📊 Real-time Output: View test results directly in VSCode output panel with detailed logging
  • ⚙️ Configurable: Customize Python path and execution timeout
  • 🚀 Performance Optimized: Efficient CodeLens provider with minimal resource usage
  • 🛡️ Error Handling: Comprehensive error handling with user-friendly notifications

🚀 How it Works

The extension adds a "$(play) Run {method_name}" CodeLens above each test method in your Locust files. When clicked, it executes:

python3 <locustfile> run_scenario <method_name>

Example:

python3 locustfile_allrequests.py run_scenario post_orderitems_cancel

📋 Requirements

  • Directory Structure: Locust files must be in a ci-test/loadtests directory
  • File Naming: Files must contain locust in the filename
  • Decorator: Locust classes must use the @enable_single_test_runner decorator
  • Method Naming: Test methods should start with: get_, post_, put_, patch_, or delete_
  • Python: Python 3.x installed and accessible via PATH

🎮 Usage

  1. Open a Locust file in the ci-test/loadtests directory
  2. Look for "$(play) Run {method_name}" buttons above your test methods
  3. Click the button to run that specific test
  4. View results in the "Locust Single Runner" output panel

⚙️ Configuration

Configure the extension via VSCode settings:

{
  "locustSingleRunner.pythonPath": "python3",
  "locustSingleRunner.timeout": 60000,
  "locustSingleRunner.useTerminal": true
}

Available Settings

Setting Type Default Description
locustSingleRunner.pythonPath string python3 Path to Python executable
locustSingleRunner.timeout number 60000 Command timeout in milliseconds (output panel only)
locustSingleRunner.useTerminal boolean true Run commands in VSCode terminal instead of output panel

Example Locust File

import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib', 'cs-locust'))
from cs_locust import BaseSequentialUser, enable_single_test_runner

@enable_single_test_runner
class MyTestUser(BaseSequentialUser):
    
    def post_order_create(self):  # ▶️ Run Test button will appear here
        # Your test code here
        pass
    
    def get_order_status(self):   # ▶️ Run Test button will appear here
        # Your test code here
        pass

Development

To run the extension in development mode:

  1. Clone this repository
  2. Run npm install
  3. Run npm run compile
  4. Press F5 to launch a new Extension Development Host window

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft