我正在尝试使用maven命令从命令行运行我的测试用例。 以下是我收到的错误消息。当我右键单击我的XML文件并在没有问题的情况下使用TestNG套件运行它时,我能够运行测试用例 我遇到的问题是我无法执行我的pom.xml中的测试用例。只有当我使用excel进行数据驱动时,才会出现此问题。我怀疑我的poi可能与maven版本不兼容,或者chrome gecko可能与maven版本不兼容。我只是猜测,这就是为什么我需要你的帮助。
C:\
Blockquote
mvn test -PClientAlert
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building cehproject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ cehproject
---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\akinrins\workspace\cehprojec
t\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ cehproject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ce
hproject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\akinrins\workspace\cehprojec
t\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ cehproj
ect ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ cehproject ---
[INFO] Surefire report directory: C:\Users\akinrins\workspace\cehproject\target\
surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Starting ChromeDriver 2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41) on
port 8611
Only local connections are allowed.
Jan 16, 2018 2:37:04 PM org.openqa.selenium.remote.ProtocolHandshake createSessi
on
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the rem
ote end
log4j:WARN No appenders could be found for logger (org.apache.http.client.protoc
ol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in
fo.
Jan 16, 2018 2:37:06 PM org.openqa.selenium.remote.ProtocolHandshake createSessi
on
INFO: Detected dialect: OSS
java.lang.NullPointerException
at utilities2.ExcelUtility.findCells(ExcelUtility.java:70)
at utilities2.ExcelUtility.getTestData(ExcelUtility.java:40)
at AlertTesting.ClientAlertTest.dataProvider(ClientAlertTest.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocat
ionHelper.java:108)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocat
ionHelper.java:55)
at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedExcep
tion(MethodInvocationHelper.java:45)
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodI
nvocationHelper.java:115)
at org.testng.internal.Parameters.handleParameters(Parameters.java:509)
at org.testng.internal.Invoker.handleParameters(Invoker.java:1308)
at org.testng.internal.Invoker.createParameters(Invoker.java:1036)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1126)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWork
er.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.ja
va:295)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXml
TestSuite.java:84)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider
.java:90)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameCla
ssLoader(ForkedBooter.java:203)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork
edBooter.java:155)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:
103)
[Utils] [ERROR] [Error] org.testng.TestNGException:
Data Provider public java.lang.Object[][] AlertTesting.ClientAlertTest.dataProvi
der() must return either Object[][] or Iterator<Object>[], not class [[Lja
va.lang.Object;
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodI
nvocationHelper.java:137)
at org.testng.internal.Parameters.handleParameters(Parameters.java:509)
at org.testng.internal.Invoker.handleParameters(Invoker.java:1308)
at org.testng.internal.Invoker.createParameters(Invoker.java:1036)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1126)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWork
er.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.ja
va:295)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXml
TestSuite.java:84)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider
.java:90)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameCla
ssLoader(ForkedBooter.java:203)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork
edBooter.java:155)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:
103)
Tests run: 6, Failures: 2, Errors: 0, Skipped: 4, Time elapsed: 9.846 sec <<< FA
ILURE! - in TestSuite
ClientAlertOne(AlertTesting.ClientAlertTest) Time elapsed: 9.712 sec <<< FAILU
RE!
java.lang.NoSuchMethodError: org.apache.poi.util.POILogger.log(ILjava/lang/Objec
t;)V
at org.apache.poi.openxml4j.opc.PackageRelationshipCollection.parseRelat
ionshipsPart(PackageRelationshipCollection.java:304)
at org.apache.poi.openxml4j.opc.PackageRelationshipCollection.<init>(Pac
kageRelationshipCollection.java:156)
at org.apache.poi.openxml4j.opc.PackageRelationshipCollection.<init>(Pac
kageRelationshipCollection.java:124)
at org.apache.poi.openxml4j.opc.PackagePart.loadRelationships(PackagePar
t.java:559)
at org.apache.poi.openxml4j.opc.PackagePart.<init>(PackagePart.java:112)
at org.apache.poi.openxml4j.opc.PackagePart.<init>(PackagePart.java:83)
at org.apache.poi.openxml4j.opc.PackagePart.<init>(PackagePart.java:128)
at org.apache.poi.openxml4j.opc.ZipPackagePart.<init>(ZipPackagePart.jav
a:78)
at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:
218)
at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:662)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:269)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:2
04)
at utilities2.ExcelUtility.setExcelFile(ExcelUtility.java:27)
at AlertTesting.ClientAlertTest.ClientAlertOne(ClientAlertTest.java:63)
TC_ClientAlertTest(AlertTesting.ClientAlertTest) Time elapsed: 9.743 sec <<< F
AILURE!
org.testng.TestNGException:
Data Provider public java.lang.Object[][] AlertTesting.ClientAlertTest.dataProvi
der() must return either Object[][] or Iterator<Object>[], not class [[Ljava.lan
g.Object;
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodI
nvocationHelper.java:137)
at org.testng.internal.Parameters.handleParameters(Parameters.java:509)
at org.testng.internal.Invoker.handleParameters(Invoker.java:1308)
at org.testng.internal.Invoker.createParameters(Invoker.java:1036)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1126)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWork
er.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.ja
va:295)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXml
TestSuite.java:84)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider
.java:90)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameCla
ssLoader(ForkedBooter.java:203)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork
edBooter.java:155)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:
103)
Results :
Failed tests:
ClientAlertTest.ClientAlertOne:63 » NoSuchMethod org.apache.poi.util.POILogger
...
ClientAlertTest.TC_ClientAlertTest » TestNG
Data Provider public java.lang.Ob...
Tests run: 6, Failures: 2, Errors: 0, Skipped: 4
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.268 s
[INFO] Finished at: 2018-01-16T14:37:13-05:00
[INFO] Final Memory: 13M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
18.1:test (default-test) on project cehproject: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\akinrins\workspace\cehproject\target\surefire-r
eports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
`enter code here`ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption