我正在尝试将ExtentReports与Selenium Webdriver和Testng一起用于图形报告。
目前我使用的是2.40.0版。但是当我将replaceExisting值设置为false时,我会遇到异常。
ExtentReports extentnew = new ExtentReports("D:\\ExtentReports\\myreport1.html", false);
请帮助。
例外:
java.text.ParseException: Unparseable date: ""
at java.text.DateFormat.parse(Unknown Source)
at com.relevantcodes.extentreports.utils.DateTimeUtil.getDate(DateTimeUtil.java:22)
at com.relevantcodes.extentreports.converters.TestConverter.createTestList(TestConverter.java:58)
at com.relevantcodes.extentreports.ExtentReports.<init>(ExtentReports.java:91)
at com.relevantcodes.extentreports.ExtentReports.<init>(ExtentReports.java:213)
at AdvanceReporting.<init>(AdvanceReporting.java:29)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:387)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:299)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:110)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:186)
at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:120)
at org.testng.TestRunner.initMethods(TestRunner.java:409)
at org.testng.TestRunner.init(TestRunner.java:235)
at org.testng.TestRunner.init(TestRunner.java:205)
at org.testng.TestRunner.<init>(TestRunner.java:160)
at org.testng.remote.RemoteTestNG$1.newTestRunner(RemoteTestNG.java:141)
at org.testng.remote.RemoteTestNG$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG.java:271)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:561)
at org.testng.SuiteRunner.init(SuiteRunner.java:157)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1299)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1286)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
答案 0 :(得分:1)
抛出此异常是因为我在其中一个测试方法中缺少endTest()语句,并尝试在第二次运行中将结果附加到已创建的报告中。它现在在插入endTest()之后工作。
谢谢