On Fri, Sep 21, 2012 at 9:49 AM, Ryan Rawson <[email protected]> wrote:

> I've used mockito a few times, and it's great... but it can make your
> tests very brittle.  It can also be hard to successfully use if the
> code is complex.  For example I had a class that took an HBaseAdmin,
> and i mocked out the few calls it used.  Then when I needed to access
> Configuration, things went downhill fast.  I ended up abandoning
> easymock even.
>
>
Interesting... I was recently mocking out some stuff with HBaseAdmin and
didn't have that much trouble (except for HBASE-6495 which is now fixed).


> The issue ultimately stems from not writing your code in a certain way
> with a minimal of easy to mock external interfaces.


Nice sentiment but a non-trivial ask with legacy code :) Part of the
problem here is that EasyMock/Mockito don't hack it when they aren't
designed for testing.


>  When this isn't
> true, then easymock does nothing for you.  It can save your bacon if
> you are trying to unit test something deep though.
>
> The other question I guess is integration testing... there is no
> specific good reason why everything is done in 1 jvm, except 'because
> we can'.


It helps provides isolation between tests so we can be sure of which tests
are actually failing.


> a longer lived 'minicluster' could amortize the cost of
> running one.
>

Looked into the long running minicluster about 8 months ago -  it generally
wouldn't help all that much. A lot of the minicluster tests get into the
internals and muck about with things to test error scenarios. The work it
would take to have a shared minicluster for tests that just need to run on
a cluster. That said, a lot of those kinds of tests are moving to the
hbase-it package so they can run on a minicluster or a real cluster.


>
> -ryan
>
> On Fri, Sep 21, 2012 at 9:06 AM, Rogerio <[email protected]> wrote:
> > lars hofhansl <lhofhansl@...> writes:
> >
> >> > To get the low-level access we could instead use jmockit at the cost
> of
> > dealing with code-weaving.
> >>
> >> As we had discussed, this scares me :).
> >> I do not want to have to debug some test code that was weaved (i.e. has
> no
> > matching source code lying around *anywhere*).
> >>
> >
> > I think you are imagining a problem that does not exist. JMockit users
> can debug
> > Java code just fine...
> >
> >
>

Reply via email to