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.
你不能同時把所有這些命令都構建到你的函數庫中。因為你沒有足夠多的人力。一些自動化項目之所以失敗,正是因為測試人員試圖創建一種終極的、無所不包的編程庫。而在框架完成且可用之前,管理支持(一些人員的工作)就已經不存在了。因此,你必須權衡先后,隨著時間逐漸地構建你的函數庫。
文章來源于領測軟件測試網 http://www.kjueaiud.com/