We would like to setup automated jobs (via Jenkins
) to alert if the third party API is down or they deployed an incompatible APIs.
I am talking about to test against the real HTTP APIs
and not a mock, but as we already have mock written using rspec
, I am not sure if we should duplicate the effort by writing two independent testes.
Anyone have this experience in this before?
(I am not limited to Ruby/Rspec
if other tools can help)
Have you had a look at VCR? Using it, you can "record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests". I've used it with RSpec when testing expected responses from external APIs, and think it's great. I'd encourage you to check out the StackOverflow questions tagged with vcr if it's something you think may work for you.
Not sure of its Jenkins integration, but when I was using VCR, I automated some regular tasks where I needed to hit the APIs with Whenever ("Cron jobs in Ruby"). Not really continuous, but somewhat automated.
When I was in this situation a few months ago I did the following:
I did it like this since it was impossible for me to guess/know what content will be provided by the live API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With