2014-05-03 17 views
3

我正在經歷在Windows上設置和運行behat的過程。安裝和設置成功的地方,現在試圖從CMD運行時我得到:在試圖針對功能運行Behat時,情況和步驟被報告爲未定義。

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(); 
} 

依此類推。

我運行命令:

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

我認爲是沒有達到一定的資源,所以在所有相關的目錄:

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" 

嘗試放置的特徵文件這裏:「F:\ Program_Files \ Behat \ bin \ features \ search.feature」 給出相同的輸出。

請讓我知道,如何成功地運行behat指定的* .feature文件。謝謝。

UPDATE:

當我運行「>貝哈特-dl」沒有輸出 - 我想我沒有達到定義表達式。

+1

bahat.yml看起來不正確 –

+0

@CiaranMcNulty - 改名它到「behat.yml」。感謝您的注意。但它並沒有解決主要問題。 –

回答

1

是,凡在缺少步驟定義:

Behat\bin\features\bootstrap\FeatureContext.php 

我被搞糊塗了一下,當他們跑在本教程中的測試腳本: http://knpuniversity.com/screencast/behat/intro

如果任何人有這個問題,請按照下列步驟此處並手動添加步驟定義: http://docs.behat.org/quick_intro.html#writing-your-step-definitions

或者請檢查FeatureContext.php是否正確地繼承了步驟定義來自水貂圖書館。你應該註釋掉該行:

Behat\Behat\Context\BehatContext, 

加入這一行:

use Behat\MinkExtension\Context\MinkContext; 

並修改FeatureContext類聲明以擴展MinkContext

class FeatureContext extends MinkContext { // code here } 
相關問題