Codeception4: GroupManager报告缺少测试文件

huangapple go评论70阅读模式
英文:

Codeception4: GroupManager reports missing test file

问题

我升级了Codeception到v4(根据此链接),然后将Symfony升级到v5(根据此链接)。现在,当我尝试运行测试时,出现了一个关于缺少测试文件的错误:

>> root@blabla: vendor/bin/codecept run

>> 在 GroupManager.php 的第 129 行:

GroupManager: 文件或目录 /var/www/html/tests/unit/SomeFileCest.php 不存在

这个文件在当前分支中不存在。它存在于项目的另一个分支中,但当前分支不应该知道这个文件的存在!

无论我切换到哪个分支,都会出现这个问题。所以某种方式,Codeception 记住了一个分支有额外的测试,并要求在其他分支中运行这个测试。看起来像是某种类型的缓存问题。

如果我切换到带有缺失文件的分支,一切都看起来正常(我确实会收到一个错误,但是因为旧框架而预期的错误)。

无论是运行 vendor/bin/codecept run 还是 vendor/bin/codecept run tests/functional(请注意,缺少的测试是单元测试),都会出现错误。

我尝试删除 /var/vendor 文件夹,然后运行 composer install/update。我还尝试完全删除分支并从远程拉取,但都没有成功。

有人有任何想法为什么会发生这种情况以及如何解决吗?

英文:

I upgraded Codeception to v4 (according to THIS) and then Symfony to v5 (according to THIS). Now, when I try to run tests I get an error about missing test file:

>> root@blabla: vendor/bin/codecept run

>> In GroupManager.php line 129:

>> GroupManager: File or directory /var/www/html/tests/unit/SomeFileCest.php does not exist

This file does NOT exist in current branch. It exists in another branch of the project, but current should not know anything about this file!

This problem happens no matter which branch I switch to. So somehow Codeception remembers, that one branch has additional test and demands that test in other branches. Looks like some sort of cache.

If I switch to the branch WITH the missing file, everything looks OK (I do get an error, but because of the old framework expected).

Error appears if I do vendor/bin/codecept run or vendor/bin/codecept run tests/functional for example (note that the missing test is a unit test).

I tried deleting /var and /vendor and running composer install/update. I also tried removing the branch completely and pulling from remote, but no joy.

Anybody has any idea why this would happen and how to fix this?

答案1

得分: 46

EDIT:
经过一些简单测试,看起来与tests/_support/failed中的旧引用有关(如@Naktibalda在他/她的评论中提到的)。


我仍然不完全理解发生了什么,但可以通过运行以下命令来解决:

vendor/bin/codecept clean

根据Codeception的帮助:

>> clean 递归清理日志和生成的代码

我将尽力进一步调查为什么会发生这种情况,但目前只有这些信息。

我希望这能帮助某人避免我经历的挫折。

英文:

EDIT:
After some simple testing it looks like it's related to old references in tests/_support/failed (as @Naktibalda mentioned in his/her comment).


I still don't fully understand what happened, but this can be fixed by running:

vendor/bin/codecept clean

From Codeception help:

>> clean Recursively cleans log and generated code

I will try to investigate further to understand why this happens, but for now this is what I have.

I hope this helps someone avoid the frustrations I went through Codeception4: GroupManager报告缺少测试文件

答案2

得分: 0

对于我的情况,我们使用了paracept来并行运行任务。这在/tests/_data目录中生成了组文件。

一旦我删除了该文件夹中的组文件,我的测试套件就正常运行了。

值得注意的是,codecept clean不会清除这个_data文件夹。

英文:

For my case we were using paracept, to run stuff in parallel. This generated group files in /tests/_data

Once I removed the group files in this folder my test suite ran normally.

Worth noting that codecept clean doesn't clear this _data folder.

huangapple
  • 本文由 发表于 2020年1月6日 17:58:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/59609992.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定