运行 Calabash 测试时,我在之前阶段收到错误,但报告以 0 代码退出。它说所有的测试都失败了,因为所有的步骤都被跳过了,但是 HTML 报告是绿色的。
如何让报告显示有错误?
更新:退出代码是正确的。如果失败,则返回非 0 代码。问题是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