簡體   English   中英

從 Jenkins(Maven 項目)執行 TestNG.xml

[英]Execute TestNG.xml from Jenkins (Maven Project)

  1. 我的項目沒有 bin 文件夾
  2. 嘗試了以下方法:

D:>java -cp "Pathtolibfolder\\lib*;Pathtobinfolder\\bin" org.testng.TestNG testng.xml

有任何想法嗎?

如果您使用的是 Maven,那么我將簡單地使用 surefire 插件並運行測試作為構建的一部分:

<plugins>

    ...

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>RELEASE</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>

    ...

</plugins>

如果您可以使用這種配置,只需指定 testng.xml 的路徑並利用它。 它允許大量參數化,我在我的項目中廣泛使用它。

查看本教程以了解它: http : //maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html

暫無
暫無

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

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