Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Testing on different modules

 
Nick Carag
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nick Carag
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Other suggestions?

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic