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
  • 26,842
  • 57
  • 182
  • 275

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
  • 47,282
  • 14
  • 68
  • 196