ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 1144] New - failure output not written to file
Date Wed, 28 Mar 2001 23:48:40 GMT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1144

*** shadow/1144	Wed Mar 28 15:48:40 2001
--- shadow/1144.tmp.4579	Wed Mar 28 15:48:40 2001
***************
*** 0 ****
--- 1,122 ----
+ +============================================================================+
+ | failure output not written to file                                         |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 1144                        Product: Ant                     |
+ |       Status: NEW                         Version: 1.3                     |
+ |   Resolution:                            Platform: All                     |
+ |     Severity: Normal                   OS/Version: All                     |
+ |     Priority:                           Component: Optional Tasks          |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: ant-dev@jakarta.apache.org                                   |
+ |  Reported By: loney@spiritedsw.com                                         |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ Ouput is not written to file as expected unless formatter useFile option is set 
+ to true. Details below from junit discussion 
+ group (http://groups.yahoo.com/group/junit). Workaround is described as well.
+ 
+ From:  loney@spiritedsw.com
+ Date:  Wed Mar 28, 2001 11:32pm
+ Subject:  Re: JUnit 3.5 & Ant 1.3
+ 
+ On further investigation, the problem is that the FormatterElement 
+ useFile flag is mysteriously reset to false. I've spent way too much 
+ time on this bug hunt, so somebody else can pick it up from here if 
+ interested.
+ 
+ --- In junit@y..., loney@s... wrote:
+ > Failure to produce output is a bug in the junit ant task code. The 
+ > class JUnitTask that implements the output mechanism is completely 
+ > bypassed; deleting it from the jar has no effect. Rather, the task's 
+ > TestRunner makes JUnitTest objects directly without wrapping them in 
+ a 
+ > JUnitTask. Work-around is to explictly define the junit task 
+ formatter 
+ > usefile option, e.g.:
+ > 
+ >       <formatter type="xml" usefile="true" />
+ > 
+ > and add a todir option to the test, e.g.
+ > 
+ >       <test name="myClass" todir="myDir" />
+ > 
+ > The junit ant task is otherwise a handy feature and the various 
+ > authors are to be congratulated.
+ > 
+ > --- In junit@y..., Fred Loney <loney@s...> wrote:
+ > > Alas, it is often the case that expectation ~= reality. Although 
+ > defining the junit task _should_ not be necessary, myself and others 
+ > have observed that it is. It is correct that junit.jar only needs to 
+ > be added to the junit task classpath if fork="true". The other steps 
+ > described below proved necessary, and no configuration yields 
+ output. 
+ > Again, is there an example of an ant 1.3 junit 3.5 task that prints 
+ > output for failed tests?
+ > > 
+ > > I notice that ant terminates without returning control to a Win2k 
+ > batch file that executes it. Perhaps the missing output defect is a 
+ > manifestation of a larger control issue.
+ > > 
+ > > Vitezslav Stejskal wrote:
+ > > 
+ > > > Fred Loney wrote:
+ > > >
+ > > > > I encountered this problem, and had to do the following:
+ > > > >
+ > > > > o add junit.jar to the classpath of the ant executable
+ > > > > o add the ant optional jar to the classpath of the ant 
+ > executable
+ > > > >
+ > > >
+ > > > As I understand Ant and junit, only above two things are
+ > > > necceassary to do when you want to use junit optional task.
+ > > >
+ > > > > o aadd junit.jar to the classpath of the junit task
+ > > >
+ > > > This and maybe other jars from ${ANT_HOME}/lib you will need to
+ > > > add to junit task's classpath when you use the fork=yes 
+ attribute
+ > > > to run your tests in separate JVM.
+ > > >
+ > > > >
+ > > > > o explicitly define the junit task
+ > > >
+ > > > Definitely, this is not neccessary ...
+ > > >
+ > > > >
+ > > > >
+ > > > > The ant directives are shown below.
+ > > > >
+ > > > > However, given all of that, junit executes as expected and ant 
+ > shows the summary result for each test (success or failure).  
+ However, 
+ > ant does not produce any output file under any circumstances or 
+ > settings. Has anybody successfully used the junit task with ant 1.3 
+ > and junit 3.5? If so, could you post a sample?
+ > > > >
+ > > > >   <!-- Add optional junit task; requires invoking ant with 
+ > optional ant jar -->
+ > > > >   <taskdef name="junit" 
+ > classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" 
+ />
+ > > > >     ...
+ > > > >   <path id="test.class.path">
+ > > > >     <path refid="app.class.path" />
+ > > > >     <pathelement location="${ext.lib}/junit.jar" />
+ > > > >   </path>
+ > > > >    ...
+ > > > >   <!-- Run the test suite -->
+ > > > >   <target name="test" depends="testbed">
+ > > > >     <junit>
+ > > > >       <classpath refid="test.class.path" />
+ > > > >       <batchtest>
+ > > > >         <fileset dir="${source}" 
+ > includes="${test.dir}/**/*.java">
+ > > > >         </fileset>
+ > > > >       </batchtest>
+ > > > >     </junit>
+ > > > >   </target>
+ > > > >

Mime
View raw message