You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (Jira)" <ji...@apache.org> on 2019/11/17 23:26:00 UTC

[jira] [Commented] (SUREFIRE-1720) JUnit 5 @Nested classes are not excluded when name ends in Tests

    [ https://issues.apache.org/jira/browse/SUREFIRE-1720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16976198#comment-16976198 ] 

Tibor Digana commented on SUREFIRE-1720:
----------------------------------------

Unfortunately you was not faster. Reporting it 10 days ago would make the fix released.
This has nothing to do with JUnit5. It is generic approach to filter physical files (*.class) but the nested classes are different.
We already have default exclusions and we have to find out why this does not have any effect in your cases:

{code:java}
    private String getDefaultExcludes()
    {
        return "**/*$*";
    }
{code}


> JUnit 5 @Nested classes are not excluded when name ends in Tests
> ----------------------------------------------------------------
>
>                 Key: SUREFIRE-1720
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1720
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 2.22.2, 3.0.0-M3
>            Reporter: Dmitry Timofeev
>            Priority: Minor
>
> {color:#808080}`<exclude>` {color}over source file names does not exclude the {color:#808080}`@Nested` {color}test classes, defined inside the matching source files, if they end with {color:#808080}`Tests`{color}.
> h3. Minimal reproducing project
> [https://github.com/dmitry-timofeev/surefire-bug] (contains the instrutctions to run)
> See AppIntegrationTest.
> h3. Surefire Configuration
> {code:java}
> <plugin>
>   <artifactId>maven-surefire-plugin</artifactId>
>   <version>${surefire.version}</version>
>   <configuration>
>     <excludes>
>       <!-- (1) Such syntax operates on source file names, according to the docs:
>            https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html
>            but does not exclude the JUnit 5 @Nested classes, defined in *matching* files. -->
>       <exclude>**/*IntegrationTest.java</exclude>
> <!--              (2) Regex-syntax operates on classes, according to the docs;
>            and excludes the @Nested classes properly: -->
> <!--              <exclude>%regex[.*IntegrationTest\$.*]</exclude>-->
>     </excludes>
>   </configuration>
> </plugin>
> {code}
> h3. {color:#9876aa}Expected Behaviour{color}
> When a pattern over source file names is used ({color:#808080}`<exclude>*Pattern.java<exclude>`{color}),
>  it must apply to all classes inside that file (including @Nested with any name).
> h3. {color:#9876aa}Actual Behaviour{color}
> The exclusion does not apply to some @Nested classes inside the matching source file (e.g, ending with {color:#808080}`Tests`{color}).
> h3. Workaround
> Also add a pattern, operating on _classes:_ {{<exclude>%regex[.*IntegrationTest\$.*]<exclude>}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)