Different results if I run one test and all test in same time
还没有人认领这个 Issue。
评估
调研方向
通过运行报告中所示的单文件和整个目录的 Codeception 功能测试命令来重现该问题。阅读 Cest 的 _before() 方法以及 ZF2、Doctrine2、DataFactory 和清理配置。当相同的测试单独运行或作为 suite 运行时都产生一致的结果,即表示完成。
由索引模型根据 Issue 内容生成。
描述
What are you trying to achieve?
Right now, I have some strange behaviour while running functional tests. If I run one file codecept run functional /FunctionalFolder/Services/ServiceOneCest, all tests are success - as expected. But in secound case, when I run all created tests codecept run functional /FunctionalFolder, some tests are finished as expected, while some others are failed.
Somehow, in _before() section, are not executed all dependeces.
class ServiceOneCest
{
public function _before(FunctionalTester $I)
{
$this->entityManager = $I->grabServiceFromContainer(EntityManager::class);
$this->entity = $this->entityManager->getRepository(Entity::class)
->findOneBy([
'name' => 'test'
]);
if (!$this->entity) {
$this->entity = $I->have(Entity::class, ['name' => 'test']);
}
}
public function testSomething(FunctionalTester $I)
{
$I->assertEquals('test', $this->entity->getName());
// here I catch error message [Error] Call to a member function getName() on null
// it only happend when I run more then one test file
}
}
//also exist some other test file
class ServiceTwoCest
{
}
I expect same results if I run one test file or more. I need to say, don't have any dependece between test data created in _before()
Please, if you see any reason or my bad code/configuration anything, give me handsup. If you have some other questions, please feel free to contact me.
Details
- Codeception version: 2.5.1
- PHP Version:PHP 7.1.25
- Operating System: ubuntu16.04.1 (on vagrant)
- Installation type: Phar || Composer
- List of installed packages (
composer show) - Suite configuration:
actor: FunctionalTester
modules:
enabled:
- ZF2
- Asserts
- \Helper\Functional
- Doctrine2:
depends: ZF2
- DataFactory:
depends: Doctrine2
- \Helper\Factories
config:
Doctrine2:
cleanup: true
- 主要语言
- PHP
- 星标
- 4
- 派生
- 2
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeception/module-doctrine 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 38/100
-
难度 4/5 3-5 天 新手友好度 30/100
-
难度 4/5 3-5 天 新手友好度 35/100
Codeception/module-doctrine#2 · 1 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 42/100
-
难度 3/5 1-2 天 新手友好度 64/100
Codeception/module-doctrine#6 · 1 条评论 ·
查看 Codeception/module-doctrine 的全部 Issue
相似的 Issue
-
Python 3.15 support可能已有人在做 @amnesiaof 今天认领。 未关闭L: python L: python:uv
难度 2/5 1-3 小时 新手友好度 72/100
dependabot/dependabot-core#16524 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
crazy-goat/rabbit-stream#830 ·
维护者通常 1 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 4 天内回复
-
Перевод устарел
难度 2/5 1-3 小时 新手友好度 70/100