Just as application software must be designed in order to be maintainable over its useful life, so must your automated tests.
正如应用软件必须设计,以便维护了其使用寿命,你的自动化测试必须如此。
Applications are maintained continuously应用程序持续改进
One reason maintainability is so important is that without it you cannot accumulate tests. On average, 25% of an application is rewritten each year; if the tests associated with the modified portions cannot be changed with a reasonable amount of effort, then they will be obsolete. Therefore, instead of gradually improving your test coverage over time by accumulating more and more test cases, you will be discarding and recreating tests instead. Since each new version of the application most likely has increasing functionality, you will be lucky to stay even!
可维护性的一个原因是如此重要,没有它你不能累积试验。平均来说,一个应用程序改写每年25%;如果与修改的部分相关的试验不能以合理的努力去改变,那么他们将被淘汰。因此,而不是逐渐提高测试覆盖率随时间积累越来越多的测试用例,你将重新测试而不是丢弃。因为应用程序的最有可能的每个新版本增加功能,你将有机会在连!
Changes must be known in advance更改必须提前知道
It is also important to know where and how to make changes to the test library in advance. Watching tests execute in hopes of finding application changes in the form of errors is not only extremely inefficient, it brings the validity of test results and metrics into question. A failed test may in fact be a correct result! If a person must watch the test to determine the results, then the test is not truly automated.
同样重要的是知道在哪里以及如何使提前改变到测试库k中。看着在寻找在错误的窗体应用程序的变化,希望测试执行,不仅效率极低,它带来的测试结果和指标成为问题的有效性。测试失败可能实际上是一个正确的结果!如果一个人必须看测试以确定结果,则测试未真正的自动化。
In most cases, the application source code will be managed by a source control or configuration management system. These systems maintain detailed change logs that document areas of change to the source code. If you can’t get information directly from development about changes to the application, ask to be copied on the change log.This will at least give you an early warning that changes are coming your way and which modules are affected.
在大多数情况下,应用程序的源代码将由源控制或配置管理系统进行管理。这些系统维护记录更改源代码领域的详细更改日志。如果你不能从开发有关更改应用程序直接获取的信息,请在更改日志被复制。这将至少给你一个预警,变化未来的路,哪些模块受到影响。
Cross-reference tests to the application交叉引用测试应用程序
Identifying needed changes is accomplished by cross-referencing testware components to the application under test, using consistent naming standards and conventions. For example, by using a consistent name for the same window throughout the test library,when it changes each test case and test script which refers to it can be easily located and evaluated for potential modifications. These names and their usage is is described more fully in the section on the Application Map.
确定需要改变的是通过交叉参考测试件组件到应用程序测试,使用一致的命名标准和惯例来完成。例如,通过使用一个一致的名称为整个测试库中相同的窗口中,当它改变每个测试用例和测试脚本是指它可以很容易地定位和评估潜在修改。这些名字和他们的用法是在应用程序映射的部分更充分的描述。
Design to avoid regression设计,避免回归
Maintainability is achieved not only by assuring that changes can be easily identified and made, but also that they do not have an unexpected impact on other areas. Unexpected impact can occur as a consequence of poor test design or implementation. For example,a test script that selects an item from a list box based on its relative position in the list is subject to failing if the order or number of items in the list changes. In this case, a maintainable test script would be designed to enter the selected item or select it based on its text value. This type of capability may be limited by your test tool; if you are evaluating tools, look for commands that use object-based commands (“select list box item XYZ”) instead of coordinate-based events (click window @ 451,687).
可维护性仅通过确保变化可以容易地识别和提出没有实现,而且它们不会对其他领域产生意想不到的影响。意外的影响,可作为发生不良试验设计或实施的结果。例如,一个测试脚本,其选择从根据它在列表中的相对位置的列表框中选择一个项目是受如果未能在列表的变化的顺序或物品的数量。在这种情况下,一个维护的测试脚本将被设计进入选择的项目或选择它根据它的文本值。这种能力可以通过测试工具的限制;如果你正在评估工具,查找使用基于对象的命令命令(“选择列表框项目XYZ”),而不是基于坐标的事件(点击窗口@451687)。
Maintainability can be designed into your test cases and scripts by adopting and adhering to an overall test framework, discussed in the next section.
可维护性可以通过采用和坚持全面测试框架,在下一节讨论设计到你的测试用例和脚本。