hadoop-mapreduce-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom White (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework
Date Fri, 02 Oct 2009 10:59:23 GMT

    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761531#action_12761531
] 

Tom White commented on MAPREDUCE-1050:
--------------------------------------

Konstantin, I think the fault injection framework is different (but complementary) to mock
objects. Both are needed. Fault injection allows you to simulate controlled faults in a larger
system - e.g. HDFS. Mock objects, on the other hand, are really for unit testing smaller parts
of the system. They allow you to mock out the dependencies of the class under test, so that
you test only a single class (or a few closely collaborating classes, like JobControl and
ControllingJob in my example). Using mock objects can help foster good class design, since
it reduces coupling by encouraging the developer to consider each class's responsibilities
and the interface between classes.

Nigel, in my experience the stacktraces from Mockito are helpful and clear. Mockito by default
is less brittle than other frameworks since it allows redundant invocations (see http://mockito.googlecode.com/svn/branches/1.8.0/javadoc/org/mockito/Mockito.html#8).



> Introduce a mock object testing framework
> -----------------------------------------
>
>                 Key: MAPREDUCE-1050
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-1050
>             Project: Hadoop Map/Reduce
>          Issue Type: Test
>          Components: test
>            Reporter: Tom White
>            Assignee: Tom White
>         Attachments: MAPREDUCE-1050.patch
>
>
> Using mock objects in unit tests can improve code quality (see e.g. http://www.mockobjects.com/).
Hadoop would benefit from having a mock object framework for developers to write unit tests
with. Doing so will allow a wider range of failure conditions to be tested and the tests will
run faster.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message