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) mstest jenkins jenkins-plugins jenkins-job-dsl jenkins-mstest