我是ruby的新手,我想在我的ruby/capybara测试中添加一个步骤,其中“如果测试A失败,请在控制台中记录此消息:"Microservice A当前已关闭。”
这应该在after钩子中完成,还是在测试中完成?另外,命令是什么?
describe 'Test Description' do
before (:each) do
login end
after (:each) do
logout
if test fail do
console.log ("Error: Microservice A currently is down")
end
end
it 'Check Page X Loads', :retry => 3, :retry_wait => 3 do
page.should have_content 'Frisbee'
navigate_to_menu 'Toys'
page.has_content?("Frisbee")
expect(page).to have_content('Buy Frisbee') end
end谢谢
发布于 2018-09-18 02:40:39
after挂钩接收作为参数运行的测试,因此您可以执行以下操作
after do |example|
if example.exception
puts "Error: Microservice A currently is down"
end
endhttps://stackoverflow.com/questions/52360011
复制相似问题