You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-issues@hadoop.apache.org by "Tom White (JIRA)" <ji...@apache.org> on 2009/10/01 18:31:23 UTC

[jira] Created: (MAPREDUCE-1050) Introduce a mock object testing framework

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


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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778481#action_12778481 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

Another though on this: mockito jar is included into common configuration of ivy. Should it be included into 
test' config instead? 

Also, the needed modifications for {{.eclipse_template/.classpath is missed}}

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12788419#action_12788419 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

Thanks for Chris' hint: I had a stale .xml file in my conf/ directory. I've deleted it and now everything works Ok.
+1 patch looks good!

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12786273#action_12786273 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

Well, still fails on my BSD machine. The message is 
{noformat}
TestLostTaskTracker
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.791 sec
------------- Standard Output ---------------
2009-12-04 16:43:13,581 INFO  mapred.JobTracker (JobTracker.java:<init>(1334)) - Starting jobtracker with owner as cos and supergroup as supergroup
2009-12-04 16:43:13,587 INFO  mapred.JobTracker (JobTracker.java:initializeTaskMemoryRelatedConfig(4086)) - Scheduler configured with (memSizeForMapSlotOnJT, memSizeForRedu
ceSlotOnJT, limitMaxMemForMapTasks, limitMaxMemForReduceTasks) (-1, -1, -1, -1)
2009-12-04 16:43:13,590 INFO  util.HostsFileReader (HostsFileReader.java:refresh(81)) - Refreshing hosts (include/exclude) list
2009-12-04 16:43:13,607 INFO  mapred.QueueConfigurationParser (QueueConfigurationParser.java:parseResource(170)) - Bad conf file: top-level element not <queues>
------------- ---------------- ---------------

Testcase: testLostTaskTrackerCalledAfterExpiryTime took 0.763 sec
        Caused an ERROR
No queues defined 
java.lang.RuntimeException: No queues defined 
        at org.apache.hadoop.mapred.QueueConfigurationParser.parseResource(QueueConfigurationParser.java:171)
        at org.apache.hadoop.mapred.QueueConfigurationParser.loadResource(QueueConfigurationParser.java:163)
        at org.apache.hadoop.mapred.QueueConfigurationParser.<init>(QueueConfigurationParser.java:92)
        at org.apache.hadoop.mapred.QueueManager.getQueueConfigurationParser(QueueManager.java:126)
        at org.apache.hadoop.mapred.QueueManager.<init>(QueueManager.java:146)
        at org.apache.hadoop.mapred.JobTracker.<init>(JobTracker.java:1376)
        at org.apache.hadoop.mapred.JobTracker.<init>(JobTracker.java:1325)
        at org.apache.hadoop.mapred.TestLostTaskTracker.setUp(TestLostTaskTracker.java:58)
{noformat}

The other problem: TestLostTaskTracker is JUnit v3 test (it extends TestCase, etc.). Please make it to be JUnit v4 (like the other two tests are).

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Nigel Daley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763314#action_12763314 ] 

Nigel Daley commented on MAPREDUCE-1050:
----------------------------------------

+1 on mockito too.  Looks good.  Would love to see some real unit tests written with this :-)

> 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12788418#action_12788418 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

Interestingly enough but I'm seeing this problem only on BSD - Linux runs just fine...

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

    Attachment: MAPREDUCE-1050.patch

Here are a few more MapReduce tests that show more mock-testing techniques, including verification, partial mocks (good for existing code, discouraged for new code), argument capture, and argument matching using Hamcrest. There are comments in the tests that explain what is going on.

> 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, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761721#action_12761721 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

Thanks for the comment, Tom. I think 'complementary' is the word I was looking for :-)

> 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Nigel Daley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761267#action_12761267 ] 

Nigel Daley commented on MAPREDUCE-1050:
----------------------------------------

One thing to consider with dynamic mock frameworks is how easy it it so understand failures when they occur.  My experience with easymock (from a few years back) was that it's use of DynamicProxy made stack traces really difficult to figure out when a test failed.  Tom, any experience with this using mockito?

> 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773210#action_12773210 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

On the other hand, having build modification + some test cases will allow to see immediately if Mockito works. So, I think with the patch as it is.

+1 on the patch. Let's have it.  

> 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, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Johan Oskarsson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763925#action_12763925 ] 

Johan Oskarsson commented on MAPREDUCE-1050:
--------------------------------------------

+1 on mockito. I've used it a couple of times and so far it's been a pleasure to work with.

> 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, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12764741#action_12764741 ] 

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

I think this could be committed after being checked by Hudson, the only thing that I'm not sure about is the names of the test classes, which end "WithMocks" to differentiate them from the existing tests. Any suggestions?

> 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, 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

    Status: Patch Available  (was: Open)

> 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, MAPREDUCE-1050.patch, 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

    Attachment: MAPREDUCE-1050.patch

I have attached a patch that illustrates a very simple application of mock objects to test the JobControl API. JobControl depends on the Job class (in org.apache.hadoop.mapreduce), but its logic is independent of Job's. To unit test JobControl's logic we shouldn't have to run a full MapReduce Job. To do so is time consuming, and introduces more dependencies than are strictly needed. (In some situations it is difficult - or at best awkward - to simulate the condition we are trying to test. E.g. https://issues.apache.org/jira/browse/MAPREDUCE-270?focusedCommentId=12759441&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12759441.)

Instead we merely need to check that for various Job behaviours JobControl acts as expected. For example, if a Job succeeds then JobControl should put it in the successful jobs collection. (The test could obviously be expanded to cover failing jobs and dependent jobs, like TestMapReduceJobControl. Also, we still need system level tests that run full MapReduce jobs using the JobControl API - this JIRA is about unit tests.)

The test uses Mockito (http://mockito.org/), a mocking framework which is gaining a lot of traction. The other contenders are jMock (http://www.jmock.org/) and EasyMock (http://easymock.org/, http://code.google.com/p/mockito/wiki/MockitoVSEasyMock). In my opinion, Mockito has the clearest syntax and is easiest to use.

Obviously the patch shows a single test. I propose that the scope of this JIRA is to write a handful of different tests to show different cases (e.g. verification of method invocation, not just stubbing), so we can evaluate the framework for inclusion.

Thoughts?

> 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765507#action_12765507 ] 

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

The test failure is unrelated.

> 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, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12774074#action_12774074 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

I've checked the test failure on the original patch's version and see the same failure. Apparently, something has been changed in MR

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

       Resolution: Fixed
    Fix Version/s: 0.22.0
     Hadoop Flags: [Reviewed]
           Status: Resolved  (was: Patch Available)

I've just committed this.

> 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
>             Fix For: 0.22.0
>
>         Attachments: MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Eli Collins (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761297#action_12761297 ] 

Eli Collins commented on MAPREDUCE-1050:
----------------------------------------

FYI filed HDFS-669 for using mock objects for HDFS testing.

> 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

    Status: Patch Available  (was: Open)

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772610#action_12772610 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

In order to move along with this new framework current patch (and JIRA) needs to be modified.
This JIRA is about adding new framework. Thus the patch needs to be focused on build's configuration and ivy modifications.
Then New JIRA needs to be opened for adding Mockito based unit tests.

Basically, the patch needs to be split in two.  

Same is true for HDFS-669

> 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, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Nigel Daley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761264#action_12761264 ] 

Nigel Daley commented on MAPREDUCE-1050:
----------------------------------------

+1.  We should explore the utility of dynamic mocks, like those produced by http://easymock.org/ or http://jmock.org/ as well as what static mocks need to be built.

> 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Konstantin Boudnik updated MAPREDUCE-1050:
------------------------------------------

    Attachment: MAPREDUCE-1050.patch

Per conversation w/ Nigel and Tom last night, I've moved test cases from {{src/test/mapred/}} hierarchy to {{src/test/unit/}} for these are true unit tests.

Also, I've created new ant target 'run-test-unit' to execute unit tests only and modified the test running macro to pickup unit tests when a testcase is specified.

Also, one of the tests 'TestLostTaskTracker' is repeatedly failing now. Tom, could you please take a look?

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

    Status: Open  (was: Patch Available)

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

    Status: Open  (was: Patch Available)

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Chad Metcalf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763138#action_12763138 ] 

Chad Metcalf commented on MAPREDUCE-1050:
-----------------------------------------

+1 on mockito

Couple of nice comparisons to easymock.

http://blog.jteam.nl/2009/08/13/easier-mocking-with-mockito/
http://code.google.com/p/mockito/wiki/MockitoVSEasyMock

The jmock guys acknowledge that their tool is opinionated and the structure arcane but that they made those decisions to force test in a certain direction. That is all fine and well for a company that can devote time and resources to training. I think its less appropriate on an open source project.

I think mockito would be a good choice in this environment (lots of developers from different backgrounds, testing training, etc). In the end we want people to use the tool and test. 

> 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Nigel Daley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761788#action_12761788 ] 

Nigel Daley commented on MAPREDUCE-1050:
----------------------------------------

I agree that injection (don't read that as just 'fault injection') is complementary to mock object testing. 

Injection can be used for faults, for enhanced controllability, and for enhanced observability when writing tests.  It is useful in situations where you don't have a very testable design, but need to write unit tests that can control and observe the code-under-test.

> 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12764744#action_12764744 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

I believe {{...WithMocks}} suffix is optional, isn't it? I suggest we just drop it. I believe we have briefly discuss it during Thursday meeting that we'll create separate folders for different types of tests, i.e. {{src/test/unit}}, {{src/test/functional}}, {{src/test/stress}} and so on. Then inside of these folder we don't need to have any special tags in the class names just whatever is required by JUnit, Mockito and so on.

> 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, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12785797#action_12785797 ] 

Hadoop QA commented on MAPREDUCE-1050:
--------------------------------------

+1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12426134/MAPREDUCE-1050.patch
  against trunk revision 887044.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 11 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Mapreduce-Patch-h3.grid.sp2.yahoo.net/162/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Mapreduce-Patch-h3.grid.sp2.yahoo.net/162/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Mapreduce-Patch-h3.grid.sp2.yahoo.net/162/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Mapreduce-Patch-h3.grid.sp2.yahoo.net/162/console

This message is automatically generated.

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

    Status: Patch Available  (was: Open)

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Eli Collins (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12764743#action_12764743 ] 

Eli Collins commented on MAPREDUCE-1050:
----------------------------------------

How about breaking out another high-level directory to separate functional tests from unit tests? eg src/unittest parallel to src/test.

> 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, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765189#action_12765189 ] 

Hadoop QA commented on MAPREDUCE-1050:
--------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12421993/MAPREDUCE-1050.patch
  against trunk revision 824750.

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 9 new or modified tests.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    +1 findbugs.  The patch does not introduce any new Findbugs warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    -1 core tests.  The patch failed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Mapreduce-Patch-h6.grid.sp2.yahoo.net/162/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Mapreduce-Patch-h6.grid.sp2.yahoo.net/162/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Mapreduce-Patch-h6.grid.sp2.yahoo.net/162/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Mapreduce-Patch-h6.grid.sp2.yahoo.net/162/console

This message is automatically generated.

> 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, MAPREDUCE-1050.patch, 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

    Attachment: MAPREDUCE-1050.patch

Here's a new patch which updates the Eclipse config, and places the Mockito jar in the test configuration for Ivy.

Also, TestLostTaskTracker is running OK for me. I'll run it through Hudson. 

> 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, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, MAPREDUCE-1050.patch, 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.


[jira] Commented: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Konstantin Boudnik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761261#action_12761261 ] 

Konstantin Boudnik commented on MAPREDUCE-1050:
-----------------------------------------------

I'm wondering if mock objects would benefit from (or might be expressed by means of) the injection framework we currently have in HDFS (HDFS-435) and will have in big Hadoop (HADOOP-6204) soon?

> 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
>
> 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.


[jira] Updated: (MAPREDUCE-1050) Introduce a mock object testing framework

Posted by "Tom White (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MAPREDUCE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom White updated MAPREDUCE-1050:
---------------------------------

    Attachment: MAPREDUCE-1050.patch

Yes, the WithMocks suffix is optional, and shouldn't be usual practice - I only added it to avoid naming conflicts. With this patch I've renamed TestLostTrackerWithMocks to TestLostTaskTracker, but I've left TestMapReduceJobControlWithMocks alone for the moment. It can be renamed once TestMapReduceJobControl is moved to the functional test hierarchy - this should go in another JIRA.

(Within a hierarchy the name needs to be unique - even for tests in different packages - since otherwise Eclipse has problems running all the tests in a hierarchy, I believe.)

> 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, MAPREDUCE-1050.patch, 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.