为什么 Maven 会失败并出现 SurefireExecutionException: >无法将选项设置为与值并行
您好,我正在使用 Windows XP 和最新版本来完成本教程
http://binil.wordpress.com/2006/12/08/automated-smoke-tests-with-selenium-cargo-testng-and-maven/
可以有人请告诉我标签是什么。
<parallel>true</parallel>
<threadCount>10</threadCount>
当我使用包含这些标签进行构建时,我遇到了失败:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
org.apache.maven.surefire.booter.SurefireExecutionException:
Cannot set option parallel with value
true; nested exception is
java.lang.reflect.InvocationTargetException:
null; nested exception is
org.apache.maven.surefire.util.NestedRuntimeException:
Cannot set option parallel with value
true; nested exception is
java.lang.reflect.InvocationTargetException:
null
org.apache.maven.surefire.util.NestedRuntimeException:
Cannot set option parallel with value
true; nested exception is
java.lang.reflect.InvocationTargetException:
null
java.lang.reflect.InvocationTargetException
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator$Setter.invoke(AbstractDirectConfigurator.java:117)
at
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator.configure(AbstractDirectConfigurator.java:63)
at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:71)
at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at
org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
Caused by:
java.lang.NullPointerException at
org.testng.TestNG.setParallel(TestNG.java:347)
... 15 more [INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE [INFO]
------------------------------------------------------------------------
Hi I am working through the tutorial here using windows XP and latest builds
http://binil.wordpress.com/2006/12/08/automated-smoke-tests-with-selenium-cargo-testng-and-maven/
Could someone please tell me what the tags are.
<parallel>true</parallel>
<threadCount>10</threadCount>
When I build with these tags included I get a failure:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
org.apache.maven.surefire.booter.SurefireExecutionException:
Cannot set option parallel with value
true; nested exception is
java.lang.reflect.InvocationTargetException:
null; nested exception is
org.apache.maven.surefire.util.NestedRuntimeException:
Cannot set option parallel with value
true; nested exception is
java.lang.reflect.InvocationTargetException:
null
org.apache.maven.surefire.util.NestedRuntimeException:
Cannot set option parallel with value
true; nested exception is
java.lang.reflect.InvocationTargetException:
null
java.lang.reflect.InvocationTargetException
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator$Setter.invoke(AbstractDirectConfigurator.java:117)
at
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator.configure(AbstractDirectConfigurator.java:63)
at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:71)
at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at
org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
Caused by:
java.lang.NullPointerException at
org.testng.TestNG.setParallel(TestNG.java:347)
... 15 more [INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE [INFO]
------------------------------------------------------------------------
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自 surefire-plugin 文档:
TestNG 页面。为此,您的 Surefire 插件应配置如下:
From the surefire-plugin documentation:
There is a section on running tests in parallel on the TestNG page of the plugin documentation. To do this your surefire plugin should be configured like this:
true
不是选项parallel
的有效值;尝试methods
(按照文档)true
is not a valid value for the optionparallel
; trymethods
(as per the docs)如果您使用旧版本的 TestNG,也可能会发生这种情况。
尝试将您的依赖项升级到 TestNG,例如:
PS:很多人通常会使用版本 5.1。
干杯
S.阿里·托克曼
http://ali.tokmen.com/
This might also happen if you use an old version of TestNG.
Try upgrading your dependency to TestNG, for example:
PS: Many people would typically use version 5.1.
Cheers
S. Ali Tokmen
http://ali.tokmen.com/