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

来源:5-3 注解实战@Test标签

woshiyu

2020-09-06

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)

写回答

2回答

rkniu

2020-11-06

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

我这边亲试已经PASS。

//img.mukewang.com/szimg/5fa53f8d09b2bd0912430727.jpg

//img.mukewang.com/szimg/5fa53f8d0902328720161262.jpg

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

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

1
0

大周

2020-09-07

TestNG by default disables loading DTD from unsecured Urls.

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

0
3
rkniu
求老师帮解决啊,我在idea的idea.vmoptions文件中加了-Dtestng.dtd.http=true也还是报这个错。创建了个testng.xml文件,注释了dtd的,仍报这个错。非常感谢
2020-11-06
共3条回复

Java接口自动化测试实战,搞定理论基础+典型应用场景

打破传统测试用例设计方法,搞懂基于TestNG的接口自动化测试技术

2086 学习 · 920 问题

查看课程