简体   繁体   中英

How maven pom.xml identifies the testng test cases in a non-standard project structure?

I am completely new to maven and testng. I am using maven as build tool, and testng as my testing framework. I am not following the standard maven project structure. Now I want my pom.xml to execute the test cases in my project. The question is, how pom.xml knows what are the test cases to consider for execution?

If you keep this in a single place you need to set the testClassesDirectory argument of the maven-surefire-plugin configuration:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
          <testClassesDirectory>path/to/compiled test classes</testClassesDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

All of this is well documented in the Maven Surefire Plugin Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM