Cucumber:未定义的步骤,虽然步骤应该被定义 [英] Cucumber: undefined step, although step should be defined

查看:27
本文介绍了Cucumber:未定义的步骤,虽然步骤应该被定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了步骤:

    Given /^the feed "([^"]*)" has an item "([^"]*)" published at "([^"]*)"$/ do |feed_name, feed_item_title, published_at|
  feed = Feed.find_by_name(feed_name)
  FeedItem.make(:feed => feed, :title => feed_item_title, :published_at => published_at)
end

我运行黄瓜测试:

Scenario: feed items should be sorted by date
    Given I am signed into an account called "GT" as a customer
    And there is a social feed called "Twitter" for the account "GT"
    And the feed Twitter has an item Majbrasa published at "2010-05-01"
    --- more follows 

黄瓜状态:

7 steps (4 skipped, 1 undefined, 2 passed)
You can implement step definitions for undefined steps with these snippets:

Given /^the feed Twitter has an item Majbrasa published at "([^"]*)"$/ do |arg1|
  pending # express the regexp above with the code you wish you had
end

我只是看不出我的步骤有什么问题.我错过了什么?在此先感谢,埃米尔

I just can't see what's wrong with my step. What is it that I'm missing? Thanks in advance, Emil

推荐答案

在你的步骤中,你需要在 Twitter 周围使用",所以在 Majbrasa 中使用它

In your step you need the " " around Twitter so use it same about Majbrasa

Scenario: feed items should be sorted by date
    Given I am signed into an account called "GT" as a customer
    And there is a social feed called "Twitter" for the account "GT"
    And the feed "Twitter" has an item "Majbrasa" published at "2010-05-01"

这篇关于Cucumber:未定义的步骤,虽然步骤应该被定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆