9

Measurement Plotsプラグインとタグ付きの xUnit テスト結果ファイルを使用して、Jenkins を使用してプロットを取得することに成功した人はいますか?

はいの場合は、動作する xUnit ファイルのサンプルを見て、Jenkins の構成に関するヒントと、この偉業を達成するための適切な Jenkins ジョブについて教えてください。

4

2 に答える 2

6

著者の助けを借りて、私はそれを理解しました。トリックは、XML 内の XML をエスケープし<system-out>、Measurements Plot プラグインにフィードするために使用することです。以下の手順は、それを使用してプラグインにさまざまな値をフィードする方法を示しています。

  1. Jenkins の「フリー スタイル ソフトウェア プロジェクト」で新しいジョブを作成する
  2. 文字列パラメータ VALUETEST を追加
  3. ビルドステップの追加 シェルコマンドの実行は以下のコードです。
  4. ビルド後のアクションの追加: JUnit の公開
    1. テスト レポート XML: testdetail-*.xml
    2. 長い標準出力を保持するにチェックを入れます
    3. 測定プロットの確認
  5. 保存して今すぐビルドします。
  6. テスト結果の下にプロットが表示されます。プロットを表示するには、複数の実行が必要です。

シェル コマンドを実行します。

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 "&lt;measurement&gt;&lt;name&gt;Line Coverage&lt;/name&gt;&lt;value&gt;$VALUETEST&lt;/value&gt;&lt;/measurement&gt;" >> testdetail-lcov.xml
echo '</system-out>' >> testdetail-lcov.xml

echo '</testcase></testsuite></testsuites>' >> testdetail-lcov.xml
于 2012-12-18T21:33:58.023 に答える
0

Measurement Plots プラグインは、標準出力とエラー バッファーから値を取得するように設計されており、テスト フレームワークの統計と詳細をプロットするために使用しないでください。

xUnit には、この仕事をうまくこなすxUnit プラグインがあります。xUnit で使用される非常に特定のタイプのデータ/情報を処理したい場合を除き、これはテスト結果を適切に表示するためのトリックです。

于 2012-05-04T13:44:34.090 に答える