multiple scenarios with multiple protocols

Hi there,
at first congratulation for publishing RC2 and gatling.io, they are really great.

Now my question. In the documentation, all simulations have the form setup(scenario.inject(…)).protocols().

However, the system we want to test, accesses different REST-Apis with different URLs in parallel. Is there a way to model this behavior with Gatling, i.e. to “bind” a protocol to a scenario ?

Thanks in advance

Ulrich

Hi, this works:
http://gatling.io/docs/2.0.0-RC2/http/http_protocol.html#bootstrapping

but looking at the next section we may need to update the example:
http://gatling.io/docs/2.0.0-RC2/http/http_protocol.html#base-url

setUp(scn.protocolConfig(httpConf)…)

16:01:36.436 [ERROR] i.g.a.ZincCompiler$ - x.scala:96: value protocolConfig is not a member of io.gatling.core.structure.PopulatedScenarioBuilder

16:01:36.438 [ERROR] i.g.a.ZincCompiler$ - scn.inject(i) .protocolConfig(httpConf)

16:01:36.438 [ERROR] i.g.a.ZincCompiler$ - ^

16:01:36.460 [ERROR] i.g.a.ZincCompiler$ - one error found

Indeed.
Just fixed it, thanks for reporting Alex !

Cheers,

Pierre

Hanks Alex,
but how can i get rid of the compilation error?

Replace protocolConfig by protocols and it’ll compile (and works ;-))

Cheers,

Pierre

Nope

GATLING_HOME is set to /Users/ukriegel/tmp/gatling-charts-highcharts-2.0.0-RC2
17:29:31.899 [WARN ] i.g.c.c.GatlingConfiguration$ - Beware, property gatling.http.ahc.allowPoolingConnection is still defined but it was removed
17:29:37.682 [ERROR] i.g.a.ZincCompiler$ - /Users/ukriegel/tmp/gatling-charts-highcharts-2.0.0-RC2/user-files/simulations/katwarn/gabriel/KatwarnStartSimulation.scala:13: value protocols is not a member of io.gatling.core.structure.ScenarioBuilder
17:29:37.686 [ERROR] i.g.a.ZincCompiler$ - setUp(GetDeviceScenario.scn.protocols(profileApi).inject(constantUsersPersecond) during (duration seconds))
17:29:37.687 [ERROR] i.g.a.ZincCompiler$ - ^
17:29:39.432 [ERROR] i.g.a.ZincCompiler$ - one error found
Compilation failed

I use Gatling-RC2, GetDeviceScenario is a Singleton defined

Hi Pierre, unfortunately it does not compile.
Here comes a schematic of my code

package katwarn.gabriel

import io.gatling.core.Predef._

import io.gatling.http.Predef._

import scala.concurrent.duration._

class TestSimulation extends Simulation {

val userPerSecond : Int = 1

val duration : Int = 1

val url = http.baseURL("…")

val scn = scenario(“test”)

.feed(ssv("…").circular)

.exec(

http("…")

.get("/foo")

.headers(HeaderMapHelper.createHeaderMap(“HEAD”, null, “${foo}”, “${baz}”, “${bar}”))

.signatureCalculator(ProfileHmacSignatureCalculator)

.check(status.saveAs(“status”), status.in(Seq(200,404))))

setUp(scn.protocols(url).inject(constantUsersPersecond) during (duration seconds))

}

I still get “value protocols is not a member of io.gatling.core.structure.ScenarioBuilder”

Sorry, I forgot to mention that the call to protocols has to be after you configured your injection profile.

setUp(GetDeviceScenario.scn.inject(constantUsersPersecond).protocols(profileApi) during (duration seconds)) // compiles

For the record, that’s because protocols is defined on PopulatedScenarioBuilder, which is the what you get after you called inject(…) : https://github.com/gatling/gatling/blob/master/gatling-core/src/main/scala/io/gatling/core/structure/ScenarioBuilder.scala

Cheers,

Pierre

Hi Pierre,
imho you made a typo - for me the following compiles

setup(GetDeviceScenario.scn.inject(constantUsersPerSec(userPerSecond) during (duration seconds)).protocols(profileApi))

Woops, my bad.
Indeed, in the middle of your injection profile definition, this wouldn’t work well…

Glad you got it working though :slight_smile: