helmethair-co / scalatest-junit-runner

JUnit 5 runner for Scalatest

Repository from Github https://github.comhelmethair-co/scalatest-junit-runnerRepository from Github https://github.comhelmethair-co/scalatest-junit-runner

Add support for other discovery selectors

giurim opened this issue · comments

Currently only class discovery selector is supported. Add support for at least

  • path selector
  • modules selector

@giurim Sorry, I realized my own mistake and deleted my comment but I guess you had already received a notification. Actually, only collecting classes whose name contains "Test" is maven-surefire-plugin's convention. I can't say I like it though...
Sorry for the noise and thanks for this project!

@slandelle Hi, no worries, yes I was OOO and replied to the notification email directly on my phone. The maven-surefire-plugin convention is an interesting problem, will look into that, maybe something can be done.

I suspect the maven-surefire-plugin convention is something from the past, before annotations landed in Java 5 and they don't want a breaking change.

Hi, you are right. The default inclusion pattern for the Maven Surefire plugin makes it only "discover" classes (files) matching the following patterns:

  • **/Test*.java
  • **/*Test.java
  • **/*Tests.java
  • **/*TestCase.java

See inclusion/exclusion configuration details: Inclusions and Exclusions of Tests

I tried the following Surefire configuration (which is pretty permissive) and I was able to run Scalatest tests with any name.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven.surefire.version}</version>
    <configuration>
        <includes>
            <include>*</include>
        </includes>
        <excludes>
            <exclude/>
        </excludes>
    </configuration>
</plugin>

See:
pom.xml
and
YouKnowWho.scala

I did not really find use for supporting other discovery selectors. I also checked several Junit Engine implementations and I think it is enough to support class-based discovery.