I am creating a .yml load scripting file for artillery tool and I am using the payload section which extracts the information from CSV files which is the data to log in to the system. But the problem is it doesn't take the provided information from csv.
I have used 'beforeRequest: "setJSONBody" ' and 'afterResponse: "logHeaders"' to track the information before request and after request , but request header is not showing the username and password taken from the csv.
Please refer below code which I have used to login to the system using credentials which are stored in the CSV file
=============================================================
config:
payload:
# path is relative to the location of the test script
path: "login_file.csv"
field:
- "username"
- "password"
target: '<<website name>>'
plugins:
expect: {}
phases:
- duration: 1
arrivalRate: 1
scenarios:
- name : open url and login
flow:
- get:
url: "/login"
- post:
url: "/login"
json:
username: "{{username}}"
password: "{{password}}"
beforeRequest: "setJSONBody"
afterResponse: "logHeaders"
expect:
- statusCode: 200
- contentType: json
==============================================================
I am expecting the output which shows me the credentials taken and 100 % scenarios run.