I'm trying to test a commandLink in a page with
ClientFacade.clickLink, but this does not seem to be working.
link.jsp:
<html
xmlns="http://www.w3.org/1999/xhtml">
<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
<f:view>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<title>Link test</title>
</head>
<body>
<h:form>
<h:commandLink id="link" value="click me"
action="target"/>
</h:form>
</body>
</f:view>
</html>
target.jsp:
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<title>Link test successful</title>
</head>
<body>
Success.
</body>
</html>
Test code:
public class LinkTest extends TestCase {
public void testClickLink() throws Exception {
ClientFacade client = new ClientFacade("/link.faces");
client.clickLink("link");
assertEquals("Link test successful", client.getWebResponse
().getTitle());
}
}
The HTML that is returned using client.getWebResponse().getText is
that of link.jsp. When I try the same test by hand, it is working OK.
How is this supposed to work?
Thanks,
Pieter Kuijpers.