Maven won't run tests

后端 未结 1 727
说谎
说谎 2021-02-08 13:16

When running mvn test maven won\'t run all Test Classes. When I explicitly provide a class by adding -Dtest=PropertyTests the tests will be run.

<
相关标签:
1条回答
  • 2021-02-08 13:25

    You need to add the maven surefire plugin to run the tests. The configuration can be found here.

    Here's a configuration that I've been using with specs/junit.

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.8.1</version>
        <configuration>
            <includes>
                <include>**/*Spec.*</include>
                <include>**/*Test.*</include>
            </includes>
        </configuration>
    </plugin>
    

    The naming convention is Test, so change PropertyTests to PropertyTest.

    0 讨论(0)
提交回复
热议问题