2 Replies Latest reply on Apr 23, 2012 5:27 AM by lfryc

    JsfUnit and RichFaces / recommended test framework?

    bcn

      What is the recommended framework for automated testing of RichFaces 4 applications?

       

      I tried JsfUnit, but got stuck right on the initial page loading.

       

      The server console shows a failure of loading a jquery resource. Then the application error page is returned instead of the inital page.

       

      10:44:21,083 INFO  [org.jboss.as.server] (management-handler-thread - 2) JBAS018559: Deployed "test.war"

      10:44:28,196 WARN  [com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl] (http-localhost-127.0.0.1-8080-1) Obsolete content type encountered: 'text/javascript'.

      10:44:29,292 WARN  [com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument] (http-localhost-127.0.0.1-8080-1) getElementById(script1334065469288) did a getElementByName for Internet Explorer

      10:44:29,312 ERROR [com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter] (http-localhost-127.0.0.1-8080-1) runtimeError: message=[The data necessary to complete this operation is not yet available.] sourceName=[http://127.0.0.1:8080/test/javax.faces.resource/jquery.js.jsf] line=[945] lineSource=[null] lineOffset=[0]

      10:44:29,358 WARN  [com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl] (http-localhost-127.0.0.1-8080-1) Obsolete content type encountered: 'text/javascript'.

      10:44:29,403 INFO  [com.gargoylesoftware.htmlunit.WebClient] (http-localhost-127.0.0.1-8080-1) statusCode=[404] contentType=[text/html]

       

      The test console shows:

       

      java.lang.RuntimeException: Could not inject method parameters

          at org.jboss.jsfunit.arquillian.container.JSFUnitTestEnricher.resolve(JSFUnitTestEnricher.java:89)

          at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.enrichArguments(LocalTestExecuter.java:94)

          at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

          at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

      ...

      Caused by: com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 404 Not Found for http://127.0.0.1:8080/test/RES_NOT_FOUND

          at com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:531)

          at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1007)

          at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:959)

          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:363)

          at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:225)

          at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:245)

          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:578)

          at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:536)

          at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1136)

          at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1038)

          at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)

          at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)

          at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:2999)

          at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1991)

          at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:895)

          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)

          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)

          at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:765)

          at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:211)

          at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:165)

          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:225)

          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:108)

          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:429)

          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:307)

          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:369)

          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:354)

          at org.jboss.jsfunit.framework.SimpleInitialRequestStrategy.doInitialRequest(SimpleInitialRequestStrategy.java:48)

          at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:259)

          at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:81)

          at org.jboss.jsfunit.arquillian.container.JSFUnitSessionFactory.createJSFSession(JSFUnitSessionFactory.java:107)

          at org.jboss.jsfunit.arquillian.container.JSFUnitSessionFactory.findJSFSession(JSFUnitSessionFactory.java:92)

          at org.jboss.jsfunit.arquillian.container.JSFUnitSessionFactory.getJSFServerSession(JSFUnitSessionFactory.java:70)

          at org.jboss.jsfunit.arquillian.container.JSFUnitTestEnricher.resolve(JSFUnitTestEnricher.java:84)

          ... 103 more

       

      Should I use Selenium WebDriver instead?

       

      Thanks