gpt4 book ai didi

cucumber 的特点——猜猜

转载 作者:行者123 更新时间:2023-12-05 09:25:32 25 4
gpt4 key购买 nike

我正在设置我的 Authlogic 用户 session 功能。我有点困惑。当我运行时:

cucumber features 

我收到一些红色错误

     Scenario: User signs in successfully                           # features/user_sessions.feature:21
Given a user exists with login: "sachin", password: "secret" # features/step_definitions/pickle_steps.rb:4
When I go to the login page # features/step_definitions/webrat_steps.rb:15
And I login as "sachin" with password "secret" # features/step_definitions/user_session_setps.rb:5
Then I should see "Login successful" # features/step_definitions/webrat_steps.rb:123
And I should be logged in # features/user_sessions.feature:26
Ambiguous match of "I should be logged in":

features/step_definitions/pickle_steps.rb:55:in `/^((?:(?:I|myself|me|my)|(?:(?:a|an|another|the|that) )?(?:(?:(?:(?:first|last|(?:\d+(?:st|nd|rd|th))) )?(?:user))|(?:(?:user)(?::? "(?:[^\"]|\.)*"))))) should (?:be|have) (?:an? )?((?:duplicable|readonly|nil|store[_ ]full[_ ]sti[_ ]class|new[_ ]record|equal|present|eql|marked[_ ]for[_ ]destruction|valid[_ ]password|valid[_ ]with[_ ]callbacks|logged[_ ]in|valid[_ ]without[_ ]callbacks|respond[_ ]to[_ ]without[_ ]attributes|valid|logged[_ ]out|respond[_ ]to|instance[_ ]variable[_ ]defined|admin|blank|changed|tainted|unserializable[_ ]attribute|locking[_ ]enabled|has[_ ]role|instance[_ ]of|partial[_ ]updates|kind[_ ]of|attribute[_ ]present|is[_ ]a|frozen|invalid|acts[_ ]like|method[_ ]exists|has[_ ]attribute|disable[_ ]perishable[_ ]token[_ ]maintenance|is[_ ]haml|id|created[_ ]at|updated[_ ]at|login|crypted[_ ]password|password[_ ]salt|persistence[_ ]token|login[_ ]count|last[_ ]request[_ ]at|last[_ ]login[_ ]at|current[_ ]login[_ ]at|last[_ ]login[_ ]ip|current[_ ]login[_ ]ip|roles|first[_ ]name|last[_ ]name|perishable[_ ]token|email))$/'
features/step_definitions/user_session_setps.rb:13:in `/^I should be logged in$/'

You can run again with --guess to make Cucumber be more smart about it
(Cucumber::Ambiguous)
features/user_sessions.feature:26:in `And I should be logged in'

Failing Scenarios:
cucumber features/user_sessions.feature:7 # Scenario: User is not signed up
cucumber features/user_sessions.feature:14 # Scenario: User enters wrong password
cucumber features/user_sessions.feature:21 # Scenario: User signs in successfully

正如 cucumber 所暗示的那样,当我使用 --guess 选项运行时:

cucumber features --guess 

全部变绿并通过。这是预期的行为还是错误??

最佳答案

据我所知,如果您有 2 个相同的不同步骤定义,Cucumber 不知道要运行哪一个。使用 --guess 标志强制 Cucumber 选择最有可能的一个。 cucumber rake 任务使用 --strict 标志,如果您有不明确的步骤,将会失败。

本质上,您需要考虑冲突的 2 个步骤(一个在 pickle steps 中,一个在 user_session_steps 中)并决定使用哪一个,然后删除另一个。

关于 cucumber 的特点——猜猜,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1767187/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com