hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Phelps <...@opendns.com>
Subject Re: Writing unit tests against HBase
Date Mon, 24 Jun 2013 22:00:25 GMT
What I'm currently looking for is a method of adding quick unit tests
(ie preferably run time of a few seconds) to test some algorithms that
read hbase data and perform some operations on it.  Mocking seems a much
better way to handle this, though I'm open to other suggestions.  I'll
try out MiniHBaseCluster anyway since I can't seem to get FakeHBase to work.

- Adam

On 6/24/13 2:39 PM, Dhaval Shah wrote:
> Why don't you spin up a mini cluster for your tests (there is a MiniHBaseCluster which
brings up an in-memory cluster for testing and you can tear it down at the end of your test)?
The benefit you get is that you no longer need to mock HBase responses and you will be talking
to an actual cluster running similar code to the one you will have running in prod, so will
be more reliable. Obviously the downside is that instead of mocking responses, you will have
to populate data in HBase tables but I still feel this is more intuitive and reliable.
> 
> Regards,
> Dhaval
> 
> 
> ________________________________
> From: Adam Phelps <amp@opendns.com>
> To: user@hbase.apache.org 
> Sent: Monday, 24 June 2013 5:14 PM
> Subject: Re: Writing unit tests against HBase
> 
> 
> On 6/18/13 4:22 PM, Stack wrote:
>> On Tue, Jun 18, 2013 at 4:17 PM, Varun Sharma <varun@pinterest.com> wrote:
>>
>>> Hi,
>>>
>>> If I wanted to write to write a unit test against HTable/HBase, is there an
>>> already available utility to that for unit testing my application logic.
>>>
>>> I don't want to write code that either touches production or requires me to
>>> mock an HTable. I am looking for a test htable object which behaves pretty
>>> close to a real HTable.
>>>
>>
>>
>> Would this help if we included it?
>> https://github.com/kijiproject/fake-hbase/
> 
> I figured I'd take a look as I was about to try using Mockito
> (https://code.google.com/p/mockito/) to try to implement unit testing of
> some of our code that accesses HBase.  The example tests in there are
> all Scala, and I'm not having much success using them in Java.  Do you
> know if there's any example Java tests that make use of fake-hbase?
> 
> - Adam 
> 


Mime
View raw message