jjzjj

Codeception

全部标签

php - 如何在 Codeception 中强制测试失败

我正在使用Codeception进行WebServices测试,这是我的代码://Makingfirstqueryforgettingneededparameter$I->wantTo('Makesomething');$I->sendPOST($this->route,['token'=>Fixtures::get('token'),'id'=>Fixtures::get('some_id')]);$I->seeResponseCodeIs(200);$I->seeResponseIsJson();$I->seeResponseContains('"error_message"');

php - 生成测试时无法找到配置文件

我正在使用我的yml文件的绝对路径...这不是我应该为其提供路径的正确文件吗?我已经验证我使用的路径是正确的...$vendor/bin/codeceptgenerate:cept-config="~/path/to/codeception.yml"acceptancecreateUser[Codeception\Exception\Configuration]Configurationfilecouldnotbefoundgenerate:cept[-c|--config[="..."]]suitetest 最佳答案 我不确定问题

php - 在 Codeception Functional Cept 中设置预期异常

我想做这样的事情:$I->setExpectedException('Laracasts\Validation\FormValidationException');在功能概念中。有机会这样做吗?\PHPUnit_Framework_TestCase::setExpectedException('Laracasts\Validation\FormValidationException');以上代码将独立运行,但如果我运行codeceptrun,一旦出现预期异常的测试完成,测试就会卡住。这是我的设置:YML:class_name:FunctionalTestermodules:enable

php - Codeception 自动加载类

我在使用Codeception自动加载器加载一些抽象测试类时遇到问题。抽象类的原因是模仿应用程序中使用的类的结构,以减少彻底测试应用程序所需的代码量。假设我有一个用于测试的抽象类,比如说“AbstractRepositoryTester”,它仅用于“存储库”测试套件(出于组织目的,我喜欢将它们分开)。我测试的每个实现“RepositoryContract”的存储库都将有一个测试,该测试还使用一些覆盖的抽象方法扩展“AbstractRepositoryTester”。现在执行此操作时,抽象类将不会在测试期间加载,必须在Bootstrap文件中手动加载。还有另一个抽象扩展了vanillaC

php - 为什么 Codeception 的 PhpBrowser 不遵循 "Reload" header ?

这真实发生在我身上CodeIgniter项目在IonAuthauthenticationlibrary,但为了清楚起见,我将其简化为最简单的形式。脚本:我的这一行脚本位于http://localhost/~captbaritone/redirect/index.php:在我的浏览器中,它重定向到Google.com。测试:为了测试它,我写了这个验收测试:wantTo('RedirecttoGoogle.com');$I->amOnPage('/index.php');$I->seeCurrentUrlEquals('https://www.google.com/');我的accepta

php - Jenkins 无法识别 Composer 命令

我在本地安装了JenkinsCI。按照Jenkins权威指南第2章中的说明安装。我在运行ElCapitan的MAC上通过JavaWebStart/JNLP文件启动Jenkins。一切顺利,示例项目正在运行。我知道我想通过Jenkins运行我的Codeception验收测试。我正在关注Codeception网站上关于此的最新博客文章:http://codeception.com/02-04-2015/setting-up-jenkins-with-codeception.html#.VwWxE2PLRAZ.使用执行shell构建步骤,我的构建失败并显示以下消息:Startedbyuser

php - Codeception,不要打印特定的 Action 来报告

在codeception中,我想检查页面中是否存在一个元素,如果第一个元素存在则再做一次测试。我可以简单地做到这一点://$IisaAcceptanceTesterObjectandextends\Codeception\Actorclasstry{$I->see('.firstElement');}catch(ElementNotFound$e){//dosomeactions}//dosomeanothersactions但是如果我这样做,在报告文件中我可以看到行"Isee'.firstElement'"。我不想在这份报告中看到这个测试。我的问题:如何安静地调用\Codecepti

php - 如何自动化 yii2 中的功能测试?

我在yii2中使用codecept功能测试来测试我的API。我将参数硬编码以便像这样进行测试usetests\codeception\backend\FunctionalTester;$I=newFunctionalTester($scenario);$I->wantTo('Checkwhenauthenticated');$I->sendPOST('/login',['password'=>'11111111','email'=>'check@check.com']);$I->seeResponseCodeIs(200);$I->seeResponseIsJson();$I->see

php - 无法让 Codeception 在多站点上使用 wp_query

我正在尝试设置一个测试来计算数据库中自定义帖子的数量,作为更强大测试的第一步,但它无法正常工作。这是测试的副本:assertEquals(53,$query);}}在我的模型中,函数如下所示publicstaticfunctioncount(){$args=array('posts_per_page'=>-1,'offset'=>0,'post_type'=>'courses','suppress_filters'=>true,);$query=new\WP_Query($args);returncount($query->posts);}但是当它到达断言时,它说53不等于0。我在本地

codeception \ extension \ runprocess不启动进程

问题:昨天CodeCeption引入了新的扩展名,该扩展应该有助于启动/停止硒服务器,Chrome驱动程序等(更多这里)。但是,即使表明过程正在开始-实际上不是。Acceptance.suite.ymlclass_name:AcceptanceTestermodules:enabled:-WebDriver:url:http://127.0.0.1:8080/browser:chrome-Yii2:part:ormentryScript:index-test.phpcleanup:falseextensions:enabled:-Codeception\Extension\RunProcess