Surefireを使用してMavenから並列TestNGテストを開始しようとしていますが、ほとんど成功していません。Surefireを使用してMavenから並列TestNGテストを起動しようとしています
私のスイートには4つのテストがありますが、これまでのところMavenはテストを一度に1つずつ連続して実行しています。 1つのテストが終了して初めて次のテストが開始されます。
私が使用している設定を見て、何か不具合を見つけたり、一般的な提案があれば教えていただければ幸いです。
これはのpom.xmlに設定されているかの確実である: -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<parallel>classes</parallel>
<threadCount>3</threadCount>
<testFailureIgnore>true</testFailureIgnore>
<suiteXmlFiles>
<suiteXmlFile>src/main/MyTestSuite.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
これは私のスイートファイル(MyTestSuite.xml)である: -
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="My Custom suite" parallel="classes">
<parameter name="driver.type" value="CHROME"/>
<parameter name="environment" value="DEV"/>
<parameter name="timeout" value="5000"/>
<parameter name="maxAttempts" value="20"/>
<parameter name="logLevel" value="INFO"/>
<parameter name="driver.quit" value="true"/>
<suite-files>
<suite-file path="./Test1.xml"/>
<suite-file path="./Test2.xml"/>
<suite-file path="./Test3.xml"/>
<suite-file path="./Test4.xml"/>
</suite-files>
</suite>
そして、ここでの1の例であります個々のスイートファイル(Test1.xml): -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Test Suite 1" parallel="classes">
<test verbose="10" name="Test1" annotations="JDK">
<classes>
<class name="com.me.test.Test1" />
</classes>
</test>
</suite>
テストが正常に実行されますが、直列に、平行ではありません。どんな提案も大歓迎です。私はキュウリのテストを並行して実行するのに問題はなかったが、これまでのTestNGでは運がなかった。読んでくれてありがとう。
素晴らしい返信と、ブログの非常に良い情報。ありがとうございました。私はスイートスイートのアプローチから離れ、あなたのブログにアプローチを採用すると思います。私は、スイート形式のスイートは、プロジェクトが歴史的にどのように組織されたかという残った特徴だと思います。それを再構成する時間! –