What's the successor of mrunit?

2019-01-21 23:33发布

问题:

Today I found out that the ASF retired mrunit (see https://blogs.apache.org/foundation/entry/the_apache_news_round_up85 and https://issues.apache.org/jira/browse/HADOOP-3733 and the homepage itself). Other than "inactivity" there was no reason given, so I guess there has to be an alternative?

What's supposed to be used instead of mrunit to unit test mapreduce jobs in the future?

回答1:

I believe the reason for this retirement is the realization that Mockito already can handle what you need to unit test your mapper/reducers. All you need is to mock your Context, Counter and HBase KeyValue and you can then pass in a row (in the form of the Result object) to a mapper and check if the key/value emitted is correct.

FYI - I actually got my MR unit tests working perfectly using this approach without any assistance from MRUnit and PowerMock.



回答2:

Not exactly a successor, but I tried and tested a work-around with a bit of research. It is actually based on the Minicluster module of hadoop.

To find out how to use it, details can be found in this link here. And a github demo project exists here.