Repository: maven-surefire Updated Branches: refs/heads/master 9c78320b7 -> bab3175e8
Fix for SUREFIRE-1278 - TestNG tests are run with group name that ends with specified group. Configured pom.xml to run only group "group" in order to show the issue. Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/ae6337ea Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/ae6337ea Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/ae6337ea Branch: refs/heads/master Commit: ae6337ea216b867e76e951e09951e475ed105d06 Parents: 9c78320 Author: Kostya Hospodarysko <khospodary...@lohika.com> Authored: Fri Sep 16 01:08:42 2016 +0300 Committer: Tibor17 <tibo...@lycos.com> Committed: Sun Sep 18 21:05:26 2016 +0200 ---------------------------------------------------------------------- .../group/match/SingleGroupMatcher.java | 2 +- .../surefire-1278-group-name-ending/pom.xml | 61 ++++++++++++++++++++ .../src/test/java/pkg/ATest.java | 40 +++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ae6337ea/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java ---------------------------------------------------------------------- diff --git a/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java b/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java index f03a7c4..99dde99 100644 --- a/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java +++ b/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java @@ -114,7 +114,7 @@ public class SingleGroupMatcher continue; } - if ( cat.endsWith( enabled ) ) + if ( cat.equals( enabled ) ) { return true; } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ae6337ea/surefire-integration-tests/src/test/resources/surefire-1278-group-name-ending/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-1278-group-name-ending/pom.xml b/surefire-integration-tests/src/test/resources/surefire-1278-group-name-ending/pom.xml new file mode 100644 index 0000000..022073d --- /dev/null +++ b/surefire-integration-tests/src/test/resources/surefire-1278-group-name-ending/pom.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>jiras-surefire-1278</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for testng groups</name> + + <dependencies> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>6.8.7</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <groups>group</groups> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ae6337ea/surefire-integration-tests/src/test/resources/surefire-1278-group-name-ending/src/test/java/pkg/ATest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-1278-group-name-ending/src/test/java/pkg/ATest.java b/surefire-integration-tests/src/test/resources/surefire-1278-group-name-ending/src/test/java/pkg/ATest.java new file mode 100644 index 0000000..28c7e30 --- /dev/null +++ b/surefire-integration-tests/src/test/resources/surefire-1278-group-name-ending/src/test/java/pkg/ATest.java @@ -0,0 +1,40 @@ +package pkg; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.testng.Assert; +import org.testng.annotations.Test; + +/** + * Tests grouping + */ +public class ATest +{ + @Test(groups = {"group"}) + public void group() + { + } + + @Test(groups = {"agroup"}) + public void agroup() + { + Assert.fail("Group should not be run"); + } +}