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