Maven故障安全不执行测试 [英] Maven fail-safe not executing tests

查看:261
本文介绍了Maven故障安全不执行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经梳理了StackOverflow和许多其他网站,发现了许多其他相关帖子,并且已经遵循了所有上述建议,但最终, failsafe正在跳过我的测试。

I've combed StackOverflow and many other sites, have found many other related posts and have followed all said suggestions, but in the end, failsafe is skipping my tests.

我的JUnit测试位于:
myModule / src / main / test / java / ClientAccessIT.java

My JUnit test is located here: myModule/src/main/test/java/ClientAccessIT.java

跳过surefire ,因为此模块中没有单元测试:

I am skipping surefire because there are no unit tests in this module:

<!-- POM snippet -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
  <skip>true</skip>
  </configuration>
</plugin>

我正在尝试使用 failsafe 运行集成测试:

And I'm trying to run integration tests with failsafe:

<!-- POM snippet -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <executions>
        <execution>
            <id>run-tests</id>
            <phase>integration-test</phase>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>

然而,当我运行 mvn verify I看到这个:

However, when I run mvn verify I see this:

[INFO] --- maven-failsafe-plugin:2.14.1:integration-test (run-tests) @ rest-services-test ---

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

我花了最后4个半小时的精练,任何帮助将不胜感激。唯一可能值得一提的是我已经货物设置和拆毁Tomcat容器。有没有人看到明显的问题?

I spent the last 4 1/2 hours scouring, any help would be appreciated. The only other thing that may be worth mentioning is that I have Cargo setting up and tearing down a Tomcat container. Does anybody see the glaring problem?

D

推荐答案

你需要重命名您的测试类。

You need to rename your test class.

您可以在文档,如@acdcjunior指出:

You can find the names the plugin looks for by default in the documentation, as pointed out by @acdcjunior:


默认情况下,Failsafe插件将自动包含具有以下通配符模式的所有测试类:

By default, the Failsafe Plugin will automatically include all test classes with the following wildcard patterns:


  • ** / IT * .java - 包括所有子目录和所有以IT开头的java文件名。

  • ** / * IT.java - 包括其所有子目录和所有以IT结尾的java文件名。

  • ** / * ITCase.java - 包括其所有子目录和所有以ITCase结尾的java文件名。

  • "**/IT*.java" - includes all of its subdirectories and all java filenames that start with "IT".
  • "**/*IT.java" - includes all of its subdirectories and all java filenames that end with "IT".
  • "**/*ITCase.java" - includes all of its subdirectories and all java filenames that end with "ITCase".

这篇关于Maven故障安全不执行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆