Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Maven failing with a SurefireExecutionException: > Cannot set option parallel with value

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]
------------------------------------------------------------------------
like image 595
Ric Avatar asked Sep 21 '09 14:09

Ric


2 Answers

From the surefire-plugin documentation:

parallel (TestNG only) When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution.

threadCount (TestNG only) The attribute thread-count allows you to specify how many threads should be allocated for this execution. Only makes sense to use in conjunction with parallel.

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:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.4.2</version>
  <configuration>
    <parallel>methods</parallel>
    <threadCount>10</threadCount>
  </configuration>
</plugin>
like image 129
Rich Seller Avatar answered Oct 08 '22 04:10

Rich Seller


true is not a valid value for the option parallel; try methods (as per the docs)

like image 41
Aaron Digulla Avatar answered Oct 08 '22 04:10

Aaron Digulla