[英]How can I publish NUnit test results using Jenkins Pipeline?
嘗試使用漂亮的Jenkins管道,我在查找如何發布NUnit測試結果時遇到了問題。
我可以通過在管道腳本中指定以下命令來運行測試:
stage 'Test'
bat '"C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console-x86.exe" "ProjectName\\bin\\Release\\UnitTests.net.dll"'
但如何讓詹金斯“發布”測試結果並不明顯。 片段生成器只建議junit,這似乎不起作用。
我使用了nunit插件版本0.21並且能夠使用發布結果
stage("PublishTestReport"){
nunit testResultsPattern: 'TestResult.xml'
}
(在上面的例子中,TestResult.xml位於jenkins工作空間的根目錄下)
調查Jenkins的NUnit插件引發了我的問題 ,在那里我找到了解決方案:
step([$class: 'NUnitPublisher', testResultsPattern: 'TestResult.xml', debug: false,
keepJUnitReports: true, skipJUnitArchiver:false, failIfNoResults: true])
將此添加到管道腳本對我有用!
但是,似乎以下內容也應該有效(但目前,顯然,它沒有):使用Snippet Generator,選擇:
step: General Build Step
Publish NUnit test result report
這將在管道腳本中生成以下內容:
step <object of type hudson.plugins.nunit.NUnitPublisher>
這失敗了!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.