setting RuntimeHook on karate from scala/gatling side

All our karate features being executed as integration tests got a RuntimeHook implementation.
Now I see that they are also called from Scala for performance testing and cannot figure out how to set the same RuntimeHook on them.
Is it possible at all? Did I miss something?

Java snippet from an integration test:

   @Karate.Test
   Karate karateFeatureTest() {
        return Karate.run("classpath:karate/somedir/a.feature").hook(new KarateHook());
    }

Scala snippet:

  val myVar: ScenarioBuilder = scenario("Test scenario")
    .exec(karateFeature("classpath:karate/somedir/a.feature"))

While the Karate class has a ‘hook’ method, karateFeature scala method doesn’t have a parameter for a hook.

>Solution :

It should be possible, here is the relevant documentation: https://github.com/karatelabs/karate/tree/master/karate-gatling#runner

Leave a Reply