Adrian -- While this is probably not the best practice, what we have done is create a set of abstract base classes that extend the JUnit test case. Depending on the architectural layer we are testing, these may just provide some helper methods or they may start the container and allow us to run the JUnit from in Eclipse. The penalty we pay on the longer running tests is usually around 15 seconds or so; but it does allow us to run a whole suite of test cases in Eclipse with only the container start-up penalty.
In an effort to focus specifically on the business logic in service implementations, we have also made some use of Mockito. The "StandaloneMockTestCase" that we extend here avoids starting up the container and allows us to mock out both the delegator and dispatcher. This provided very targeted unit tests (usually as part of code coverage metrics) while mocking out external dependencies. If at all interested, I created a JIRA ticket and attached some source that displayed this technique. What we have not done is figure out how to integrate our unit tests with the standard ones in JUnit and have them all run as part of our automated build scripts. Currently, we only run our own unit tests. We also have not done enough work building up TestSuites at the various architectural layers as well as for each component. To be honest, I am unsure if we are even doing this in the best possible way. I started out trying to create debug configurations that would execute specific unit tests / component tests with the arguments to Start but I found it rather tedious. Moreover, it did not allow us to leverage the good tooling in the IDE. ----- Original Message ----- From: Adrian Crum <[email protected]> To: [email protected] Sent: Sat, 7 Nov 2009 02:08:54 -0500 (EST) Subject: Re: OFBiz Tests and Ant build.xml Files Mridul, Thank you! I have to confess, I don't use the command line often (actually never). I was referring to running tests from within Eclipse. But I'll give your suggestion a try! -Adrian --- On Fri, 11/6/09, Mridul Pathak <[email protected]> wrote: > From: Mridul Pathak <[email protected]> > Subject: Re: OFBiz Tests and Ant build.xml Files > To: [email protected] > Cc: "Mridul Pathak" <[email protected]> > Date: Friday, November 6, 2009, 8:22 PM > Hi Adrian, > > To run a component specific JUnit tests you > can use java -jar ofbiz.jar -test > -component='component-name'. I used it a long ago and > I can recall pretty surely that it worked. And if this > works, I believe ant run-tests -component='component-name' > should also work. > Just in case the above commands do not work > (which I doubt) then we should add this support to the > framework. > > -- > Thanks, > Mridul Pathak > > On 07-Nov-09, at 8:28 AM, Adrian Crum wrote: > > > I've been working a lot in the framework, and I would > like to get some automated tests in there. The problem is, > there is no "test" ant target at the component level. Is > there a way that can be done? I'm not familiar with ant > build.xml files, so could someone help out with that? > > > > -Adrian > > > > > > > > > >
