有没有办法在终端中显示所有自定义 step-definitions 的列表?

Is there a way to display a list of all custom step-definitions in terminal?

我正在努力寻找一种在终端中显示所有自定义 step-definitions 的方法,就像 "behat -dl" 为 MinkContext 及其 pre-defined 步骤执行此操作一样。是否有某种方法可以显示所有 custom-declared 步骤? 这是我的 FeatureContext.php header 的样子,这样您就可以更好地了解我的步数的存储方式。

MyCustomContext.php:

use Behat\Behat\Context\CustomSnippetAcceptingContext;
use Drupal\DrupalExtension\Context\MinkContext as MinkContext;

class MyCustomContext extends MinkContext implements CustomSnippetAcceptingContext

完全披露:我与 Alex 一起工作,所以可以访问他的源代码。

答案实际上是将 behat.yml 文件更改为以下内容:

default:
  paths:
    features: %paths.base%/features/
    bootstrap: %paths.base%/features/bootstrap 
  contexts:
    # - Drupal\DrupalExtension\Context\DrupalContext
    # - Drupal\DrupalExtension\Context\MessageContext
    - InvotraWebContext

关键是引用 bootstrap 位置,以便 behat 加载带有自定义上下文的 php 文件,然后添加自定义上下文的 class 名称 (InvotraWebContext)进入 'contexts' 值。我还必须注释掉现有的自定义上下文,它们实际上是我们实际想要引用的自定义上下文的父 classes(否则 behat 会对重复的步骤感到困惑)。

最后一步是运行

bin/behat -dl