2

Jenkins Job DSLプラグインは、CI 構成をリポジトリに保存し、ブランチごとに変更するための非常に優れた方法です。

問題は、MSTest テストを実行し、結果を解析して表示する自然な方法、または自然に近い方法があるかどうかです。

現在、powershell 呼び出しを行っていますが、UI 統合ではなく、ログのみが表示されます。

def testSomeProjectJob =  job(testSomeProjectJobName) {
    steps { 
      powerShell("& ${vstest} '${root}/SomeProject/SomeProject.Tests/bin/Debug/SomeProject.Tests.dll' ")
    }
}

パブリッシャーやテンプレートを使用したトリック、またはそのためのJOB DSLへのプラグインを作成するためのヒントがあるかもしれません


UPD: @daspilker answer、jenkins xUnit PluginおよびarchiveXUnitを使用した MSTest および VSTest の最終的なスクリプト テンプレート

  job('RunTests') {
      steps {
           // VSTEST
           powerShell("& ${vstest} 'path/to/Tests.dll' /logger:trx ")
           // Or MSBUILD
            powerShell("& ${msbuild} /testcontainer:'path/to/Tests.dll' ")
      }
      publishers {
        archiveXUnit {
          msTest {
            pattern('**/*.trx')
            // deleteOutputFiles()
          }
        }
      }
    }
4

2 に答える 2

2

VSTest 用ですが、DSL ジョブで使用できるように構成ブロックを使用する必要がありました。

static Closure useVsTest(List<String> dlls) { return { it / 'builders' << 'org.jenkinsci.plugins.vstest__runner.VsTestBuilder' { vsTestName 'VS 14.0' testFiles dlls.join('\n') settings '' testCaseFilter '' enablecodecoverage false useVsixExtensions true platform 'x86' otherPlatform '' framework 'framework45' otherFramework '' logger 'trx' otherLogger '' cmdLineArgs '/TestAdapterPath:"."' failBuild true } } }

于 2016-06-16T17:57:02.940 に答える