Wanted to see if anyone had good ideas on testing a webhook service. The service POSTs to urls provided by the user.
Some ideas:
1. Add a new API endpoint to our current api service that is just used for integration testing webhooks that would then write to the db or a file or something that the integration test can then fetch and read.
2. Set up a temp server that I can read responses from ideally without any fs/db side effects. Found stub-http
that might support this use case(?). This would seem to preclude any remote testing (but maybe not).
1 would be simpler to implement but I don't like the idea of changing our app api for an integration test. Would think there are others who have solved this problem.
I always do (2) myself. Standing up a simple jetty instance with pedestal or ring isn’t much code and there’s really no better integration test. Specifically in your case, I’d build a handler that records activity in an atom and assert the things I expected to happen actually happened.
Thanks for the response @donaldball --- confirms what I thought I should do