Unit Testing of servlets and jsp by Junit
hi,
suggest me how to do the unit testing by junit!
thanks in advance
hi,
suggest me how to do the unit testing by junit!
thanks in advance
On the JUnit Web site, there is an "extensions" section which lists a number of Web tools for testing.
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.
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).