Elias
Elias

Reputation: 130

how to auto generate new unit test ant reports

I'm using ant junit to generate reports for my unit test,so lets say i have a unit test called userServiceTest so in my build.xml file i put the following :

<target name="UserServiceTest">
        <mkdir dir="${junit.output.dir}" />
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml" />
            <test name="webapp.service.UserServiceTest" todir="${junit.output.dir}" />
            <jvmarg line="-ea" />
            <classpath refid="Web Application.classpath" />
        </junit>
    </target>

now lets say i've added a new unit test class called productServiceTest is it possible to include this new unit test to be generated in my reports automatically?

Thank you in advance.

Upvotes: 0

Views: 237

Answers (1)

yorammi
yorammi

Reputation: 6458

Try <batchtest> instead of <test>:

<target name="UserServiceTest">
        <mkdir dir="${junit.output.dir}" />
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml" />
            <batchtest fork="yes" todir="${junit.output.dir}">
                 <fileset dir="${src.tests}">
                      <include name="webapp.service.*ServiceTest"/> 
                  </fileset>
            </batchtest>
            <jvmarg line="-ea" />
            <classpath refid="Web Application.classpath" />
        </junit>
</target>

Upvotes: 1

Related Questions