在JUnit
中,我会用@Before
方法完成此操作但我在Mink中没有看到。有没有人知道如何为所有测试执行此操作,而不是必须在每个函数中执行$this->getSession()->maximize()
?感谢
答案 0 :(得分:3)
您可以使用背景或功能挂钩。两者的工作方式与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)
{
}
在文档中阅读更多内容: