LoginSignup
5
2

More than 5 years have passed since last update.

Jenkins Pipelineのjunit関数にオプションを指定していい感じにしよう

Last updated at Posted at 2017-12-23

この記事ではJenkins 2.88, Pipeline Plugin 2.5, JUnit Plugin 1.23を使用して動作確認を行いました。

簡単テスト結果集計junit

Jenkins Pipelineの使用時、テスト結果xmlファイルからの集計にはjunit関数を使います。

junit 'junit_output.xml'

こんな感じですね。

これで特に実用上困らないですがJUnit Pluginの説明を見ると、Configuration に4つオプション指定できると書いてあります。

https://jenkins.io/doc/pipeline/steps/junit/ を見て指定の仕方を確認します。

実際のオプション指定の書き方と意味

junit allowEmptyResults: true, keepLongStdio: true, healthScaleFactor: 2.0, testResults: '**/target/reports/TEST-*.xml'

  • Test report XMLs
    • テスト結果のxmlファイルを指定します
  • Retain long standard output/error
    • 長い標準エラー出力を保持します
  • Health report amplification factor
    • 「空模様の倍率」。2.0だと5%のテスト失敗が10%の失敗として空模様(Build trend)に反映される?
  • Allow empty results
    • 空のテスト結果ファイルを指定してもエラーになりません

おや? Pipeline Pluginの説明に他にも書いてあるぞ...?

https://jenkins.io/doc/pipeline/steps/junit/
testDataPublishersとか色々指定できるようだけど力尽きたのでここまで...

5
2
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
5
2