TestNG by default disables loading DTD from unsecure Urls

后端 未结 14 1067
[愿得一人]
[愿得一人] 2021-01-02 00:10

I\'m using testng maven and selenium to run my tests, currently I have the following testng.xml file

Looks like the problem is with the &listeners and &class

14条回答
  •  盖世英雄少女心
    2021-01-02 00:47

    Please follow all the steps as below. Works perfectly after configuring JVM arguments in Eclipse.

    Problem Statement:

    TestNG by default disables loading DTD from unsecure Urls If you need to explicitly load the DTD from a http url, please do so by using the JVM argument [-Dtestng.dtd.http=true]

    Often we need to use certain VM arguments on the JVM that launches the Rule Project.

    To do so, the following 2 steps are needed: • Define a new installed JRE with default JVM arguments: -- Go to the Eclipse Window > preferences > Java > Installed JREs". -- Select the Default JRE and Click on Duplicate. -- Change the JRE name as per your choice, for example myJRE and Enter the Default VM arguments as “-Dtestng.dtd.http=true” enter image description here

    -- Click Finish. --- Uncheck the default JRE and check the new JRE added with VM arguments. --- Click Apply, Apply and Close.

    • Configure the Rule Project launch configuration to use the new installed JRE: -- Go to the Run > Run Configurations --- Run Configuration Dialog is in view.

    enter image description here

    --- Enter the Name of your choice, for example: RunConfigWithJVMArgs. --- Test tab:  Project name by default displayed.  Select the “Suite” option and browse for your testng.xml file present in your project folder. For example: src/main/resources/testng.xml enter image description here

    --- Arguments tab:  Enter ““-Dtestng.dtd.http=true” in the VM arguments text field. --- JRE tab:  Select “Alternate JRE : “ as the newly added JRE with JVM arguments. --- No other changes required. --- Click Apply and then Run.

    If the suite starts and runs successfully in Eclipse, then it will work when you run the packaged JAR file as well.

    Note: Perform mvn clean and mvn package –Dmaven.test.skip=true after changing the above configurations in Eclipse.

    Once the JAR is ready, it will have the new JRE configured with JVM arguments and it will fix the problem statement.

提交回复
热议问题