org.testng.TestNGException: TestNG by default disables loading DTD from unsecured Urls.問題解決

TestNG XML DTD錯誤

最近在tesgng跑測試用例時碰到了這個問題:

org.testng.TestNGException: 
TestNG by default disables loading DTD from unsecured Urls. If you need to explicitly load the DTD from a http url, please do so by using the JVM argument [-Dtestng.dtd.http=true]

解決方法:
在testNG的xml中刪除這一行:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
xml即可正常運行

----------------------------後續更新----------------------------------
以上做法可以調用xml配置文件啓動測試腳本,但根本原因是testng版本過高導致的,我之前跑的testng版本是7.2.0,更換爲7.0.0beta後問題解決

附maven依賴:

 <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.0.0-beta7</version>
            <scope>compile</scope>
        </dependency>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章