Search code examples
karate

How to use Karate to test receive webhook and process webhook


System A API server ( Implemented in Go ) -> POST HTTP CALL to Mock Server B ( implemented in Go )
Mock Server B sends webhook -> System A Webhook Consumer (Implemented in Go)
System A Webhook Consumer processes webhook and updates postgres DB to update user-state lets say from inactive to active.

How should I use Karate to effectively test such an asynchronous flow without the benefit of interoperability with Java. All the services are deployed on GCP cloud for integration testing

Should I implement a waitTime in karate script after making POST HTTP Call to Mock Server B and poll System A GET API to check for updates on the postgres DB such as GET user-state.json to check if state is active?

I could only think of polling mechanism but i am not sure if is good practice with karate


Solution

  • As of now the best reference is this: https://stackoverflow.com/a/68037401/143475

    Since this is a common need, we are releasing dedicated webhook support as part of the async addons (not open-source) in January 2024. If you are interested in beta-testing, let us know.