maven - 运行我的 Maven 项目时来自 Eclipse 的 TestNG 错误
问题描述
TestNG Error in Maven Project
嗨戴维斯和其他人也是如此: - 下面是我的项目截图和代码,我在TestNg
使用 Maven 项目时遇到了这个错误,请帮助我,我还附上了一些截图供参考:-
GenerateReports.java
package ExtentReports.GenerateHTMLReports;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.reporter.ExtentSparkReporter;
public class GenerateReports {
ExtentReports E2;
@BeforeTest
public void config()
{
String s1 = System.getProperty("user.dir")+"\\reports\\index1.html";
ExtentSparkReporter E1 = new ExtentSparkReporter(s1);
E1.config().setReportName("MyAutomationReport");
E1.config().setDocumentTitle("GoogleHomePage");
E2 = new ExtentReports();
E2.attachReporter(E1);
E2.setSystemInfo("Tester", "G");
}
@Test
public void initializeDriver()
{
E2.createTest("MyHTMlReportTest");
System.setProperty("webdriver.chrome.driver",
"F:\\Selenium_Training\\Ganesh_Project\\Browser_Drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
driver.getTitle();
driver.close();
E2.flush();
}
}
Pom.xml 在 XML 中运行 Maven 项目时出现 TestNG 错误,这是错误消息:-
org.testng.TestNGException:
TestNG by default disables loading DTD from unsecured 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]
at org.testng.xml.TestNGContentHandler.resolveEntity(TestNGContentHandler.java:115)
at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEn
Also, i tried the below possibilities and again getting error message which is different from this:-
I tried to add Jvm argument -Dtestng.dtd.http=true and placed it under run -->run configurations-->arguments-->VM arguments in eclipse
After placing the above jvm argument i am getting this new error message in console, do not know how to solve it below is the error after adding jvm argument and running the maven project:-
org.testng.TestNGException: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at org.testng.TestNG.parseSuite(TestNG.java:354)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:374)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:103)
解决方案
推荐阅读
- math - 在飞机上滑行
- python - 有谁知道 tkinter 滚动条(滑块)发生了什么?许多选项不起作用
- javascript - 如何使用 django 模型中的时间戳在 html 表中创建计时器?
- python - 谷歌表格使用名称查找以前创建的表格
- ionic-framework - Ionic4 - 动态添加选项后,离子选择无法正确更新
- ruby-on-rails - 在 rails admin 中隐藏设计来宾用户
- javascript - 在 javascript 中编写正则表达式的最佳方法是什么?
- python - 处理nii.gz时如何避免大数据问题?
- javascript - Knockout JS 在大型 JSON 对象上循环,在控制台中出现未定义的错误
- javascript - 该函数有几个参数。但是,不要传递所有参数