Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to skip junit tests in ant build script?

Tags:

ant

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?

like image 885
JRR Avatar asked May 05 '13 04:05

JRR


People also ask

Can JUnit be integrated with ant?

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.

How do I stop JUnit test in Eclipse?

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.

Can JUnit be run automatically?

JUnit provides Test runners for running tests. JUnit tests can be run automatically and they check their own results and provide immediate feedback.


1 Answers

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.

like image 176
Bogdan Avatar answered Sep 22 '22 08:09

Bogdan