Selenium is a test tool for web applications.
Selenium tests run directly in a browsers, just as real users do. And they run in Internet Explorer, Mozilla and Firefox on Windows, Linux and Macintosh.
Taken from a Selenium doco site:
http://www.openqa.org/selenium/index.html.Playing around with it a bit here at work. Seems quite good.
Once set up, to write a test, you place the thing you're testing for in a HTML row:
eg.:
<tr><td>clickAndWait</td><td>//input[@value='Modify']</td><td> </td></tr>
<tr><td>assertTextNotPresent</td> <td>Previous Page</td><td> </td></tr>
This is best place inside a jsp. If using jsp, this can include other jsp for common functionality such as login etc.
eg: an example login jsp:
<tr>
<td>open</td>
<td>
http://localhost:8080index.jsp</td>
<td> </td>
</tr>
<tr><td>assertTextPresent</td> <td>Login Portlet</td><td> </td></tr>
<tr><td>type</td> <td>userID</td><td>wpsadmin</td></tr>
<tr><td>type</td> <td>password</td><td>wpsadmin</td></tr>
<tr><td>clickAndWait</td> <td>//input[@value='Log in']</td><td> </td></tr>
This could then simply be included by the calling jsp as:
<jsp:include page="../shared/login.jsp" />
One could even pass params if needed such as:
<jsp:include page="../shared/selectWar.jsp">
<jsp:param name="warName" value="identityManagement" />
</jsp:include>
Where the selectWar.jsp called would be able to access the variable with:
String warName = request.getParameter("warName");
All standard jsp stuff.