I am trying to do some specific logic in "after (:each)" declarations for failed TCs. How to catch the fact and the reason of TC failure using Ruby and Rspec methods? I tried something like:
after(:each) do
if RSpec::Expectations::ExpectationNotMetError
e = RSpec::Expectations::ExpectationNotMetError
puts "Error is: " + e.to_s
@driver.save_screenshot "../Reports/#{e}.png"
end
end
But it doesn't work.
Aucun commentaire:
Enregistrer un commentaire