Maven이 SureFireexEcutionException으로 실패한 이유 :> 값과 평행 한 옵션을 설정할 수 없습니다.

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

  •  12-09-2019
  •  | 
  •  

문제

안녕하세요 저는 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]
------------------------------------------------------------------------
도움이 되었습니까?

해결책

로부터 확실한 플루인 선적 서류 비치:

평행한 (testng 만 해당) 병렬 속성을 사용할 때 TestNG는 서로에 의존하는 메소드를 제외하고 모든 테스트 방법을 별도의 스레드로 실행하려고합니다.

ThreadCount (TestNG 만 해당) 속성 스레드-카운트를 사용하면이 실행에 할당해야 할 스레드 수를 지정할 수 있습니다. 병렬과 함께 사용하는 것이 합리적입니다.

병렬로 테스트 실행에 관한 섹션이 있습니다. 테스트 페이지 플러그인 문서의. 이렇게하려면 SureFire 플러그인을 다음과 같이 구성해야합니다.

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

다른 팁

true 옵션의 유효한 값이 아닙니다 parallel; 노력하다 methods (문서에 따라)

이전 버전의 TestNG를 사용하는 경우에도 발생할 수 있습니다.

예를 들어 TestNG로 종속성을 업그레이드하십시오.

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

추신 : 많은 사람들이 일반적으로 버전 5.1을 사용합니다.

건배

S. Ali Tokmenhttp://ali.tokmen.com/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top