抑制黄瓜错误(未完全显示)
我刚刚安装了黄瓜,并进行了测试。我收到以下错误:
teefcomp:cucumber-intro teef$ cucumber features/manage_users.feature
Using the default profile...
F----F
Failing Scenarios:
cucumber features/manage_users.feature:6 # Scenario: User List
1 scenario (1 failed)
4 steps (4 skipped)
0m0.029s
它似乎正在抑制该错误。我期待这样的事情:
Feature: Manage users
In order to understand my user base better
As an administrator
I want to view a list of users
Scenario: User List
Given I have users named George, Mary
uninitialized constant User (NameError)
./features/step_definitions/user_steps.rb:3
./features/step_definitions/user_steps.rb:2:in '/^I have users named (.*)$/'
features/manage_users.feature:7:in 'Given I have users named George, Mary'
有人知道如何让黄瓜完整显示错误吗?
--backtrace
、--verbose
、-b
和 --trace
不起作用;我仍然看到 F----F
并列出了失败的场景,但我仍然期望“NameError”行上有类似描述的内容。这是旧版本黄瓜的功能吗? (我正在使用截屏视频来开始使用黄瓜。)
I just installed cucumber, and I tested it. I got the following error:
teefcomp:cucumber-intro teef$ cucumber features/manage_users.feature
Using the default profile...
F----F
Failing Scenarios:
cucumber features/manage_users.feature:6 # Scenario: User List
1 scenario (1 failed)
4 steps (4 skipped)
0m0.029s
It seems to be suppressing the error. I was expecting something like:
Feature: Manage users
In order to understand my user base better
As an administrator
I want to view a list of users
Scenario: User List
Given I have users named George, Mary
uninitialized constant User (NameError)
./features/step_definitions/user_steps.rb:3
./features/step_definitions/user_steps.rb:2:in '/^I have users named (.*)$/'
features/manage_users.feature:7:in 'Given I have users named George, Mary'
Anyone know how to get cucumber to display the errors in full?
--backtrace
, --verbose
, -b
and --trace
do not work; I still see F----F
and the failing scenario is listed, but I still expect something like description on the "NameError" line. Is this a feature of an older version of cucumber? (I'm using screencasts to start using cucumber.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
-b
标志运行应该会为您提供完整的回溯编辑:
此外,您可以使用
--backtrace
的完整表示法。如果您通过 rake 运行,请使用--trace
标志运行以获得完整输出,您可以使用
--format
标志。我通常使用--format Pretty
来逐行浏览。来自
--help
输出。running with the
-b
flag should give you a full backtraceEDIT:
Additionally, you can use the full notation of
--backtrace
. If you are running via rake, run with the--trace
flagto get full output, you can use the
--format
flag. I generally use--format pretty
to get a line-by-line walk through.from the
--help
output.如果您的应用程序是 Rails 应用程序,您可以对感兴趣的场景使用 @allow-rescue 标记,然后您的 Rails test_log 将包含有关应用程序中最初引发错误的位置的更多详细信息。
从命令行,您可以使用 tail -n200 log/test_log.rb 快速查看测试日志的末尾(调整行数以查看感兴趣的部分)。
If your application is a Rails app, you can use the @allow-rescue tag for the scenario-of-interest, then your rails test_log will include more details about where in your application the error was originally raised.
From the command line you can quickly look at the end of the test log with tail -n200 log/test_log.rb (adjust the number of lines to see the portion of interest).