2017-12-15 27 views
0

私は既に Surefire is not picking up Junit 5 tests を見ていますが、Junit5ではこれらの提案がすぐには機能しないようになっています。Maven surefireプラグインでJunit5テストが検出されない

のMaven:私は私のpom.xml

<dependencies> 
    <dependency> 
     <groupId>com.google.guava</groupId> 
     <artifactId>guava</artifactId> 
     <version>23.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>commons-lang3</artifactId> 
     <version>3.7</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.junit.jupiter</groupId> 
     <artifactId>junit-jupiter-api</artifactId> 
     <version>5.0.2</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.junit.platform</groupId> 
     <artifactId>junit-platform-surefire-provider</artifactId> 
     <version>1.0.2</version> 
     <scope>test</scope> 
    </dependency> 
    <!-- Only required to run tests in an IDE that bundles an older version --> 
    <dependency> 
     <groupId>org.junit.platform</groupId> 
     <artifactId>junit-platform-launcher</artifactId> 
     <version>1.0.2</version> 
     <scope>test</scope> 
    </dependency> 
    <!-- Only required to run tests in an IDE that bundles an older version --> 
    <dependency> 
     <groupId>org.junit.jupiter</groupId> 
     <artifactId>junit-jupiter-engine</artifactId> 
     <version>5.0.2</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.junit.vintage</groupId> 
     <artifactId>junit-vintage-engine</artifactId> 
     <version>4.12.2</version> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.20.1</version> 
     </plugin> 
    </plugins> 
</build> 

に次き3.3.9 あなたが推測していますこれらはJunit5の最新可能バージョンで、見ることができますが、私は実行するとMVNがそれをinstallコマンドを通りまだテストを検出しません。

提案がありますか?確かにそれはmaven + surefireプラグイン+ Junit5 API + Junit5エンジンが一緒に遊んでいないことを確認し、それを動作させるためにバージョンをアップグレード/ダウングレードするのは嬉しいです。

答えて

3

あなたは確実にv2.19にダウングレードできます。

シュアファイア2.20には、open issue againt JUnit5があります。

次シュア構成はJUnit5で動作します:

<junit.platform.version>1.0.1</junit.platform.version> 
<junit.jupiter.version>5.0.1</junit.jupiter.version> 
<maven.surefire.plugin.version>2.19</maven.surefire.plugin.version> 

<plugin> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>${maven.surefire.plugin.version}</version> 
    <dependencies> 
     <dependency> 
      <groupId>org.junit.platform</groupId> 
      <artifactId>junit-platform-surefire-provider</artifactId> 
      <version>${junit.platform.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.junit.jupiter</groupId> 
      <artifactId>junit-jupiter-engine</artifactId> 
      <version>${junit.jupiter.version}</version> 
     </dependency> 
    </dependencies> 
</plugin> 
+0

Aahaので、私はプラグインのセクション内の依存関係を使用する必要がありました。私はちょうどトップレベルに設定していた。 –

関連する問題