简体   繁体   中英

Error while executing the testNG.xml file

I am getting the error below while executing the Java testNG.xml file in Eclipse:

[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.

Can anyone help with this?

我已经将我的 testng-6.14.3 从 testng 7.xx 降级,现在它工作正常

Add <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > this line in testng.xml file, It will be second one line of testng.xml file.

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

I have upgraded my testNG version in POM.xml from 6.14.3 to

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.1.0</version>
    <scope>test</scope>
</dependency>

Changing version solved this error.

There are 2 possible reasons for this error.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >  is not present in your testng .xml
  1. which I faced recently your Java version is not compatible with your testng version.

for #2 better to update testng version

它帮助我将 http 协议替换为 https,因此该行是

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >

I am also facing the same issue for my Selenium Automation. I have added binaries for TestNG in my pom.xml. But I don't have any TestNG.xml file. Just running the class as TestNG suite.

Check your config.properties for for any syntax error and correct it. Example: any property would have special character(; or: etc..) at the end of the line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM