18 Mar 2013
11 mins read
This section gives the introduction about test automation framework, various types of the framework and the analysis of the best suitable framework for the application under test (the application under test is referred as AUT). This also includes the detailed description of the format of the input (the input to the framework is referred as the test tables) that is given to our test automation framework.
The test automation tool vendors market their product as the main feature of the tool is the ability to capture the user actions and later to playback them. Here is the basic paradigm for GUI-based automated regression testing – the so called Record/Playback method (also called as Capture/Replay approach)
The basic drawback in this method is the scripts resulting from this method contain hard-coded values which must change if anything at all changes in our AUT. The costs associated with maintaining such scripts are astronomical, and unacceptable. These scripts are not reliable, even if the application has not changed, and often fail on replay (pop-up windows, messages, and other things can happen that did not happen when the test was recorded).
If the tester makes an error entering data, etc., the test must be re-recorded. If the application changes the test must be re-recorded. All that is being tested are things that already work. Areas that have errors are encountered in the recording process (which is manual testing, after all). These bugs are reported, but a script cannot be recorded until the software is corrected. So logically nothing is tested by this approach.
So, avoid using “Record/Playback” as a method of automating testing. This method is fraught with problems, and is the most costly (time consuming) of all methods over the long term. The record/playback feature of the test tool is useful for determining how the tool is trying to process or interact with the application under test, and can give us some ideas about how to develop your test scripts, but beyond that, its usefulness ends quickly.
As we have eliminated Record/Playback method, let us explore about the existing automation methodologies. There are several test automation frameworks available, among these the selection is made based on the factors such as reusability of both the scripts and the test assets. The different test automation frameworks available are as follows,
The test script modularity framework is the most basic of the frameworks. It’s a well-known programming strategy to build an abstraction layer in front of a component to hide the component from the rest of the application. This insulates the application from modifications in the component and provides modularity in the application design. When working with test scripts (in any language or proprietary environment) this can be achieved by creating small, independent scripts that represent modules, sections, and functions of the application-under-test. Then these small scripts are taken and combined them in a hierarchical fashion to construct larger tests. The use of this framework will yield a higher degree of modularization and add to the overall maintainability of the test scripts.
The test library architecture framework is very similar to the test script modularity framework and offers the same advantages, but it divides the application-under-test into procedures and functions (or objects and methods depending on the implementation language) instead of scripts. This framework requires the creation of library files (SQABasic libraries, APIs, DLLs, and such) that represent modules, sections, and functions of the application-under-test. These library files are then called directly from the test case script. Much like script modularization this framework also yields a high degree of modularization and adds to the overall maintainability of the tests.
A data-driven framework is where test input and output values are read from data files (ODBC sources, CVS files, Excel files, DAO objects, ADO objects, and such) and are loaded into variables in captured or manually coded scripts. In this framework, variables are used for both input values and output verification values. Navigation through the program, reading of the data files, and logging of test status and information are all coded in the test script. This is similar to table-driven testing (which is discussed shortly) in that the test case is contained in the data file and not in the script; the script is just a “driver,” or delivery mechanism, for the data. In data-driven testing, only test data is contained in the data files.
The merits of the Data-Driven test automation framework are as follows,
The demerits of the Data-Driven test automation framework are as follows,
This requires the development of data tables and keywords, independent of the test automation tool used to execute them and the test script code that “drives” the application-under-test and the data. Keyword-driven tests look very similar to manual test cases. In a keyword-driven test, the functionality of the application-under-test is documented in a table as well as in step-by-step instructions for each test. In this method, the entire process is data-driven, including functionality.
In order to open a window, the following table is devised, and it can be used for any other application, just it requires just changing the window name.
Test Table for Opening a Window
Once creating the test tables, a driver script or a set of scripts is written that reads in each step executes the step based on the keyword contained the Action field, performs error checking, and logs any relevant information.
The merits of the Keyword Driven Testing are as follows,
The demerits of the Keyword Driven Testing are as follows,
The most commonly implemented framework is a combination of all of the above techniques, pulling from their strengths and trying to mitigate their weaknesses. This hybrid test automation framework is what most frameworks evolve into over time and multiple projects. The most successful automation frameworks generally accommodate both Keyword-Driven testing as well as Data-Driven scripts.
This allows data driven scripts to take advantage of the powerful libraries and utilities that usually accompany a keyword driven architecture. The framework utilities can make the data driven scripts more compact and less prone to failure than they otherwise would have been.
The utilities can also facilitate the gradual and manageable conversion of existing scripts to keyword driven equivalents when and where that appears desirable. On the other hand, the framework can use scripts to perform some tasks that might be too difficult to re-implement in a pure keyword driven approach, or where the keyword driven capabilities are not yet in place. The following sections describe its architecture, merits and demerits.
The framework is defined by the Core Data Driven Engine, the Component Functions, and the Support Libraries. While the Support Libraries provide generic routines useful even outside the context of a keyword driven framework, the core engine and component functions are highly dependent on the existence of all three elements.
The test execution starts with the LAUNCH TEST(1) script. This script invokes the Core Data Driven Engine by providing one or more High-Level Test Tables to CycleDriver(2). CycleDriver processes these test tables invoking the SuiteDriver(3) for each Intermediate-Level Test Table it encounters. SuiteDriver processes these intermediate-level tables invoking StepDriver(4) for each Low-Level Test Table it encounters. As StepDriver processes these low-level tables it attempts to keep the application in synch with the test. When StepDriver encounters a low-level command for a specific component, it determines what Type of component is involved and invokes the corresponding Component Function(5) module to handle the task.
All of these elements of the framework rely on the information provided in the App Map to interface or bridge the automation framework with the application being tested. The App Map is the only means by which the framework could identify the objects in the application under test. Each of these elements is described in more detail in the following sections. The following figure shows the diagrammatic representation of the Hybrid Test Automation Framework.
Hybrid Test Automation Framework
The Application Map is one of the most critical components, which is used for mapping the objects from names humans can recognize to a data format useful for the automation tool. For a given project it is needed to define a naming convention or specific names for each component in each window as well as a name for the window itself. Then use the Application Map to associate that name to the identification method needed by the automation tool to locate and properly manipulate the correct object in the window.
Application Map not only gives the ability to provide useful names for the objects, it also enables the scripts and keyword driven tests to have a single point of maintenance on the object identification strings. Thus, if a new version of an application changes the title of the window or label of the components or the index of an image element within it, they should not affect the test tables. The changes will require only a quick modification in one place–inside the Application Map.
Component Functions are those functions that actively manipulate or interrogate component objects. In test automation framework there are different Component Function modules for each type of component that are encountered (Window, CheckBox, TextBox, Image, Link, etc,).
Component Function modules are the application-independent extensions applied to the functions already provided by the automation tool. However, unlike those provided by the tool, the extra code to help with error detection, error correction, and synchronization are added. These modules can readily use the application-specific data stored in the Application Map and test tables as necessary. In this way, these Component Functions are developed once and are used again and again by every application tested.
Another benefit from Component Functions is that they provide a layer of insulation between the application and the automation tool. Without this extra layer, changes or “enhancements” in the automation tool itself can break existing scripts and the table driven tests. Each Component Function modules will define the keywords or “action words” that are valid for the particular component type it handles.
The component Functions takes the windows name in which the component resides, the actual component name on which the action is to be performed, the values needed for performing the action and the type of action to be performed as its arguments. The Component Function keywords and their arguments define the low-level vocabulary and individual record formats will be used to develop the test tables.
The input to the framework apart from the application map are the test tables, which holds the arguments needed for the Component Functions and other information. There are three levels in which the test tables are organized, they are as follows,
Low-level Test Tables or Step Tables contain the detailed step-by-step instructions of the tests. Using the object names found in the Application Map, and the vocabulary defined by the Component Functions; these tables specify what window, what component, and what action to take on the component. The columns in the Step Tables are as follows,
The StepDriver module is the one that initially parses and routes all low-level instructions that ultimately drive our application.
Intermediate-level Test Tables or Suite Tables do not normally contain such low-level instructions. Instead, these tables typically combine Step Tables into Suites in order to perform more useful tasks. The same Step Tables may be used in many Suites. In this way the minimum numbers of Step Tables necessary are developed. Then they are organized in Suites according to the purpose and design of the tests, for maximum reusability. The columns in the Suite Tables are as follows,
The Suite Tables are handled by the SuiteDriver module which parses each record in the Suite Table and passes each Step Table to the StepDriver module for processing.
High-level Test Tables or Cycle Tables combine intermediate-level Suites into Cycles.
The Suites can be combined in different ways depending upon the testing Cycle which is efficient to execute. Each Cycle will likely specify a different type or number of tests. The columns in the Cycle Tables are as follows,
These Cycles are handled by the CycleDriver module which passes each Suite to SuiteDriver for processing.
The Core Data Driven Engine is the primary part of the framework and it has three main modules, they are as follows
CycleDriver processes Cycles, which are high-level tables listing Suites of tests to execute. CycleDriver reads each record from the Cycle Table, passing SuiteDriver each Suite Table it finds during this process. SuiteDriver processes these Suites, which are intermediate-level tables listing Step Tables to execute. SuiteDriver reads each record from the Suite Table, passing StepDriver each Step Table it finds during this process. The following figure represents the Core Data Driven Engine,
Core Data Drive Engine
StepDriver processes these Step Tables, which are records of low-level instructions developed in the keyword vocabulary of the Component Functions. StepDriver parses these records and performs some initial error detection, correction, and synchronization making certain that the window and\or the component planned to manipulate is available and active. StepDriver then routes the complete instruction record to the appropriate Component Function for final execution.
The Support Libraries are the general-purpose routines and utilities that let the overall automation framework do what it needs to do. They are the modules that provide services like,
They also provide traditional automation tool scripts access to the features of our automation framework including the Application Map functions and the keyword driven engine itself. Both of these items can vastly improve the reliability and robustness of these scripts until such time that they can be converted over to keyword driven test tables.
26 Oct 2017
22 Nov 2016
23 May 2016
13 May 2016
Digital Assurance, Enterprise Solutions, Others
26 Apr 2013
22 Mar 2013
01 Mar 2013
BI & Analytics
19 Mar 2009
26 Nov 2010
02 Jan 2012
17 Feb 2012
Infrastructure Mgmt. Services
02 Mar 2012
03 Jan 2013
04 Feb 2013
06 Feb 2013
Digital Assurance, Enterprise Solutions
14 Feb 2013
18 Feb 2013
21 Feb 2013
27 Feb 2013
04 Mar 2013
05 Mar 2013
12 Apr 2013
29 Apr 2013
13 May 2013
11 Jun 2013
17 Jun 2013
25 Jun 2013
19 Aug 2013
26 Aug 2013
27 Aug 2013
03 Sep 2013
10 Sep 2013
19 Sep 2013
24 Sep 2013
26 Sep 2013
30 Sep 2013
01 Oct 2013
03 Oct 2013
01 Nov 2013
19 Nov 2013
Enterprise Solutions, Manufacturing and Consumer
28 Nov 2013
03 Dec 2013
20 Dec 2013
03 Jan 2014
22 Jan 2014
27 Jan 2014
31 Jan 2014
12 Feb 2014
13 Feb 2014
20 Mar 2014
24 Mar 2014
17 Apr 2014
11 Jun 2014
Manufacturing and Consumer
26 Jun 2014
30 Jun 2014
10 Jul 2014
15 Jul 2014
16 Jul 2014
18 Jul 2014
28 Oct 2014
13 Jul 2015
06 Aug 2015
26 Aug 2015
28 Sep 2015
07 Oct 2015
26 Oct 2015
07 Mar 2016
22 Mar 2016
Application Transformation Mgmt.
11 Jul 2016
25 Aug 2016
03 Sep 2016
14 Sep 2016
15 Nov 2016
25 Nov 2016
Business Process Services
25 Apr 2017
Banking and Financial Services
18 May 2017
30 May 2017
23 Jun 2017
27 Jun 2017
18 Jul 2017
28 Nov 2017
11 Dec 2017
25 Jan 2018
21 Feb 2018
14 Mar 2018
( Mandatory field * )
Please Check on "I Agree" to register for the blog.