codeception 相关问题

Codeception是PHP的现代全栈测试框架。受BDD的启发,它提供了一种编写接受,功能甚至单元测试的方法。由PHPUnit提供支持。

在不称为“测试”的环境中使用 Symfony TestContainer

我在CodeCception中编写了一个单元测试,我的配置Unit.suite.yml 演员:单元测试员 模块: 启用: - 断言 - 交响乐: 环境:“自动测试” 步骤装饰器:~ 我有一个

回答 1 投票 0

Codeception REST 超时问题

我正在尝试增加 Codeception REST 超时,但它似乎不起作用。 这就是我所拥有的 类名:ApiTester 模块: 启用: - \Helper\Api: - 休息: ...

回答 3 投票 0

如何在Codeception中使用attachFile()附加文件

我正在尝试一些 PHP 和 Codeception 验收测试,我想在验收测试中上传一个文件。我在网上进行了无数搜索,但我无法让它为我工作。在这里...

回答 1 投票 0

测试看不到治具的数据

我有一个夹具来填写测试用户 命名空间测试\夹具; 使用 Doctrine\Bundle\FixturesBundle\Fixture; 使用Doctrine\Persistence\ObjectManager; 使用应用程序\实体\用户; 最后一课 UserFixture

回答 1 投票 0

如何使用codeception测试select2动态标签

从预先填充的列表中选择一个选项的操作如下: $selector = "选择[name='tags']"; $this->tester->openSelect2($selector); $this->测试仪->selectOptionForSelect2($

回答 2 投票 0

codeception 数组示例

是否有一种实现方法可以将示例转换为数组,以便我可以将其作为参数直接传递给发布请求。现在我要做的就是: /** * @dataprovider

回答 3 投票 0

在 Github Workflow 中安装 Mailcatcher 需要很长时间

更新 1:mailatcher 可以正常工作,但现在运行每个测试需要 4 分钟。 我需要在 Github 工作流程中进行一些 Mailcatcher 验收测试。所有其他测试都运行良好。我也得到了

回答 1 投票 0

如何在Codeception单元测试用例中使用Yii2用户身份?

我是单元测试的新手。尝试使用 codeception 插件在我的 Yii2 项目中创建一些测试用例。从过去 1 周开始我就开始学习了。 现在我知道如何在单元 t 中使用 Fixtures、Mocks 和 Stubs...

回答 1 投票 0

Chromedriver 无法与代码接收一起使用

所以我正在使用代码接收进行自动化测试。使用 phpbrowser 运行良好,但我想测试的页面使用 ajax,所以我按照 codeception 上的说明更改为 webdriver

回答 2 投票 0

Codeception 测试中找不到 Yii2 类

我开始在 Yii2 中使用 Codeception 进行单元测试。太好了,Yii2 现在完全接受了它,这是我升级的一个主要原因! 我很难让 Codeception 找到

回答 4 投票 0

如何在codeception中点击另一个网页的按钮后等待一个网页被重定向?

/** * @param int $timeout : 超时时间 * @抛出模块异常 */ 公共函数 waitAjaxLoad($timeout = 10) { $this->webDriverModule->waitForJS('return !!window.jQuery &&

回答 3 投票 0

我们可以在代码接收中跳过整个 ces 课程吗?

我需要跳过以下 cest 类中的所有测试,目前我正在使用 @skip 注释跳过单个测试。有什么方法可以让我在类级别本身跳过执行,而不是......

回答 2 投票 0

Codeception,如何分割yml文件?

我想将第二个 yml 文件包含到我的 api.suite.yml 中。我能以某种方式做到吗? 我的 api.suite.yml 看起来像这样 演员:ApiTester 模块: 启用: - 断言 - 休息: ...

回答 2 投票 0

在 Mac m1 arm64 上安装 Chrome 浏览器

我正在使用 Codeception 和 Cakephp4 进行测试。我尝试使用 chromium 浏览器而不是 chrome,但出现此错误: 系统信息:主机:'f1c4f5d6ba86',ip:'172.28.0.2',os.name:'Linux',os.a...

回答 1 投票 0

拖放方法不执行任何操作,只是执行时不执行任何操作

我只是使用 I.dragAndDrop() 方法,它没有执行任何操作。只是没有做任何动作就过去了 只是我想做的小型拖放功能,它没有抛出任何电子...

回答 1 投票 0

vendor/bin/codecept 内容不正确

我安装了较旧的 Codeception 2.5(因为 PHP 框架 Yii1 的模块),如下所示: 作曲家需要代码接收/代码接收:2.5.* 然后执行: php供应商/bin/codecept运行单元--coverag...

回答 1 投票 0

如何跳过 Codeception cest 测试

我只想跳过代码接收 cest 测试中的一项测试。 使用 Cept 测试,您可以执行 $scenario->skip();但不适用于 Cest 测试。 所以我想做这样的事情。运行第一个测试...

回答 6 投票 0

Behat 的 Codeception 式报告

有人知道是否有办法获得 Behat 的测试报告,类似于我们为 Codeception 获得的测试报告? 我的意思是,具有漂亮格式输出的 Behat 只是为我们提供了功能文件的步骤。哪里...

回答 2 投票 0

禁用 mailcatcher 命令行消息

当使用 mailcatcher 测试邮件发送时,我使用 codeception 和 codeception-mailcatcher-module。 一切都作为 Github 动作运行,我触发了这样的东西: php 供应商/bin/co...

回答 0 投票 0

yii2 单元测试在 null 上调用成员函数 getDb() 时出错

<?php namespace tests\codeception\engine; use engine\components\BaseException; use engine\components\BaseService; use engine\modules\account\models\AccUser; use engine\modules\account\models\AccUserActivity; use engine\modules\account\services\AccountService; use yii\db\Connection; class AccountServiceTest extends \Codeception\TestCase\Test { protected $tester; protected function _before() { } protected function _after() { } public function getDb() { $connection=Yii::$app->getDb(); } public function testIsEmailAvailable() { $account = AccountService::model(); // 1. Existing email check $email = '[email protected]'; $this->assertEquals(true, $account->isEmailAvailable($email)); // 2. New email check $email = '[email protected]'; $this->assertEquals(false, $account->isEmailAvailable($email)); // 3. Not an email check only character $email = 'arulvel'; $this->assertEquals(false, $account->isEmailAvailable($email)); // 4. Not an email check only numbers $email = '549876315'; $this->assertEquals(false, $account->isEmailAvailable($email)); // 5. Empty check $email = ''; $this->assertEquals(false, $account->isEmailAvailable($email)); return true; } } 在运行测试时显示这样的错误 尝试测试电子邮件是否可用(AccountServiceTest::testIsEmailAvailable)... PHP 致命错误:调用成员函数 getDb() on null in /var/www/html/rewards/shopsup-rewards- web/htdocs/vendor/yiisoft/yii2/db/ActiveRecord.php 第 133 行 致命错误。测试未完成。 在 null 上调用成员函数 getDb() 在第 133 行访问 ActiveRecord.php 时就像 有什么配置需要做吗?? 来自Github 在单元测试的情况下,您有责任创建应用程序 实例。 来自Yii论坛 你可以设置数据库组件吗? https://github.com/yiisoft/yii2-codeception/blob/master/TestCase.php#L36 class TestCase extends Test { use FixtureTrait; /** * @var array|string the application configuration that will be used for creating an application instance for each test. * You can use a string to represent the file path or path alias of a configuration file. * The application configuration array may contain an optional `class` element which specifies the class * name of the application instance to be created. By default, a [[\yii\web\Application]] instance will be created. */ public $appConfig = '@tests/codeception/config/unit.php'; 如果你使用 Yii2 高级模板。 编辑您的 unit.suite.yml 并将“orm”添加到零件数组中。 例如 suite_namespace: backend\tests\unit actor: UnitTester modules: enabled: - Yii2: part: [orm, email, fixtures] - Asserts

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.