avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leif Mortenson <l...@silveregg.co.jp>
Subject Re: [VOTE] modify build.xml to use JUnitReport for tests
Date Thu, 24 Jan 2002 04:20:48 GMT
Peter Donald wrote:

>On Thu, 24 Jan 2002 14:18, Leif Mortenson wrote:
>>If you run build test on Excalibur, the output can be a little
>>overwhelming. It is not easy to get a feel for the overall state of the
>>project without looking over each test result one by one, making sure
>>that they passed.
>>Luckily ant has the JunitReport task, which creates a beautiful set of
>>html reports clearly showing the results of the test suite.
>>I wanted to ask before making this change because it would require that
>>the test outfiles be changed from text files to xml files.
>>I'll start with my +1
>I would prefer to have at least the option to do text reports. The main 
>reason is I tend to run the tests from inside the editor and it is far easer 
>to tell which things are working or not while developing a particular 
>package. So maybe we could add  a property "build.xml-reports" or something 
>to determine which version we run.
>Alternatively we could have a "single test target" which only tests a single 
>junit class (passed in from command line via 
>-Djunit.test=org.excalibur.MyTest) and uses the text formatter?
>Or something else?

Glad I asked then.  It looks like like the junit task allows you to 
specify two formatters.
So I can make it output both text and xml reports.

As I was adding that though I realized that there is already another 
task called
test-reports which already does this.  How would you feel about removing 
the test-reports
task in favor of the method above to reduce code duplication?

If there is concern about the clutter caused by both text and xml files 
being in the reports
directory, that problem could be solved by deleting the test xml files 
after the junittest
task has completed.

I like the idea of being able to run individual tests, so I added a new 
task test-subset
which expects a property junit.test for the test(s) to be run.

I'm including the diff of that.



cvs -z3 diff build.xml (in directory E:\Jakarta\jakarta-avalon-excalibur\)
Index: build.xml
RCS file: /home/cvs/jakarta-avalon-excalibur/build.xml,v
retrieving revision 1.88
diff -r1.88 build.xml
<       <formatter type="plain"/>
 >       <formatter type="xml"/>    <!-- xml reports for junitreport -->
 >       <formatter type="plain"/>  <!-- text reports for humans     -->
 >     <junitreport todir="${build.reports}">
 >       <fileset dir="${build.reports}">
 >         <include name="TEST-*.xml"/>
 >       </fileset>
 >       <report format="frames" todir="${build.reports}/html"/>
 >     </junitreport>
 >   </target>
 >   <target name="test-subset-check" unless="junit.test">
 >     <fail message="junit.test not specified.  Example usage: build 
test-subset -Djunit.test=**/ResourceLimiting*TestCase.class" />
 >   </target>
 >   <target name="test-subset" depends="test-subset-check, compile" 
description="perferm a subset of unit tests">
 >     <mkdir dir="${build.reports}"/>
 >     <junit fork="true" printsummary="yes" dir="${build.reports}">
 >       <formatter type="plain"/>  <!-- text reports for humans     -->
 >       <classpath>
 >         <path refid="test.class.path"/>
 >         <pathelement location="${build.classes}"/>
 >         <pathelement location="${build.scratchpad}"/>
 >       </classpath>
 >       <batchtest todir="${build.reports}">
 >         <fileset dir="${build.classes}">
 >           <include name="${junit.test}"/>
 >         </fileset>
 >         <fileset dir="${build.scratchpad}">
 >           <include name="${junit.test}"/>
 >         </fileset>
 >       </batchtest>
 >     </junit>

To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message