Return-Path: Delivered-To: apmail-lucene-hadoop-dev-archive@locus.apache.org Received: (qmail 22320 invoked from network); 9 Oct 2007 20:44:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Oct 2007 20:44:54 -0000 Received: (qmail 69449 invoked by uid 500); 9 Oct 2007 20:44:41 -0000 Delivered-To: apmail-lucene-hadoop-dev-archive@lucene.apache.org Received: (qmail 69097 invoked by uid 500); 9 Oct 2007 20:44:40 -0000 Mailing-List: contact hadoop-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hadoop-dev@lucene.apache.org Delivered-To: mailing list hadoop-dev@lucene.apache.org Received: (qmail 69088 invoked by uid 99); 9 Oct 2007 20:44:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2007 13:44:40 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Oct 2007 20:44:41 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A14FF7141FE for ; Tue, 9 Oct 2007 13:43:50 -0700 (PDT) Message-ID: <27918859.1191962630628.JavaMail.jira@brutus> Date: Tue, 9 Oct 2007 13:43:50 -0700 (PDT) From: "Tom White (JIRA)" To: hadoop-dev@lucene.apache.org Subject: [jira] Commented: (HADOOP-1936) WordCount unit test plus a helper class to facilitate testing Mappers and Reducers In-Reply-To: <103485.1190496710877.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HADOOP-1936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533496 ] Tom White commented on HADOOP-1936: ----------------------------------- Sorry to come to this so late, but I would vote to use a mock object library (jMock) to write tests for mappers and reducers as you argued for on the user list (http://www.mail-archive.com/hadoop-user@lucene.apache.org/msg02261.html). Using jMock is much more concise than the approach in this patch (see http://www.matthewekent.com/?p=15), although I admit it does have a bit of a learning curve. > WordCount unit test plus a helper class to facilitate testing Mappers and Reducers > ---------------------------------------------------------------------------------- > > Key: HADOOP-1936 > URL: https://issues.apache.org/jira/browse/HADOOP-1936 > Project: Hadoop > Issue Type: Test > Components: examples > Reporter: Kate Rhodes > Priority: Trivial > Attachments: WordCountTestExampleAndOutputCollectorTestHelper.patch > > > There are to pieces to this The first is a test for WordCount, not because word count actually needed one but because it would be useful to beginners to have an example of how to unit test Mappers and Reducers. > The second piece is AOutputCollector and it's associated unit test TestAOutputCollector. This is an abstract class that can be quickly extended by a stub OutputCollector in your unit tests to collect the output from your Mapper and Reducer tests and make it available for easy retreival when testing to see if the fourth key that was emitted was the one you expected. I think that this would be a useful tool to have in the main test folder but wasn't sure where would be best to put it. Also, since nothing else in Hadoop uses Hungarian notation you'll probably want to rename it. I didn't because I'm not confident about the naming conventions here and figured that since it and its test probably wouldn't end up living in the same folder as WordCount that you could just rename it when you moved it. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.