Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get ant JUnit result in user defined xml file name?

Tags:

junit4

ant

How to get ant JUnit result in user defined xml file name? Junit (ant task) by default creates TEST-testcasename.xml for results, is there a way to change this xml file name? I am running same testcase multiple times for different browsers and currently the result for one browser is being overwritten by another browser's result.

Here is my code:

<target name="junit1">
<junit fork="true" forkmode="once" haltonfailure="false" logfailedtests="true">
<classpath refid="classpath.project"/>
<formatter type="xml"/>
<jvmarg value="-Dbrowser=${browser}"/>
<batchtest todir="${dir.report}">
    <fileset dir="${dir.src}">
        <include name="${testcase}"/>
    </fileset>
</batchtest>
</junit> 
like image 229
user1019163 Avatar asked Nov 29 '25 22:11

user1019163


1 Answers

Why don't you just use a different output directory for each browser, or copy the output directory to another one when tests are finished?

<batchtest todir="${dir.report}/${browser}">

If you need all the files to be in the same directory, rename (or copy) them after each batch using the move (or copy) task with a glob mapper :

<mapper type="glob" from="TEST*.xml" to="${browser}-TEST*.xml"/>
like image 113
JB Nizet Avatar answered Dec 02 '25 03:12

JB Nizet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!