Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Successful Retries Never Output Exceptions #39

Open
dylanlive opened this issue Aug 14, 2015 · 1 comment
Open

Successful Retries Never Output Exceptions #39

dylanlive opened this issue Aug 14, 2015 · 1 comment

Comments

@dylanlive
Copy link

I recently moved from rspec-rerun to rspec-retry. I'm using Capybara & Selenium Rspec Tests. These can occasionally be flakey, which is why I am glad for this gem's existence.

However, I try to improve my tests to retry at last resort. Perhaps I'm not waiting long enough for a page to load, etc.

Unfortunately rspec-retry doesn't give me insight as to why the test failed in the first place. If it passes on attempt 3, I'll never know why 1 & 2 failed.

Would the community be opposed to including the exception to the verbose_retry output?

My fear is that this can make the test output rather unreadable at times in the log - especially if it's a big exception. Perhaps a better solution would be to include a snippet when the test finishes with stats about the exceptions rspec-retry caught.

I can fork, experiment and submit a PR, but curious on your thoughts before I do this.

@sbonebrake
Copy link

I'd like to go a step further and keep track of the exceptions and runtimes within the example and potentially let a custom logger decide what to do with them. I think this can be accomplished with the following:

def clear_exception
  if @exception
    finish(reporter)
    metadata[:prior_execution_results] ||= []
    metadata[:prior_execution_results] << metadata[:execution_result]
    metadata[:execution_result] = Example::ExecutionResult.new

    metadata[:prior_exceptions] ||= []
    metadata[:prior_exceptions] << @exception
    @exception = nil
    start(reporter)
  end
end

Obviously this could be cleaned up, renamed and split into a few methods, but I think it would work. Would this solve what you're trying to accomplish?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants