You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jeremy Boynes <jb...@apache.org> on 2010/10/08 03:37:49 UTC

[taglibs] Pick common format for test class names

We have different formats for test class names and need to specifically list them in the pom.xml file.

i'd like to propose picking a standard format and using a single wildcarded pattern to select them. The defaults for the surefire plugin are:
	**/Test*.java
	**/*Test.java
	**/*TestCase.java

i would suggest one of the latter 2 to avoid conflicts with inner classes (e.g. TestTransformSupport$1)

Thoughts?
Jeremy
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [taglibs] Pick common format for test class names

Posted by Jeremy Boynes <jb...@apache.org>.
On Oct 10, 2010, at 7:01 AM, Konstantin Kolinko wrote:

> 2010/10/8 Jeremy Boynes <jb...@apache.org>:
>> We have different formats for test class names and need to specifically list them in the pom.xml file.
>> 
>> i'd like to propose picking a standard format and using a single wildcarded pattern to select them. The defaults for the surefire plugin are:
>>        **/Test*.java
>>        **/*Test.java
>>        **/*TestCase.java
>> 
> 
> Tomcat trunk already uses Test* for tests,
> and *Test for abstract base classes, like e.g. CookiesBaseTest.java  here:
> 
> http://svn.apache.org/repos/asf/tomcat/trunk/test/org/apache/tomcat/util/http/

I prefer Test* as well but don't want to fight Maven. Going with Test* means maintaining include or exclude lists which is an extra step that can lead to error. We already had an issue with some tests not being run because the includes were not set up right.

Based on the other replies I'd renamed all tests in impl to match **/*Test.java to give consistency; we can always change it again.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [taglibs] Pick common format for test class names

Posted by Jeremy Boynes <jb...@apache.org>.
On Oct 10, 2010, at 7:01 AM, Konstantin Kolinko wrote:
...
> 
> I do not know surefire, but the above file masks end with *.java,  and
> your inner classes do not have .java suffix in them. Is there really a
> problem??

This is what happens if I rename SetSupportTest to TestSetSupport:

-------------------------------------------------------------------------------
Test set: org.apache.taglibs.standard.tag.common.core.TestSetSupport$Bean
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.007 sec <<< FAILURE!
initializationError(org.apache.taglibs.standard.tag.common.core.TestSetSupport$Bean)  Time elapsed: 0.003 sec  <<< ERROR!
java.lang.Exception: No runnable methods
	at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:171)
	at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:115)
	at org.junit.runners.ParentRunner.validate(ParentRunner.java:269)
	at org.junit.runners.ParentRunner.<init>(ParentRunner.java:66)
	at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:59)
	at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:13)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
	at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
	at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.<init>(JUnit4TestSet.java:45)
	at org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite.createTestSet(JUnit4DirectoryTestSuite.java:56)
	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:96)
	at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:209)
	at org.apache.maven.surefire.Surefire.run(Surefire.java:156)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)


Re: [taglibs] Pick common format for test class names

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/10/8 Jeremy Boynes <jb...@apache.org>:
> We have different formats for test class names and need to specifically list them in the pom.xml file.
>
> i'd like to propose picking a standard format and using a single wildcarded pattern to select them. The defaults for the surefire plugin are:
>        **/Test*.java
>        **/*Test.java
>        **/*TestCase.java
>

Tomcat trunk already uses Test* for tests,
and *Test for abstract base classes, like e.g. CookiesBaseTest.java  here:

http://svn.apache.org/repos/asf/tomcat/trunk/test/org/apache/tomcat/util/http/


> i would suggest one of the latter 2 to avoid conflicts with inner classes (e.g. TestTransformSupport$1)
>

I do not know surefire, but the above file masks end with *.java,  and
your inner classes do not have .java suffix in them. Is there really a
problem??

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [taglibs] Pick common format for test class names

Posted by Rahul Akolkar <ra...@gmail.com>.
On Thu, Oct 7, 2010 at 9:37 PM, Jeremy Boynes <jb...@apache.org> wrote:
> We have different formats for test class names and need to specifically list them in the pom.xml file.
>
> i'd like to propose picking a standard format and using a single wildcarded pattern to select them. The defaults for the surefire plugin are:
>        **/Test*.java
>        **/*Test.java
>        **/*TestCase.java
>
> i would suggest one of the latter 2 to avoid conflicts with inner classes (e.g. TestTransformSupport$1)
>
> Thoughts?
<snip/>

If you want to do this, I'd +1 *Test.java (shorter).

-Rahul


> Jeremy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [taglibs] Pick common format for test class names

Posted by Rex Wang <rw...@gmail.com>.
+1 for *Test.java

2010/10/8 Jeremy Boynes <jb...@apache.org>

> We have different formats for test class names and need to specifically
> list them in the pom.xml file.
>
> i'd like to propose picking a standard format and using a single wildcarded
> pattern to select them. The defaults for the surefire plugin are:
>        **/Test*.java
>        **/*Test.java
>        **/*TestCase.java
>
> i would suggest one of the latter 2 to avoid conflicts with inner classes
> (e.g. TestTransformSupport$1)
>
> Thoughts?
> Jeremy
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>


-- 
Lei Wang (Rex)
rwonly AT apache.org