Surefire 的方法过滤器

Method filter for Surefire

从这个页面: https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html

在"Fully qualified class name"部分,似乎可以在pom.xml中指定运行的测试方法。但是,这个叫"test"的标签写在什么地方不是很清楚。任何人都可以透露一些信息吗?

更新:

您可以在 <properties> 中定义它,如:

<project>
    <properties>
        <test>TestCircle#testSlow</test>
    </properties>
</project>

此外,您可以按照提示 here 使用 includesexcludes,例如:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20.1</version>
        <configuration>
          <includes>
            <include>Sample.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20.1</version>
        <configuration>
          <excludes>
            <exclude>**/TestCircle.java</exclude>
            <exclude>**/TestSquare.java</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>