Cucumber::Undefined 错误有什么值得担心的吗?

发布于 2025-01-02 04:32:26 字数 2033 浏览 0 评论 0原文

我的黄瓜功能文件如下

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 错误值得担心吗?

谢谢 保罗

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔嚣张 2025-01-09 04:32:26

是的,他们是!这表明您的测试实际上没有被执行。您没有说您是否真正编写了步骤定义。如果有,那么 Cucumber 找不到这些文件,如果您不使用传统的文件夹结构,那么您需要使用

cucumber -r my_step_defs_location features

包含您的步骤的文件夹替换 my_step_defs_location 来告诉 Cucumber 这些文件的位置定义。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文