笔者最近在用testng+maven时,运行编写的xml文件时,编辑器报了一个错,如下
报错:
[TestNGContentHandler] [WARN] It is strongly recommended to add "<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >" at the top of your file, otherwise TestNG may fail or not work as expected.Groups1
解决办法:
在xml文件中,添加一句:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
文件如下:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="suitename"> <!--运行所有类--> <test name="runAll"> <classes> <class name="com.course.testng.groups.Groups1"></class> <class name="com.course.testng.groups.Groups2"></class> <class name="com.course.testng.groups.Groups3"></class> </classes> </test> <!--运行指定的分组--> <test name="runGroup1"> <groups> <run> <include name="client"></include> </run> </groups> <classes> <class name="com.course.testng.groups.Groups1"></class> <class name="com.course.testng.groups.Groups2"></class> </classes> </test> </suite>