Search code examples
junit5micronautcucumber-javamaven-failsafe-plugin

Cucumber Integration Test not seen by Maven Failsafe


I've created a Micronaut/Cucumber/JUnit5 test and am trying to run it as an integration test with Maven's Failsafe plugin.

When I run it as a normal test, Cucumber works properly. When I change the name of the test to FooIT and run mvn verify, Failsafe finds it but, claims there are no tests found.

FooIT » NoTestsDiscovered Suite [foo.FooIT] did not discover any tests

The test itself:

@MicronautCucumber
public class FooIT {
}

Definition of the @MicronautCucumber annotation

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
@Documented
@Testable
@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("features")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty")
@ConfigurationParameter(key = JUNIT_PLATFORM_NAMING_STRATEGY_PROPERTY_NAME, value = "long")
@ConfigurationParameter(key = PLUGIN_PUBLISH_QUIET_PROPERTY_NAME, value = "true")
// Add some tests to class
@SuppressWarnings("java:S2187")
public @interface MicronautCucumber {
}

Failsafe plugin entry in pom.xml

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

Example project can be found at this github repo


Solution

  • The example is fine. I was using an alias for mvn verify that included a -Dgroups=... argument, so Maven was filtering out my intended test.