How can I run a Node-js script in Artillery.i.o without including it in Load test scenario

放肆的年华 提交于 2019-12-06 05:03:31

If you need to login before every single request:

  1. In the config section of the YAML file, add a processor line with your custom JS specified. Note, your JS is expected to be a standard Node.js module:
"config": {
  "processor": "AutoLogin.js"
}
  1. In the post action of your flow, add a line for the beforeRequest hook:
"post": {
  "url": "/addContact",
  "beforeRequest": "functionFromAutoLogin", 
  "contactInfo": {
    "Name": "Davion",
    "Mobile": "9289543654",
    "Email": "Davion@gmail.com"
  }
}

From: https://artillery.io/docs/http-reference/#advanced-writing-custom-logic-in-javascript

See also https://artillery.io/docs/script-reference/#payload-files for using a CSV for the test data.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!