【发布时间】:2016-03-12 10:06:34
【问题描述】:
在JUnit 中,我会在@Before 方法中完成此操作,但在Mink 中我看不到。有谁知道如何为所有测试执行此操作,而不必在每个函数中执行$this->getSession()->maximize()?谢谢
【问题讨论】:
标签: php selenium phpunit behat mink
在JUnit 中,我会在@Before 方法中完成此操作,但在Mink 中我看不到。有谁知道如何为所有测试执行此操作,而不必在每个函数中执行$this->getSession()->maximize()?谢谢
【问题讨论】:
标签: php selenium phpunit behat mink
您可以使用背景或功能挂钩。两者的工作方式都类似于 xUnit 框架中使用的 setUp 方法。
背景更明确:
Feature: your feature
Background:
Given the window is maximized
Scenario: Log in
Given I press the login button
Then I should see "logged in"
使用钩子,您可以执行 FeatureContext 方法。也许这样更合适:
/** @BeforeFeature */
public static function setupFeature(FeatureEvent $event)
{
}
在文档中阅读更多信息:
【讨论】: