You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chad La Joie <ch...@switch.ch> on 2008/04/03 13:37:15 UTC
Surefire not excluding jUnit TestSuite$1
I've checked the docs, mail archive, and open bug list for this one
because I'm sure I'm just missing something stupid.
When surefire runs my unit tests it always attempts to run
junit.framework.TestSuite$1 which, of course, fails. The surefire docs
note that the default test exclude list is **/*$*, which is presumably
meant to avoid this problem. For some reason though this test is not
being skipped in my setup. I've tried manually setting the exclude list
to the default value indicated by the docs as well other things meant to
try and capture TestSuite (e.g. **/TestSuite*,
/junit/framework/TestSuite*) and nothing seems to work.
I'm using Maven 2.0.8 with surefire plugin 2.4.2 on Java 1.5.0_13 on OS
X 10.5.
Following is an example of one plugin configuration in my default build
section and I have no other profiles overriding these settings:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<excludes>
<exclude>**/*$*</exclude>
<exclude>**/TestSuite*</exclude>
<exclude>/junit/framework/TestSuite*</exclude>
<exclude>/junit/**</exclude>
</excludes>
</configuration>
</plugin>
Can some one point out what I'm missing? Thanks.
--
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Security
Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
phone +41 44 268 15 75, fax +41 44 268 15 68
chad.lajoie@switch.ch, http://www.switch.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Surefire not excluding jUnit TestSuite$1
Posted by Chad La Joie <ch...@switch.ch>.
Done: http://jira.codehaus.org/browse/SUREFIRE-480
Martin Höller wrote:
> On Thursday 03 April 2008 Chad La Joie wrote:
>> The error message in the summary report wasn't at all helpful and I
>> missed the line in "<<< FAILURE!" line in the scrolling text as the
>> tests were ran. A better error message would really help here. I think
>> just reporting, in the summary, the "TestCase" class that didn't
>> actually contain tests would probably be sufficient.
>
> Could you please file a JIRA for this, so it might be fixed in a future
> version.
>
> thx,
> - martin
--
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Security
Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
phone +41 44 268 15 75, fax +41 44 268 15 68
chad.lajoie@switch.ch, http://www.switch.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Surefire not excluding jUnit TestSuite$1
Posted by Martin Höller <ma...@xss.co.at>.
On Thursday 03 April 2008 Chad La Joie wrote:
> The error message in the summary report wasn't at all helpful and I
> missed the line in "<<< FAILURE!" line in the scrolling text as the
> tests were ran. A better error message would really help here. I think
> just reporting, in the summary, the "TestCase" class that didn't
> actually contain tests would probably be sufficient.
Could you please file a JIRA for this, so it might be fixed in a future
version.
thx,
- martin
Re: Surefire not excluding jUnit TestSuite$1
Posted by Kathryn Huxtable <ka...@kathrynhuxtable.org>.
Sorry. Didn't mean to post that to the list. -K
On Apr 3, 2008, at 2:38 PM, Kathryn Huxtable wrote:
> So how are you liking Maven now? -K
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Surefire not excluding jUnit TestSuite$1
Posted by Kathryn Huxtable <ka...@kathrynhuxtable.org>.
So how are you liking Maven now? -K
On Apr 3, 2008, at 2:19 PM, Chad La Joie wrote:
> Alright, one of our developers located the problem.
>
> It appears that when surefire runs it creates a TestSuite from all
> concrete classes that match the default includes pattern (**/
> Test*.java, **/*Test.java, **/*TestCase.java). In this project
> there was a non-abstract base class that all tests were inheriting
> from called BaseTestCase (in the other projects this class was
> abstract). This matched the include rule, but wasn't a valid test
> case and this is what caused the error.
>
> The error message in the summary report wasn't at all helpful and I
> missed the line in "<<< FAILURE!" line in the scrolling text as the
> tests were ran. A better error message would really help here. I
> think just reporting, in the summary, the "TestCase" class that
> didn't actually contain tests would probably be sufficient.
>
> Chad La Joie wrote:
>> Martin, thanks for the reply, unfortunately the debug output didn't
>> help, but it did lead me to look at something else.
>> I have other projects that use Maven as well and none of them
>> exhibit this problem, so it seems like it must be something with
>> this project's POM. However, if I diff this project's POM with
>> another project the only differences are the dependencies and
>> project information (like name, version, etc.). The other portions
>> are all the same.
>> In both cases (this project with the error and the other projects
>> without it) when I run Maven on debug and without explicitly
>> configuring surefire in my POM, surefire doesn't report an excludes
>> property (so surefire must use its default setting in absence of
>> the list rather than adding the default value to the list if no
>> other value is presented). If I add back in the snippet below the
>> plugin correctly reports list of exclusions but still exclude
>> TestSuite.
>> So, certainly it would seem to be something wrong with my POM, but
>> I sure can't see what it is. I'm pretty new to Maven, so I don't
>> know its guts. Does it cache configuration information somewhere
>> that wouldn't be removed by a clean? I know about the SuperPOM but
>> its settings don't touch this plugin and my settings.xml only
>> contains a single property pointing to my gpg signing key so that
>> shouldn't be overriding anything And, if either of these were to
>> blame it would show up in more than just this one project, I would
>> think.
>> Martin Höller wrote:
>>> On Thursday 03 April 2008 Chad La Joie wrote:
>>>
>>>> <plugin>
>>>> <groupId>org.apache.maven.plugins</groupId>
>>>> <artifactId>maven-surefire-plugin</artifactId>
>>>> <configuration>
>>>> <testFailureIgnore>true</testFailureIgnore>
>>>> <excludes>
>>>> <exclude>**/*$*</exclude>
>>>> <exclude>**/TestSuite*</exclude>
>>>> <exclude>/junit/framework/TestSuite*</
>>>> exclude>
>>>> <exclude>/junit/**</exclude>
>>>> </excludes>
>>>> </configuration>
>>>> </plugin>
>>>
>>> Try running maven with -X and see what surefire says about its
>>> excludes. Maybe you have to quote the dollar sign somehow.
>>>
>>> hth,
>>> - martin
>
> --
> SWITCH
> Serving Swiss Universities
> --------------------------
> Chad La Joie, Software Engineer, Security
> Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
> phone +41 44 268 15 75, fax +41 44 268 15 68
> chad.lajoie@switch.ch, http://www.switch.ch
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Surefire not excluding jUnit TestSuite$1
Posted by Chad La Joie <ch...@switch.ch>.
Alright, one of our developers located the problem.
It appears that when surefire runs it creates a TestSuite from all
concrete classes that match the default includes pattern (**/Test*.java,
**/*Test.java, **/*TestCase.java). In this project there was a
non-abstract base class that all tests were inheriting from called
BaseTestCase (in the other projects this class was abstract). This
matched the include rule, but wasn't a valid test case and this is what
caused the error.
The error message in the summary report wasn't at all helpful and I
missed the line in "<<< FAILURE!" line in the scrolling text as the
tests were ran. A better error message would really help here. I think
just reporting, in the summary, the "TestCase" class that didn't
actually contain tests would probably be sufficient.
Chad La Joie wrote:
> Martin, thanks for the reply, unfortunately the debug output didn't
> help, but it did lead me to look at something else.
>
> I have other projects that use Maven as well and none of them exhibit
> this problem, so it seems like it must be something with this project's
> POM. However, if I diff this project's POM with another project the
> only differences are the dependencies and project information (like
> name, version, etc.). The other portions are all the same.
>
> In both cases (this project with the error and the other projects
> without it) when I run Maven on debug and without explicitly configuring
> surefire in my POM, surefire doesn't report an excludes property (so
> surefire must use its default setting in absence of the list rather than
> adding the default value to the list if no other value is presented). If
> I add back in the snippet below the plugin correctly reports list of
> exclusions but still exclude TestSuite.
>
> So, certainly it would seem to be something wrong with my POM, but I
> sure can't see what it is. I'm pretty new to Maven, so I don't know its
> guts. Does it cache configuration information somewhere that wouldn't
> be removed by a clean? I know about the SuperPOM but its settings don't
> touch this plugin and my settings.xml only contains a single property
> pointing to my gpg signing key so that shouldn't be overriding anything
> And, if either of these were to blame it would show up in more than
> just this one project, I would think.
>
> Martin Höller wrote:
>> On Thursday 03 April 2008 Chad La Joie wrote:
>>
>>> <plugin>
>>> <groupId>org.apache.maven.plugins</groupId>
>>> <artifactId>maven-surefire-plugin</artifactId>
>>> <configuration>
>>> <testFailureIgnore>true</testFailureIgnore>
>>> <excludes>
>>> <exclude>**/*$*</exclude>
>>> <exclude>**/TestSuite*</exclude>
>>> <exclude>/junit/framework/TestSuite*</exclude>
>>> <exclude>/junit/**</exclude>
>>> </excludes>
>>> </configuration>
>>> </plugin>
>>
>> Try running maven with -X and see what surefire says about its
>> excludes. Maybe you have to quote the dollar sign somehow.
>>
>> hth,
>> - martin
>
--
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Security
Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
phone +41 44 268 15 75, fax +41 44 268 15 68
chad.lajoie@switch.ch, http://www.switch.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Surefire not excluding jUnit TestSuite$1
Posted by Chad La Joie <ch...@switch.ch>.
Martin, thanks for the reply, unfortunately the debug output didn't
help, but it did lead me to look at something else.
I have other projects that use Maven as well and none of them exhibit
this problem, so it seems like it must be something with this project's
POM. However, if I diff this project's POM with another project the
only differences are the dependencies and project information (like
name, version, etc.). The other portions are all the same.
In both cases (this project with the error and the other projects
without it) when I run Maven on debug and without explicitly configuring
surefire in my POM, surefire doesn't report an excludes property (so
surefire must use its default setting in absence of the list rather than
adding the default value to the list if no other value is presented).
If I add back in the snippet below the plugin correctly reports list of
exclusions but still exclude TestSuite.
So, certainly it would seem to be something wrong with my POM, but I
sure can't see what it is. I'm pretty new to Maven, so I don't know its
guts. Does it cache configuration information somewhere that wouldn't
be removed by a clean? I know about the SuperPOM but its settings don't
touch this plugin and my settings.xml only contains a single property
pointing to my gpg signing key so that shouldn't be overriding anything
And, if either of these were to blame it would show up in more than
just this one project, I would think.
Martin Höller wrote:
> On Thursday 03 April 2008 Chad La Joie wrote:
>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-surefire-plugin</artifactId>
>> <configuration>
>> <testFailureIgnore>true</testFailureIgnore>
>> <excludes>
>> <exclude>**/*$*</exclude>
>> <exclude>**/TestSuite*</exclude>
>> <exclude>/junit/framework/TestSuite*</exclude>
>> <exclude>/junit/**</exclude>
>> </excludes>
>> </configuration>
>> </plugin>
>
> Try running maven with -X and see what surefire says about its excludes.
> Maybe you have to quote the dollar sign somehow.
>
> hth,
> - martin
--
SWITCH
Serving Swiss Universities
--------------------------
Chad La Joie, Software Engineer, Security
Werdstrasse 2, P.O. Box, 8021 Zürich, Switzerland
phone +41 44 268 15 75, fax +41 44 268 15 68
chad.lajoie@switch.ch, http://www.switch.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Surefire not excluding jUnit TestSuite$1
Posted by Martin Höller <ma...@xss.co.at>.
On Thursday 03 April 2008 Chad La Joie wrote:
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <configuration>
> <testFailureIgnore>true</testFailureIgnore>
> <excludes>
> <exclude>**/*$*</exclude>
> <exclude>**/TestSuite*</exclude>
> <exclude>/junit/framework/TestSuite*</exclude>
> <exclude>/junit/**</exclude>
> </excludes>
> </configuration>
> </plugin>
Try running maven with -X and see what surefire says about its excludes.
Maybe you have to quote the dollar sign somehow.
hth,
- martin