2015-06-11 01:49
浏览 48

Behat / Mink错误片段未生成以下步骤

When switching over from Behat to Mink in v3 to use headless browser for testing. It stops generating Snippets for me automatically from my feature files.

Following the setup for features/bootstrap/FeatureContext.php from the docs.


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

In Behat style just before it had output the functions I needed to set up.

图片转代码服务由CSDN问答提供 功能建议

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

在文档中设置features / bootstrap / FeatureContext.php之后。

 <  code> behat 
   \  n 


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dthok9648 2015-06-11 01:55

    Found the answer after some head scratching and hacking around with some other site examples. Drupal use being the one that helped.

    Mink now is not meant to do it for you for some reason and you are to implement them yourself, seems strange and they should just add it to the docs.

    All needed to do was include the namespace and "implement" it and then all good

    add to features/bootstrap/FeatureContext.php

    use Behat\Behat\Context\SnippetAcceptingContext;

    and at the end of your class def "implements SnippetAcceptingContext"

    class FeatureContext extends MinkContext implements SnippetAcceptingContext

    Then all works again showing when do behat or add auto to the file with

    behat --append-snippets

    You will see at the end of the output something like

    u features/bootstrap/FeatureContext.php - `I should see "count" greater than "10"` definition added
    点赞 打赏 评论
  • dongmaoluan5719 2018-04-19 00:37

    SnippetAcceptingContext is deprecated and will be removed in version 4.0. Use the behat --snippets-for CLI option instead.

    点赞 打赏 评论

相关推荐 更多相似问题