I downloaded a large project that uses ant to build and it runs an extensive number of junit tests each time after compilation. Is there a way to by pass all those tests without changing every individual build file?
Learn Maven and Ant the easy way! There are a number of JUnit extensions available. If you are unfamiliar with JUnit, you should download it from www.junit.org and read its manual. This chapter shows how to execute JUnit tests by using Ant. The use of Ant makes it straight forward through the JUnit task.
You press the 'Stop JUnit test run' wanting to halt the execution immediately. And it doesn't! Then you must go to the Debug view (why that name? i'm not debugging, i'm running) and 'Terminate' it from there.
JUnit provides Test runners for running tests. JUnit tests can be run automatically and they check their own results and provide immediate feedback.
Any decent ANT build file should have well defined execution targets that can be called individually and declare dependencies to other targets if needed, basically something like this:
<project default="unitTests">
<target name="clean">
<echo message="Cleaning..." />
</target>
<target name="compile" depends="clean">
<echo message="Compiling..." />
</target>
<target name="unitTests" depends="compile">
<echo message="Testing..." />
</target>
</project>
The default target (specified in the <project>
tag) is usually the most comprehensive task that compiles the project and ensures integrity of the application by also running unit tests.
If your project's build file is constructed like that, then it's a matter of running ANT with the compile target and that will skip the tests. If it isn't built like that then there is no other way than to change the build file and separate the unit tests into it's own target that is not the default.
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