2016-11-14 86 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

相关问题