0

I already changed the below items since I saw this-https://stackoverflow.com/questions/57299606/testng-by-default-disables-loading-dtd-from-unsecure-urls

  1. Run/Debug configurations both class&method in both TESTNG and TESTNG Template vm option: -ea -Dtestng.dtd.http=true

  2. testng.xml, and even I deleted the first line and follow the error message to put <!DECOTYPE ..... to the first line, it still failed

I still encounter this error. Could anyone please help with this, please?

testng.xml

Run/Debug_Configurations

Ashley
  • 39
  • 5
  • 1
    Please tell why do you think that NoClassDefFoundError is connected with TestNG warning? – Olga Klisho Nov 16 '20 at 11:26
  • @OlgaKlisho Thanks a lot for the heads up. I found my external library was not completed. after adding the "libs" folder under selenium-java-3.141.59 with okhttp-3.11.0.jar and okio-1.14.0.jar, it worked fine! – Ashley Nov 17 '20 at 15:07

2 Answers2

0

The external library was not completed. After adding the "libs" folder under selenium-java-3.141.59 with okhttp-3.11.0.jar and okio-1.14.0.jar, it worked fine! enter image description here

enter image description here

Ashley
  • 39
  • 5
0

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.

William
  • 151
  • 11