本文介绍了Cucumber ::未定义错误的东西担心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的黄瓜功能文件如下

 功能:创建和管理视频
为了录制视频
作为注册用户
我想创建和管理视频

场景:已发送的视频列表
鉴于我已经发送了题为生日快乐的视频到我的朋友X
当我去我的发件箱视频列表
然后我应该看到生日快乐视频
我应该看到我的朋友X



我使用以下命令运行cucumber:

  cucumber features 

我得到以下输出

 使用默认配置文件... 
功能:创建和管理视频
为了录制视频
作为注册用户
我想创建和管理视频

场景:发送视频列表#features / manage_video.feature:6
鉴于我已经将生日快乐视频发送到我的朋友X#功能/manage_video.feature:7
未定义的步骤:我已经发送视频标题为生日快乐到我的朋友X(Cucumber ::未定义)
功能/ manage_video.feature:7:给我发送了视频生日快乐到我的朋友X'
当我去发送的视频列表#features / manage_video.feature:8
未定义的步骤:我去我的发件箱视频列表(Cucumber :: Undefined)
features / manage_video.feature:8:当我到发件箱的视频列表
然后我应该看到生日快乐视频#功能/manage_video.feature:9
未定义的步骤:我应该看到生日快乐视频(Cucumber :: Undefined)
features / manage_video.feature:9:在然后我应该看到 video'
我应该看到我的朋友X#features / manage_video.feature:10
未定义的步骤:我应该看到我的朋友X(Cucumber ::未定义)
功能/ manage_video.feature:10:在`我应该看到我的朋友X'

1种情况(1未定义)
4步(4未定义)
0m1 .877s

下面我得到一些片段,我将在steps_definition文件中使用。 p>

我的问题是:这些Cucumber :: Undefined错误是否值得担心?



谢谢
保罗

解决方案

是的!这表明没有任何测试实际上正在执行。你不说你是否真的写过步定义。如果你有,然后Cucumber没有找到这些,如果你不使用常规的文件夹结构,那么你需要告诉Cucumber这些位置使用

  cucumber -r my_step_defs_location功能

更换 my_step_defs_location 与包含步骤定义的文件夹。


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?

ThanksPaul

解决方案

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.

这篇关于Cucumber ::未定义错误的东西担心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 19:50