Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
794 views
in Technique[技术] by (71.8m points)

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

Apache Maven 3.0 (r1004208; 2010-10-04 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...