Why automate?为什么要自动化?

时间:2024-01-08 12:02:32

The need for speed is practically the mantra of the information age. Because technology is now being used as a competitive weapon on the front lines of customer interaction, delivery schedules are subject to market pressures. Late products can lose revenue, customers, and market share. But economic pressures also demand resource and cost reductions as well, leading many companies to adopt automation to reduce time to market as well as cut testing budgets.

对速度的需求实际上是信息时代的口头禅。由于技术目前正被用作客户互动的第一线竞争的利器,交付进度都受到市场的压力。一旦产品发布延迟就会失去收入,客户和市场份额。但是,经济压力也压迫求资源和成本的降低,因此许多公司采用自动化来加速上市时间以及降低测试预算。

While it might be costly to be late to the market, it can be catastrophic to deliver a defective product. Software failures can cost millions or even billions,and in some cases entire companies have been lost. So if you don’t have enough people or time to perform adequate testing to begin with, adding automation will not reduce software instability and errors. Since it is well-documented that software errors – even a single one – can cost millions more than your entire testing budget, the first priority should be first to deliver reliable software. Once that is achieved, then focus on optimizing the time and costs. In other words, if your software doesn’t work, it doesn’t matter how fast or cheap you deliver it.

虽然这可能是后期市场成本高昂,这是灾难性的提供一个有缺陷的产品。软件故障可以花费数百万甚至数十亿,在某些情况下,整个企业已经破产。所以,如果你没有足够的人或时间来进行充分的测试,引入自动化不会降低软件的不稳定性和误差。事实已经证明软件缺陷——即使只有一个缺陷—— 可能花费数百万比你的整个测试的预算多,首要任务应是第一个提供可靠的软件。一旦实现,然后重点优化的时间和成本。换句话说,不管软件交付如何快速和廉价,你的软件却不起任何作用。

Automated delivers software tests provide three key benefits: cumulative coverage to detect errors and reduce the cost of failure, repeatability to save time and reduce the cost to market, and leverage to improve resource productivity.

软件测试自动化主要有三个优点:累计覆盖检测错误和降低故障成本,重复性节约时间和降低市场成本,以提高资源生产率。

But realize that the test cycle will be tight to begin with, so don’t count on automation to shorten it - count on it to help you meet the deadline with a reliable product. By increasing your coverage and thus reducing the probability of failure, automation can help to avoid the costs of support and rework, as well as potentially devastating costs.

但意识到测试周期将紧张的开始,不要指望自动化缩短它,指望它来帮助你在最后期限时满足可靠的产品。通过增加你的覆盖,从而减少失败的概率,自动化可以帮助避免支持和返工成本,以及潜在的破坏性的成本。

Cumulative coverage

累计覆盖

It is a fact that applications change and gain complexity over their useful life. As depicted in the figure below, the feature set of an application grows steadily over time. Therefore, the number of tests that are needed for adequate coverage is also constantly increasing.

这是事实应用程序变更与,并在其使用年限获得复杂性。在下图中所示,应用程序的功能集随着时间的推移稳步增长。因此,测试所需的适当的覆盖范围的数量也不断增加。

这是一个事实,即应用程序的变化和并随着其使用时间增长而变的更具复杂性。如下图所示,应用程序的功能集稳步随时间增长。因此,需要用于充分覆盖该测试的数目也在不断增加。

Why automate?为什么要自动化?

Just a 10% code change still requires that 100% of the features be tested. That is why manual testing can’t keep up – unless you constantly increase test resources and cycle time, your test coverage will constantly decline. Automation can help this by allowing you to accumulate your test cases over the life of the application so that both existing and new features can always be tested.

只是一个10%码的变化仍需要100%的功能测试。这就是为什么手工测试无法跟上–除非你不断增加测试资源和时间,否则你的测试覆盖率将不断下降。自动化可以帮助这通过允许你在应用程序的生命周期累积你的测试用例,使现有的和新的功能都可以检验。

Ironically, when test time is short, testers will often sacrifice regression testing in favor of testing new features. The irony is that the greatest risk to the user is in the existing features, not the new ones! If something the customer is already doing stops working – or worse, starts doing the wrong thing – then you could halt operations.The loss of a new feature may be inconvenient or even embarrassing, but it is unlikely to be devastating.

具有讽刺意味的是,当测试时间短,测试人员往往会为了支持新功能测试牺牲回归测试。恰恰给用户最大的风险是存在的功能,不是新的!如果客户已经停止工作–或更糟的是,开始做错误的事情–然后你可以停止运作。一个新功能的损失可能带来不便甚至尴尬,但它不太可能是毁灭性的。

But this benefit will be lost if the automated tests are not designed to be maintainable as the application changes. If they either have to be rewritten or require significant modifications to be reused, you will keep starting over instead of building on prior efforts. Therefore, it is essential to adopt an approach to test library design that supports maintainability over the life of the application.

但是,如果自动化测试将会失去其优势若程序变更时不同步进行维护。如果他们要么必须重写或要求显著修改以期可以被重用,你会不断重新开始,而不是建立在以前的基础之上。因此,它有必要采用设计测试库的的方式以保证其在软件生命周期中的可维护性。

Leverage

优势

True leverage from automated tests comes not only from repeating a test that was captured while performed manually, but from executing tests that were never performed manually at all. For example, by generating test cases programmatically, you could yield thousands or more - when only hundreds might be possible with manual resources.Enjoying this benefit requires the proper test case and script design to allow you to take advantage of external data files and other constructs.

从自动测试的真正优势不仅在重复执行测试时进行了手动测试并且进行结果捕获,而且覆盖了手动执行测试时可能永远不会覆盖的部分。例如,通过编程生成测试用例,你可能会产生数千或更多——当只有几百可能用人工资源。享受这个好处,需要合适的测试案例和脚本的设计,让你可以充分利用外部数据文件和其他结构的优势。

Faster time to market

快速上市时间

Because software has become a competitive weapon, time to market may be one of the key drivers for a project. In some cases, time is worth more than money, especially if it means releasing a new product or service that generates revenue.

因为软件已经成为竞争的武器,上市时间可能是一个项目的关键驱动因素之一。在某些情况下,时间比金钱更有价值,特别是如果这意味着发布一个新的产品或服务产生的收入。

Automation can help reduce time to market by allowing test execution to happen 24X7. Once the test library is automated, execution is faster and run longer than manual testing. Of course, this benefit is only available once your tests are automated.

自动化可以帮助缩短产品上市时间,允许测试执行的情况发生24X7。一旦测试库是自动的,运行时间比手动测试更快。当然,这样做的好处是只有一次的测试自动化提供。

Reduced cost of failure

降低失败成本

Software is used for high risk, mission critical applications that represent revenue and productivity. A single failure could cost more than the entire testing budget for the next century! In one case a single bug resulted in costs of almost $2 billion. The national department of standards and technology estimates the cost of correcting defects at $59.5 billion a year, and USA Today claims a $100 billion annual cost to the US economy.

软件用于高风险,即表示收入和生产率的关键任务应用。一个单一故障的成本可能超过整个下个世纪测试预算!在一个案例中一个错误导致了近$20亿成本。标准与技术国家部门估计,修正缺陷每年为$595亿成本,而今日美国声称每年付出$1000亿费在美国经济。

Automation can reduce the cost of failure by allowing increased coverage so that errors are uncovered before they have a chance to do real damage in production.

自动化可以通过允许更大的覆盖范围这样错误被提前发现,避免了损失。

Notice what was NOT listed as a benefit: reduced testing resources. The sad fact is that most test teams are understaffed already, and it makes no sense to try to reduce an already slim team.Instead, focus on getting a good job done with the time and resources you have. In this Handbook we will present practical advice on how to realize these benefits while keeping your expectations realistic and your management committed.

注意不被列为的一个有点:减少测试资源。可悲的事实是,大多数测试团队的人手不够了,这是没有意义的尝试减少已经很小的团队。相反,在有限的时间和资源集中精力做好测试。在本手册,我们将介绍如何同时保持你的期望现实和你的管理致力于实现这些好处的实用建议。