0

Is it possible to configure afterScenario hook globally?

I can configure per .feature file like this:

  Background:
    * url baseMhsServiceUrl
    * configure afterScenario =
      """
      function(){
        var uri = karate.prevRequest.url;
        karate.log('Request was: ' + uri);
      }
      """

But, I tried this in the karate.config.js and it is not working at all.

karate.configure('afterScenario', "function(){var uri = karate.prevRequest.url;\nkarate.log('Request was: ' + uri);}");

Could not find such an example in the docs.

djangofan
  • 28,471
  • 61
  • 196
  • 289

1 Answers1

1

No, do consider contributing code.

But you have the option of writing a RuntimeHook: https://github.com/intuit/karate/wiki/1.0-upgrade-guide#hooks

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248