5 Replies Latest reply on May 27, 2009 3:45 PM by utish

    Setting up a JSFUnit project

    utish

      Created a JSF project in Eclipse. Added all the jars as described here.

      http://www.jboss.org/jsfunit/gettingstarted.html

      Also included the entries in web.xml and the included the cactus-report.xsl in the root of WAR.

      Wrote an ant script which generates a WAR with JSFUnit dependencies as described here.

      http://www.jboss.org/community/wiki/JSFUnitWithAnt

      Here is my snippet from build.xml

      
      <delete file="${exploded-jsfunit.dir}/${project.distname}.war"/>
      
       <target name="create.jsfunit.exploded.dir" depends="deploy">
       <path id="jsfunit.classpath">
       <fileset dir="${webinf.dir}/lib">
       <include name="*.jar"></include>
       </fileset>
       </path>
      
       <taskdef
       name="jsfunitwar"
       classname="org.jboss.jsfunit.ant.JSFUnitWarTask"
       classpathref="jsfunit.classpath"></taskdef>
      
       <jsfunitwar srcfile="${deploy.dir}/${project.distname}.war"
       destfile="${exploded-jsfunit.dir}/${project.distname}.war"
       autoaddjars="true">
      
       <!-- This is where you have compiled your jsfunit tests -->
       <classes dir="${classes.test}"
       includes="**/*.class">
       </classes>
      
       <TestRunner></TestRunner>
       </jsfunitwar>
       </target>
      
      


      I'm actually able to deploy the generated WAR with JSFUnit dependencies and actually run a JUnit tester as described here:

      http://www.jboss.org/community/wiki/UsingJSFUnitwithEclipse

      My problem is I'm unable to see the test reports in the browser when I poin to the URL as follows:

      http://localhost:8080/myjsfapp/ServletTestRunner?suite=com.foo.JSFUnitTest&xsl=cactus-report.xsl

      I cannot see the report in the browser as described here (but the test runs):

      http://www.jboss.org/jsfunit/gettingstarted.html

      Any idea what I could be missing in this setup?

      Thanks in advance.

        • 1. Re: Setting up a JSFUnit project
          ssilvert

          When you execute the ServletTestRunner from your browser, what comes back? Is there an error message in the browser or in a server log?

          How do you know that the test was really run?

          Stan

          • 2. Re: Setting up a JSFUnit project
            utish

            The browser basically remains blank. No error message in the browser. I can see the tests running successfully using some sysouts in the test class.

            • 3. Re: Setting up a JSFUnit project
              utish

              And no error message in the server log.

              • 4. Re: Setting up a JSFUnit project
                ssilvert

                 

                "utish" wrote:
                The browser basically remains blank. No error message in the browser.

                When you view source in the browser, what do you see? Is it really blank HTML that is returned or something else?

                What browser are you using?

                Please try it without cactus-report.xsl and see what comes back. You should see plain XML:
                http://localhost:8080/myjsfapp/ServletTestRunner?suite=com.foo.JSFUnitTest

                Stan

                • 5. Re: Setting up a JSFUnit project
                  utish

                  I was using Chrome. The xml was there in the source when I used it without cactus-report.xsl.

                  But I found the real issue that was causing the problem. When cactus-report.xsl was downloaded, it got downloaded as cactus-report.xsl.xml.

                  Thanks Stan for the help!!! :)