Skip to main content

locustfile.py

locustfile.py - Overview

  1. Overview This file defines a Locust script for load testing. It simulates user behavior by sending HTTP GET requests to the /dispatch endpoint with different customer IDs and nonse values.

  2. Detailed Documentation

Class: UserTasks

  • Purpose: Defines the tasks that a simulated user will perform.
  • Parameters: None
  • Returns: None

Attributes:

  • wait_time: Specifies the wait time between tasks for each user.

    • Type: function
    • Description: Defines a wait time between 5 and 15 seconds.
    • Parameters: None
    • Returns: None

Method: rachel

  • Purpose: Simulates a user accessing the /dispatch endpoint with specific customer and nonse parameters.
  • Parameters: None
  • Returns: None

Method: trom

  • Purpose: Simulates a user accessing the /dispatch endpoint with specific customer and nonse parameters.
  • Parameters: None
  • Returns: None

Method: japanese

  • Purpose: Simulates a user accessing the /dispatch endpoint with specific customer and nonse parameters.
  • Parameters: None
  • Returns: None

Method: coffee

  • Purpose: Simulates a user accessing the /dispatch endpoint with specific customer and nonse parameters.
  • Parameters: None
  • Returns: None

Class: HttpUser

  • Purpose: It is a base class in Locust, and UserTasks inherits from it to simulate HTTP user behavior.

Function: task

  • Purpose: It is a decorator in Locust to mark a function as a task that a simulated user will execute.

Function: between

  • Purpose: Defines a wait time between tasks for each user.

Code Examples

None

Include in Getting Started: NO