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

On test failure print step implementation snippet #44

Closed
Apoorva-GA opened this issue Sep 20, 2017 · 1 comment
Closed

On test failure print step implementation snippet #44

Apoorva-GA opened this issue Sep 20, 2017 · 1 comment
Assignees

Comments

@Apoorva-GA
Copy link
Contributor

Apoorva-GA commented Sep 20, 2017

To easily debug test failures.
Print a snippet of the Step implementation with the line that failed and decrease verbosity of the stack trace.

e.g.

# Specification Heading
  ## Vowel counts in single word	 ✘
        Failed Step: The word "gauge" has "3" vowels.
        Specification: specs/example.spec:18
        Error Message: <3> expected but was
        <4>.
        Stacktrace:
        > 11 | assert_equal(expected_count.to_i, 4)
        /Users/apoorvag/tmp/step_implementations/step_implementation.rb:11:in `block in <top (required)>'

  ## Vowel counts in multiple word	 ✘
        Failed Step: Almost all words have vowels
        Specification: specs/example.spec:28
        Error Message: <3> expected but was
        <0>.
        Stacktrace:
        > 20 | assert_equal(expected_count, actual_count)
        /Users/apoorvag/tmp/step_implementations/step_implementation.rb:20:in `block (2 levels) in <top (required)>'
        /Users/apoorvag/tmp/step_implementations/step_implementation.rb:16:in `each'
        /Users/apoorvag/tmp/step_implementations/step_implementation.rb:16:in `block in <top (required)>'


  Error Message: no block given (yield)
  Stacktrace:
  > 29 | assert_fail_assertion()
  /Users/apoorvag/tmp/step_implementations/step_implementation.rb:29:in `block in <top (required)>'
@Apoorva-GA Apoorva-GA self-assigned this Sep 20, 2017
Apoorva-GA added a commit that referenced this issue Oct 3, 2017
Apoorva-GA added a commit that referenced this issue Oct 17, 2017
sriv added a commit that referenced this issue Oct 17, 2017
Reducing stack trace and showing the code snippet of failure #44
@Apoorva-GA
Copy link
Contributor Author

Should be available in gauge-ruby nightly >= 17/10/17.

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

No branches or pull requests

2 participants