Hi, I really thanks to the members of this group who really helped me in writing and running junit testcases for bean methods. Now i again want your help in testing jsp pages. The jsp page contains two text fields. In that page only i am calling jean mathod which makes a SELECT query to the DB. I am populating those two text fields by this select query. So how can i go about testing jsp page? Pls help me. Do any one know any good site which explains in details how to test jsp page?
It's not exactly trivial, though, and I don't know of a good introduction, besides the chapter in the book in the sig below (unfortunately only available in german).
"JUnit in Action" contains a chapter on testing JSPs using Cactus, but that's even more complicated. "JUnit Recipes" likely contains good advice on the topic, too, but I don't have it at hand.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ilja, Do you have a preference over JWebUnit and ServletUnit. I haven't gotten too far with either of them, but JWebUnit seemed easier to use. And it's based on ServletUnit so the level of abstraction is higher.
Originally posted by Jeanne Boyarsky: Ilja, Do you have a preference over JWebUnit and ServletUnit. I haven't gotten too far with either of them, but JWebUnit seemed easier to use. And it's based on ServletUnit so the level of abstraction is higher.
Don't confuse ServletUnit with HttpUnit!
ServletUnit (being a part of the HttpUnit distribution) is a servlet container designed for unit testing. It is running inside your test and gives you close control over the servlet environment. The WebConversation is directly linked to the container, that is it doesn't need to go over a socket.
With other words, ServletUnit gives you many of the benefits of in-container-testing, without incurring the overhead.
In the book, I've used it in concert with JWebUnit, but it can as easily be combined with the test-framework of your choice, such as HtmlUnit or XHtmlUnit, for example. I've even written a prototypical extension to http://www.jdemo.de which uses ServletUnit to render and display a JSP without the need to start a true servlet container.