黄瓜::未定义的错误需要担心什么?

时间:2012-02-04 06:37:25

标签: cucumber bdd

我的黄瓜特征文件如下

Feature: Create and Manage Videos
    In order to record a video
    As a registered user
    I want to create and manage videos

    Scenario: sent videos list
        Given I have sent video titled "Happy Birthday" to "My Friend X"
        When I go to my outbox list of videos
        Then I should see "Happy Birthday" video 
        And I should see "My Friend X" 

我使用以下命令运行黄瓜

cucumber features

我得到以下输出

Using the default profile... 
Feature: Create and Manage Videos
  In order to record a video
  As a registered user
  I want to create and manage videos

  Scenario: sent videos list                                         #       features/manage_video.feature:6
    Given I have sent video titled "Happy Birthday" to "My Friend X" # features/manage_video.feature:7
      Undefined step: "I have sent video titled "Happy Birthday" to "My Friend X"" (Cucumber::Undefined)
      features/manage_video.feature:7:in `Given I have sent video titled "Happy Birthday" to "My Friend X"'
    When I go to my outbox list of videos                            # features/manage_video.feature:8
      Undefined step: "I go to my outbox list of videos" (Cucumber::Undefined)
  features/manage_video.feature:8:in `When I go to my outbox list of videos'
Then I should see "Happy Birthday" video                         # features/manage_video.feature:9
      Undefined step: "I should see "Happy Birthday" video" (Cucumber::Undefined)
  features/manage_video.feature:9:in `Then I should see "Happy Birthday" video'
    And I should see "My Friend X"                                   # features/manage_video.feature:10
      Undefined step: "I should see "My Friend X"" (Cucumber::Undefined)
  features/manage_video.feature:10:in `And I should see "My Friend X"'

1 scenario (1 undefined)
4 steps (4 undefined)
0m1.877s

在下面我得到了一堆我将在steps_definition文件中使用的片段。

我的问题是::这些Cucumber :: Undefined错误需要担心吗?

由于 保罗

1 个答案:

答案 0 :(得分:2)

是的,他们是!这表明您的测试都没有实际执行。你没有说你是否真的写过步骤定义。如果你有,那么Cucumber没有找到这些,如果你没有使用传统的文件夹结构,那么你需要告诉Cucumber这些位于哪里

cucumber -r my_step_defs_location features

用包含步骤定义的文件夹替换my_step_defs_location