0 Replies Latest reply on Mar 26, 2012 8:31 AM by arslnmsd

    Need some help in running JSFUnit with TestNG on Tomcat6 using MyEclipse IDE

    arslnmsd

      Dear All,

       

      I am new to this forum and also new to JSF Unit Testing. I am writing JSF Unit tests for a legacy web application built on JSF 1.2 and Servlet Container version 2.5. It is a big project and I am unable to run the test as a TestNG test.

       

      I can see the test results in the browser (e.g. http://localhost:8080/mywebapp/ServletTestRunner?suite=my.test.JSFUnitTest&xsl=cactus-report.xsl), But when I run the JSFUnitTest class as a TestNG test, I get the following:

       

      java.lang.IllegalStateException: Can not find HttpSession.  Make sure JSFUnitFilter has run and your test extends org.apache.cactus.ServletTestCase.

                at org.jboss.jsfunit.framework.WebConversationFactory.makeWebClient(WebConversationFactory.java:136)

                at org.jboss.jsfunit.framework.WebClientSpec.<init>(WebClientSpec.java:116)

                at org.jboss.jsfunit.framework.WebClientSpec.<init>(WebClientSpec.java:94)

                at org.jboss.jsfunit.framework.WebClientSpec.<init>(WebClientSpec.java:78)

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

                at my.test.JSFUnitTest.setUp(JSFUnitTest.java:26)

                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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)

                at org.testng.internal.Invoker.invokeMethod(Invoker.java:702)

                at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:894)

                at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1219)

                at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)

                at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)

                at org.testng.TestRunner.privateRun(TestRunner.java:768)

                at org.testng.TestRunner.run(TestRunner.java:617)

                at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)

                at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)

                at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)

                at org.testng.SuiteRunner.run(SuiteRunner.java:240)

                at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)

                at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)

                at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)

                at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)

                at org.testng.TestNG.run(TestNG.java:1022)

                at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)

                at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)

                at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)

       

      What am I missing, or doing wrong.

       

      I am using Catus and JSFUnit v 1.3 as described in the page(http://www.jboss.org/jsfunit/gettingstarted.html) and the test class is similar to (https://community.jboss.org/wiki/JSFUnitTestClass).

       

      Appreciate your help.

       

      Thanks in advance.

       

      Arsalan