baseURLs - use one URL for the whole scenario/user combination

Hi all,

My application is deployed on several environments and I’d like to test all of them simultaneously.
I’m using baseURLs to setup all URLs and I expect that one virtual user will use the same base URL durinng the whole scenario (just like real users will do)

However I can see that each http request is executed against random base URL from the provided list.

Is it possible to change this behavior and stick virtual user to a single base URL?

Thanks,
Dmitry.

As far as I know, you cannot change this behavior.

However, you can override the baseURL of a request by simply writing another one in the GET or POST (as long as it starts with “http”, the baseURL is replaced, see: http://gatling.io/docs/2.2.1/http/http_protocol.html#core-parameters )

So you need to

  1. define a mechanism to assign the baseURL per virtual user ( for example define a list containing all URLs, then get a URL by list.get( % list.size()) )
  2. save it in the user session ( exec(session => { session.set(key, value}) )
  3. and then return it in your GET or POST ( exec(http(“myRequest”).get(session => { session.get(key) })) ) and possibly append other parameters

I think this should do the trick.

+1 for Alexander’s solution

I think the behavior Dimitry expects would make more sense than the current one, but that’s not something we can change until the next version (non fix).
https://github.com/gatling/gatling/issues/3043