2
votes

I'm trying to feed URLs into a Gatling simulation from a CSV file and I'm getting the following error:

11:48:01.967 [ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-1' failed to execute: No attribute named 'Url' is defined

My data file looks like this:

Url
/foo
/bar

And my simulation is as follows:

val httpProtocol = http
    .baseURL("https://example.com")

val csvFeeder = csv("urls.csv").random

val scn = scenario("Simulation")
          .feed(csvFeeder)
          .exec(http("request_0")
            .get("${Url}")
          )

setUp(scn.inject(
    atOnceUsers(1),
    rampUsers(3) over(5 seconds),
    constantUsersPerSec(3) during(600 seconds) randomized
)).protocols(httpProtocol)

If I debug the simulation (I'm using IntelliJ FYI) I can see csvFeeder has 2 records, each record is a Tuple2 and if I dig in to that I can see that _1 = "Url" and _2 = "/foo" so the feeder is loading the data.

Why am I getting the error No attribute named 'Url' is defined ?

I'm using Gatling version 2.1.7.

2

2 Answers

4
votes

It turns out the issue was due to the input CSV file having a UTF-8 BOM. Removing the BOM fixed the issue.

0
votes

You're doing it the right way.

Possible explanations:

  • You're not loading the same file when running Gatling and when debugging from IntelliJ
  • You actually have a typo in your column header