在使用 behat 和 selenium 执行测试时启动 Xdebug
Start Xdebug while performing test with behat and selenium
我将 Behat 配置为使用 Selenium Standalone 3.0.1 和 Chrome 驱动程序,但是现在,我需要在我的代码中添加断点来调试它,所以我需要启用 Xdebug。
当我的 Chrome 浏览器启动我的 selenium 时,我需要将 XDEBUG_SESSION_START=1 添加到 url.
我该怎么做?
终于自己找到了答案。您需要在 senario url 中添加 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 触发 behat
SET XDEBUG_CONFIG="idekey=netbeans-xdebug"
cd C:\netbeanprojetject\myproject
bin\behat.bat
我将 Behat 配置为使用 Selenium Standalone 3.0.1 和 Chrome 驱动程序,但是现在,我需要在我的代码中添加断点来调试它,所以我需要启用 Xdebug。
当我的 Chrome 浏览器启动我的 selenium 时,我需要将 XDEBUG_SESSION_START=1 添加到 url.
我该怎么做?
终于自己找到了答案。您需要在 senario url 中添加 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 触发 behat
SET XDEBUG_CONFIG="idekey=netbeans-xdebug"
cd C:\netbeanprojetject\myproject
bin\behat.bat