duandu5846 2014-05-03 12:30
浏览 39

在尝试针对某项功能运行Behat时,报告的方案和步骤未定义

I'm going through the process of setting up and running behat on windows. The installation and set up where successful, now when trying to run it from CMD i get:

2 scenarios (2 undefined)
8 steps (8 undefined)
0m0.081s

You can implement step definitions for undefined steps with these snippets:

/**
 * @Given /^I am on "([^"]*)"$/
 */
public function iAmOn($arg1)
{
    throw new PendingException();
}

And so on.

I'm running the command:

 F:\Program_Files\Behat\bin>Behat F:\Program_Files\Behat\vendor\behat\mink-extension\features\search.feature

I think that some resource is not being reached, so there is are all the relevant directories:

Behat: "F:\Program_Files\Behat\bin\"
Features: "F:\Program_Files\Behat\vendor\behat\mink-extension\features\"
Feature context: "F:\Program_Files\Behat\bin\features\bootstrap\FeatureContext.php"
Behat config: "F:\Program_Files\Behat\bin\behat.yml"

Trying to place the features file here: "F:\Program_Files\Behat\bin\features\search.feature" gives the same output.

Please let me know, how to succefully run behat against the *.feature file specified. Thanks.

UPDATE:

when i run " >behat -dl " there is no output - I guess I'm not reaching definition expressions.

  • 写回答

1条回答 默认 最新

  • douza19870617 2014-05-03 14:59
    关注

    Yes, the step definitions where missing in:

    Behat\bin\features\bootstrap\FeatureContext.php
    

    I was confused a bit when they ran the test script in this tutorial: http://knpuniversity.com/screencast/behat/intro

    If anyone else has this problem follow these steps here and add the step definitions manually: http://docs.behat.org/quick_intro.html#writing-your-step-definitions

    Or please check that the FeatureContext.php correctly inherits the step definitions from Mink library. You should comment out this line:

    Behat\Behat\Context\BehatContext,
    

    Add this line:

    use Behat\MinkExtension\Context\MinkContext;
    

    And modify the FeatureContext class declaration to extend MinkContext

    class FeatureContext extends MinkContext { // code here }
    
    评论

报告相同问题?