Gatling configure base url in configuration file

leo picture leo · Apr 1, 2015 · Viewed 10.7k times · Source

I want to configure the base url of my gatling simulation in the configuration file. So that I can easy switch between test and live system.

I works fine when I configure it in the simulation-scala file with:

val httpConf = http
        .baseURL("http://computer-database.herokuapp.com")

If I remove the line above and configure it in the config (gatling.conf) file with:

gatling {
   http {
     baseUrls = "http://localhost8080/baserate"
     ...

I get the following error and my scenario does not work because the base url is empty.

09:57:26.352 [ERROR] i.g.c.c.GatlingConfiguration$ - Your gatling.conf file is outdated, some properties have been renamed or removed.
Please update (check gatling.conf in Gatling bundle, or gatling-defaults.conf in gatling-core jar).
Enabled obsolete properties:'gatling.http.baseUrls' was removed, use HttpProtocol.

Is it still possible in the current version of gatling to configure the base url outside of the

My version is the gatling-maven-plugin:2.1.2.

Answer

leo picture leo · Apr 1, 2015

I solved this by creating a application.properties file in /test/resources/ with

baseUrl=http://www.example.com

I changed my simulation like this:

import com.typesafe.config._
class BasicSimulation extends Simulation {
   val conf = ConfigFactory.load()
   val baseUrl = conf.getString("baseUrl")
   val httpConf = http.baseURL(baseUrl)