apache / apache/maven-surefire

[SUREFIRE-1514] Selecting multiple tests does not work when tests are inside parent class

Open
#2,573 2 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Jori](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=buumi)** opened **[SUREFIRE-1514](https://issues.apache.org/jira/browse/SUREFIRE-1514?redirect=false)** and commented

I'm using TestNG to run tests with Maven Failsafe plugin version 2.21.0. I'm trying to follow instructions over at http://maven.apache.org/surefire/maven-failsafe-plugin/examples/single-test.html for running multiple tests in a single class:

mvn -Dit.test=ITCircle#testOne+testTwo verify

This works fine as long as testOne and testTwo are defined inside the class ITCircle. However, it does not work if ITCircle is a subclass of class ParentClass which holds the test methods. 

 

So basically my structure is

testpackage

  - ParentClass

      - public void setup

      - public void test1

      - public void test2

  - SubClass extends ParentClass

      - public void setup

 

mvn \-Dit.test=testpackage.ParentClass verify     - OK (2 tests ran)

mvn \-Dit.test=testpackage.ParentClass#test1+test2 verify     - OK (2 tests ran)

mvn \-Dit.test=testpackage.SubClass verify     - OK (2 tests ran)

mvn \-Dit.test=testpackage.SubClass#test1+test2 verify     - No tests found

---

**Affects:** 2.21.0

**Attachments:**
- [maven-project.zip](https://issues.apache.org/jira/secure/attachment/12918520/maven-project.zip) (_2.53 kB_)

Contributor guide

Open the contributing guide

Research direction

Start by unpacking the attached maven-project.zip and reproduce the four Maven Failsafe commands described in the issue with TestNG. Compare inherited test selection for ParentClass and SubClass; done means selecting test1+test2 on the subclass runs both tests instead of reporting no tests found.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.