[ 
http://jira.codehaus.org/browse/SUREFIRE-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kristian Rosenvold closed SUREFIRE-458.
---------------------------------------

    Resolution: Won't Fix
      Assignee: Kristian Rosenvold

Marking this issue won't fix:

This is supported by the "groups" attribute for TestNG, and the corresponding 
JUnit feature (@Categories support) is SUREFIRE-656. We will not be supporting 
any additional selection mechanisms since both the major test frameworks now 
support it.

As an additional info, version 2. 7 now properly detects test classes for all 
providers, so the wildcard include pattern *.* should be good.

> alternative test-class scanner (by type filter) 
> ------------------------------------------------
>
>                 Key: SUREFIRE-458
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-458
>             Project: Maven Surefire
>          Issue Type: Improvement
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.4.1
>            Reporter: manuel aldana
>            Assignee: Kristian Rosenvold
>             Fix For: Backlog
>
>
> hi, 
> currently test filtering is done by using the <include> directive, which 
> includes test-classes by file name pattern. this approach is sometimes a bit 
> annoying for namings of classes are unreliable. test data classes are 
> sometimes named like TestDataForXXX or XXXDataForTest so they are included to 
> testsuite too.
> a better approach would be to scan test classes by the type. currently we are 
> using gsbase-test-suite scanner to accomplish this. it would be cool if this 
> kind of scanner would be included in surefire-plugin, so it is not neccessary 
> to implement such a collector for each project.
> following code as example (scans for test-classes which are concrete):
> {code:java title=Test-class Scanner}
> import java.lang.reflect.Modifier;
> import com.gargoylesoftware.base.testing.RecursiveTestSuite;
> import com.gargoylesoftware.base.testing.TestFilter;
> import junit.framework.Test;
> /** @author manuel aldana, ald...@gmx.de */
> public class TestCaseCollector {
>       /** @return Testsuite, which returns all concrete Test-classes */
>       public static Test suite() throws Exception {
>               return new RecursiveTestSuite("target/test-classes", new 
> TestFilter() {
>                       public boolean accept(Class clazz) {
>                               if (isConcreteTestCase(clazz))
>                                       return true;
>                               return false;
>                       }
>               });
>       }
>       private static boolean isConcreteTestCase(Class clazz) {
>               if (isAbstractClass(clazz))
>                       // it is assumed, that abstract classes have no 
> superclasses which are concrete test classes
>                       return false;
>               if (clazz.getSuperclass().getName().equals("java.lang.Object"))
>                       return false;
>               if 
> (clazz.getSuperclass().getName().equals("junit.framework.TestCase"))
>                       return true;
>               // recurse to parents
>               return isConcreteTestCase(clazz.getSuperclass());
>       }
>       private static boolean isAbstractClass(Class clazz) {
>               if (Modifier.isAbstract(clazz.getModifiers()))
>                       return true;
>               return false;
>       }
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to