[LRUG] VCR caches

Samuel Joseph tansaku at gmail.com
Tue Sep 18 02:17:10 PDT 2018


Hi Mark,

That's a great blog post - thanks for sharing :-)

The rule of thumb that we've been following is to make our acceptance 
tests (using Cucumber/Capybara/RSpec) as "realistic" as possible, so 
they use VCR as much as possible, and webmock in places where we need 
extra confirmation about network connections (just reviewing I think 
we're mainly recording interactions with 3rd party services such as 
stripe, pivotaltracker, codeclimate and github).

Our unit tests are all well stubbed, and then the integration tests have 
a mix of gem stubbing and webmock.  You might well be right, and perhaps 
we need to give up on purist "realism" in our acceptance tests and use 
more gem/library stubbing ...

What's unclear is how much the more "realistic" acceptance tests have 
ever bought us (nothing? a little? a lot?), compared to the trouble it 
creates for new developers trying to manage the VCR caches ...

Many thanks again

Best, Sam


On 11/09/2018 11:05, Mark Burns wrote:
> Generally I think people tend to test HTTP services at the wrong 
> abstraction. So it might be why it’s a pain point for you. Your non 
> http related test code ends up having to know about http (via VCR or 
> web mock or whatever).
>
> It might be easier for you to wrap your services in a gem or library 
> and inside that library thoroughly test the HTTP interactions.
>
> Then outside of the library avoid the leaky http abstraction.
>
> I’ve seen and done it myself so I wrote a post about it a few years 
> ago. It’s probably a bit dated now.
>
> http://blog.polyglotsoftware.co.uk/2014/02/07/a-pattern-for-stubbing-out-apis-with-rspec.html
>
> (Apologies in advance if you are not making this same mistake)
> On Tue, 11 Sep 2018 at 10:44, Samuel Joseph <tansaku at gmail.com 
> <mailto:tansaku at gmail.com>> wrote:
>
>     Hi Lrugers,
>
>     Any thoughts on how to manage VCR caches effectively in a team
>     context?
>
>     https://github.com/vcr/vcr
>
>     We have a few open source projects using VCR, and we have the
>     recordings
>     of the network communication checked into git so that all
>     developers can
>     run tests in a consistent network environment.
>
>     I have two concerns
>
>     1) new developers onboarding often get snarled up in the caching
>     and the
>     files generated
>     2) the cached recordings are gradually getting further and further
>     out
>     of date - could we automate their refreshing?
>
>     I have reached out to the VCR community in the past, but haven't had
>     much feedback:
>
>     * https://github.com/vcr/vcr/issues/672
>     * https://github.com/vcr/vcr/issues/719
>     * https://groups.google.com/forum/#!topic/vcr-ruby/8DoA7MUq-38
>     <https://groups.google.com/forum/#%21topic/vcr-ruby/8DoA7MUq-38>
>
>     I wondered if anyone else was using VCR and how they were making
>     it work
>     well for them with their team.  Perhaps people are not using it and
>     doing something else?
>
>     Many thanks in advance
>
>     Best, Sam
>
>     _______________________________________________
>     Chat mailing list
>     Chat at lists.lrug.org <mailto:Chat at lists.lrug.org>
>     Archives: http://lists.lrug.org/pipermail/chat-lrug.org
>     Manage your subscription:
>     http://lists.lrug.org/options.cgi/chat-lrug.org
>     List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20180918/508729f4/attachment.html>


More information about the Chat mailing list