【问题标题】:Behat / Mink error Snippets for the following steps not generated未生成以下步骤的 Behat / Mink 错误片段
【发布时间】:2018-04-19 08:37:48
【问题描述】:

在 v3 中从 Behat 切换到 Mink 以使用无头浏览器进行测试时。它会停止从我的功能文件中自动为我生成片段。

按照文档中 features/bootstrap/FeatureContext.php 的设置。

behat

# generates this error at the bottom of the output
--- Snippets for the following steps in the default suite were not generated (check your configuration)

在它输出我需要设置的功能之前以 Behat 风格。

【问题讨论】:

  • 我觉得Docs应该更新并解释得更好,教程和示例似乎很长一段时间都一样

标签: php bdd behat mink


【解决方案1】:

在摸索一些其他网站示例后找到了答案。 Drupal 的使用起到了帮助作用。

出于某种原因,Mink 现在不打算为您做这件事,您要自己实现它们,这看起来很奇怪,他们应该将其添加到文档中。

所有需要做的就是包含命名空间并“实现”它,然后一切顺利

https://behat-drupal-extension.readthedocs.org/en/3.0/localinstall.html

添加到 features/bootstrap/FeatureContext.php

use Behat\Behat\Context\SnippetAcceptingContext;

在你的课程结束时定义“实现 SnippetAcceptingContext”

class FeatureContext extends MinkContext implements SnippetAcceptingContext

然后所有工作再次显示何时执行或将自动添加到文件中

behat --append-snippets

你会在输出的末尾看到类似的东西

u features/bootstrap/FeatureContext.php - `I should see "count" greater than "10"` definition added

【讨论】:

    【解决方案2】:

    SnippetAcceptingContext 已弃用,将在 4.0 版中删除。请改用behat --snippets-for CLI 选项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-01-29
      • 2013-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多