[英]How to run dynamic testng.xml using maven mvn test command line?
[英]Run single TestNG test with maven by using testng.xml
我已經在參數化的testng.xml
定義了我的測試。 我使用Failsafe插件並使用mvn verify
運行我的測試。 整個套件都已執行。
如果我必須從我的testng.xml
套件中只運行一個測試怎么辦? 我想要使用參數,但我想從命令行只運行一個測試。
maven參數:
-Dit.test=CheckoutIT#testOrderId
不起作用,因為maven在沒有testng.xml
的情況下直接運行測試,參數不綁定,測試將被忽略。
有辦法嗎? 解決方法是創建一個只有一個測試的臨時套件xml,但它不能成為解決方案......
最好的問候Robert
根據testng doc:
The command line flags that specify what tests should be run will be ignored if you also specify a testng.xml file, with the exception of -includedgroups and -excludedgroups, which will override all the group inclusions/exclusions found in testng.xml.
另一個解決方案是將偵聽器添加到您的maven目標,該目標將解析您的testng.xml並獲取測試參數以將它們應用於您當前的測試。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.