How to unit check logic in jsp?

What tools or methods exist for this purpose?

+6
java jsp unit-testing
source share
4 answers

Try JspTest . Use it to verify presentation logic on a JSP page.

+2
source share

Apart from the display logic, which is usually difficult to test, my advice would not be in JSP logic. Instead, move it to POGO and the problem will be solved.

+7
source share

Check out HtmlUnit or Watij .

They provide a mute browser engine that allows you to write tests by moving HTML pages, filling out forms, clicking buttons, etc.

Having said that, I try to use as little functionality as possible in my JSPs (or the like) and focus my testing on the core business logic objects and how to create beans for the JSP display. But final JSP testing is definitely a good idea.

+3
source share

Share it ?;)

In container testing (using Cactus ), or compile the JSP for servlets, and then mock the response / response objects.

JUnit In Action contains a JSP unit tests section and server-side code. I would highly recommend the book.

+1
source share

All Articles