为了从用户的角度测试内部 IT 应用程序,我需要为我的场景建立 Behat 背景,包括登录到基于 cookie 的单点登录解决方案。
这是在 Givens 中设置日志记录的最低限度的测试。一旦成功,当然会有更多的“When”和“Then”。
Feature: Bouncerize
In order to log in to internal applications
As an application user
I need to be able to use the SSO system
Scenario: Log in to Bouncer
Given I am on "https://private_url/login/"
And I fill in "pass_word" with "a hard to guess password"
And I fill in "id" with "username"
And I press "Sign In"
当我运行这个场景时,第一个 Given 失败并出现错误:
Scenario: Log in to Bouncer # features/bouncer.feature:8
Given I am on "https://gh.bouncer.login.yahoo.com/login/" # FeatureContext::visit()
A cookie name is required to generate a field value for this cookie
到目前为止, FeatureContext除了它扩展之外,没有任何自定义Behat\Mink\Behat\Context\MinkContext