0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

./gradlew test --test ~でテストクラスが見つからないと出たら

Posted at

テストが莫大な数になったので自身の担当分のみ出力させる方法がないか調べました。

環境

Java 21
VSCode
JUnit5

前提

・xxxxTest.javaだけテストしたい
・構造は下記
 :a-sample-practice jp.co.app.example.yyyyTest.java
 :b-sample-practice jp.co.app.example.xxxxTest.java

解決策①

特定のテストクラスを指定

./gradlew test --test jp.co.app.example.xxxxTest.java

しかし上記を実行しても見つからないよ〜というエラーパターンがあります。
「jp.co.app.example」、こちらが同じため先にヒットしてしまった方で判定してしまうのかもしれません。
そのため次の方法でテストします。

解決策②

モジュールで明示的にする

./gradlew :b-sample-practice test --test jp.co.app.example.xxxxTest.java

明示的に記述することでテストを行なってくれます。

終わりに

多分もっとスマートなやり方があると思います

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?