我正在使用 Behat 和 Mink 来测试几个站点。其中两个使用单点登录,所以我的一个测试包括登录一个站点,转到第二个站点并检查我是否已登录。
这是通过以下行为代码完成的:
Feature: SSO
In order to login in all related sites
As a anonymous user
I want to login in just one site
Scenario: Login with normal user
Given I am on "/user/login"
When I fill in "name" with "username"
And I fill in "pass" with "password"
And I press "login"
Then I should see "My account"
And I go to "http://server.developer1.workstations/"
Then I should see "Close session"
这行得通,但问题是这一行:
And I go to "http://server.developer1.workstations/"
我们有不同的环境(本地开发者、开发者、暂存)和不同的 URL,所以我无法编写适用于每台机器的测试。第一台服务器没问题,因为我可以为每台机器设置不同的 base_url 设置,但是我找不到将第二台服务器设置为常规设置的方法,而不是重写每个功能文件来更改第二台服务器的 URL。
有什么方法可以声明变量、常量或可以存储在每台机器不同的文件中的东西吗?