32 位/64 位应用程序的单元测试
我们的应用程序现在有 64 位目标以及旧的 32 位目标。我的问题涉及我们的单元测试。我们是否也应该在两者中编译并运行我们的单元测试?我们有可能通过这种方式发现缺陷吗?我是否过于偏执?
We have an application that now has a 64 bit target, as well as the old 32 bit target. My question concerns our Unit Tests. Should we compile and run our Unit Tests in both as well? Is there any chance we will find flaws this way? Am I being overly paranoid?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果语言暴露了 32 位和 64 位模式之间的差异,当然您应该对两者进行单元测试。与仅测试一个平台相比,它所需的人力资源不到两倍,因此很划算 :)。
如果您的语言没有暴露 32 位和 64 位之间的差异(例如,该语言中只有无界整数),您仍然应该对这两个平台进行单元测试。您将在独立于平台的语言的依赖于平台的实现中发现错误,或者确保没有任何错误对您的代码产生太明显的影响。在这种情况下,第二组测试的额外人力成本为零,预言机与第一组测试相同。
编辑:再次考虑情况 1,也许您应该编写代码,以便它在两个平台上给出相同的结果即使您的语言暴露了 32 位和 64 位之间的差异。在这种情况下,这两个系列的测试的预言机都是相同的。
If the language exposes the differences between 32- and 64-bit mode, of course you should unit-test both. It will take less than twice the human resources than for testing only one platform, so it's a bargain :).
If your language doesn't expose the difference between 32- and 64-bit (say, you have only unbounded integers in that language), you should still unit-test both platforms. You will find bugs in the platform-dependent implementation of your platform-independent language, or make sure that there aren't any that affect your code too obviously. And in this case the additional human cost of the second set of tests is nil, the oracles are the same as for the first one.
EDIT: thinking about case 1 again, perhaps you should write your code so that it gives the same results on both platforms even if your language exposes the differences between 32- and 64-bit. In this case again, the oracles are the same for both series of tests.
我相信它们都必须在每个夜间构建中运行。对于日常集成构建来说,仅运行一组测试就足够了。
I believe they both must be run for each nightly build. For daily integration builds though it's enough to run only one set of tests.