【发布时间】:2016-09-03 18:38:47
【问题描述】:
我们使用 TeamCity 来执行 Specflow+Specrun 的 Selenium 测试,问题是 TeamCity 计数重新执行了测试。 p>
例如,如果某个测试第一次失败,他将被重新执行两次,在 teamcity 中我们会看到三个测试失败,但可能是一次测试。
另外,如果第一次重新执行失败,但其他两次成功,这将在teamcity中报告为两次失败,一次通过,但我需要报告只通过了一次测试。
是否可以在 TeamCity 中使用服务消息或其他方式进行配置?
更新:
根据回答,我们可以使用 powershell 脚本收集日志并使用 teamcity 服务消息更改构建状态:
$path = Get-ChildItem %teamcity.build.checkoutDir%\ProjectFolder\bin\Remote\TestResults\specrun.log
$file = Get-content $path
$total = $file | select-string "Total:"
$passed = $file | select-string "Succeeded:"
$failed = $file | select-string "Failed:"
write-host $( "##teamcity[buildStatus text='Tests {0}, {1}, {2}']" -f $total, $passed, $failed )
【问题讨论】:
-
谢谢。非常有用的脚本。
标签: continuous-integration automated-tests teamcity specflow specrun