[ https://issues.apache.org/jira/browse/SUREFIRE-1278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15494146#comment-15494146 ]
Guillaume Boué commented on SUREFIRE-1278: ------------------------------------------ It seems the issue is with the class [{{SingleGroupMatcher}}|https://github.com/apache/maven-surefire/blob/surefire-2.19.1/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java#L117], which determines if a given group is enabled by checking it if ends with the configured group. There are 2 overloads of the method, and the same "endsWith" test is done to determine if the given category, represented as a [{{String}}|https://github.com/apache/maven-surefire/blob/surefire-2.19.1/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java#L108] or a [{{Class}}|https://github.com/apache/maven-surefire/blob/surefire-2.19.1/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java#L86], is enabled. There are test cases checking this behaviour for the {{Class...}} overload [here|https://github.com/apache/maven-surefire/blob/surefire-2.19.1/surefire-grouper/src/test/java/org/apache/maven/surefire/group/match/SingleGroupMatcherTest.java#L40-L44], but not for the {{String...}} overload. Changing this method to use {{equals}} fixes the issue and does not break any existing test. > TestNG tests are run with group name that ends with specified group > -------------------------------------------------------------------- > > Key: SUREFIRE-1278 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1278 > Project: Maven Surefire > Issue Type: Bug > Components: Maven Surefire Plugin > Affects Versions: 2.19.1 > Environment: OS X El Capitan 10.11.6 > TestNG 6.9.10 > Reporter: Kostya Hospodarysko > Assignee: Tibor Digana > Attachments: testng-groups.zip > > > h4.Preconditions: > There is a simple TestNG class with two methods so that 1st method has group > "group" and 2nd has group "apigroup". > h4.Steps to reproduce: > Run tests with command: > {noformat} > mvn clean test -Dgroups=group > {noformat} > {color:red}h4.Actual:{color} > Both tests are run. > {color:green}h4.Expected:{color} > Only method with group "group" is run. > Demo project could be found here: > https://github.com/khospodarysko/testng-groups. > Looks like the issue is in GroupMatcherMethodSelector as looking at > includeMethod it is seen that is always returns true. -- This message was sent by Atlassian JIRA (v6.3.4#6332)