We had to have make external API calls and we used vcr to record and replay in our integration tests. All was going on well.
Despite this coverage, we saw our code breaking in production due to small chages in request xml body. We wanted our integration spec to cover these too. By default, vcr matches request method and url. We wanted it to match the post body too. Simple match by body does not solve as it does plain string match. It would give false negatives.
So, we decided to match our xml request body. This is what we did.
Let’s take a very simple use case of integrating with a http endpoint which has an authentication mechanism.
You can clearly see if have many routes like this, there will be a lot of duplication.
Scala with Camel is a very powerful combination for integration. Camel has fantastic support for testing. It’s very easy and useful to test-drive the integration. Following are few styles when it comes to testing camel with scala.
Migrated from: My old post
Today people visit temple for so many reasons. Fundamentally, those reasons come out of fear or greed depending on the situation. During recession people ask god to save job (out of fear) or otherwise, they ask for promotion or better job (out of greed).
Problem: Given a and b,
find the sum of range of numbers between a and b.
E.g. Given 1 and 4, the result is 10 (1+2+3+4). Simple.
Let’s do this with programmers’ favorite, Iteration
We run our app on heroku and kept on getting R14s. Our google and stackoverflow skills did provide
few suggestions and but din’t help much. We used few tools (rack_bug, oink) see the memory usage. They provided who use how much
but we could make further progress with that. So here’s what we did to find out.
Days back I have come across a common requirement to disable link on clicking it once. Typically, it’s because on click of those links some AJAX thins happen and some fragments of the page gets updated.
If you try to express your logic in if-else way like this,
then polymorphic way would be,