File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes How to test servlet using Junit test? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "How to test servlet using Junit test?" Watch "How to test servlet using Junit test?" New topic
Author

How to test servlet using Junit test?

Steve James
Ranch Hand

Joined: Apr 12, 2009
Posts: 44
Does anybody know how to test an servlet class using Junit without using Cactus test . Is it possible to test a servlet using Junit without cactus test.Please tell me the process how to test a servlet using Junit test .




I am just a brick in the wall of Java
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Depends on what exactly you want to test. For roundtrips tests to a web server or servlet container I recommend jWebUnit.

But you could also use a mock library (such as jmock or easymock) to create mock objects for the servlet-specific classes, and integrate the tests into your test suite that way.


Ping & DNS - updated with new look and Ping home screen widget
Steve James
Ranch Hand

Joined: Apr 12, 2009
Posts: 44
ulf , valuable information . thank you .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to test servlet using Junit test?
 
Similar Threads
Cactus for Unit Testing
This weeks Giveaway
benefits of cactus?
Unit Testing JSP
Cactus and Junit