2016-11-14 85 views
0

我配置了Behat以使用Selenium Standalone 3.0.1和Chrome驅動程序,但現在,我需要在代碼中添加斷點來調試它,所以我需要啓用Xdebug。在使用behat和selenium進行測試時啓動Xdebug

當我的Chrome瀏覽器啓動我的硒時,我需要將XDEBUG_SESSION_START = 1添加到該URL。

我該怎麼做?

回答

0

終於自己找到了答案。您需要添加Xdebug的參數在塞納里奧網址:

Feature:check account 

Scenario: local login 
    Given I am on "/login?XDEBUG_SESSION_START=netbeans-xdebug" 
    When I fill in "_username" with "testuser" 
    And I fill in "_password" with "testuser" 
    And I press "Envoyer" 
    Then I should be on "/" 
    And I should see "Main" 

另外,我創建了一個批處理文件來觸發貝哈特與Xdebug的

SET XDEBUG_CONFIG="idekey=netbeans-xdebug" 
cd C:\netbeanprojetject\myproject 
bin\behat.bat 
+1

不是最好的解決辦法,如果你使用的是這不會幫助套房在CI。一個更好的方法是在BeforeScenario鉤子中使用調試標籤來進行post/visit,類似於這裏https://github.com/Behat/Behat/issues/703 – lauda

+0

我一週前開始了,所以我將在稍後解決。但是,謝謝 – Chopchop

+0

對我自己來說,注意有xdebug.remote_autostart = 0。否則,當gey卡住時捲曲 – Chopchop

相關問題