gpt4 book ai didi

testing - Maven 测试不会选择 JUnit 4 测试,除非类在多模块项目上以测试结束

转载 作者:行者123 更新时间:2023-11-28 19:42:53 29 4
gpt4 key购买 nike

Apache Maven 3.0 (r1004208; 2010-10-04 12:50:56+0100)

运行

mvn test

忽略任何 JUnit 4 测试,除非类的名称是 *Test。

只有一个对 junit-4.8.2 的依赖,目标/源配置为 1.6

最佳答案

这是maven surefire plugin中的标准配置.

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

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

来源:Inclusions and Exclusions of Tests (本文还展示了如何添加额外的测试类模式)。

关于testing - Maven 测试不会选择 JUnit 4 测试,除非类在多模块项目上以测试结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4934533/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com