-
Notifications
You must be signed in to change notification settings - Fork 0
5. Data files
Joaquim Rocha edited this page Jun 1, 2020
·
4 revisions
Data files are CSV files with data that can be replaced on the request template, to generate dynamic requests.
The first line should contain the name of the columns. Because we will use them on GO templates, they shouldn't contain spaces, the best option is to use snake case (in practice consists on writing compound words or phrases in where the elements are separated with one underscore character "_" and no spaces).
Example: CSV file
APP_ID,APP_NAME,APP_URL,X_KEY
101,Facebook,www.facebook.com,bc001be8-a454-11ea-bb37-0242ac130002
102,GOOGLE,google.pt,bc001fbc-a454-11ea-bb37-0242ac130002
103,Twitter,twitter.com,bc0022a0-a454-11ea-bb37-0242ac130002
Each request will access to only one line of the file (if, the preceding file was going to be used to generate 3000 requests to a server, each line will be used 1000 times).
The columns can be used on the following elements of a request using the format {{ .Data.<column name> }}
:
- endpoint
- header value
- request body
Example: Template file
method: PUT
endpoint: "http://127.0.0.1:8080/apps/{{ .Data.APP_ID }}"
headers:
User-Agent: Beast/1
Content-Type: application/json
X-App-Name: {{ .Data.X_KEY }}
request-body: >
{
"app-id": {{ .Data.APP_ID }},
"name": "{{ .Data.APP_NAME }}",
"uri": "{{ .Data.APP_URL }}"
}