Cucumber::Undefined error something to worry about?

时光总嘲笑我的痴心妄想 提交于 2020-01-25 05:25:20

问题


My cucumber feature file is as follows

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" 

I run cucumber using the following command

cucumber features

I get the following output

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

Below this I get a bunch of snippets which I will use in the steps_definition file.

My question is :: Are these Cucumber::Undefined errors something to worry about?

Thanks Paul


回答1:


Yes they are! This indicates that none of your tests are actually being executed. You don't say if you've actually written step definitions or not. If you have, then Cucumber isn't finding these, if you aren't using the conventional folder structure then you'll need to tell Cucumber where these are located using

cucumber -r my_step_defs_location features

Replacing my_step_defs_location with the folder containing your step definitions.



来源:https://stackoverflow.com/questions/9138950/cucumberundefined-error-something-to-worry-about

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!