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
To solve this problem in Eclipse follow following steps:
Now below problem "TestNG by default disables loading DTD from unsecure Urls" will not be there.
-Dtestng.dtd.http=true
in JVM_args.FROM
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
TO:
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
I personally prefer updating the DOCTYPE.
Just change all yours
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"
on https:
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd"
Thats it.
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.
In the TestNG file change the value (http) inside the <!DOCTYPE> parameter into https as highlighted in the below image. That is it.