简体   繁体   English

Calabash html报告在Before阶段忽略错误

[英]Calabash html report ignores errors during Before phase

When running the Calabash tests I get an error during the Before phase but the report exits with 0 code. 运行Calabash测试时,在Before阶段出现错误,但 报告以0代码退出。 It says that all the tests were failed because all the steps were skipped but the HTML report is green. 它说所有测试都失败了,因为跳过了所有步骤,但是HTML报告为绿色。

How can I make the report show that there was an error? 如何使报告显示有错误?

Updated: The exit code is correct. 已更新:退出代码正确。 If it fails it returns a non 0 code. 如果失败,则返回非0码。 The problem is the html formatter. 问题是html格式器。 I'm running it with the following flag: --format=html --out ./target/calabash-reports.html 我正在使用以下标志运行它:--format = html --out ./target/calabash-reports.html

Use 采用

screenshot_and_raise "Error description" 

line in side ruby step definitions where you want to raise the error 红宝石步骤定义中要在其中引发错误的行

Eg: 例如:

Then /^I (?:press|touch) list item number (\d+)$/ do |index|
   index = index.to_i
   screenshot_and_raise "Index should be positive (was: #{index})" if (index<=0)
   touch("tableViewCell index:#{index-1}")
   sleep(STEP_PAUSE)
end

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM