Does JSFUnit work with RichFaces?
Yes. See JSFUnitWithRichFaces
Does JSFUnit work with Tomahawk?
Yes. We don't have any tests for Tomahawk in the JSFUnit test suite, but developers in the community now report that it works.
Does JSFUnit work with IceFaces?
Right now it does not. We are working with IceSoft to fix this.
Does JSFUnit work with JUnit 4?
Currently, you can use the JUnit 4 jar, but annotations such as @Test will not work. This is due to a limitation in Cactus that is scheduled to be fixed in Cactus 2.0.
Should I use both SeamTest and JSFUnit?
JSFUnit is an in-container superset of SeamTest. SeamTest is especially well-suited to testing Seam components in isolation. SeamTest also has a simulated JSF lifecycle that you can use for quick and dirty integration testing.
Of course, SeamTest runs a little faster because you don't have to start the container. But that's becoming less of an issue as many containers these days can start in 5-6 seconds.
With JSFUnit, you can literally test every part of your application in its true deployment environment. You get a real HttpRequest/HttpResponse and you run through your chosen JSF implementation with all its associated servlet filters, phase listeners, etc. All the artifacts, the HTML, the request/response objects, the managed beans, the FacesContext, and the database, are available for assertions.
So the way I see it is that you should use SeamTest for isolated testing of Seam components. You can also use it for limited integration testing if you don't mind setting up the mock environment.
Use JSFUnit for everything else.
What is the difference between JSFUnit and Selenium?
Selenium is purely for black box testing. That is, Selenium only gives you the client side view of things. Also, Selenium uses native browser code. That can be good or bad depending on your perspective.
JSFUnit uses a pure java headless browser (HtmlUnit) that can emulate different versions of Firefox and IE. It has an API on top of HtmlUnit that understands JSF views. So the client API is a little easier to use than Selenium.
JSFUnit is usually a better choice for developers because it allows you to do comprehensive white box testing as well as the black box testing that Selenium provides.
You can use both JSFUnit and Selenium if you want. You can run them side-by-side as part of your test suite. But there is no formal integration.
How do I find an element in a DataTable?
Elements in a DataTable will end up with one or more index numbers in the id. That can make them more difficult to work with. However, it's really not that hard once you understand UsingComponentIDs. There is a section of the aformentioned document that deals directly with finding elements on your page that were rendered as part of a collection. If all else fails, you can use FireBug to look at the HTML source and then use HTMLUnit to query elements using XPath. Using the HtmlUnit API with JSFUnit for a short tutorial on using JSFUnit and HTMLUnit together. FireBug can even help you formulate your XPath query.
Why do I get a "Failed to get the test results" error?
This is probably because the application failed in a way which caused Cactus to error out. You should find an error in your server's log file or you can enable Cactus logging. For more information see the Cactus FAQ.
Why do I get a "Failed to get the test results" error after I redeploy the application?
See this forum posting. This can happen on Tomcat, JBoss, and presumably, other Tomcat-based containers. Right now the workaround is to lower the connectionTimeout in server.xml.