Reputation: 147
I'm looking for best practices or the recommended approach to test async code execution with Karate.
Our use cases are all pretty similar but a basic one is:
How can I check with Karate that after processing has finished other endpoints return the correct result?
Concrete real life example:
/api/export
Generally I have two ideas on how to approach this:
retry until
on the endpoint that returns the list of exportsIs either of those approach recommended or should I choose an entirely different solution?
Upvotes: 1
Views: 573
Reputation: 58088
The moment queuing comes into the picture, I would not recommend retry until
. It would work if you are in a hurry, but if you are ok to write a little bit of Java code, please read on. Note that this Java "glue code" needs to be written only once, and then the team responsible for writing the functional flows will be up and running.
I personally would prefer option (2) just because when a test fails, you will have a lot more diagnostic information and traces to look at.
Pretty sure you won't have a problem using AWS Java libs to do things such as polling SQS.
I think this example will answer all your questions: https://twitter.com/getkarate/status/1417023536082812935
Upvotes: 1