This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 41155
    
  45
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 .
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to test servlet using Junit test?
 
Similar Threads
Unit Testing JSP
benefits of cactus?
Cactus and Junit
Cactus for Unit Testing
This weeks Giveaway