TestNG XML not valid with DTD @ http://testng.org/testng-1.0.dtd
See original GitHub issuePlease see stackoverflow link here: http://stackoverflow.com/questions/42772424/testng-xml-not-valid
I am getting issues with the XML not meeting the DTD.
TestNG Version
Tried on 6.11 and 6.9.11
Expected behavior
XML should be valid with DTD.
Actual behavior
Getting the error: 1: 3 The markup declarations contained or pointed to by the document type declaration must be well-formed.
Is the issue reproductible on runner?
- Shell
- Maven
- Gradle
- Ant
- Eclipse
- IntelliJ
- NetBeans
Test case sample
I have some generated TestNG XMLs that worked for a long time, but recently they are invalid when I run them through Java’s SAXParser and through http://www.xmlvalidation.com/
Example generated XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="1" verbose="2" name="TestNG Forum" parallel="tests">
<test name="TestNG Test0" preserve-order="false">
<parameter name="device" value="58f56054954b6b3e323a3405fc49023eb1569a98"/>
<packages>
<package name="output"/>
</packages>
</test> <!-- TestNG Test0 -->
</suite> <!-- TestNG Forum -->
Example XML from TestNG’s site @ http://testng.org/doc/documentation-main.html
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1" >
<test name="Nopackage" >
<classes>
<class name="NoPackageTest" />
</classes>
</test>
<test name="Regression1">
<classes>
<class name="test.sample.ParameterSample"/>
<class name="test.sample.ParameterTest"/>
</classes>
</test>
</suite>
EDIT:
SAXParser error:
[Fatal Error] testng-1.0.dtd:1:3: The markup declarations contained or pointed to by the document type declaration must be well-formed.
org.xml.sax.SAXParseException; systemId: http://testng.org/testng-1.0.dtd; lineNumber: 1; columnNumber: 3; The markup declarations contained or pointed to by the document type declaration must be well-formed.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:205)
at com.video.recorder.XpathXML.parseXML(XpathXML.java:42)
at com.cucumber.listener.ExtentCucumberFormatter.feature(ExtentCucumberFormatter.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at cucumber.runtime.Utils$1.call(Utils.java:37)
at cucumber.runtime.Timeout.timeout(Timeout.java:13)
at cucumber.runtime.Utils.invoke(Utils.java:31)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:290)
at com.sun.proxy.$Proxy17.feature(Unknown Source)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:161)
at cucumber.api.testng.TestNGCucumberRunner.runCucumber(TestNGCucumberRunner.java:63)
at cucumber.api.testng.AbstractTestNGCucumberTests.feature(AbstractTestNGCucumberTests.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:414)
at org.testng.internal.thread.ThreadUtil$1.call(ThreadUtil.java:52)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:34 (8 by maintainers)
Top Results From Across the Web
3 - Stack Overflow
How can I ignore DTD validation but keep the Doctype when writing an XML file? ... What is the purpose of specifying a...
Read more >How To Solve- org.testng.TestNGException - YouTube
How To Solve- org. testng. TestNGException : TestNG by default disables loading DTD from unsecured Urls.
Read more >Documentation - TestNG
This section describes the format of testng.xml (you will find documentation on ant and the command line below). The current DTD for testng.xml...
Read more >Search - appsloveworld
... Referenced file contains errors (http://testng.org/testng-1.0.dtd)-eclipse. ... But I think it worth mention that this is a problem of Eclipse not ...
Read more >TestNG by default disables loading DTD from unsecured Urls ...
<version>7.3.0</version> ... Can add the -Dtestng.dtd.http=true flag to the default TestNG ... Make sure TestNG suite XML should have the https endpoint ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I curl the dtd file and saw a message that it was moved to https://testng.org/testng-1.0.dtd. So I just changed the url in my in the testng xml to https😕/testng.org/testng-1.0.dtd instead of http😕/testng.org/testng-1.0.dtd, now it’s working on my end.
I’m having this problem when using TestNG 7.3.0 in Eclipse. Where do you find the “TestNG xml” … is that somehow generated by Eclipse?