Absolutely. If our build passes the unit test suite then it's tagged and a candidate for production
No. Deployments don't include tests nor the supporting libraries (e.g. unit test libraries, mocking etc.)
The above is my general rule (I'm usually deploying to non-technical users). However I do have an exception, which is a programming utility that is unit tested with ~130 test scripts. Because the test scripts double as examples, I deploy those along with the production release, and consequently they enhance the existing documentation.
Deploying tests with open-source code is definitely worthwhile. It allows people to play with, modify and submit patches, whilst being able to run the tests that passed successfully to permit the original artifact to be released.
Yes and Yes, application behaviour can be different between release and debug builds, hence as part of the release process the release build has to pass all its unit tests.
Yes of course! Unit tests run on all build configurations.
Unit tests are always intact but this does not mean that shipped assemblies are dependent on anything relating to the tests. Tests are always written in a parallel assembly (in the same build environment) that then tests the production assembly. The parallel assembly is not shipped as it only contains the tests.
Yes, remember the classic "Assert with side-effects" error that must be caught as well. But this one doesn't need to be done as often as the debug build, where a complete test should be done every day.
Typically unit-tests are in different translation units and in a different project, so that a release build of the main project does not touch them at all. If your unit-tests are in the same translation units as the tested code though, you can use conditional compilation to exclude them from releases.
Depends on the project. Yes to number 1. Following the principal that everything should be checked into source code control and it should be simple to get a new developer going. Make them part of the codebase. New people can do a check out and run the tests.
Whether they are deployed to production is a different issue. I haven't worked on a project that needed them there. Rails' deployment model is (generally) simply a check-out of the whole project on a production machine, so yes they are there. Java/Maven projects have a whole build/packaging step, and generally unit tests can-- and are-- removed when building the final .war file.
Either way, you don't expect them to run. In today's environment, it doesn't really matter if they site there-- memory and disk are so cheap it's really not an issue. I have heard the argument that you don't want the test code on the production server so that there's no risk that it will get run, but I haven't heard of a scenario when this would really happen.
发布评论
评论(5)
以上是我的一般规则(我通常部署对于非技术用户)。 不过,我确实有一个例外,它是一个编程实用程序,使用约 130 个测试脚本进行了单元测试。 由于测试脚本兼作示例,因此我将它们与生产版本一起部署,从而增强了现有文档。
使用开源代码部署测试绝对是值得的。 它允许人们玩、修改和提交补丁,同时能够运行成功通过的测试以允许发布原始工件。
The above is my general rule (I'm usually deploying to non-technical users). However I do have an exception, which is a programming utility that is unit tested with ~130 test scripts. Because the test scripts double as examples, I deploy those along with the production release, and consequently they enhance the existing documentation.
Deploying tests with open-source code is definitely worthwhile. It allows people to play with, modify and submit patches, whilst being able to run the tests that passed successfully to permit the original artifact to be released.
是的,是的,发布版本和调试版本之间的应用程序行为可能有所不同,因此作为发布过程的一部分,发布版本必须通过其所有单元测试。
Yes and Yes, application behaviour can be different between release and debug builds, hence as part of the release process the release build has to pass all its unit tests.
是的,当然! 单元测试在所有构建配置上运行。
单元测试始终完好无损,但这并不意味着交付的程序集依赖于与测试相关的任何内容。
测试始终在并行程序集中(在同一构建环境中)编写,然后测试生产程序集。 并行程序集未发货,因为它仅包含测试。
Yes of course! Unit tests run on all build configurations.
Unit tests are always intact but this does not mean that shipped assemblies are dependent on anything relating to the tests.
Tests are always written in a parallel assembly (in the same build environment) that then tests the production assembly. The parallel assembly is not shipped as it only contains the tests.
取决于项目。 第 1 点是的。遵循这样的原则:所有内容都应该检查到源代码控制中,并且应该很容易让新开发人员上手。 让它们成为代码库的一部分。 新人可以检查并运行测试。
它们是否部署到生产中是另一个问题。 我还没有参与过需要他们的项目。 Rails 的部署模型(通常)只是在生产机器上检查整个项目,所以是的,它们就在那里。 Java/Maven 项目有一个完整的构建/打包步骤,并且通常在构建最终的 .war 文件时可以删除单元测试。
不管怎样,你都不希望他们跑。 在今天的环境中,它们是否位于那里并不重要——内存和磁盘都很便宜,这真的不是问题。 我听说过这样的论点:您不希望在生产服务器上运行测试代码,这样就不会有运行的风险,但我还没有听说过这种情况真的会发生的情况。
Depends on the project. Yes to number 1. Following the principal that everything should be checked into source code control and it should be simple to get a new developer going. Make them part of the codebase. New people can do a check out and run the tests.
Whether they are deployed to production is a different issue. I haven't worked on a project that needed them there. Rails' deployment model is (generally) simply a check-out of the whole project on a production machine, so yes they are there. Java/Maven projects have a whole build/packaging step, and generally unit tests can-- and are-- removed when building the final .war file.
Either way, you don't expect them to run. In today's environment, it doesn't really matter if they site there-- memory and disk are so cheap it's really not an issue. I have heard the argument that you don't want the test code on the production server so that there's no risk that it will get run, but I haven't heard of a scenario when this would really happen.