javarubymockingtddvcr

Java alternative for Ruby's vcr?


Is there a java alternative for Ruby's VCR?

As far as I understand, the benefits of using VCR are immense, you can run an "integration test" and record the results, store them some where locally. Now from the next time when you need to run your tests, you can mockup your actual database hits with the data recorded from the first run.

  1. Is there something similar in java world?
  2. If not, what kind of bottlenecks I might face if I try to implement it?

VCR only records HTTP interactions, but can such an approach be done to record, say any kind of database operations/function calls to other team's APIs which I don't need to test, basically this will relieve me from mocking up so many things by automating it.

Here is an example of VCR with Ruby's unit tests:


Solution

  • Check out betamax. It's a groovy port of VCR. It should work on the JVM with any language, I believe.

    As for using a VCR-like library to record/playback DB interactions: Sven Fuchs tried this approach and didn't see much benefit to it.