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>