Error while executing the testNG.xml file

Viewed 24230

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?

6 Answers

i have downgrade my testng-6.14.3 from testng 7.x.x now its working fine

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

it helped me to replace http protocol to https so the line is

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

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.

Related