You don't really need to add -Dtestng.dtd.http=true
if you are going to create your own testng.xml file with https
for IntelliJ Run/Debug Configurations to use. You were seeing the error message because IntelliJ did not use your testng.xml file. By default IntelliJ generates a .xml file for TestNG configurations, which has a path like this C:/User/<your name>/AppData/Local/JetBrains/IntelliJIdea2020.2/temp-testng-customsuite.xml. You however cannot overwrite it because it is regenerated every time a TestNG configuration runs. IntelliJ's TestNG plugin is currently unable to dynamically generate the .xml with correct protocol, i.e. http
vs https
because of the concern for backward compatibility. Please see this commit for more details.
To use your own testng.xml, you need to change the Test kind of your TestNG configuration to Suite, then put/select the path of your testng.xml to be the value of Suite and apply. This answer also illustrates the above steps with images.
Last but not least, although the wording of the TestNG warning is strong, it is unlikely to be the cause of the NoClassDefFoundError
in your screenshot. Maybe this is the answer for fixing that NoClassDefFoundError
.