2017-05-22 4 views
0

私のプロジェクトには何千もの統合テストがあります。彼らは完了するまでに多くの時間がかかります。Gradleは、実行前に大量のテストを印刷できますか?

問題は、私が持っているテストの量を覚えていないことです。そのため、testタスクの実行中に進捗状況がわかりません。

Gradleで印刷する方法はありますか1234 of 4567 tests completed

答えて

0

私はテストの総量を知る方法はないと思う。 。おそらく、あなたがフックする方法があるかどうかを確認するためにTest.javaを通して見て取ることができる

をあなたはTestListenerを介して、または経由で実行されたテストの合計数をプリントアウトすることができTest.afterTest(Closure)

例:

test { 
    def allCount = new AtomicLong() 
    def failCount = new AtomicLong() 
    def skipCount = new AtomicLong() 
    def successCount = new AtomicLong() 
    afterTest { TestDescriptor td, TestResult tr -> 
     allCount.incrementAndGet() 
     switch (tr.resultType) { 
      case TestResult.FAILURE : failCount.incrementAndGet(); break; 
      case TestResult.SKIPPED: skipCount.incrementAndGet(); break; 
      case TestResult.SUCCESS: successCount.incrementAndGet(); break; 
     } 
     logger.lifecycle("All: $allCount, Success: $successCount, Fail: $failCount, Skipped: $skipCount") 
    } 
} 
+0

Testクラスのリファレンスをありがとう、それを見てみましょう。 –

関連する問題