【发布时间】:2018-10-13 07:11:36
【问题描述】:
我想将我的测试名称传递给 browserstack,以便它们记录在 browserstack 界面中的会话值(名称)中
在我的验收助手中,我定义了以下方法
/**
* HOOK: before test
*
* We use this method to set the test name which will be logged in BrowserStack
* https://www.browserstack.com/automate/capabilities
* @param \Codeception\TestInterface $test
*/
public function _before(\Codeception\TestInterface $test)
{
codecept_debug('_before');
codecept_debug($this->getModule('WebDriver')->_getConfig()['capabilities']);
$config['capabilities'] = $this->getModule('WebDriver')->_getConfig()['capabilities'];
$config['capabilities']['name'] = $test->getName();
$this->getModule('WebDriver')->_setConfig($config);
codecept_debug($this->getModule('WebDriver')->_getConfig()['capabilities']);
}
我的方法存在一些问题
- 此事件似乎在测试登录到 browserstack 后触发(这是我的主要问题 - 我正在寻找注入此名称值的正确位置)
- 测试有时会以错误的名称记录 - 多个测试将使用相同的名称
我应该使用哪个事件来实现我的目标?
【问题讨论】: