Use the unless
attribute.
If you don't want "test" to run, just
ant -Ddont.run.tests=true
It should be undefined if you want the tests to run. Ant just checks for whether it's defined at all. Also, there's an if
attribute that does the converse.
Here's an article on the both.