This is straightforward code re-use, which is just as desirable in test automation as in any other software development.
这属于直接的代码重用。与其它任何软件开发一样,在测试自动化中也有同样的需求。
d. Define larger, complex chunks of test cases that are used in several test cases.
d. 定义用在若干测试用例中的更大更复杂的测试用例块
It may be desirable to encapsulate larger sequences of commands. However, there are risks in this, especially if you overdo it. A very complex sequence probably won’t be re-used in many test scripts, so it might not be worth the labor required to generalize it, document it, and insert the error-checking code into it that you would expect of a competently written library function. Also, the more complex the sequence, the more likely it is to need maintenance when the UI changes. A group of rarely-used complex commands might dominate your library’s maintenance costs.
存在着封装更大规模的命令序列的需求。然而,这样做也存在着风险,尤其是当你过多使用时。因为一个很复杂的命令序列很可能在很多测试脚本中无法重用,所以,就不值得花力气去生成它,为它写文档,并为它加入错误检查代码以期成为编写完善的库函数。此外,序列越复杂,当用户界面改变时就越需要维护。那样一来,你的库维护成本就被一组几乎不用的复杂命令决定了。
e. Define utility functions.
e. 定义实用程序函数
For example, you might create a function that logs test results to disk in a standardized way. You might create a coding standard that says that every test case ends with a call to this function.
例如,你可以创建一个以标准方法把测试结果保存到硬盘的日志函数。你也可以创建一个编码标准,即每个测试用例都以对该函数的调用作为结束。
Each of the tools provides its own set of pre-built utility functions. You might or might not need many additional functions.
每个工具都提供了它自己的一套预构建实用程序函数。这样,你可能需要也可能不需要更多额外的函数了。
Some framework risks
使用框架的风险
You can’t build all of these commands into your library at the same time. You don’t have a big enough staff. Several automation projects have failed miserably because the testing staff tried to create the ultimate, gotta-have-everything programming library. Management support (and some people’s jobs) ran out before the framework was completed and useful. You have to prioritize. You have to build your library over time.
你不能同时把所有这些命令都构建到你的函数库中。因为你没有足够多的人力。一些自动化项目之所以失败,正是因为测试人员试图创建一种终极的、无所不包的编程库。而在框架完成且可用之前,管理支持(一些人员的工作)就已经不存在了。因此,你必须权衡先后,随着时间逐渐地构建你的函数库。
文章来源于领测软件测试网 https://www.ltesting.net/