Cucumber Integration Test not seen by Maven Failsafe

huangapple go评论109阅读模式
英文:

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 &#187; 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(&quot;cucumber&quot;)
@SelectClasspathResource(&quot;features&quot;)
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = &quot;pretty&quot;)
@ConfigurationParameter(key = JUNIT_PLATFORM_NAMING_STRATEGY_PROPERTY_NAME, value = &quot;long&quot;)
@ConfigurationParameter(key = PLUGIN_PUBLISH_QUIET_PROPERTY_NAME, value = &quot;true&quot;)
// Add some tests to class
@SuppressWarnings(&quot;java:S2187&quot;)
public @interface MicronautCucumber {
}

Failsafe plugin entry in pom.xml

      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.0.0&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;goals&gt;
              &lt;goal&gt;integration-test&lt;/goal&gt;
              &lt;goal&gt;verify&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;

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.

huangapple
  • 本文由 发表于 2023年4月11日 09:42:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/75981849.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定