【问题标题】:Codeception - comment() to HTML outside of the CestCodeception - 注释()到 Cest 之外的 HTML
【发布时间】:2016-02-04 18:30:04
【问题描述】:

我已经扩展了“test.fail”(如http://codeception.com/docs/08-Customization 的扩展部分所示)方法,我想将一些调试行直接打印到 HTML 报告中,但我无法使用相同的 comment() 方法当我在 Cest 测试中时,这是可能的。

我想使用类似的东西:

 comment("TEST FailEvent!");

而不是

codecept_debug("TEST FailEvent!");

在下面的代码中:

class MyCustomTestEventHandler extends \Codeception\Extension
{
public static $events = array(
    'test.before' => 'beforeTest',
    'test.fail' => 'testFailed'
);

public function beforeTest(\Codeception\Event\TestEvent $e) { }

public function testFailed(\Codeception\Event\FailEvent $e) {
    codecept_debug("TEST FailEvent!");
}

}

【问题讨论】:

    标签: php automated-tests customization codeception


    【解决方案1】:

    我正在使用这个解决方法...

    把它放在你的 Acceptance Helper 类中:

        public function seeMyVar($var)
        {
           $this->debug($var);
        }
    

    在您的 Cest 测试中:

        $fail = "TEST FailEvent!";
        $I->seeMyVar($fail);
    

    【讨论】:

      猜你喜欢
      • 2017-05-12
      • 1970-01-01
      • 2016-08-21
      • 2015-05-13
      • 2017-04-03
      • 1970-01-01
      • 1970-01-01
      • 2016-12-07
      • 1970-01-01
      相关资源
      最近更新 更多