Reputation: 889
I am aware that Frank tool provide option for capturing screenshot. But it is a user defined step.
Taking a screenshot of the app:
Then /^I save a screenshot with prefix (\w+)$/ do |prefix|
filename = prefix + Time.now.to_i.to_s
%x[screencapture #{filename}.png]
end
But is there any other possibility of by default saving the screenshot in case of unexpected test failure ?
Upvotes: 2
Views: 453
Reputation: 46846
Assuming the application is still open, you could use an After hook to call the Frank step that takes screenshots if the test failed.
Try this:
After do |scenario|
if scenario.failed?
steps %Q{
Then I save a screenshot with prefix test
}
end
end
Upvotes: 4