[英]Execute TestNG.xml from Jenkins (Maven Project)
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.