gpt4 book ai didi

ruby - 显示因特定标记而失败的测试数量(Jenkins 中的 Ruby、Cucumber)

转载 作者:太空宇宙 更新时间:2023-11-03 16:05:06 26 4
gpt4 key购买 nike

我正在考虑将@high_priority 和@low_priority 添加到我们测试套件中的某些测试中,以便找出有多少高优先级(风险)测试失败了。理想情况下,我希望在 Jenkins 中的测试作业旁边有一列显示

1/100 high priority and 8/60 low priority tests failed.

如果有必要,我对控制台输出中的类似输出很满意。

目前 Jenkins 作业正在运行命令行执行,如:

cucumber --tags @AU_smoke ENVIRONMENT=beta --format html --out 'C:\git\testingworkspace\Reports\smoke_BETA_test_report.html'  --format pretty

编辑:添加额外的作业并不是真正的解决方案,我们有大量的作业运行所有测试的子集,因此为高优先级和低优先级添加额外的作业需要将我们拥有的作业数量增加三倍。

最佳答案

我已经决定将 description setter 插件与 extra columns 插件一起使用。这允许我将构建描述添加为我的 View 和我的代码中的列

After do |scenario|
if scenario.status.to_s=="passed"
$passed=$passed+1
elsif scenario.status.to_s=="failed"
$failed=$failed+1
puts "FAILED!"
elsif scenario.status.to_s=="undefined"
$undefined=$undefined+1
end
$scenario_count=$scenario_count+1
if scenario.failed?
Dir::mkdir('screenshots') if not File.directory?('screenshots')
screenshot = "./screenshots/FAILED_#{scenario.name.gsub(' ','_').gsub(/[^0-9A- Za-z_]/, '')}.png"
@browser.driver.save_screenshot(screenshot)
puts "Screenshot created: #{screenshot}"
embed screenshot, 'image/png'
#@browser.close
end
#@browser.close
end

at_exit do
end_time=Time.now

elapsed_time=end_time.to_i - $start_time.to_i
puts "\#description#scenarios total: #{$scenario_count}, passed: #{$passed}, failed: #{$failed}, known bug fails: #{$known_bug_failures}, undefined: #{$undefined}.#description#"
...

然后在描述 setter 插件中我使用正则表达式

/#description#(.+)#description#/ 

并使用第一个匹配组作为构建描述名称。这也让我可以查看作业的构建历史,一眼就能看出过去几周有多少测试以及通过了多少测试。

关于ruby - 显示因特定标记而失败的测试数量(Jenkins 中的 Ruby、Cucumber),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15662198/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com