Ghada
Ghada

Reputation: 67

Is there an equivalent in Karate DSL to the "Finally" block in java?

I am working with Karate for a couple of months now. I have noticed that if a test fails , the post-request functions (The functions that are executed after the request has been sent) will not be executed and it can make the other tests in that feature file fail. So is there an equivalent in Karate to the "Finally" block in Java ? Thanks in advance.

Upvotes: 1

Views: 826

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

Yes, you are looking for the afterScenario hook. Note that to detect if there is an error, the errorMessage will not be null: https://github.com/intuit/karate#hooks

Upvotes: 1

Related Questions