I have created a first shot at making use of mocking in unit tests. You can take a look at https://issues.apache.org/jira/browse/OFBIZ-2842. There are more notes on the ticket; but here are some highlights:
- selected "mockito" framework (MIT lic) - created a new BaseTestCase - extended to an OfbizMockTestCase (in services) with mocked delegator, disaptcher, and dctx. Also has some testcase extensions to make checking success/error of services easier, creating service context, etc. - wrote CommonDimensionServicesTest This guy does not require an ofbiz container and runs inside my Eclipse in about .5s (granted it does not test a whole lot). It tests some failure scenarios as well as a successful "creation" of a DateDimension entity. One thing you will notice is that it is easy to test "exception" scenarios. So testing error handling for situations like database deadlocks become very easy to do. Moreover, you can test third party integration logic using similar techniques. Tim Ruppert wrote: > > +1 - would be super helpful. > > Cheers, > Tim > -- > Tim Ruppert > HotWax Media > http://www.hotwaxmedia.com > > o:801.649.6594 > f:801.649.6595 > > On Aug 18, 2009, at 12:05 AM, snowc wrote: > >> >> Hi Bob, The mocking code sounds great. Would you be happy to share? >> >> > -- View this message in context: http://www.nabble.com/is-compile-and-ofbiz-restart-still-needed-for-java-changes--tp24971472p25038084.html Sent from the OFBiz - User mailing list archive at Nabble.com.
