列出单个上下文的定义

时间:2016-03-21 13:59:30

标签: command-line behat

不确定我正在寻找的是否可能。

我正在使用behat,我们有几个团队使用相同的基本代码。 所以有很多句子定义是不可互换的。

我想按上下文列出句子,例如behat -dl,但只从单个上下文文件中提取(如果我可以命名列表,则更好)。

知道是否有可能吗?

修改:添加behat -di输出

...
 Then /^the response status code should be (?P<code>\d+)$/
    - Checks, that current page response status is equal to specified.
    # FeatureContext::assertResponseStatus()

 Then /^the response status code should not be (?P<code>\d+)$/
    - Checks, that current page response status is not equal to specified.
    # FeatureContext::assertResponseStatusIsNot()

 Then /^(?:|I )should see "(?P<text>(?:[^"]|\\")*)"$/
    - Checks, that page contains specified text.
    # FeatureContext::assertPageContainsText()

 Then /^(?:|I )should not see "(?P<text>(?:[^"]|\\")*)"$/
    - Checks, that page doesn't contain specified text.
    # FeatureContext::assertPageNotContainsText()
...

1 个答案:

答案 0 :(得分:0)

没有开箱即用的解决方案。但!您可以使用grep功能。 F.E.

./bin/behat -di

将为您提供有关测试步骤的扩展信息:

TestSuite | When /^I am searching with "([^"]*)" text$/
          | at `Test\Context\FeatureContext::simpleSearch()`

因此,如果您想按文件过滤结果,可以使用下一个命令:

./bin/behat -di| grep "Test\\\\Context\\\\FeatureContext"

注意:反斜杠应该这样对待:\\\\,因为this problem

更新:解决方案仅适用于Behat版本&gt; 3使用套件功能。

相关问题