artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
8.04k stars 511 forks source link

multiple targets #303

Closed monzerhijazi closed 3 years ago

monzerhijazi commented 7 years ago

I have a scenario where I'm load testing 3 connected web applications (with one that provides a logged in session cookie) Is there any way to have one test file that can have multiple targets? I tried setting the URL on each request and not providing a target at all and that didn't work.

What I was thinking of doing:

config: phases:

scenarios:

benlipp commented 7 years ago

Also need this functionality

hassy commented 7 years ago

You should be able to set target to one of the targets and then use full URLs in actual request specs.

Cristy94 commented 7 years ago

What about WebSocket? How can I have multiple targets (eg: connect to one auth server, after auth responds with login info connect to the actual content server while using the ws engine?

rtorrero commented 7 years ago

There is a dirty workaround for this: target: "http:/" .... scenarios:

It's not ideal but it should work

xuan9230 commented 5 years ago

Do we still need this workaround in 2019?

itsmepetrov commented 5 years ago

Faced with the same issue, workaround works, but it would be really good to see official solution for that

mrmachine commented 5 years ago

I also need this for an app with multiple websocket servers.

brunettia commented 5 years ago

Can you use HTTP and WS in the same file ?

cshen4 commented 4 years ago

I have the same problem where my web application needs to connect to both http requests and a websocket. Is there a way to configure both https and wss requests in the same file?

msarzijr commented 4 years ago

I also would like to execute one test for WS and HTTP in the same configuration file and the environment config too.

placetobejohan commented 3 years ago

You should be able to set target to one of the targets and then use full URLs in actual request specs.

This works as advertised : the target is used by default but is overridden if you specify a different target in the url.

paul-uz commented 3 years ago

I'm trying to use 2 different URLs in my scenarios, but I'm seeing odd things in the console. I have a phase set with duration 10, arrivalRate 100, but artillery runs past 10 seconds.

I tried the method mentioned here https://github.com/artilleryio/artillery/issues/303#issuecomment-329448547 but it does not work.

fabasoad commented 3 years ago

I'm trying to use 2 different URLs in my scenarios, but I'm seeing odd things in the console. I have a phase set with duration 10, arrivalRate 100, but artillery runs past 10 seconds.

I tried the method mentioned here #303 (comment) but it does not work.

Just tested locally - works for me. Be sure that you define https:/ (one slash!) in target, and url is starting from second slash (/host.com/endpoint). When I tried at first I did a mistake by defining https:// (with 2 slashes) in target and I had "Invalid URL" error message. If this is not your case, please share the config that you are using and the output.

paul-uz commented 3 years ago

I did exactly as you mentioned, based on the comment I linked. Uses https:/ as the target, and it did not work.

fabasoad commented 3 years ago

@paul-uz I think we can move from "guesses" mode to "investigation" mode in case you share the config that you are using and the output that you've got. Also, there shouldn't be a big hopes that it should work as this is a hacky workaround and not the official supported feature.

hassy commented 3 years ago

@fabasoad thank you for jumping in to help out! :) @paul-uz would you mind creating a new Discussion please, as what you're seeing is unlikely to be a bug in Artillery.

I am going to close this issue. Multiple URLs as described in the original comment have always been supported. Here's an example of a working script:

config:
  target: https://artillery.io
  phases:
    - arrivalCount: 1
      duration: 1
scenarios:
  - flow:
      - get:
          url: "/"
      - get:
          url: "https://github.com/"
      - get:
          url: "http://neverssl.com/"

A few folks asked about mixing multiple engines in the same scenario (e.g. HTTP + WS). It's not supported right now (unless you write custom JS code), but it's something we're planning to add in Artillery v2. New issue to track: https://github.com/artilleryio/artillery/issues/1005

paul-uz commented 3 years ago

@hassy is there a way to have the different stats for each URL displayed in the reports?

Effectively, the report treats both URLs as being one the same target host, and does not differentiate between them in the report, meaning the report is useless if you define different URLs, say one for a staging server, and one for production.

hassy commented 3 years ago

@paul-uz yep, with https://github.com/artilleryio/artillery-plugin-metrics-by-endpoint