scenarios

You can define a test scenario using a set of requests defined in requests. Multiple scenarios can be defined.

scenarios:
  {scenario-name}:
    num-users: {num-users}
    period: {period}
    loop: {loop}
    requests:
      setup:
        # randomly
        {request-name}: {num-requests}
        ...
        # or sequentially
        - {request-name}
        - ...
      main:
        # randomly
        {request-name}: {num-requests}
        ...
        # or sequentially
        - {request-name}
        - ...
  ...

{scenario-name}

The name of a scenario. It may contain alphanumeric characters, underscore _ and hyphen-minus -. The first character cannot be hyphen-minus -. The length can be up to 64 characters.

num-users (required)

The number of virtual users who send requests.

period (required)

The length of time in seconds that the scenario runs for.

Keys Limitations Required
entry 0 < entry <= overall optional. defaults to overall period.
overall overall <= 259200 (= 3 days) required.
  • With simple form

    period: 50
    

    equivalent to

    period:
      overall: 50
      # entry: 50 // `entry` defaults to `overall`
    

    In this case, the number of virtual users grow incrementally during the overall period.

  • With entry period specified

    With entry period, you can explicitly set the period during which the number of virtual users grow incrementally up to the specified num-users.

    num-users: 20
    period:
      overall: 50
      entry: 10
    

    In this case, the number of virtual users grow incrementally from 0 to 20 users in 10 seconds.

loop

When set to true, virtual users repeat the scenario for the overall period. Otherwise, each virtual user exits after finishing the scenario. The default value is false.

requests (required)

Requests to be sent in the scenario.

requests has two parts. The first part setup is executed only once immediately after each virtual user is created. For example, you can write the log-in process of a virtual user in setup. The second part main is executed after setup and can be repeated if you set loop to true.

If you do not use setup, you can write your request description directly under requests. The following descriptions are equivalent:

requests:
  - request1
  - request2
requests:
  main:
    - request1
    - request2

requests supports both random request order and sequential request order.

  • Randomly ordered requests

    If you specify the pairs of request names and integers as below, virtual users send requests for the specified number of times in random order.

    requests:
      request1: 10
      request2: 20
    
  • Sequentially ordered requests

    By specifying request names in array format, requests are sent in the array order.

    requests:
      - request1
      - request2
    

wait

wait parameter can be used to specify the number of seconds to wait between requests. wait parameter can be defined immediately under both {scenario-name} and requests.

  • Under {scenario-name}

    scenarios:
      {scenario-name}:
        ...
        wait: 5 # wait for 5 seconds between each request
        requests:
          request1: 80
          request2: 40
    

    The wait value is applied to all requests of {scenario-name}.

  • Under requests

    scenarios:
      {scenario-name}:
        ...
        requests:
          - request1
          - wait: 5 # wait for 5 seconds between request1 and request2
          - request2
          - request3
    

    The time to wait after a specific request can be specified by adding wait parameter after the request. This overrides the wait parameter defined immediately under {scenario-name}.

The value of wait parameters can be either a single number or an array of two numbers. When a single number is specified, it waits for the specified number of seconds after the request. When an array of two numbers is specified, it waits for a random number of seconds in the range between the two numbers.

# waits for 5 seconds
wait: 5

# waits for 3.5 to 5.5 seconds
wait: [3.5, 5.5]

# waits for 3.5 to 5.5 seconds
wait:
  - 3.5
  - 5.5

If wait is not specified, wait: [0.5, 5.5] is applied for each request.

results matching ""

    No results matching ""