我有參數化的testng測試,我想單獨使用IntelliJ「運行/調試測試」功能執行它們(用於調試目的)。運行單獨的testng測試並使用IntelliJ讀取testng.xml參數
當我這樣做,我有不同的執行環境,因爲它本身的IntelliJ創建一個新的文件testng.xml
在"user\.IdeaIC14\system\temp-testng-customsuite.xml"
不帶參數的信息。
我的代碼是:
@BeforeTest
public void setUpTestSuite(ITestContext context) throws Exception {
Map<String, String> suiteParams = context.getCurrentXmlTest().getSuite().getParameters();
url = suiteParams.get("URL");
login = suiteParams.get("login");
pass = suiteParams.get("pass");
}
運行試驗時從單獨的IntelliJ suiteParams
是空的。
有沒有人知道任何方式從IntelliJ執行測試或類,並將它們「鏈接」到原始文件testng.xml
?
* testng tests *是您需要的嗎? –
@nikpon對不起,我沒有得到你的問題...我添加了一些代碼來顯示我的問題 – Morvader