You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andrew Pennebaker <ap...@42six.com> on 2013/11/25 16:07:53 UTC

mvn test -Dtest=...TestClass shows the wrong error

If I try to run a single test class with:

mvn test -Dtest=namespace1.TestClass

But TestClass is really in namespace1.namespace2, then Maven reports:

Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on
project p1: No tests were executed!  (Set -DfailIfNoTests=false to ignore
this error.)

Which is misleading. In fact, there is no class namespace1.TestClass. Would
be nice if the message for this edge case were changed to something like:

No such class: namespace1.TestClass.

The current error message had me scratching my head for a while--TestClass
*does* have @Test methods!--before I realized I had forgotten to go one
level deeper in my namespace.

--
Cheers,

Andrew Pennebaker
apennebaker@42six.com

Re: mvn test -Dtest=...TestClass shows the wrong error

Posted by Andrew Pennebaker <ap...@42six.com>.
Not quite. I want a specific error message printed when a user specifies a
test class to run, and the class does not exist.

I updated my surefire version to 2.12 and got the same behavior as before.


On Mon, Nov 25, 2013 at 4:28 PM, Robert Scholte <rf...@apache.org>wrote:

> IIUC this has been fixed with version 2.12 by adding the
> failIfNoSpecifiedTests[1]
>
> Robert
>
> [1] http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#
> failIfNoSpecifiedTests
>
>
> Op Mon, 25 Nov 2013 16:07:53 +0100 schreef Andrew Pennebaker <
> apennebaker@42six.com>:
>
>  If I try to run a single test class with:
>>
>> mvn test -Dtest=namespace1.TestClass
>>
>> But TestClass is really in namespace1.namespace2, then Maven reports:
>>
>> Failed to execute goal
>> org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on
>> project p1: No tests were executed!  (Set -DfailIfNoTests=false to ignore
>> this error.)
>>
>> Which is misleading. In fact, there is no class namespace1.TestClass.
>> Would
>> be nice if the message for this edge case were changed to something like:
>>
>> No such class: namespace1.TestClass.
>>
>> The current error message had me scratching my head for a while--TestClass
>> *does* have @Test methods!--before I realized I had forgotten to go one
>>
>> level deeper in my namespace.
>>
>> --
>> Cheers,
>>
>> Andrew Pennebaker
>> apennebaker@42six.com
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Cheers,

Andrew Pennebaker
apennebaker@42six.com

Re: mvn test -Dtest=...TestClass shows the wrong error

Posted by Robert Scholte <rf...@apache.org>.
IIUC this has been fixed with version 2.12 by adding the  
failIfNoSpecifiedTests[1]

Robert

[1]  
http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#failIfNoSpecifiedTests


Op Mon, 25 Nov 2013 16:07:53 +0100 schreef Andrew Pennebaker  
<ap...@42six.com>:

> If I try to run a single test class with:
>
> mvn test -Dtest=namespace1.TestClass
>
> But TestClass is really in namespace1.namespace2, then Maven reports:
>
> Failed to execute goal
> org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on
> project p1: No tests were executed!  (Set -DfailIfNoTests=false to ignore
> this error.)
>
> Which is misleading. In fact, there is no class namespace1.TestClass.  
> Would
> be nice if the message for this edge case were changed to something like:
>
> No such class: namespace1.TestClass.
>
> The current error message had me scratching my head for a  
> while--TestClass
> *does* have @Test methods!--before I realized I had forgotten to go one
> level deeper in my namespace.
>
> --
> Cheers,
>
> Andrew Pennebaker
> apennebaker@42six.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org