Suite.xml files attempt to make web request when suite references standard TestNG DTD using HTTP
See original GitHub issueTestNG Version
7.3.0
Expected behavior
Suite file referencing http://testng.org/testng-1.0.dtd
should NOT attempt to load the DTD URL, and therefore should not require -Dtestng.dtd.http=true
.
Actual behavior
The http
version of the DTD URL is unrecognized by Parser.isUnRecognizedPublicId
, and therefore TestNG complains that it needs the testng.dtd.http
property to download the DTD from the URL.
Is the issue reproductible on runner?
- Shell
- Maven
- Gradle
- Ant
- Eclipse
- IntelliJ
- NetBeans
Test case sample
The following suite file is generated by IntelliJ 2020.2.3, when I right-click to run a class:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Default Suite">
<test name="myproject">
<classes>
<class name="example.TestClass"/>
</classes>
</test> <!-- myproject -->
</suite> <!-- Default Suite -->
Issue Analytics
- State:
- Created 3 years ago
- Comments:30
Top Results From Across the Web
3 - Stack Overflow
I solved it by adding the secure flag in the URL as follows: "https://testng.org/testng-1.0.dtd". Regards.
Read more >TestNG Example: How To Create And Use TestNG.Xml File
Let's run the XML file. Run the test by right click on the TestNG XML file and select Run As => TestNG Suite....
Read more >Documentation - TestNG
A suite is represented by one XML file. It can contain one or more tests and is defined by the <suite> tag. A...
Read more >TestNG 7.4.0 - Released !
xml files attempt to make web request when suite references standard TestNG DTD using HTTP; GITHUB-2385: Make @Listeners can work for ...
Read more >Jetty : The Definitive Reference - Eclipse
war exists, only the XML is deployed (which may use the WAR in its configuration). If you have a standard web application, you...
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 FreeTop 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
Top GitHub Comments
@robbytx - Thanks for confirming that the fix works fine.
Sure. Feedback taken. On the flip-side of not sounding blunt, adding a unit test for this would be a bit more involved effort, since
I didn’t have the time. Also I self concluded that this is not a functionality that is going to be changing a lot over time and so I did a quick cost effort weighing in and intentionally skipped adding a test.
But all said and done, if you have any ideas on how to go about adding a test for this, please feel free to contribute. If it’s via a PR, it’s even more merrier. We will be more than happy to get it vetted out and merged.
Yes, it is working now – thank you for fixing it.
At the risk of being rude, I can’t help but observe that this regression could have been avoided if this type of behavior were covered by a unit test, and I’ll note that your fix does not contain a unit test, so this behavior could be regressed in the future.