aspose file tools*
The moose likes Testing and the fly likes Testing on different modules Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Testing on different modules" Watch "Testing on different modules" New topic
Author

Testing on different modules

Nick Carag
Greenhorn

Joined: Dec 08, 2010
Posts: 13
Hi All,

i have a project with a structure like this:


|--core
|
|--commons
|
|--data-model
|
|--service
|

and so on. I realized all the tests on the data-model module using HSQLDB (with JPA 2.0 + Hibernate 3.6.7) and now i've started writing tests for the service module. It's made up of different services that use DAO/repository classes so my question is, should I continue using the test database configuration or just mock the data-model classes?
I'm using maven 3 as build tool and I've added the src/test/resources folder of data-model as testResource in the service's pom.

Thanks


Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

I have an application that we test it with the database, HSQLDB.

I think it is a better approach because you do not need to mock anything. Maybe this will help you to have an idea.JUnit with HSQLDB, JPA and Hibernate


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Nick Carag
Greenhorn

Joined: Dec 08, 2010
Posts: 13
Hebert Coelho wrote:I have an application that we test it with the database, HSQLDB.

I think it is a better approach because you do not need to mock anything. Maybe this will help you to have an idea.JUnit with HSQLDB, JPA and Hibernate


Thanks for the reply. The Unit Tests on data-model are ok (I already use HSQLDB and the approach described in your link), my question is about testing the service layer. Classes in service layer use repositories and daos of data-model layer. Do I have to mock them or to use the test configuration of data-model (so HSQLDB)? If the second, i have to use the src/test/resources folder as described in my first post?
Nick Carag
Greenhorn

Joined: Dec 08, 2010
Posts: 13
Other suggestions?

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Testing on different modules