我应该如何处理无法修复的错误的失败测试
我有一组复杂的集成测试,使用 Perl 的 WWW::Mechanize 来驱动 Web 应用程序并根据特定的数据组合检查结果。有超过 20 个子例程组成了测试逻辑、循环数据等。每个测试都在不同的数据集上运行多个测试子例程。
该网络应用程序并不完美,因此有时错误会导致使用非常特定的数据组合进行测试失败。但这些组合非常罕见,以至于我们的团队很长一段时间都不会费心去修复这些错误;优先考虑构建许多其他新功能。
那么对于失败的测试我该怎么办?这只是每个数据组合的数十个测试中的几个测试。 1)我不能让它失败,因为那样整个测试套件都会失败。 2)如果我们将它们注释掉,这意味着我们错过了对所有其他数据集进行测试的机会。 3)我可以在失败的特定数据集中添加一个标志,并且如果设置了该标志,则测试不会运行,但随后我会在测试子例程中的各处传递额外的标志。
最干净、最简单的方法是什么? 或者干净和简单是互斥的?
I have a complex set of integration tests that uses Perl's WWW::Mechanize to drive a web app and check the results based on specific combinations of data. There are over 20 subroutines that make up the logic of the tests, loop through data, etc. Each test runs several of the test subroutines on a different dataset.
The web app is not perfect, so sometimes bugs cause the tests to fail with very specific combinations of data. But these combinations are rare enough that our team will not bother to fix the bugs for a long time; building many other new features takes priority.
So what should I do with the failing tests? It's just a few tests out of several dozen per combination of data.
1) I can't let it fail because then the whole test suite would fail.
2) If we comment them out, that means we miss out on making that test for all the other datasets.
3) I could add a flag in the specific dataset that fails, and have the test not run if that flag is set, but then I'm passing extra flags all over the place in my test subroutines.
What's the cleanest and easiest way to do this?
Or are clean and easy mutually exclusive?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这就是 TODO 的用途。
That's what TODO is for.
我看到两个主要选项
禁用测试(将其注释掉),并参考您的错误跟踪系统(即错误IG),可能还会在错误中保留注释,并表明已为该错误准备了测试< /p>
移动失败的内容在单独的测试套件中进行测试。您甚至可以反转失败的断言,这样您就可以运行该套件,当它是绿色时,错误仍然存在,如果它变成红色,则错误已经消失或有其他问题。当然,错误跟踪系统和包的链接仍然是一件好事。
I see two major options
disable the test (commenting it out), with a reference to your bugtracking system (i.e. a bug ig), possibly keeping a note in the bug as well that there is a test ready for this bug
move the failing tests in a seperate test suite. You could even reverse the failing assertion so you can run the suite and while it is green the bug is still there and if it becomes red either the bug is gone or something else is fishy. Of course a link to the bugtracking system and bag is still a good thing to have.
如果您实际上将 Test::More 与 WWW::Mechanize 结合使用,则案例已结(请参阅@daxim 的评论)。如果没有,请考虑类似的方法:
If you actually use Test::More in conjunction with WWW::Mechanize, case closed (see comment from @daxim). If not, think of a similar approach: