标题: Typical Architecture of Automation Frameworks [打印本页] 作者: dreamsea123 时间: 2009-8-14 17:10 标题: Typical Architecture of Automation Frameworks An Automation Framework primarily comprises of elements like:
A) Function Library
B) Object Repository
C) Database
D) Application Scenario Files
E) Initialization VB Script
F) Sequence File
G) Driver Script
H) Test Case List File
A) Function Library:
While creating automation framework the entire coding is done by using VB script functions that are user defined. We store these VB script functions in function library files with (*.vbs) extension. Apart from Driver Scripts, there is no need of doing any script creation beyond the function library.
Every application consists of following two types of function libraries
1) Containing common functions that are not dependent on the application functions.
2) Containing functions, which are specific, the application.
The script designer strives to utilize the common functions, which are independent of the application, to the maximum possible extent. However there is no hard & fast rule to always use common functions only. Whenever there is absolute necessity of using some functions, which are essential for the application, the same are created on the spot & are stored in the concerned function library.
"ExecuteScenarioFile" is a function present in our common function library & is called from the Driver Script or from outside the function library. This function is used for accessing the keywords, various objects and all other parameters from the Scenario File. This is also used to call other relevant functions as well from the function library.
The function library files with (*.vbs) extension are stored in the Function Library folder.
B) Object Repository:
Every application being automated contains a single / unique object repository file. The object repository files with (*.tsr) extension are stored in the Object Repository folder.
C) Database:
MS Access database module of MS Office is used to store all the test data. While designing the structure of the database the designer tries to keep one independent table for every screen of the application. Test Case ID field is usually designated as the primary key for every table. Test Case ID is unique for every record used by the program for iteration. Test Case ID identifier is quite helpful in navigating through some particular type of data stored in the table. QTP establishes a link with database by building its system DSN and using the same DSN in the script. As a best practice, every application should have an independent database file; however for the sake of conserving the space on the hard disc, multiple applications can share the same database.
The MS Access database files with (*.mdb) extension are stored in the Database folder.
D) Application Scenario Files:
This is a typical MS Excel spreadsheet file, which contains records with information on different keywords, objects & many other parameters representing a test scenario. QTP accesses the information from this application scenario file & performs the defined actions over the application. The MS Excel spreadsheet file serves the purpose of test case documentation as well & there remains no need to create another set of test case documentation. The application scenario files are the most versatile features of keyword driven framework.
The subject matter experts (SME’s) who usually don’t have much of programming knowledge are able to easily use these application scenario files for creating automated tests by making quick selection of keywords from the dropdown lists.
We can save tremendous amount of automation effort by creating maximum number of common which can be reused again & again thereby getting the maximum benefit.
The application scenario files with (*.xls) extension are stored in the application folder corresponding to the particular application.
E) Sequence File:
These are initialization settings files for the Driver QTP Script and are similar to the conventional configuration files. This is also a typical MS Excel spreadsheet file, which contains records with information like:
1) Name of Application Scenario file
2) Name of Object Repository
3) Name of Function Library
4) List of Test Cases to be executed
5) Details of Data Source
6) Details of script development work area
7) Details of script execution work area
Every application carries a "Run" or "Ignore" flag specifying the application scenario being executed. This sequence file in the form of spreadsheet is used by the Initialization VB Script uses & decides as to which application & which scenario is to be executed, for getting the information on the concerned Application Scenario file & for doing the initialization settings for the application.
The Sequence File with (*.xls) extension are stored directly in the root folder.
F) Initialization VB Script:
Initialization is the starting point for the execution of a script. QTP gets launched by Initialization VB Script & the work area is set either as development or production depending upon the inputs from the user. We can use the same Initialization VB script for doing the initialization settings for multiple web applications.
It carries out the following settings for the Driver Script.
1) Setting the Work Area according to user input.
2) Setting the application scenario file for the current run.
3) Setting the object repository.
4) Setting the function libraries.
5) Setting the data source.
6) Setting the test case list.
Once the above settings are completed, Initialization VB Script launches the Driver Script in read only mode, & makes it ready for execution by the user. Thereafter the Driver Script takes over the entire control.
The Initialization VB Script with (*.vbs) extension are stored directly under the root folder.
G) Driver Script:
These are test scripts of QTP meant for driving the script execution after Initialization VB Scripts complete their task. These driver scripts reside outside the function library.
These Driver Scripts call the "ExecuteScenarioFile" function for accessing the keywords, various objects and all other parameters from the Scenario File and making calls to suitable functions in the function library.
The Driver Scripts are stored directly under the root folder.
H) Test Case List File:
These files contain the list of all Test Case ID’s for execution under the present run. With the help of these files, the user gets an option for selecting only a subset of the data from the database for executing in the present run.
These Test Case List Files are stored directly under the root folder.