Git Product home page Git Product logo

locust-github-action's Introduction

Load Testing with Locust

A GitHub action for load testing using Locust

Sample Workflow

name: Test Locust Load Test

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Run Load Test
        uses: apardo04/locust-github-action@master
        with:
          LOCUSTFILE: "locustfile.py"
          REQUIREMENTS: "requirements.txt"
          URL:  "https://google.com"
          USERS: "5"
          RATE: "5"
          RUNTIME: "10s"

Arguments

  • LOCUSTFILE: The locustfile you want to use to load test. If no file is provided, a simple load test will be done on the landing page of the provided URL.
  • REQUIREMENTS: requirements.txt file you want to use to install 3rd party dependencies. Not required.
  • URL: URL to the site you want to load test. This is Required.
  • USERS: Number of Users to spawn. Not required, defaults to 5.
  • RATE: Specify the hatch rate (number of users to spawn per second). Not required, defaults to 5.
  • RUNTIME: Specify the run time for a test. Not required, defaults to 10 seconds.

Installing 3rd party dependencies for your locustfile

Please see this branch as an example: https://github.com/apardo04/locust-github-action/tree/requirements-test

  1. Make sure your repo has a requirements.txt file.
  2. In your workflows yml file, use the REQUIREMENTS input and pass it the path to the file.
  3. Import the dependencies in your locustfile.py

Using a specific version of locust

  1. Decalare a specific version in your requirements.txt file (See Installing 3rd party dependencies above)
locust==2.5.1

Passing Github Secrets to locustfile

Please see this branch as an example: https://github.com/apardo04/locust-github-action/tree/env-var-test

  1. Create a repository secret in Github.
  2. Assign it to an env variable (ex: 'GITHUB_USERNAME') in the workflows yml file: https://github.com/apardo04/locust-github-action/blob/env-var-test/.github/workflows/test.yml
  3. Reference the env variable in locustfile: https://github.com/apardo04/locust-github-action/blob/env-var-test/locustfile.py

locust-github-action's People

Contributors

apardo04 avatar ishaan-jaff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.