1 2 Previous Next 22 Replies Latest reply on Feb 15, 2008 7:51 AM by kingkon Go to original post
      • 15. Re: ANT
        kingkon

        Thanks wringe for your help..now my destwar was created...now i need to run the tests automatically by using this war......

        All I show in that example is creating the "JSFUnified" war. In other words, you end up with a war capable of running JSFUnit tests.

        Next, your ant script needs to:
        1) Start the servlet container
        2) Deploy the war
        3) Run your JUnit tests (they will automatically send requests to the Cactus ServletRedirector on your server. That's where the tests are actually run)
        4) Stop the servlet container



        This was said by stan..

        In cactus we have a tag cactus so that we can run testcases using batchtest and everything..similarly we have in junit also but.....i haven't found that tag in jsfunit....can you tell me how to run this war...

        and one more thing if we can use these tags ( like junit r cactus ) can we use WAS server....i mean to ask can we deploy the testcases into WAS

        Help me Out...

        Thanks

        • 16. Re: ANT
          ssilvert

          As far as I know, nobody has tried using the cactus tag for this. Since JSFUnit is executed using Cactus then it should work.

          Theoretically, another option is to use cargo for start/stop/deploy and then run your JSFUnit tests as you normally run plain JUnit.

          Cargo Ant tasks:
          http://cargo.codehaus.org/Ant+support

          I'm pretty sure cargo does support WAS, so that should work. However, there is a workaround for WebSphere that you will need to implement to run it with JSFUnit:
          http://www.jboss.com/index.html?module=bb&op=viewtopic&t=125918

          Stan

          • 17. Re: ANT
            kingkon

            Correct me if i am wrong.... i am using cactus....this is my build script

            Build Script


             <target name="make.jsfunit.war" depends="clean" >
             <echo> ${src.war}</echo>
             <echo>${lib.dir}</echo>
             <war destfile="${src.war}"
             webxml="D:\Mywork\jsfunit\WebContent\WEB-INF\web.xml">
             <classes dir="D:\Mywork\jsfunit\WebContent\WEB-INF\classes"/>
             <lib dir="D:\Mywork\jsfunit\WebContent\WEB-INF\lib"/>
             <metainf dir="D:\Mywork\jsfunit\WebContent\META-INF"/>
             <fileset dir="D:\Mywork\jsfunit\WebContent">
             <include name="pages\**"/>
             <include name="\**"/>
             </fileset>
             </war>
            
             <jsfunitwar srcfile="${src.war}"
             destfile="${dest.war}">
             <TestRunner/>
            
             </jsfunitwar>
            
            
             <echo>${tomcat.home}</echo>
            
            <cactus warfile="${dest.war}" fork="yes">//this is the line where it is failed
             <classpath>
             <path refid="jsfunit.classpath"/>
             <pathelement location="${build.dir}"/>
             </classpath>
             <containerset timeout="3000">
             <generic name="My Container" port="8080">
             <startup target="tomcat-start"/>
             <shutdown target="tomcat-stop"/>
             </generic>
             </containerset>
             <formatter type="xml"/>
             <batchtest>
             <fileset dir="${build.dir}">
             <include name="**/*Test.java"/>
             </fileset>
             </batchtest>
            </cactus>
            
             </target>


            this the error i am facing


            Buildfile: build.xml
            
            clean:
             [delete] Deleting directory D:\try2\JSFUnitWarTask\destwar
             [mkdir] Created dir: D:\try2\JSFUnitWarTask\destwar
             [delete] Deleting directory D:\try2\JSFUnitWarTask\sourcewar
             [mkdir] Created dir: D:\try2\JSFUnitWarTask\sourcewar
            
            make.jsfunit.war:
             [echo] D:\try2\JSFUnitWarTask\sourcewar\jsfunittest.war
             [echo] D:\try2\JSFUnitWarTask\lib
             [war] Building war: D:\try2\JSFUnitWarTask\sourcewar\jsfunittest.war
            [jsfunitwar] Automatically adding JSFunit required jars to the new war
             [echo] C:\Program Files\Apache Software Foundation\Tomcat 6.0
             [cactus] -----------------------------------------------------------------
             [cactus] Running tests against My Container @ http://localhost:8080
             [cactus] -----------------------------------------------------------------
            
            tomcat-start:
             [java] Feb 13, 2008 5:26:33 PM org.apache.catalina.core.AprLifecycleListene
            r init
             [java] INFO: The Apache Tomcat Native library which allows optimal performa
            nce in production environments was not found on the java.library.path: C:\Progra
            m Files\Java\jdk1.6.0_03\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C
            :\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\
            Program Files\Java\jdk1.6.0_03\bin;D:\softwares\apache-ant-1.6.5\bin;
             [java] Feb 13, 2008 5:26:33 PM org.apache.coyote.http11.Http11Protocol init
            
             [java] INFO: Initializing Coyote HTTP/1.1 on http-8080
             [java] Feb 13, 2008 5:26:33 PM org.apache.catalina.startup.Catalina load
             [java] INFO: Initialization processed in 471 ms
             [java] Feb 13, 2008 5:26:33 PM org.apache.catalina.core.StandardService start
             [java] INFO: Starting service Catalina
             [java] Feb 13, 2008 5:26:33 PM org.apache.catalina.core.StandardEngine start
             [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
             [java] Feb 13, 2008 5:26:33 PM org.apache.coyote.http11.Http11Protocol start
             [java] INFO: Starting Coyote HTTP/1.1 on http-8080
             [java] Feb 13, 2008 5:26:33 PM org.apache.jk.common.ChannelSocket init
             [java] INFO: JK: ajp13 listening on /0.0.0.0:8009
             [java] Feb 13, 2008 5:26:33 PM org.apache.jk.server.JkMain start
             [java] INFO: Jk running ID=0 time=0/32 config=null
             [java] Feb 13, 2008 5:26:33 PM org.apache.catalina.startup.Catalina start
             [java] INFO: Server startup in 570 ms
            
            BUILD FAILED
            D:\try2\JSFUnitWarTask\build.xml:128: Failed to start the container after more t
            han [3000] ms. Trying to connect to the [http://localhost:8080/my-jsfunit-test/S
            ervletRedirector?Cactus_Service=RUN_TEST] test URL yielded a [-1] error code. Pl
            ease run in debug mode for more details about the error.



            can you help me out....

            and you are suggesting me for cargo ..but in cargo i found that it had support only upto tomcat 5 ...but i am using tomcat 6...n more over with cactus i can use generic container..so that i can go for any container....so i have used cactus..please go through my script and correct me if i am wrong..

            Thanks

            Thanks..

            • 18. Re: ANT
              mwringe

               

              "kingkon" wrote:

              BUILD FAILED
              D:\try2\JSFUnitWarTask\build.xml:128: Failed to start the container after more t
              han [3000] ms. Trying to connect to the [http://localhost:8080/my-jsfunit-test/S
              ervletRedirector?Cactus_Service=RUN_TEST] test URL yielded a [-1] error code.
              Please run in debug mode for more details about the error.




              • 19. Re: ANT
                kingkon

                Debug mode


                BUILD FAILED
                D:\try2\JSFUnitWarTask\build.xml:128: Failed to start the container after more t
                han [3000] ms. Trying to connect to the [http://localhost:8080/my-jsfunit-test/S
                ervletRedirector?Cactus_Service=RUN_TEST] test URL yielded a [-1] error code. Pl
                ease run in debug mode for more details about the error.
                 at org.apache.cactus.integration.ant.container.ContainerRunner.startUpCo
                ntainer(ContainerRunner.java:153)
                 at org.apache.cactus.integration.ant.CactusTask.executeInContainer(Cactu
                sTask.java:442)
                 at org.apache.cactus.integration.ant.CactusTask.execute(CactusTask.java:
                208)
                 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
                 at org.apache.tools.ant.Task.perform(Task.java:364)
                 at org.apache.tools.ant.Target.execute(Target.java:341)
                 at org.apache.tools.ant.Target.performTasks(Target.java:369)
                 at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
                 at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
                 at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
                cutor.java:40)
                 at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
                 at org.apache.tools.ant.Main.runBuild(Main.java:668)
                 at org.apache.tools.ant.Main.startAnt(Main.java:187)
                 at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
                 at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)


                • 20. Re: ANT
                  kingkon

                  Facing this error.....help me out


                  [cactus] Failed to connect to [http://localhost:8080/my-jsfunit-test/ServletR
                  edirector?Cactus_Service=RUN_TEST] (http://localhost:8080/my-jsfunit-test/Servle
                  tRedirector?Cactus_Service=RUN_TEST)
                   [cactus] Checking if server is up ...
                   [cactus] Failed to connect to [http://localhost:8080/my-jsfunit-test/ServletR
                  edirector?Cactus_Service=RUN_TEST] (http://localhost:8080/my-jsfunit-test/Servle
                  tRedirector?Cactus_Service=RUN_TEST)
                   [cactus] Checking if server is up ...
                   [cactus] Failed to connect to [http://localhost:8080/my-jsfunit-test/ServletR
                  edirector?Cactus_Service=RUN_TEST] (http://localhost:8080/my-jsfunit-test/Servle
                  tRedirector?Cactus_Service=RUN_TEST)
                  
                  BUILD FAILED
                  D:\try2\JSFUnitWarTask\build.xml:129: Failed to start the container after more t
                  han [3000] ms. Trying to connect to the [http://localhost:8080/my-jsfunit-test/S
                  ervletRedirector?Cactus_Service=RUN_TEST] test URL yielded a [-1] error code. Pl
                  ease run in debug mode for more details about the error.
                   at org.apache.cactus.integration.ant.container.ContainerRunner.startUpCo
                  ntainer(ContainerRunner.java:153)
                   at org.apache.cactus.integration.ant.CactusTask.executeInContainer(Cactu
                  sTask.java:442)
                   at org.apache.cactus.integration.ant.CactusTask.execute(CactusTask.java:
                  208)
                   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
                   at org.apache.tools.ant.Task.perform(Task.java:364)
                   at org.apache.tools.ant.Target.execute(Target.java:341)
                   at org.apache.tools.ant.Target.performTasks(Target.java:369)
                   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
                   at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
                   at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
                  cutor.java:40)
                   at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
                   at org.apache.tools.ant.Main.runBuild(Main.java:668)
                   at org.apache.tools.ant.Main.startAnt(Main.java:187)
                   at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
                   at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
                  


                  • 21. Re: ANT
                    kingkon

                    what is tag used for??

                    • 22. Re: ANT
                      kingkon

                       

                      <TestRunner/>


                      1 2 Previous Next