黄瓜:虽然步骤已定义,但未定义步骤

时间:2012-09-27 22:59:04

标签: ruby cucumber selenium-webdriver gherkin

我有这个步骤实施

给定/ ^实体URI“([^”] *)“$ / do | arg1 |   @entityUri = arg1 端

我将此步骤从现有要素文件复制到新要素文件

   Given entity URI <Entity Resource URI>

黄瓜州 1个场景(1个未定义) 8个步骤(2个跳过,4个未定义,2个通过) 0m0.009s

您可以使用以下代码段实现未定义步骤的步骤定义:

给定/ ^实体URI“(。*?)”$ / do | arg1 |   pending#用您希望的代码表达上面的正则表达式 端

P.S:我检查了新旧功能文件的目录结构,它们处于同一级别。即使这个解决方案对我也不起作用:Cucumber: undefined step, although step should be defined

2 个答案:

答案 0 :(得分:3)

根据步骤匹配器正则表达式,我希望步骤与步骤周围的双引号匹配:

Given entity URI "<Entity Resource URI>"

答案 1 :(得分:0)

Check with the folder structure it should be like below
Create project folder
 >Create features folder
  >Create step definitions folder
    >Save .rb files here
  >Save .feature files here.

Step definition folder and .feature files should be in the feature file.

Even i faced the same issue like you.The folder structure solved my problem.