Skip to content

Loop over payload with count? #3639

@flah00

Description

@flah00

I would like each VU to submit a payload multiple times. It would be very nice if I could define a single payload and configure each VU to submit that payload count times.

I have a single json payload. The payload has been converted to a CSV and added to config.payload in artillery.yaml.

I tried to use scenarios.flow.loop, scenarios.flow.over, and scenarios.flow.count. However it seems like count is ignored in this context.

When I define config.phases I am able to create multiple VUs and each of those users will POST the json payload once and exit.

Version info:

2.0.26

Running this command:

artillery run -e local -o report.json artillery.yaml

I expected to see this happen:

I expected a report with 2 requests, eg

$ jq -r '.aggregate.summaries."http.total".count' < report.json
2

Instead, this happened:

Artillery made a single request

$ jq -r '.aggregate.summaries."http.total".count' < report.json
1

Files being used:

payload.csv

"{""key"":""value""}"

artillery.yaml

config:
  http:
    extendedMetrics: true
  environments:
    ci:
      target: https://some.host.tld
    local:
      target: 'http://localhost:8080'
  payload:
    - path: payload.csv
      name: json_bodies
      loadAll: true
      fields:
        - json_body
  plugins:
    expect:
      reportFailuresAsErrors: true
    publish-metrics:
      - type: datadog
        appKey: '{{ $env.DATADOG_APP_KEY }}'
        apiKey: '{{ $env.DATADOG_API_KEY }}'
        tags: []
        event:
          title: "Plugin integration test"
          priority: normal
scenarios:
  - name: post decision
    flow:
      - count: 2
        over: json_bodies
        loop:
          - post:
              url: '/'
              headers:
                Content-Type: application/json
              body: '{{ $loopElement.json_body }}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions