لماذا مخضرم الفشل مع 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 فقط) السمة الخيط العد يسمح لك لتحديد كيفية العديد من المواضيع التي ينبغي أن تخصص لهذا التنفيذ.إلا أنه من المنطقي أن تستخدم جنبا إلى جنب مع موازية.

هناك قسم على تشغيل الاختبارات في نفس الوقت على TestNG الصفحة من وثائق البرنامج المساعد.للقيام بذلك لديك مؤكدة البرنامج المساعد يجب أن يتم تكوين مثل هذا:

<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. علي لكزنhttp://ali.tokmen.com/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top