hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bertrand Dechoux <decho...@gmail.com>
Subject Re: Unit tests for Map and Reduce functions.
Date Wed, 26 Sep 2012 21:30:40 GMT
0.9.0-incubating<https://repository.apache.org/content/repositories/releases/org/apache/mrunit/mrunit/0.9.0-incubating/>
is
indeed the last version although the 1.0 might be released soon.
Like you can see, there is an artefact for hadoop1 and another one for
hadoop2.

Mockito is used within MRUnit. But why do everything by hand when people
already build something?
A little sample for a a full mapper-reducer test :

MapReduceDriver.newMapReduceDriver(new WordCountMapper(),new
WordCountReducer())
            .withInput(new LongWritable(1), new Text("word1 word2 word2
word1"))//
            .withOutput(new Text("word1"), new LongWritable(2))//
            .withOutput(new Text("word2"), new LongWritable(2))//
            .runTest();

Of course, there is also a MapDriver and a ReduceDriver. And MRunit
supports both mapred and mapreduce packages.

Regards

Bertrand

On Wed, Sep 26, 2012 at 10:58 PM, John Armstrong <jrja@ccri.com> wrote:

> On 09/26/2012 04:39 PM, Kai Voigt wrote:
>
>> I don't know any other unit testing framework.
>>
>
> We rolled our own here.  It's not exactly hard, except for the tricky bit
> about not having class objects for generics in Java.
>
>


-- 
Bertrand Dechoux

Mime
View raw message