Jawad Kalia
Jawad Kalia

Reputation: 296

Running a single feature file before and after a test run

Was looking for a solution to run a feature file at the end of the suite My workflow (In parallel Run)

  1. karate.callSingle('Login.feature') so at the beginning i do one login and then use the cookies/token for the whole suite
  2. Run tests in Parallel
  3. Runs the Logout.feature file

Upvotes: 2

Views: 2162

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

There is no direct support for this currently. By the way no one has ever requested this. If this is so important, kindly open a feature request.

One workaround is to set a singleton / Java static variable from callSingle and then in your JUnit / Java parallel runner, call the feature to logout using the Java API (search the docs for this) and you can pass arguments / access the static variable.

EDIT: just realized that the @AfterClass JUnit annotation may be more than sufficient for your needs.

Upvotes: 1

Related Questions