1

I currently have my afterScenerio for my scenarios configured as such

configure afterScenario = karate.call(helperFolder + 'jama/updateJama.feature', {id: jamaId, failed: karate.scenario.failed}) 

Inside my updateJama.feature, I want to be able to update results based on whether the calling scenario passes or fails. The issue is, "failed" is always true inside updateJama.feature. I'm assuming that this is because karate.scenrio.failed is being evaluated for the called scenario and not the calling scenario. So, what is the correct way to achieve this?

1 Answers1

1

I was able to get it working by using this:

* configure afterScenario =  function(){ karate.call(helperFolder + 'jama/updateJama.feature', {id: jamaId, failed: karate.scenario.failed}); } 
  • 1
    just one comment, in my opinion this is un-necessary over-engineering and complication of tests. just keep them simple. in my opinion `call` should be only used for setup before your main flow. and yes the hooks are designed to work only in the "main" flow, if you want more control, look at the `RuntimeHook`: https://stackoverflow.com/a/65989469/143475 – Peter Thomas Sep 08 '22 at 04:42