Thanks for the pointers Mark.  The work that is there probably isn't  
directly applicable as it is way behind the trunk at this point, but  
the approach may be useful.

I tried a couple of approaches, with varying degrees of success.  One  
approach was to modify core DSpace classes (e.g. adding protected no- 
arg constructors) to support creation of mock objects for core classes  
like Item and Context (the mock objects extended these classes e.g.  
MockItem extends Item).  Another approach was to use a combination of  
JMockit (used to mock static methods) and EasyMock for creating  
mocks.  Note that JMockit instruments bytecode in order to mock  
statics, so there is some maven pixie dust required for invoking  
surefire (IIRC a dependency:copy and some system properties passed to  
surefire).

I think the JMockit/EasyMock approach worked better for me; I think  
maintaining a library of mocks is more difficult.  If you are doing  
unit testing, a simple mock of Context is enough to make DSpace think  
a database is there when it actually isn't.  There is some work in one  
of those branches which has a test harness for spinning up a database  
and loading in seed data for full on integration tests.

On Apr 7, 2010, at 6:58 PM, Mark Diggory wrote:

> 1.) We need to be clear about separating Unit Testing the codebase  
> from kicking the tires of an installation. So, I rather like your  
> separation for the test classes into a separate module. we do still  
> need to think about true Unit testing and it should remain separate  
> so please scratch my idea about using src/test/java.

I agree its important to understand: there is a difference between  
unit testing and integration testing, and that may impact how the  
project or test classes are organized, and what approaches are taken...

I think the testability of DSpace is pretty important and I'm glad  
that this work by Scott and others is moving towards that goal!

Best,
Elliot

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Dspace-devel mailing list
Dspace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to