How to terminate all tests in Karate DSL if sign in failed?

Viewed 24

So, basically I'm running API tests where the user needs to be logged in. Currently user passwords expire after 60 days.

I would like to try sign in as the user, and if that fails, terminate all other tests. Currently the tests keep running and all of them fail.

The idea is saving time by not having to wait for all tests to fail.

Is there a way to do this in Karate?

I found this How to configure karate to stop execution when any scenario fails? But it's a bit older and I'm not sure if it's still true.

Thanks

1 Answers

Yes this is not directly supported in Karate today. I've just opened a feature request so you can watch it: https://github.com/karatelabs/karate/issues/2090

For the time being you could try running a health-check before your test-suite starts, store the credentials if needed and then proceed.

Related