2015-11-19 64 views
2

我設置了一個簡單的測試場景來學習behat,但我遇到了一些問題。我正在關注THIS教程。Behat - 未定義的功能步驟

這裏是我的功能顯示

Feature: show 
    This is a behat feature to test the article pages. 

##TODO 
Scenario: I want to view a detailed article page 
    Given I am logged in 
     And I'm on "/articles" 

    When I press an article Image 

    Then I should see a title 
     And I should see an Image 
     And I should see some text 

,這裏是我的FeatureContext.php文件

 <?php 


     use Behat\MinkExtension\Context\MinkContext; 



     /** 
     * Features context. 
     */ 
     class FeatureContext extends MinkContext 
     { 
      /** 
      * Initializes context. 
      * Every scenario gets its own context object. 
      */ 
      public function __construct() 
      { 
      } 

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

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

      /** 
      * @When /^I fill in "([^"]*)" with "([^"]*)"$/ 
      */ 
      public function iFillInWith($arg1, $arg2) 
      { 
       throw new PendingException(); 
      } 

      /** 
      * @Then /^I should see "([^"]*)" in the "([^"]*)" element$/ 


    */ 
     public function iShouldSeeInTheElement($arg1, $arg2) 
     { 
      throw new PendingException(); 
     } 
} 

但是每次我嘗試運行的功能,我會得到相同的結果,看起來像這樣:

Feature: show 
    This is a behat feature to test the article pages. 

    Scenario: I want to view a detailed article page # features\show.feature:5 
    Given I am logged in 
    And I'm on "/articles" 
    When I press an article Image 
    Then I should see a title 
    And I should see an Image 
    And I should see some text 

1 scenario (1 undefined) 
6 steps (6 undefined) 
0m0.32s (4.78Mb) 

我不確定是什麼原因導致了這個問題。我一直在尋找解決方案,但我找不到它。我希望你們中的一個能幫助我!

在此先感謝

+0

上有一個https非常好的教程:// knpuniversity.com – johnatasjmo

回答

相關問題