cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Cayenne junit testing, Was: Cayenne 3.0 roadmap
Date Mon, 30 Oct 2006 14:33:06 GMT
Current default Cayenne unit tests are probably a bad model, as most  
bootstrap code was written before Cayenne was even operational.  
However the new Maven-based integration test package that targets  
testing of POJO's is the state of the art as far as I am concerned  
(can be used from Ant as well of course):

https://svn.apache.org/repos/asf/incubator/cayenne/main/trunk/ 
integration-test/

You can mirror this approach:

* generated entity classes are placed in the "main" source folder
* test cases a placed in the "test" source folder
* a common superclass of all test cases performs shared stack  
initialization and creates the schema from Cayenne mapping (or from a  
manual SQL script - whichever applies)
* ItestDBUtils is used to perform raw DB operations bypassing Cayenne  
(this is still work in progress - more utility methods can be added):

https://svn.apache.org/repos/asf/incubator/cayenne/main/trunk/ 
integration-test/itest-common/src/main/java/org/apache/cayenne/itest/ 
ItestDBUtils.java

Andrus


On Oct 30, 2006, at 4:09 AM, Aristedes Maniatis wrote:
> On 30/10/2006, at 7:20 PM, Giulio Cesare Solaroli wrote:
>
>> Now, for the project I am working at, I need to find out how to do DB
>> based test the Cayenne way. Once I have struggled to set up a sound
>> test environment, playing with the new expression package should be
>> much easier.
>
> Yes, we at ish have many times marveled at the junit tests in  
> Cayenne. And not really understood them. We've long wanted to do  
> something similar in our application and might return to it in the  
> future when we have time. It would be great to document this  
> process and possibly create a framework to make this easier. I  
> wonder if a suitable framework might be build inside Cayenne itself.
>
> Ari Maniatis
>
>
>
> -------------------------->
> ish
> http://www.ish.com.au
> Level 1, 30 Wilson Street Newtown 2042 Australia
> phone +61 2 9550 5001   fax +61 2 9550 4001
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>
>


Mime
View raw message