Warum versagt Maven mit einem SurefireExecutionException:> Kann nicht Option parallel Wert eingestellt

StackOverflow https://stackoverflow.com/questions/1454908

  •  12-09-2019
  •  | 
  •  

Frage

Hallo Ich arbeite durch das Tutorial hier Windows XP und neuesten Builds

http://binil.wordpress.com/2006/12/08/automated-smoke-tests-with-selenium-cargo-testng-and-maven/

Könnte jemand bitte sagen Sie mir, was die Tags sind.

<parallel>true</parallel>
<threadCount>10</threadCount>

Wenn ich mit diesen Tags Build enthalten ich einen Fehler:

-------------------------------------------------------  
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]
------------------------------------------------------------------------
War es hilfreich?

Lösung

Aus todsichere-Plugin Dokumentation:

  

parallel (TestNG nur) Wenn Sie das parallele Attribut verwenden, wird TestNG versuchen, alle Ihre Testmethoden in separaten Threads ausgeführt werden, mit Ausnahme von Methoden, die voneinander abhängig sind, die in der ausgeführt wird gleicher Thread, um ihre Reihenfolge der Ausführung zu respektieren.

     

tpi (TestNG nur) Das Attribut Fadenzahl ermöglicht es Ihnen, wie viele Threads angeben sollten für diese Ausführung zugeordnet werden. Macht nur Sinn in Verbindung mit parallel zu verwenden.

Es gibt einen Abschnitt über Tests parallel auf der TestNG der Plugin-Dokumentation. Um dies Ihre todsichere Plugin tun soll wie folgt konfiguriert werden:

<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>

Andere Tipps

true ist kein gültiger Wert für die Option parallel; versuchen methods ( nach den docs )

Dies könnte auch passieren, wenn Sie eine alte Version von TestNG verwenden.

Versuchen Sie, Ihre Abhängigkeit zu TestNG, zum Beispiel ein Upgrade:

<dependency>
  <groupId>org.testng</groupId>
  <artifactId>testng</artifactId>
  <version>5.11</version>
  <classifier>jdk15</classifier>
  <scope>test</scope>
</dependency>

PS: Viele Menschen in der Regel verwenden würden Version 5.1

.

Prost

S. Ali Tokmen http://ali.tokmen.com/

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top