运行我的Maven项目时来自Eclipse的TestNG错误

问题描述

TestNG Error in Maven Project您好,戴维斯和其他人:-以下是我的项目屏幕截图和代码,我在使用Maven Project时遇到此TestNg错误,请为此提供帮助,并且还附带了一些屏幕截图供参考:-

    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)
      

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)