• Post Reply Bookmark Topic Watch Topic
  • New Topic

Testing stratagies ?  RSS feed

 
Dean Fredericks
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you do unit testing with J2EE - is it possible ?

Sure testing you standard java bean methods is easy with JUnit.

But how do you unit test a Servlet, JSP or a EJB ?

I have a app with many many sevlerts and JSPs. And often when I make a change, I test it and its fine, only the change has broken something somwhere else in the app.

Can anybody give me some testing tips, pointers, advice , etc ?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, of course it's possible.

The most important trick is to have as few logic in the servlets, EJBs etc. as possible - just let them delegate to POJOs that you can test as usual.

There are also a number of books out there on the topic. I like "JUnit Recipes" and "JUnit in Action" best.
 
Gerardo Tasistro
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you seen JWebUnit? It supports http testing.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gerardo Tasistro:
Have you seen JWebUnit? It supports http testing.


Yes. Those aren't unit tests, tough.
 
Buhi Mume
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Jakarta Cactus project for unit testing Java EE components.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!