Search code examples
javascripttestingartillery

Artillery - testing an API a several times


I'm trying to use Artillery to test one of my API and resolving a potential bug. Here is my code :

  "config": {
    "target": "http://websocket.target",
    "phases": [
      {"duration": 3, "arrivalRate": 4}
    ]
  },
  "scenarios": [
    {
      "name": "target",
      "engine": "socketio",
      "flow": [
        {
          "emit": {
            "namespace": "/test/basket",
            "channel": "add",
            "data": {
              "foodId":91789,
              "restaurantId":3,
            }
          }
        },
        {
         "think":0
        }
      ]
    }
  ]
}

I've decided to simulate this situation:

4 users add food to the basket for 3 seconds (without delay). But the most crucial stuff for me is their concurrency. Does Artillery have a specific flag or attribute for this feature?


Solution

  • Artillery does not provide a way to set a fixed concurrency level. The desired concurrency level can be achieved by having virtual users maintain the connection to the server for some period of time with think like in your test script.