Auto testing of webhook requests in Ruby on Rails
Hi, sorry if I should be asking this on Rails forums instead, but just wondering if someone already has prior experience with writing test cases to test CG web hooks.
I'm having trouble writing automated tests for actions initiated by the CG web hook. I have thought of about recording down the requests and then post them locally from a serialized file. Does anyone know any other methods of dealing with testing web hooks?
Discussions are closed to public comments.
If you need help with Cheddar please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Marc Guyer on 09 Nov, 2012 09:01 PM
Hi -- This really isn't a rails related question I think. The answer depends on your development environment. The key to webhooks is that they are like an API but they work in the other direction. In other words, the hook sender (CheddarGetter) must be able to access your development environment over the public internet. So, your dev environment needs to be accessible. If your dev environment runs on a local machine inside a private network, you've got issues.
You might check out PostCatcher for basic post testing. Also, maybe look at Localtunnel if you want to expose a port from your local machine on the public web.
2 Posted by h1624938 on 12 Nov, 2012 03:34 AM
Yes you're right, I've done exactly that - I have recorded the posts and now I'm manually simulating it in my own environment, eliminating the need to wait for an actual webhook call from CG. This seems to work well so far, thanks.
Support Staff 3 Posted by Marc Guyer on 12 Nov, 2012 01:29 PM
Very cool - mocking the process is certainly an effective way to automate tests efficiently.
Marc Guyer closed this discussion on 12 Nov, 2012 01:29 PM.