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

Show line number of failed scenario #172

Open
cirosantilli opened this issue Nov 2, 2014 · 4 comments
Open

Show line number of failed scenario #172

cirosantilli opened this issue Nov 2, 2014 · 4 comments

Comments

@cirosantilli
Copy link

It would be cool to see it at least on the Errors summary, something like:

Error summary:
  Failures (1)
    A :: B :: C (line 123)

so I can easily run just the failing test next with spinach test.spinach:123

@aackerman
Copy link

It would be even better to do as cucumber as rspec and output the exact command to re-run a failing test to allow for simple copy/paste.

@javierav
Copy link
Contributor

@cirosantilli @aackerman You can easily create your own reporter to show the required info. For example, I recently created a reporter that writes failing scenarios in a txt file to rerun them later: https://github.com/arandaio/spinach-rerun-reporter 😉

@alkuzad
Copy link

alkuzad commented Nov 26, 2015

hack for that (append to env)

module Spinach
  class Reporter
    # This module handles Stdout's reporter error reporting capabilities.
    module Reporting
      def summarized_error(error)
        feature, scenario, step, exception = error
        summary = "    #{feature.name} :: #{scenario.name} :: #{full_step step} (#{feature.instance_variable_get('@filename')}:#{scenario.line})"
        if exception.kind_of?(Spinach::StepNotDefinedException)
          summary.red
        elsif exception.kind_of?(Spinach::StepPendingException)
          summary += "\n      Reason: '#{exception.reason}'\n"
          summary.yellow
        else
          summary.red
        end
      end
    end
  end
end

@mileslane
Copy link

We found that the approach shown above no longer works with spinach 0.10.1. Support for "scenario.line" has been removed and replaced with "scenario.lines". Unfortunately, this spits out all the line numbers, not just the one for the failing test. A way to get the old behavior back would be appreciated.

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

No branches or pull requests

5 participants