简体   繁体   中英

BatchTest (Ant) not “executing” JUnit tests

The following ANT script executes the 2 tests mentioned:

<target name="tests">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
        <test name="x.atest" todir="${junit.output.dir}"/>
        <test name="x.ytest" todir="${junit.output.dir}"/>              
        <classpath refid="ab.classpath"/>
    </junit>
</target>

However, when I am trying to change it to BatchTest, it builds successfully but does not execute the tests:

<target name="tests">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
        <batchtest todir="${junit.output.dir}" fork="yes">
            <fileset dir="${tests.dir}">
                <include name="**/.class" />
            </fileset>
        </batchtest>
        <classpath refid="ab.classpath"/>
    </junit>
</target>

I am out of my wits now as what might be missing here. Can someone please help?

Without seeing what in ${tests.dir} I can't really tell, but does ${tests.dir} contain the compiled unit tests or the source code for the tests? if it's the latter try changing <include name="**/.class" /> to <include name="**/.java" /> or pointing the dir atrribute of fileset to whereever the compiled tests are outputted to

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM