• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unit testing Java EE 5 applications

 
Kenneth Gustafsson
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello people,

I've looked through a couple of testing frameworks that looked promising at first, but then turned out to have some kind of quirk which puts it into the not usable zone for me. I'm not mentioning them as I don't want to affect any ones opinion, I might have dismissed one without a good enough reason.

I'm wondering which framework you recommend? And why? Do you prefer to test in container, outside it or maybe both?
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some tests, eg EJB container-managed transactions, can only be tested using a real EJB container (not a mock container) as you need to ensure that your code and the container are properly processing commits and rollbacks.

For JUnit tests, you can easily do these if you write the business logic using plain old Java objects, and test (outside the real container).

The EJB which calls the POJOs will basically just be the means of providing EJB services, and you can test the EJB using a real container.
 
Kenneth Gustafsson
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your advice, it's indeed an interesting approach. I'll take it up with the rest of the project group. In the meantime I'll look into ejb3unit, as it still seems promising after reading about it on its web page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic