ruby-on-rails – 黄瓜错误被抑制(未完全显示)

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 黄瓜错误被抑制(未完全显示)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚安装了黄瓜,我测试了它.我收到以下错误
  1. teefcomp:cucumber-intro teef$cucumber features/manage_users.feature
  2. Using the default profile...
  3. F----F
  4.  
  5. Failing Scenarios:
  6. cucumber features/manage_users.feature:6 # Scenario: User List
  7.  
  8. 1 scenario (1 Failed)
  9. 4 steps (4 skipped)
  10. 0m0.029s

它似乎是在抑制错误.我期待的是:

  1. Feature: Manage users
  2. In order to understand my user base better
  3. As an administrator
  4. I want to view a list of users
  5.  
  6. Scenario: User List
  7. Given I have users named George,Mary
  8. uninitialized constant User (NameError)
  9. ./features/step_definitions/user_steps.rb:3
  10. ./features/step_definitions/user_steps.rb:2:in '/^I have users named (.*)$/'
  11. features/manage_users.feature:7:in 'Given I have users named George,Mary'

任何人都知道如何让黄瓜完整显示错误

–backtrace,– verbose,-b和–trace不起作用;我仍然看到F —- F并列出了失败的场景,但我仍然希望在“NameError”行上有类似描述的内容.这是旧版黄瓜的特征吗? (我正在使用截屏视频开始使用黄瓜.)

解决方法

使用-b标志运行应该会给你一个完整的回溯
  1. cucumber features/manage_users.feature -b

编辑:

此外,您可以使用–backtrace的完整符号.如果您通过rake运行,请使用–trace标志运行

要获得完整输出,可以使用–format标志.我通常使用–format pretty来逐行浏览.

来自–help输出.

  1. -f,--format FORMAT How to format features (Default: pretty). Available formats:
  2. debug : For developing formatters - prints the calls made to the listeners.
  3. html : Generates a nice looking HTML report.
  4. json : Prints the feature as JSON
  5. json_pretty : Prints the feature as pretty JSON
  6. junit : Generates a report similar to Ant+JUnit.
  7. pdf : Generates a PDF report. You need to have the
  8. prawn gem installed. Will pick up logo from
  9. features/support/logo.png or
  10. features/support/logo.jpg if present.
  11. pretty : Prints the feature as is - in colours.
  12. progress : Prints one character per scenario.
  13. rerun : Prints failing files with line numbers.
  14. stepdefs : Prints All step definitions with their locations. Same as
  15. the usage formatter,except that steps are not printed.
  16. tag_cloud : Prints a tag cloud of tag usage.
  17. usage : Prints where step definitions are used.
  18. The slowest step definitions (with duration) are
  19. listed first. If --dry-run is used the duration
  20. is not shown,and step definitions are sorted by
  21. filename instead.
  22. Use --format rerun --out features.txt to write out failing
  23. features. You can rerun them with cucumber @rerun.txt.
  24. FORMAT can also be the fully qualified class name of
  25. your own custom formatter. If the class isn't loaded,Cucumber will attempt to require a file with a relative
  26. file name that is the underscore name of the class name.
  27. Example: --format Foo::BarZap -> Cucumber will look for
  28. foo/bar_zap.rb. You can place the file with this relative
  29. path underneath your features/support directory or anywhere
  30. on Ruby's LOAD_PATH,for example in a Ruby gem.

猜你在找的Ruby相关文章