You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Slawomir Jaranowski (Jira)" <ji...@apache.org> on 2023/03/08 23:53:00 UTC

[jira] [Closed] (SUREFIRE-2115) Unable to execute specific inner class test in Surefire

     [ https://issues.apache.org/jira/browse/SUREFIRE-2115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Slawomir Jaranowski closed SUREFIRE-2115.
-----------------------------------------
    Resolution: Won't Fix

> Unable to execute specific inner class test in Surefire
> -------------------------------------------------------
>
>                 Key: SUREFIRE-2115
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2115
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin, TestNG support
>            Reporter: Baubak Gandomi
>            Priority: Major
>
> Hi I have a nested class hierarchy which is as follows:
> {code:java}
> public class NestClassContainer {
>     @Test
>     public static class TestClass1 {
>         public void testC1_m1() {
>             System.out.println("Should not execute");
>         }
>     }
>     @Test
>     public static class TestClass2 {
>         public void testC2_m1() {
>             System.out.println("Should execute");
>         }
>     }
> }{code}
> I want to use Surefire to only execute NestClassContainer$TestClass2, This works just fine in TestNG exeution, but I cannot get it to work in Surefire.
> When I try to execute one of the nested classes TestClass2 , it executes all the tests in the top class. (Tested versions 2.22.1 & 3.0.0-M7)
> Here is my commandline:
> {code:java}
> mvn clean test -Dtest=NestClassContainer$TestClass2 {code}
> Expected outcome:
> We execute only testC2_m1
> Actual outcome:
> Both testC1_m1 & testC2_m1 are executed.
> I have even tries setting the annotations on the test methods instead, but the result is the same.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)