2016-11-24 21 views
1

失敗したテストを再実行するためにSurefireパラメータをテストしようとしているため、私が知っているテストを再実行したい。 私はここでSurefire再実行失敗テストが動作しない

-Dsurefire.rerunFailingTestsCount=2 -Dtest=TestThatFails test 

-Dsurefire.rerunFailingTestsCount=2 -Dtest=TestThatFails surefire:test 

は、私がいることを期待していたpom.xml

<dependency> 
    <groupId>org.apache.maven.surefire</groupId> 
    <artifactId>surefire-api</artifactId> 
    <version>2.19.1</version> 
</dependency> 
<dependency> 
    <groupId>org.seleniumhq.selenium</groupId> 
    <artifactId>selenium-java</artifactId> 
    <version>2.53.1</version> 
</dependency> 

<dependency> 
    <groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>4.12</version> 
    <scope>test</scope> 

の一部であり、予想通り、それらのいずれもが作品の2つのコマンドでMavenを実行してみました確信は失敗後にテストを再開するが、Maven ju stはこのエラーを投げます。解決する方法はわかりましたが、テストを再実行します。

Results : 

Tests in error: 
    testA(selenium.services.TestThatWillFail): Element is not currently visible and so may not be interacted with(..) 

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 

[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 55.060 s 
[INFO] Finished at: 2016-11-24T12:58:02+01:00 
[INFO] Final Memory: 18M/173M 

[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project eskn_selenium: There are test failures. 

答えて

1

すなわち文書から欠落しているがSUREFIRE-1087で述べたように、パラメータrerunFailingTestsCountは、Mavenの確実なプラグインのバージョン2.18で導入されました。あなたが2.12.4のデフォルトバージョン(Super POMに由来)を使用しているので、そのオプションは利用できません。

したがって、修正プログラムは、Surefireバージョンを少なくとも2.18以上のバージョンに更新するだけです。例えば、現在2.19.1である、最新:このパラメータは唯一の(あなたが4.12のJUnitしておりますので、あなたのケースである)のJUnit 4+で動作することを

<pluginManagement> 
    <plugins> 
    <plugin> 
     <artifactId>maven-surefire-plugin</artifactId> 
     <version>2.19.1</version> 
    </plugin> 
    </plugins> 
</pluginManagement> 

注意。

+0

今私は見る! 私はそれを依存関係として追加すると作業はしますが、プラグインとして追加する必要があると思いました。私はあなたがpom.xml haha​​ですでに定義されていることに気付かなかったかどうか聞いていました。 ありがとうございました! –

1

代わりに、コマンドラインプロパティ-Dsurefire.rerunFailingTestsCount = 2を使用しての、あなたもちょうどヴィムRutgeertsの答えに追加するプロパティのセクションにポンポンで

<properties> 
    <surefire.rerunFailingTestsCount>2</surefire.rerunFailingTestsCount> 
</properties> 
0

それを定義することができます - rerunFailingTestsCountでなければなりません私の場合は

<configuration> 
    <rerunFailingTestsCount>2</rerunFailingTestsCount> 
</configuration> 

maven-surefire-plugin 2.19.1それがこの方法を働いたとのこのようなpropertiesconfigurationセクションではなく、。それはpropertiesにあったときにうまくいかなかった。

関連する問題