我正在使用 Codeception 对我的 Laravel 4 PHP 应用程序进行单元、功能和验收测试。
我的单元测试如下所示:
use Codeception\Util\Stub;
class ExampleTest extends \Codeception\TestCase\Test
{
public function testExample()
{
$example = true;
$this->assertSame($example, true);
}
}
我的功能测试如下所示:
use \TestGuy;
class ExampleCest
{
public function example(TestGuy $I)
{
$I->amOnPage('/auth/login');
$I->see('Sign in');
}
}
但我也想在我的功能测试中使用 PHPUnit 断言方法。但是当我尝试时,我得到了这个错误:
调用未定义的方法 ExampleCest::assertSame()
如何在 Codeception 功能测试中使用 PHP 断言方法?
最佳答案
在 Codeception 4 中,只需添加断言模块:
modules:
enabled:
- \Codeception\Module\Asserts
到你的 suite.yml 配置文件并运行 codeception build
关于phpunit - 如何在 Codeception 功能测试中使用 PHPUnit 断言方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21430988/