简体   繁体   English

yii2 使用 codeception 进行测试

[英]yii2 testing using codeception

I am writing a simple test case.我正在编写一个简单的测试用例。 I installed codeception using composer.我使用composer安装了codeception。 My test cases are located in root folder inside test case folder我的测试用例位于测试用例文件夹内的根文件夹中

when i try to run the following code当我尝试运行以下代码时

namespace app\tests\testcases;

use yii\codeception\TestCase;

class SomeMyTest extends TestCase
{

public function testOne()
{
    echo "here";
}



}

when i try to run the code in a browser i get the following error当我尝试在浏览器中运行代码时,出现以下错误

 Fatal error: Class 'yii\codeception\TestCase' not found 

There is this file called as yiisoft\\yii2-codeception\\TestCase.php in my project在我的项目中有一个名为 yiisoft\\yii2-codeception\\TestCase.php 的文件

What am i doing wrong?我究竟做错了什么? Can anyone help.?任何人都可以帮忙。?

https://github.com/yiisoft/yii2-codeception

composer require yiisoft/yii2-codeception --dev

Install codeception using this commands使用此命令安装 codeception

composer require codeception/codeception
composer require codeception/specify
composer require codeception/verify

More at https://www.yiiframework.com/doc/guide/2.0/en/test-environment-setup更多信息请访问https://www.yiiframework.com/doc/guide/2.0/en/test-environment-setup

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM