Why Codeception creates new \Test instance for each test* method?

吃可爱长大的小学妹 提交于 2019-12-10 13:08:54

问题


As a base I use \Codeception\TestCase\Test class.

And I noticed that for every test* methods defined in class, codeception recreates TestCase\Test class !

But Why?

As result I can't use class fields!

public function getName() {
    if (!empty($this->_name)) {
        return $this->_name;
    } else $this->_name = uniqid('_name');
}

getName() for every test method will return new generated name.. thats wrong behavior as for me. It's possible to resolve this situation if I wants to use class fields for every test methods, like in normal OOP?

来源:https://stackoverflow.com/questions/32580410/why-codeception-creates-new-test-instance-for-each-test-method

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!