I'm very new to ant and junit. I need junit to create an xml output so I can integrate with team city. The tests run just fine, but I'm not getting any output in the directory that I'm specifying. I'm running on windows 7. I have junit.jar and ant-junit.jar in my ant_home/lib directory. here is my build xml target:
<target name="onlyjunit-sikuli" description="Execute All sikuli tests">
<delete dir="${automated}/results/sikuli"/>
<mkdir dir="${automated}/results"/>
<mkdir dir="${automated}/results/sikuli"/>
<junit printsummary="yes" showoutput="yes" fork="true" forkmode="once">
<jvmarg value="-Xmx512m"/>
<jvmarg value="-Xms512m"/>
<jvmarg value="-Dsikuli.mode=${sikuli.mode}"/>
<classpath refid="classpath.test"/>
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<batchtest if="env.testname" todir="${automated}/results/sikuli">
<fileset dir="${automated}/src">
<include name="**/com/foo/builder/Sikuli/**/${env.testname}.java"/>
</fileset>
</batchtest>
<test unless="env.testname" name="com.foo.builder.Sikuli.SikuliTestSuite"/>
</junit>
<junitreport todir="${automated}/results/sikuli/report">
<fileset dir="${automated}/results/sikuli" includes="*.xml"/>
<report todir="${automated}/results/sikuli/report"/>
</junitreport>
</target>
What am I doing wrong?
I had to add a todir on the test element.
来源:https://stackoverflow.com/questions/5994790/ant-and-junit-no-xml-report-being-generated