You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Bob Morley (JIRA)" <ji...@apache.org> on 2009/08/19 07:27:14 UTC

[jira] Updated: (OFBIZ-2842) Add mocked unit test framework

     [ https://issues.apache.org/jira/browse/OFBIZ-2842?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bob Morley updated OFBIZ-2842:
------------------------------

    Attachment: mockito-all-1.8.0-rc2.jar
                OFBIZ-2842.patch

Mockito has been chosen for this work because it is simplistic and it uses the MIT license.  Not sure if I should be attaching the file here or not; but you will have to place this in the base/lib to honor the classpath.

> Add mocked unit test framework
> ------------------------------
>
>                 Key: OFBIZ-2842
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2842
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: ALL COMPONENTS
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: mockito-all-1.8.0-rc2.jar, OFBIZ-2842.patch
>
>
> Add the ability to create "true" unit tests -- ones that only test the confines of the method itself and using mocking techniques and dependency injection.  This focuses the unit test on the actual code in the method and makes the assumption that other methods have been properly tested and will work.  This does not suggest that there is not also value in unit tests that test more of an integration between components (such as a test that will actually invoke services using a the real dispatcher and manipulate entities with the real delegator).
> The goal of this will be to make it easy and very quick to test java-based methods (initial focus on services) along with not having to start an ofbiz container creating a suite of very quick method focused unit tests.
> I have attached a first pass at some of the base classes and a sample of a "mostly complete" unit test for the DateDimensionServices class (which has one method).  Looking for feedback on this approach, potential for community collaboration, and potential buy-in.  Some other things that are still to be done --
> - more samples
> - integration into ant build
> - solution to the "static worker" issue
> - UtilResourceBundle solution (I have it partially commented out)
> - easy verification of service interface adherence (servicedef existance & IN/OUT validation)
> - potential for GenericEntity get/set validation (verify entitydef adherence) (may not want to do this)
> - investigate potential for mocked simple methods
> - ant driven code coverage metrics

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