请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

运行就报错,testng下载导入都是成功的

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]
at org.testng.xml.TestNGContentHandler.resolveEntity(TestNGContentHandler.java:115)

正在回答 回答被采纳积分+3

2回答

rkniu 2020-11-06 20:03:33

Run > Edit Configurations ->对应的configuration下的'VM options' 更改为'-ea -Dtestng.dtd.http=true'

我这边亲试已经PASS。

https://img1.sycdn.imooc.com//szimg/5fa53f8d09b2bd0912430727.jpg

https://img1.sycdn.imooc.com//szimg/5fa53f8d0902328720161262.jpg

https://img1.sycdn.imooc.com/szimg/5fa53f8e0926318e21221482.jpg

然后还要设置下Edit Templates的TestNG里的VM options参数,不然每次在代码行运行还是会一样的错误出现

1 回复 有任何疑惑可以回复我~
大周 2020-09-07 14:05:55

TestNG by default disables loading DTD from unsecured Urls.

这句话说的是你的testng配置文件里边加载了不安全的url,你把配置文件中最上边的那行DTD限制去掉试一下。 就这个这个配置文件的事儿。 

0 回复 有任何疑惑可以回复我~
  • 提问者 woshiyu #1
    我没有生成xml文件,就直接运行的这个
    回复 有任何疑惑可以回复我~ 2020-09-08 00:02:59
  • rkniu #2
    我也是这个错误,我也是和楼上一样没用创建testng的配置文件,呜呜呜。。。
    回复 有任何疑惑可以回复我~ 2020-11-06 15:09:39
  • rkniu #3
    求老师帮解决啊,我在idea的idea.vmoptions文件中加了-Dtestng.dtd.http=true也还是报这个错。创建了个testng.xml文件,注释了dtd的,仍报这个错。非常感谢
    回复 有任何疑惑可以回复我~ 2020-11-06 18:44:42
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信