Reputation: 314
There is part of ant script with junit task:
...
<target name="test">
<mkdir dir="path_to_report_dir">
<junit fork="true" printsummary="true" showoutput="true" maxmemory="1024M">
<classpath ... />
<batchtest todir="path_to_report_dir">
<formatter type="xml" />
<fileset ... />
</batchtest>
</junit>
</target>
...
This script works from Eclipse and from command line. But it doesn't work in TeamCity. The last informative message in TeamCity is: [mkdir] Created dir: path_to_report_dir Process exit code: 0
It looks like junit task doesn't work and also it stops performting aff all script. Where is trouble in?
Upvotes: 0
Views: 1463
Reputation: 314
The cause was in <fileset>
file list. The TeamCity version of Ant doesn't work with strings like "/test/"
(this mean select all files recursively); it only works with strings like "**/test/*.class"
. The local version of Ant supports both variants.
Thanks.
Upvotes: 1
Reputation: 77991
Don't know if this helps.... but here's my standard test target:
<target name="test" depends="compile-tests">
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="test.path"/>
<pathelement path="${classes.dir}"/>
<pathelement path="${test.classes.dir}"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.reports.dir}">
<fileset dir="${test.src.dir}">
<include name="**/*Test*.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
Build output:
test:
[junit] Running org.demo.AppTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.056 sec
Notes
Upvotes: 0