Testing a custom protocol with Gatling 2.1.4 / No Gatling-core test-jar available in Maven central

Hello,

I am trying to write a custom protocol for Gatling and for integration testing purposes I inspired myself to the HttpIntegrationSpec in Gatling. It seems that such a spec uses io.gatling.core.test.ActorSupport , which access private [gatling] methods of the gatling Configuration:


def apply(f: TestKit with ImplicitSender => Any): Unit = synchronized {
  var oldGatlingConfiguration: GatlingConfiguration = null
  try {
    oldGatlingConfiguration = GatlingConfiguration.configuration
    GatlingConfiguration.set(GatlingConfiguration.setUpForTest())
    f(new TestKit(GatlingActorSystem.start()) with ImplicitSender)

  } finally {
    GatlingConfiguration.set(oldGatlingConfiguration)
    logger.info("Shutting down GatlingActorSystem")
    GatlingActorSystem.shutdown()
  }
}

Unfortunately the test-jar of gatling-core is not deployed on Maven central, what's the suggested approach to write integration specifications?

Regards

Edmondo

You won’t be able to write proper integration specs with Gatling 2.1.
You’d have to mutate the configuration singleton placeholder, which is of course not thread-safe.

That’s the reason why we got rid of our mutable singletons in 2.2.

Testing got a whole lot easier with Gatling 2.2, to the point the kind of workaround done in ActorSupport are longer needed :

AkkaSpec being the base class used for tests involving Akka Actors.

Since there was a lot of refactoring done in Gatling 2.2, which also impacts the customs protocols, I can only highly suggest that you use Gatling 2.2 snapshots instead of Gatling 2.1.

Cheers,

Pierre

Hello,

I have been trying to use AkkaSpec in a custom protocol test, but I’m not able to get AkkaSpec in any of the dependencies published on maven.

Since this Class is under src/test could you publish the test-jar for gatling-core?

We don’t seem to have one published at the moment under: https://repo1.maven.org/maven2/io/gatling/gatling-core/2.2.2/

Cheers,
Konstantinos

Contribs welcome

Hi Stephane,

I’m happy to help here, given that AkkaSpec also depends on BaseSpec that lives in gatling-commons, I would need to expose those project as well as test-jar.

Do you think we should rather move those classes under gatling-test-framework instead ?

Thanks,
Konstantinos

Actually, I’d rather keep those internal.
Moving them into deployed jars would send a message that they are public APIs (and you would use them this way), meaning that we can’t break them easily.
I think it’s best that you fork them. It’s not like they do much anyway.

No worries then, I will probably copy them over onto our custom protocol.

Cheers,
Konstantinos

Being curious. What’s your custom protocol about?

Hi Stephane,

The protocol is about Kafka integration, I know there is an older attempt already, but it is quite limited on what we are trying to achieve, e.g ideally we would want a request-reply paradigm similar to JMS protocol so that we can correlate throughput, response times, etc.

  • We need to use Kafka 0.10.x, whereas the old one is still on 0.8.x

Cheers,
K

Open source it. There might be other people who could be interested in helping.

Absolutely! Once we have something worth sharing I would definitely share with the community.

Great!