Measurement Plotsプラグインとタグ付きの xUnit テスト結果ファイルを使用して、Jenkins を使用してプロットを取得することに成功した人はいますか?
はいの場合は、動作する xUnit ファイルのサンプルを見て、Jenkins の構成に関するヒントと、この偉業を達成するための適切な Jenkins ジョブについて教えてください。
Measurement Plotsプラグインとタグ付きの xUnit テスト結果ファイルを使用して、Jenkins を使用してプロットを取得することに成功した人はいますか?
はいの場合は、動作する xUnit ファイルのサンプルを見て、Jenkins の構成に関するヒントと、この偉業を達成するための適切な Jenkins ジョブについて教えてください。
著者の助けを借りて、私はそれを理解しました。トリックは、XML 内の XML をエスケープし<system-out>
、Measurements Plot プラグインにフィードするために使用することです。以下の手順は、それを使用してプラグインにさまざまな値をフィードする方法を示しています。
シェル コマンドを実行します。
echo '<?xml version="1.0" encoding="UTF-8"?>' > testdetail-lcov.xml
echo '<testsuites name="CodeAnalysis" tests="2" failures="0" disabled="0" errors="0" time="0">' >> testdetail-lcov.xml
echo '<testsuite name="Suite" tests="1" >' >> testdetail-lcov.xml
echo '<testcase name="Case" status="run" time="0" classname="Suite">' >> testdetail-lcov.xml
echo '</testcase></testsuite>' >> testdetail-lcov.xml
echo '<testsuite tests="1" >' >> testdetail-lcov.xml
echo '<testcase name="Lcov" status="run" time="0" classname="CodeAnalysis.Coverage">' >> testdetail-lcov.xml
echo '<system-out>' >> testdetail-lcov.xml
echo "<measurement><name>Line Coverage</name><value>$VALUETEST</value></measurement>" >> testdetail-lcov.xml
echo '</system-out>' >> testdetail-lcov.xml
echo '</testcase></testsuite></testsuites>' >> testdetail-lcov.xml
Measurement Plots プラグインは、標準出力とエラー バッファーから値を取得するように設計されており、テスト フレームワークの統計と詳細をプロットするために使用しないでください。
xUnit には、この仕事をうまくこなすxUnit プラグインがあります。xUnit で使用される非常に特定のタイプのデータ/情報を処理したい場合を除き、これはテスト結果を適切に表示するためのトリックです。