skip a single junit test from command line

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

skip a single junit test from command line

Tranquil
Hi,

Is there a way to skip a single junit test while running from command line
(without changing the java code or pom.xml?)

mvn install -DskipTests -> this will work for all tests

so something like mvn install -DskipTests='path/to/test/Test.java'  to
ignore a single one... ?


thanks!
Reply | Threaded
Open this post in threaded view
|

Re: skip a single junit test from command line

Anders Hammar
No, there isn't. (Unless you're using TestNG and have an appropriate group
which you can exclude through excludedGroups).

/Anders

On Mon, May 16, 2011 at 15:54, eyal edri <[hidden email]> wrote:

> Hi,
>
> Is there a way to skip a single junit test while running from command line
> (without changing the java code or pom.xml?)
>
> mvn install -DskipTests -> this will work for all tests
>
> so something like mvn install -DskipTests='path/to/test/Test.java'  to
> ignore a single one... ?
>
>
> thanks!
>
Reply | Threaded
Open this post in threaded view
|

Re: skip a single junit test from command line

Barrie Treloar
In reply to this post by Tranquil
On Mon, May 16, 2011 at 11:24 PM, eyal edri <[hidden email]> wrote:
> Hi,
>
> Is there a way to skip a single junit test while running from command line
> (without changing the java code or pom.xml?)
>
> mvn install -DskipTests -> this will work for all tests
>
> so something like mvn install -DskipTests='path/to/test/Test.java'  to
> ignore a single one... ?

Kind of,

http://maven.apache.org/plugins/maven-surefire-plugin/examples/single-test.html

mvn -Dtest=TestSquare,TestCi*le test

But that would require you to craft an expression that included every
test BUT the one you wanted.
Which is unlikely to be possible.

Why are you trying to skip one test?
Why not fix the code so it works, or disable the test in the code, or use
http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#testFailureIgnore
to ignore the fact that the test is failing.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]