First, I have searched in stackoverflow, the following questions are related to mine, but not exactly what I wanted:
Suppose I have more than 100 test cases: A1Test... A100Test. I can make bachtest
of junit in ant
to run all of them. But I only want to run, say, A50Test. How I config my build.xml
, so that I can run:
ant test A50Test
I don't want to create 100 targets for each of the test.
Introduce property which defines test name you want to execute:
<property name="unit.test" value="*.java" />
Use this property in your batchtest:
<batchtest fork="yes" todir="${output.test.dir}">
<fileset dir="${source.test.dir}" includes="**/${unit.test}"/>
</batchtest>
Pass value for this property to ant:
ant test -Dunit.test=A50Test