[ https://jira.codehaus.org/browse/SUREFIRE-917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=312565#comment-312565 ]
Peter Lynch commented on SUREFIRE-917: -------------------------------------- IMO this whole thing is missing surefire killer feature that is not documented. ;) > [junit] category simple name matching fails throwing ClassNotFoundException > --------------------------------------------------------------------------- > > Key: SUREFIRE-917 > URL: https://jira.codehaus.org/browse/SUREFIRE-917 > Project: Maven Surefire > Issue Type: Bug > Components: Junit 4.x support > Affects Versions: 2.12.4 > Reporter: Peter Lynch > Attachments: fix_support_for_junit_simple_group_name_matching.patch > > > According to a [unit test I > found|https://git-wip-us.apache.org/repos/asf?p=maven-surefire.git;a=blob;f=surefire-grouper/src/test/java/org/apache/maven/surefire/group/parse/GroupMatcherParserTest.java;h=e92595a09de1eb706f54c70b8efe8df592e40ec5;hb=HEAD#l134] > JUnit categories/group support should allow matching groups by the category > interface simple name along with the fully qualified name. > Example , given category interfaces: > {noformat} > category.Fast > category.Slow > {noformat} > The following commands should be equivalent: > {noformat} > mvn test -Dgroups="Slow,Fast" > mvn test -Dgroups="category.Slow,category.Fast" > mvn test -Dgroups="category.Slow.class,category.Fast.class" > {noformat} > In my testing, the first command does not work. Instead I get the following > exception: > {noformat} > org.apache.maven.surefire.util.SurefireReflectionException: > java.lang.reflect.InvocationTargetException; nested exception is > java.lang.reflect.InvocationTargetException: null > java.lang.reflect.InvocationTargetException > 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.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) > at > org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) > at > org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) > at > org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) > at > org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) > Caused by: java.lang.RuntimeException: Unable to load category: Fast > at > org.apache.maven.surefire.group.match.SingleGroupMatcher.loadGroupClasses(SingleGroupMatcher.java:134) > at > org.apache.maven.surefire.group.match.JoinGroupMatcher.loadGroupClasses(JoinGroupMatcher.java:44) > at > org.apache.maven.surefire.common.junit48.FilterFactory.createGroupFilter(FilterFactory.java:92) > at > org.apache.maven.surefire.junitcore.JUnitCoreProvider.createJUnit48Filter(JUnitCoreProvider.java:183) > at > org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:115) > ... 9 more > Caused by: java.lang.ClassNotFoundException: Fast > at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > at java.lang.ClassLoader.loadClass(ClassLoader.java:306) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:247) > at > org.apache.maven.surefire.group.match.SingleGroupMatcher.loadGroupClasses(SingleGroupMatcher.java:130) > ... 13 more > {noformat} > It seems like if a category name cannot be loaded, it should just be ignored. > I added an integration test that proves the failure and supplied a patch > which avoids the problem to allow specifying the simple class name for > matching. > It would be great to have this working to allow a developer to easily run > specific groups of tests in a concise manner. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira