5 Replies Latest reply on Oct 4, 2005 8:06 PM by Bob Walker

    Suggested one-line addition to build.xml: Allow running just

    Bob Walker Newbie

      In order to allow running a single test case without hacking the build file or deleting mass class files, make the suggested change to build.xml, run the build command with one extra define (-D) argument, testcase, and you should only have to sit through one test?s execution.

      testcase is the classname to execute (with the redundant prefix, org.jboss.admin., omitted).

      The output is placed in the output/ant/test-reports directory, but with a different prefix (TESTCASE, instead of TEST) to the testname, in order to facilitate distinguishing the two types of reports:

      TESTCASE-org.jboss.admin.console.web.struts.jms.SaveDestinationActionTest.txt

      TEST-org.jboss.admin.console.web.struts.datasource.FlushPoolActionTest.txt

       **** Sample output ****
      C:\_dev\jack's\jboss-head\admin-console>build test -Dtestcase=console.web.struts.jms.SaveDestinationActionTest
      
      Calling ..\tools\bin\ant.bat -logger org.apache.tools.ant.NoBannerLogger test -Dtestcase console.web.struts.jms.SaveDestinationActionTest
      
      Buildfile: build.xml
      
      test:
      
       [junit] Running org.jboss.admin.console.web.struts.jms.SaveDestinationActionTest
      
       [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.781 sec
      
      BUILD FAILED
      
      C:\_dev\jack's\jboss-head\admin-console\build.xml:97: Test org.jboss.admin.console.web.struts.jms.SaveDestinationActionTest failed
      
      Total time: 4 seconds
      


      Here?s the one-line change. (It?s actually a 1.1-line change, because the batchtest element needs to know when not to run.)
       <junit ? 
       <test
       if="testcase"
       name="org.jboss.admin.${testcase}"
       fork="yes"
       outfile="TESTCASE-org.jboss.admin.${testcase} "
       todir="output/ant/test-reports"/>
      
       <batchtest 
       unless="testcase"
       fork="yes"
       todir="output/ant/test-reports">
      


      Does anyone object, or wish to present an alternative means of achieving the desired objective (running a single test)?

      Thanks,
      Bob the dinosaur