Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
How to repeat gherkin snippet in Karate?

I have a snippet of Gherkin that builds a JSON body and makes an API call.

I can reuse this snippet in other Karate features via:

* call read("/path/to/snippet.feature")

I have a scenario where I need to repeat this API call, so I want to run this snippet N times.

karate.repeat() exists; however, despite the name, it does not work with Karate gherkin files, or even def'ed Karate functions based on a feature file. Apparently, it only works with JS functions.

How do I repeat a call read() of another feature file an arbitrary number of times without having to explicitly repeat the line that many times? This could get unwieldy in a scenario where the number of calls needed for the scenario is more than a small few.

It seems the only solution is to re-implement that feature as a JS function, so that now I have both a Gherkin and a JS definition of the exact same functionality, which is a pattern that is begging for maintenance nightmares.

How can I call a Karate feature file multiple times in another Karate feature?

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!