Hi Pieter,
It looks like you've found a bug in JSFUnit. Our test suite doesn't
include an example of using plain <h:commandLink>. We only have it for
an AJAXified commandLink.
The clickLink() method was really meant for static links of the type
that get created when you use <h:outputLink>. I'm not sure if I should
overload this method for use with <h:commandLink> or not. Any thoughts?
Anyway, I'll be fixing this ASAP and let you know.
Stan
Pieter Kuijpers wrote:
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.
------------------------------------------------------------------------
_______________________________________________
jsfunit-dev mailing list
jsfunit-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jsfunit-dev