gatling-it:test does not read a custom configuration file specified by "sbt -Dconfig.resource=/loc-gatling.conf gatling-it:test"

The version of Gatling:

  • plugin
  • addSbtPlugin(“io.gatling” % “gatling-sbt” % “2.2.2”)- dependency
  • “io.gatling.highcharts” % “gatling-charts-highcharts” % “2.2.3” % “it,test”
  • “io.gatling” % “gatling-test-framework” % “2.2.3” % “it,test”

The version of Sbt:

  • sbt.version = 1.0.2

Hi,

Our team recently upgraded our SBT version from 0.13.16 to 1.0.2.

The following tests worked with SBT 0.13.16:

  • sbt -Dconfig.resource=/loc-gatling.conf gatling:test (tests under src/test) Success

  • sbt -Dconfig.resource=/loc-gatling.conf gatling-it:test (tests under src/it) Success

  • sbt -Dconfig.resource=/test.conf test (tests under src/test) Success

  • sbt -Dconfig.resource=/test.conf test it:test` (tests under src/it) Success

However, all gatling-it tests failed with SBT 1.0.2:

  • sbt -Dconfig.resource=/loc-gatling.conf gatling:test (tests under src/test) Success

  • sbt -Dconfig.resource=/loc-gatling.conf gatling-it:test (tests under src/it) Failed!

  • sbt -Dconfig.resource=/test.conf test (tests under src/test) Success

  • sbt -Dconfig.resource=/test.conf it:test (tests under src/it) Success
    sbt -Dconfig.resource=/loc-gatling.conf gatling-it:test (tests under src/it) failed because my Simulation class cannot find the custom configuration file specified by passing -Dconfig.resource=/loc-gatling.conf.

I was able to do this in SBT 0.13.16.
I’m also able to specify a custom configuration file in normal integration test in SBT 1.0.2, as I mentioned in the above example: sbt -Dconfig.resource=/test.conf it:test

Here’s my Simulation class:

class HealthcheckSimulation extends Simulation {

  val config = ConfigFactory.load()
  val base_url: String = config.getString("server.baseUrl")
  val warm_up_url: String = config.getString("gatling.http.warmUpUrl")

  val blogHttpConf = http
    .baseURL(base_url)
    .acceptHeader("text/html")
    .userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116")
    .acceptLanguageHeader("en-US,en;q=0.8,pt;q=0.6")
    .warmUp(warm_up_url)

  val scenario1 = scenario("Healthcheck GET request")
    .exec(
      http("GET healthcheck request")
        .get("/healthcheck")
        .check(status.is(_ => 200))
    )
    .pause(1)

  // inject 100 users over 10 seconds
  setUp(
    scenario1.inject(rampUsers(100) over 10)
  ).protocols(blogHttpConf)

}

We still want to be able to specify a custom configuration file when launching gatling-it:test and gatling:test.
Has anyone any idea?

Thank you.

Cheers,
Kewei

Hi there,

I’ll be frank: we haven’t investigated sbt 1.0 yet. The sbt 1.0 support was a contribution, and we haven’t upgraded our own build yet as sbt-dependency-graph, which is an important piece of our toolbox, doesn’t support it yet. So you’re on your own on this one for now.

Then, as things works as expected with sbt 0.13 and not with 1.0, I’m very tempted to say it’s a sbt issue, so I’d advice reporting an issue there.

Regards,

Hi, Stéphane,

Thank you for letting me know that the Gatling team hasn’t investigated sbt 1.0 yet.
I’ll report an issue to sbt. If that doesn’t work, we’ll continue with sbt 0.13 for now.

Cheers,
Kewei