I'm not very good with Ant, but we're using it as a build tool. Right now, we can run "ant test" and it'll run through all the unit tests.
However, I'd love to be able to do something like ant test some_module
and have it accept some_module
as a parameter, and only test that.
I haven't been able to find how to pass command line args to Ant - any ideas?
To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.
Property is a name of property and value is a value associated to the property. Ex. It is used to show less information to the console.
One solution might be as follows. (I have a project that does this.)
Have a separate target similar to test
with a fileset
that restricts the test to one class only. Then pass the name of that class using -D
at the ant command line:
ant -Dtest.module=MyClassUnderTest single_test
In the build.xml (highly reduced):
<target name="single_test" depends="compile" description="Run one unit test"> <junit> <batchtest> <fileset dir="${test.dir}" includes="**/${test.module}.class" /> </batchtest> </junit> </target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With