2017-07-10 8 views
0

mavenからTest Suitesを並列にしたいです。 私のpom.xmlは、以下のようになります。mavenとTestngで並列スイートを実行する方法

<profiles> 
     <profile> 
      <id>API_AUTOMATION</id> 
      <build> 
       <plugins> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-surefire-plugin</artifactId> 
         <version>2.19.1</version> 
         <configuration> 
          <parallel>suites</parallel> 
          <threadCount>8</threadCount> 
          <suiteXmlFiles> 
           <!-- TestNG suite XML files --> 
           <suiteXmlFile>./module1.xml</suiteXmlFile>        
          <suiteXmlFile>./module2.xml</suiteXmlFile> 
          </suiteXmlFiles> 
          <testSourceDirectory>src/main/java</testSourceDirectory> 
         </configuration> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
</profiles> 

すべて.xmlファイルはテストスイートですTestNGファイルです。 私に教えてください、どのように並列にスイートを実行する。

+0

として設定します。 [Surefireのドキュメント](http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html#Running_Tests_in_Parallel)では、「」ではなく、「」ではありませんが、テスト(おそらくエラー、最初に ''と書かれています)。残りはOKです。 –

+0

次のコマンドを使ってテストを実行しました。 'mvn clean test -Dmaven.test.failure.ignore = true -Djdk.level = 1.7 -P API_AUTOMATION'ですが、テスト並列を実行せず、順番に実行しました。 –

+1

8プロパティで試してみてください。スレッドカウントプロパティを設定しないで0に設定してください。 – Murthi

答えて

1

あなたは編集によってあなたの質問にエラーの説明を追加してください <threadCountSuites>8</threadCountSuites>プロパティで試すことができますし、スレッド数のプロパティを設定しないか、0

1

Parallelmode "suites"はTestNGではサポートされていませんが、SurefireやRun TypeのTestNGではサポートされていません。ドキュメントのcommand line optionsから

-parallel methods|tests|classes If specified, sets the default 
             mechanism used to determine how 
             to use parallel threads when 
             running tests. If not set, 
             default mechanism is not to use 
             parallel threads at all. This can 
             be overridden in the suite 
             definition. 

証明はv6.11 sources of XmlSuiteで見つけることができます:

public class XmlSuite implements Serializable, Cloneable { 
    /** Parallel modes */ 
    public enum ParallelMode { 
    TESTS("tests", false), METHODS("methods"), CLASSES("classes"), INSTANCES("instances"), NONE("none", false), 

    ... 
    } 
    ... 
} 

これはTestNGの6.11およびそれ以前のバージョンに適用されます。

複数の.xmlファイルのテストをmultiple <test> nodesdefine the parallelism in the testng.xmlという1つの.xmlファイルに追加することを検討して、testsとすることを検討してください。

関連する問題