Unit Testing of servlets and jsp by Junit

hi,

suggest me how to do the unit testing by junit!

thanks in advance

[88 byte] By [naveenchowdharya] at [2007-11-27 10:49:13]
# 1

On the JUnit Web site, there is an "extensions" section which lists a number of Web tools for testing.

karma-9a at 2007-7-29 11:17:47 > top of Java-index,Java Essentials,Java Programming...
# 2

There are serveral approaches. The HttpUnit package actually pretends to be a browser, and follows a sequence of interactions with a server.

Or you can use "Mock objects" which allow you to produce fake request and response objects then verify what the servlet does to them.

malcolmmca at 2007-7-29 11:17:47 > top of Java-index,Java Essentials,Java Programming...
# 3

Or abstract the business logic away from the actual servlets themselves (always a good idea) and test those classes outside the context of a servlet framework.

That limits the code that actually is impacted by being a servlet to the absolute minimum (essentially parameter passing).

jwentinga at 2007-7-29 11:17:47 > top of Java-index,Java Essentials,Java Programming...
# 4

thank you 4r immediate reply!

can u suggest me some links on how to use HTTPUNIT

thanku!

naveenchowdharya at 2007-7-29 11:17:47 > top of Java-index,Java Essentials,Java Programming...