Created
May 29, 2021 19:42
-
-
Save leduyminh48/7d65fc1582a53593f8b97663781cd6e5 to your computer and use it in GitHub Desktop.
Sample Artillery load testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config: | |
target: "http://localhost:3000" | |
phases: | |
- duration: 30 | |
arrivalRate: 2 | |
name: Warm up | |
processor: "./processors/users.js" | |
payload: | |
- | |
path: "./payloads/secret.csv" | |
fields: | |
- "STOKEN" | |
ensure: | |
maxErrorRate: 5 | |
scenarios: | |
- name: "Search by assignee and status" | |
flow: | |
- get: | |
url: "/user" | |
qs: | |
filter: "{\"take\": 30}" | |
headers: | |
Authorization: "Bearer {{STOKEN}}" | |
capture: | |
json: "$.entities" | |
as: "users" | |
- get: | |
url: "/status" | |
headers: | |
Authorization: "Bearer {{STOKEN}}" | |
capture: | |
json: "$.entities" | |
as: "statuses" | |
- loop: | |
- function: "getStatusId" | |
- get: | |
url: "/task" | |
qs: | |
filter: "{\"relations\": [\"assignedTo\", \"status\", \"createdBy\"], \"where\": [{\"assignedTo\": {\"id\": \"{{$loopElement.id}}\"}, \"status\": {\"id\": \"{{statusId}}\"}}]}" | |
headers: | |
Authorization: "Bearer {{STOKEN}}" | |
capture: | |
json: "$.count" | |
as: "count" | |
- log: "countTasks: {{count}}" | |
over: users | |
- name: "Adding comments" | |
flow: | |
- get: | |
url: "/task" | |
qs: | |
filter: "{\"take\": 30}" | |
headers: | |
Authorization: "Bearer {{STOKEN}}" | |
capture: | |
json: "$.entities" | |
as: "tasks" | |
- loop: | |
- log: "taskId: {{$loopElement.id}}" | |
- post: | |
url: "/comment" | |
json: | |
comment: "comment for {{$loopElement.id}}" | |
taskId: "{{$loopElement.id}}" | |
headers: | |
Authorization: "Bearer {{STOKEN}}" | |
capture: | |
json: "$.id" | |
as: "commentId" | |
- log: "countTasks: {{count}}" | |
over: tasks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment