aer*_*hov 2 mstest jenkins jenkins-plugins jenkins-job-dsl jenkins-mstest
Jenkins Job DSL插件是一种非常好的方式,可以在repo中存储CI配置,并在分支之间进行更改.
问题是 - 是否有一种自然或接近自然的方式来运行MSTest测试,解析结果并显示它们.
现在我做了一个powershell调用,但这只给了我日志,而不是UI集成.
def testSomeProjectJob = job(testSomeProjectJobName) {
steps {
powerShell("& ${vstest} '${root}/SomeProject/SomeProject.Tests/bin/Debug/SomeProject.Tests.dll' ")
}
}
Run Code Online (Sandbox Code Playgroud)
可能有一个出版商或一个带模板的技巧,或者为JOB DSL编写插件的一些技巧
UPD:使用@daspilker回答,jenkins xUnit插件和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()
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
使用PowerShell步骤是一个良好的开端.安装xUnit插件以解析并显示结果.它可以解析各种测试结果,包括MSTest.您可以使用DSL配置插件.
例:
job('example') {
steps {
powerShell('...')
}
publishers {
archiveXUnit {
msTest {
pattern('path/to/test/results')
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
851 次 |
| 最近记录: |