简体   繁体   English

使用Groovy在Jenkins管道中生成测试结果报告| 管道执行| 报告类型

[英]Test Result Report in Jenkins Pipeline using Groovy | Pipeline Execution | Report Types

我正在詹金斯(Jenkins)中建立针对以各种测试框架(NUnit,MSTest等)编写的测试项目的测试结果报告,并且希望增进我对报告类型以及管道执行阶段和发布之间的区别的理解。

Pipeline Execution 管道执行

Stages are executed in the order in which they appear and if there are any stages after and the one before fails the following stages will not get executed. 阶段按照它们出现的顺序执行,并且如果后面有任何阶段,而前一个阶段失败,则以下阶段将不会执行。

Where post gets executed regardless of whether or not the stages completed successfully or not, after the stages execution. 在阶段执行之后,无论阶段是否成功完成,都将在何处执行发布。

Report Types 报告类型

Provided I have a stage (produces test result): 如果我有一个阶段(产生测试结果):

stage('MSTest') {
  steps {
    bat(script: 'dotnet test "..\\TestsProject.csproj" --logger "trx;LogFileName=TestResult.xml"')
  }
}

And a post that runs always (consume test result to produce test result report): 并始终运行一个帖子(消耗测试结果以生成测试结果报告):

post {
always {
  xunit testTimeMargin: '5000', thresholdMode: 1, thresholds: [], tools: [ReportType(deleteOutputFiles: true, failIfNotNew: false, pattern: '..\\TestResult.xml', skipNoTestFiles: false, stopProcessingIfError: false)]
}

} }

Project variations: 项目变化:

Provided my test project is written in NUnit the 'ReportType' method in 'tools:' will need to be replaced with NUnit3 for the post to execute successfully. 如果我的测试项目是用NUnit编写的,则“ tools:”中的“ ReportType”方法将需要替换为NUnit3,以使帖子成功执行。

Provided my test project is written in MSTest the 'ReportType' method in 'tools:' will need to be replaced with MSTest for the post to execute successfully. 如果我的测试项目是用MSTest编写的,则“ tools:”中的“ ReportType”方法将需要用MSTest替换,以使帖子成功执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Groovy进行Jenkins管道模拟 - Jenkins pipeline mocking with Groovy 詹金斯管道结果指标分析 - Jenkins pipeline result metric analysis 测试失败挂Jenkins管道 - Failed test is hanging Jenkins pipeline 为什么 Jenkins 多分支流水线作业页面显示 junit 流水线每个阶段的测试结果导致测试计数不正确 - Why does Jenkins multibranch pipeline job page show junit test result for each stage of pipeline which makes count of test incorrect 测试在本地运行,但是在jenkins上没有生成测试“发布JUnit测试结果报告”失败:未找到测试报告文件 - Tests running locally but no test generation on jenkins ‘Publish JUnit test result report’ failed: No test report files were found 我如何为适合Jenkins / Hudson消费的常规测试生成JUnit测试报告? - How would I produce JUnit test report for groovy tests, suitable for consumption by Jenkins/Hudson? Xcode 8 Jenkins JUnit错误:测试报告未找到报告文件 - Xcode 8 Jenkins JUnit error: test report no report files found 从 Nunit 测试结果生成报告 - Generate report from Nunit test result 如何在Jenkins的cppUnit xml报表中设置测试持续时间? - How to set test duration in cppUnit xml report for Jenkins? 如何为测试用例生成一些报告导致单元测试? - How to generate some report for test cases result in unit test?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM