【问题标题】:How to link feature files with step definition in CodeceptJS?如何将功能文件与 CodeceptJS 中的步骤定义链接?
【发布时间】:2019-08-23 22:46:12
【问题描述】:

我正在尝试使用 PHPStorm 作为我的 IDE 在 CodeceptJS 中实现 BDD 框架。但由于某种原因,它无法识别步骤定义,并且在功能文件中显示错误

未定义的步骤参考

我遵循了 CodeceptJS 文档中给出的步骤,例如 codeceptjs gherkin:init(它实现了小黄瓜模块)和 codeceptjs gherkin:snippets(它自动实现了步骤定义) 我正在运行

  • MacOS
  • PHPStorm 上的 CodeceptJS
  • 带有 ChromeDriver 的 Selenium 服务器

我的 codecept.conf.js 文件

exports.config = {
  output: './output',
  helpers: {
    WebDriver: {
      smartWait: 10000,
      url: 'my_url',
      browser: 'chrome'
    }
  },
  include: {
    I: './steps_file.js',
    assignmentsPage: './pages/AssignmentsPageObject.js'
  },
  mocha: {},
  bootstrap: null,
  teardown: null,
  hooks: [],
  gherkin: {
    features: './features/*.feature',
    steps: ['./step_definitions/steps.js']
  },
  plugins: {
    screenshotOnFail: {
      enabled: true
    }
  },
  tests: './*_test.js',
  name: 'AssignmentsClient'
}

我希望框架能够检测到与功能文件中提到的各种场景相对应的步骤定义。

有人可以帮我吗?

【问题讨论】:

    标签: phpstorm gherkin codeceptjs


    【解决方案1】:

    目前不支持 CodeceptJS,请投票给WEB-31128 以获取有关此功能的任何进展的通知

    【讨论】:

    • 非常感谢莉娜!非常感谢!
    【解决方案2】:

    更新:无法识别 BDD 框架的原因是 PHPStorm 不支持黄瓜插件。所以它只在IDE中显示未定义。一旦您开始从终端运行测试,它就会被识别并相应地工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-23
      • 1970-01-01
      • 2021-12-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多