英文:
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
英文:
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
答案1
得分: 0
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.
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论