Alternative to Gatling.fromMap

804 views
Skip to first unread message

Nicolas Capdevila

unread,
Mar 13, 2015, 3:59:34 PM3/13/15
to gat...@googlegroups.com
Hello team,

We used Gatling.fromMap to pass overrides read from our own configuration files.
However, after upgrading to 2.1.4 from (2.0.3), we now have to create our own class under the io.gattling.app package, so that we can instantiate the Gatling class. Is this the recommended pattern?

Thank you for such an enjoyable, productive and solid tool. We started using it in our company (taulia) a few months ago with a lot of success. Kudos to your craftsmanship!

Nico

Stéphane LANDELLE

unread,
Mar 13, 2015, 4:46:35 PM3/13/15
to gat...@googlegroups.com
Hi Nico,

What are you doing exactly, that you mean to instanciate yourself?
The Gatling companion object is still public, only the class isn't. We're trying to trim down our Scaladoc scope.

Thanks for your kind words!

Stéphane Landelle
Lead developer


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicolas Capdevila

unread,
Mar 13, 2015, 5:04:47 PM3/13/15
to gat...@googlegroups.com
Hi Stéphane,

This is what I am referring to:

with 2.0.3
========
package com.taulia

  import io.gatling.app.Gatling //The companion object is public

  object GatlingBootstrap {

  val run = {
    //...
    val simulationClass = Class.forName(gatlingSimulationClass).asInstanceOf[Class[Simulation]]
    logger.debug(s"Calling into Gatling with simulation class: $simulationClass and config variables:\n$configMap")
    Gatling.fromMap(configMap, Option(simulationClass))  //works beautifully for us!!
  }
}

with 2.1.4
========
package io.gatling.app  //No need for import, but the Gatling class is package-private, so our class needs to be in the same package
  
  object GatlingBootstrap {

    val run = {
      //...
      val simulationClass = Class.forName(gatlingSimulationClass).asInstanceOf[Class[Simulation]]
      logger.debug(s"Calling into Gatling with simulation class: $simulationClass and config variables:\n$configMap")
      new Gatling(configMap, Option(simulationClass)).start // fromArgs is of no use to us because we need to pass overrides from our config files
    }
}

Hope this make sense.

Thanks

Nico

You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/b0sZ09ZYhVw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.

Stéphane LANDELLE

unread,
Mar 13, 2015, 5:49:15 PM3/13/15
to gat...@googlegroups.com
fromMap is still there and public: https://github.com/gatling/gatling/blob/2.1.X/gatling-app/src/main/scala/io/gatling/app/Gatling.scala#L46

You probably didn't realize that you can pass the simulation classname with the simulationClass option. And that there's a helper for building those parameters: https://github.com/gatling/gatling/blob/2.1.X/gatling-core/src/main/scala/io/gatling/core/config/GatlingPropertiesBuilder.scala#L50

Stéphane Landelle
Lead developer


Nicolas Capdevila

unread,
Mar 16, 2015, 11:11:23 AM3/16/15
to gat...@googlegroups.com
Hi Stéphane,

Thanks for pointing me in the right direction.

Much appreciated!

Cheers,

Nico
On Mar 13, 2015, at 2:46 PM, Stéphane LANDELLE <slan...@gatling.io> wrote:

You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/b0sZ09ZYhVw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages