1

I have the next code:

* def deleteCallResult = call read('classpath:somepath@deleteCall') { id: #(id) }
Then match deleteCallResult.responseStatus == 204

* def getCallResult = call read('classpath:somepath@getCall') { id: #(id) }
Then match getCallResult.responseStatus == 404
Then match getCallResult.response.title == "Not Found"

And would like to put it in afterScenario snippet (without moving it into a separate feature file):

* configure afterScenario =
"""
function(){ ... }
"""

Does Karate syntax allow to do it? Did not find examples

Darkstar13
  • 11
  • 1

1 Answers1

0

You may be able to do this if you use the JavaScript match syntax explained here: https://stackoverflow.com/a/50350442/143475

And you can try to call a @ignore Scenario in the same feature. The line below is JS. There is an improvement to this that will be in the next version.

karate.call('same.feature', { some: 'arg' });

But consider what you are asking as not supported. Note that trying to write "clever" tests like this typically lands you in trouble. It is recommended that you keep your main test flows simple.

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