开发者

Maven test isn't picking up JUnit 4 Tests unless class ends with Test on a multi-module project

开发者 https://www.devze.com 2023-02-09 01:36 出处:网络
Apache Maven 3.0 (r1004208; 2010-10-0开发者_运维问答4 12:50:56+0100) running mvn test ignores any JUnit 4 tests unless the name of the class is *Test.

Apache Maven 3.0 (r1004208; 2010-10-0开发者_运维问答4 12:50:56+0100)

running

mvn test

ignores any JUnit 4 tests unless the name of the class is *Test.

Having just a single dependency to junit-4.8.2 and target/source configured to be 1.6


That's the standard configuration in the 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".

Source: Inclusions and Exclusions of Tests (this article also shows how you can add additional test class patterns).

0

精彩评论

暂无评论...
验证码 换一张
取 消