How can I execute a before Each hook in only SINGLE feature?

Viewed 34

I would like to execute a before each hook (which will be a feature file itself) but only for 1 feature. From the docs I can see that we have karate.callSingle(), but this will be executed only once before all:

You can use karate.callSingle() directly in a *.feature file, but it logically fits better in the global “bootstrap”.

So I have:

  • before everything : karate.callSingle()
  • before every Scenario : use Backgroud (but I want only once per feature not before every scenario)
  • once (or at the start of) every Feature : callonce in the background, but I want this for NOT EVERY feature but only for one feature
1 Answers

Aren't you over-thinking this. If you want something extra only for one feature, just add some more lines of code to it !?

Related