(Thanks to Dr. Cem Kaner for allowing me to use some of the text from his document. The examples shown here are created with the help of documents shown in source)
A Test Automation Framework is a set of assumptions, concepts and tools that provide support for automated software testing. The main advantage of such a framework is the low cost for maintenance. It also puts into effect a set of standards/principles to follow. Frameworks help in improving the scalability and reliability of test automation assets.
A framework isolates the application under test from test scripts by providing a set of functions in a shared function library. Test script writers treat these functions as commands of their test tool’s programming language. Frameworks include several types of functions. Here are some basic types:
Define every feature of the application.
You can write functions to select a menu choice, pull up a dialog, set a value for a variable, or issue a command.
Define commands or features of the tool’s language. Test-automation tools come with a scripting language. You can add a layer of indirection by putting a wrapper around each command (T. Arnold, Software Testing with Visual Test 4.0, IDG Books, 1996). A wrapper is a routine created around another function that might do nothing more than calling the wrapped function.
Define small, conceptually unified tasks done frequently. This is straightforward code reuse.
Define larger, complex test cases used in several tests. It may be desirable to encapsulate larger command sequences. Rarely used complex commands might dominate your library’s maintenance costs.
Define utility functions. For example, create a function to log test results to disk in a standardized way.
5 Generations of Test Automation
Keyword Driven Framework
Functional Decomposition Framework
Choose Your Test Automation Framework