GeeCON Prague 2014*
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


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: 42050
    
  64
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 - my free Android networking tools app
Steve James
Ranch Hand

Joined: Apr 12, 2009
Posts: 44
ulf , valuable information . thank you .
 
GeeCON Prague 2014
 
subject: How to test servlet using Junit test?