Using feeder to feed baseUrls

I use a very long list of base URLs in order to load test my proxy server.
I would like to use a feeder to feed this list from a text file (CSV file is appropriate for this), however I could not find documentation of how to use the feeder’s variable in baseUrls field.

This is the original code:

val httpProtocol = http
.proxy(Proxy(“localhost”, 443))

and I want to achieve something like:

val feeder = csv(“websites.csv”).random

val httpProtocol = http
.proxy(Proxy(“localhost”, 443))

Is it possible, and if so, what is the right syntax for this?

Maybe you should use a Map
and I’m not sure if you can utilize baseUrl in that case. You’d need to concatenate the url from the map within the method HTTP.

I didn’t do that. It was just a idea.

Per documentation, base URL is selected once:

If that’s the intention -
Assuming you have column ‘url’ in websites.csv, you can try:
def websites = csv(“websites.csv”).random
val httpProtocol =

Thank you all for your quick answers.

I did not manage to make Vu’s example work. I got the following error:

14:03:36.795 [ERROR] i.g.c.ZincCompiler$ - /gatling/simulations/BasicProxySimulation.scala:16:23: no arguments allowed for nullary method apply: ()io.gatling.core.feeder.Feeder[Any] in trait Function0 E .baseUrl(websites(“url”))

output.txt (4.52 KB)

No, it doesn’t work. baseUrl takes a String and baseUrls a sequence of Strings. And only plain old Strings, not Gatling EL.

Stop trying to use feeder + baseUrl, it’s not possible.

Honestly, I don’t understand your use case. The goal of a baseUrl is to not repeat it in each request and only specify the path.
Do you really want to execute requests against path /foo on both google and youtube?!

In your feeder, you most likely have full blown absolute urls (what you’re mentioning so far seriously looks like a web crawler).
Just use those absolute urls directly in your request, baseUrl is an optional thing.

Thanks Stephane,

The DUT is a proxy server, not a website. I don’t care about which website I visit, so I just picked top-50 from Alexa and I want each session to get its homepage. I want to put the proxy server under stress with real-world traffic. I don’t want to put load on some 3rd party website, so I round-robin on a big list.
Instead of having this list in the simulation file as part of the baseUrls field, I would like to feed the website.
I wasn’t aware that baseUrl is optional. I’ll do as you suggested.

Thanks again!

Thank you, Stephane.

Tomer - I myself have an implementation as suggested by Stephane because of its dynamic nature (i.e. base URL can change from requests to requests for every virtual user). Your use-case should work well with a feeder in the scenario that provides URL to individual requests.

Sorry for untested suggestion. In case you want to try the baseURL approach without feeder, here’s a tested suggestion using a data file with a few records:

val websites =
.readRecords.asInstanceOf[Vector[Map[String, String]]]

val httpProtocol =
.baseUrls(websites: _*)

As explained in the doc, baseUrls is intended for emulating client side load balancing.
@Vu, is this what you’re doing?

If you just want to execute a bunch of GET requests from urls defined in a CSV file, you shouldn’t use baseUrl.
You should just use a feeder and then pass the url from the feeder directly to the request’s get method.

Hi Stephane,

I agree to your suggestion/doc for Tomer’s use-case.

No, I don’t rely on baseUrls in our application.
We have server side load balancing, and it’s dynamic with instructions provided in certain responses. Thus, we build out the server targets at the request level.
Just an interesting note for me is that I initialize baseUrls using user inputs in JAVA_OPTS. I can do the same using data file as well.