1

I'm using Karate for BDD. Basically, I have a database that I'm querying via a graphql endpoint. Grabbing the data, performing some calculations, and returning the result.

If I were using Cucumber, in my StepDef I'd stage a bunch of data into an in-memory database that I could test my queries against. The data might come via an example in my feature file.

But with Karate there are no stepdefs. So how would I go about this?

Ken White
  • 123,280
  • 14
  • 225
  • 444
Steve
  • 4,457
  • 12
  • 48
  • 89

1 Answers1

1

You just need to use Java interop: https://github.com/karatelabs/karate#calling-java

This is the reason Karate does not have "step defs", because it is far easier to write "glue" code this way, and you can even use JavaScript for logic.

Also refer: https://stackoverflow.com/a/61918214/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248