簡體   English   中英

Maven pom.xml如何在非標准項目結構中識別出Testng測試用例?

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

我對Maven和Testng完全陌生。 我正在使用maven作為構建工具,並使用testng作為我的測試框架。 我沒有遵循標准的Maven項目結構。 現在,我希望pom.xml在項目中執行測試用例。 問題是, pom.xml如何知道要考慮執行哪些測試用例?

如果將其放在一個位置,則需要設置maven-surefire-plugin配置的testClassesDirectory參數:

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

所有這些都在Maven Surefire插件文檔中有詳細記錄

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM