开发者

maven 3 webapp - No tests to run?

I've created a webapp with maven 3:

 mvn archetype:generate -DgroupId=com.my.app -DartifactId=myweb-app -DarchetypeArt开发者_如何学CifactId=maven-archetype-webapp -DinteractiveMode=false

I didn't get the src/test/java folder, so I added it. As I understand, this doesn't violate the Standard Directory Layout.

I wrote some JUnit tests, but when I tried to run them via mvn test, I get the "no tests to run" message:

------------------------------------------------------- T E S T S ------------------------------------------------------- There are no tests to run.

Results :

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

Of course, I can run these tests from the run as dialog, but i'd like maven to do it for me. Is there a way to achieve this?

Thanks in advance


The default configuration of the maven surefire plugin only includes test classes that follow a naming convention, see the default value of the includes parameter:

<includes>
    <include>**/Test*.java</include>
    <include>**/*Test.java</include>
    <include>**/*TestCase.java</include>
</includes>

Some examples how to configure this can be found at Inclusions and Exclusions of Tests.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜