JAN-MAR 2007 Vol 3 Issue12

BRAINWAVE                                                     

 

Automation Testing using QTP
by Ashish Lumba
Assosiate QA L2 (Automation), Sapient Corporation Gurgaon.

With the Growing trend in IT, the word Software Testing has gained an immense importance in every Tech guys Life. It is now precisely being recognized as a Dept of extreme importance in any IT related Company. After all its rightly said “For a Reliable Software Development Testing and Development should go hand in hand”.

I would like to intimate you all with Automation Testing a Database prominent application.

There are many stages in Automation Testing

Automation has been always easier for Web Testing rather than Database Testing. I would like to emphasize here on automating an application with numerous Stored Procedures which always is a tedious task for any automation tester.

We have many automation Tools available in the market one of the most Feasible and widely used is Quick Testing Professional (QTP).

Prerequisites

Database: Oracle 9i

Tech Used: Any (Sun/Microsoft Technologies)

Instances Used: Separate DB instances for Development and QA teams

OS Used: Any (Windows/Linux)

1. Designing .SQL queries to prepare the Initial Data Cut on which the Stored Procedures will run and the application will access the DB.

Note: The preparation and analysis of the Initial Data Cut also results in Performance Testing of the various Stored Procedures. We can easily set an upper limit of data to be acted upon by stored procedures and this upper limit may vary from procedure to procedure.

For ex: Running a stored Proc on 50,000 records in a table results in a Exception being thrown such as (Out of Memory). We then tweak the data and reduce the Initial Data Cut to Rerun the stored Proc on lesser data. This step is repeated until the stored Proc runs successfully. This sets an upper limit of Data Cut for this particular Stored Proc.

Automation Architecture for testing Screens (Web Based)

A main excel file stores the names of all excel files to be used. Each of this excel file names are made relative to the names of Functionality of the software to be tested. Each functionality is divided and written in an excel.

Qtp Script reads this main excel file and stores all these names in an array. It then reads the corresponding excel which is first in the list. This excel is then scanned, it contains the corresponding actions to be performed on the application screen as a function name along with all the parameters to be passed. These parameters are the user entered fields during script recording. An excel may contain one or more than one function name depending upon the functionality to be tested.

Note: Some common functionalities such and Login and Logout are recorded in a separate Reusable action and this action is used in the entire set of scripts by inserting a call to this action.

Automation Architecture for testing Stored Procedures (DB Based)

VBScript calls and executes the specific Stored Procedures. We have common DB Functions for Opening a Connection, closing a connection and so on. This avoids the Wait Time needed to be added for executing the stored Procedure if the stored procedure is executed through the .SQL prompt (we need to specifically add wait time and this wait time varies a lot as the Data Cut varies).

Note: Suppose we have written the wait time in accordance with 1% Data Cut and if the same QTP Script is executed for 10% Data Cut it may result in failure of stored Procedure execution which in turn results in script failure. In order to avoid this we call stored procedure directly using VBScript (in this case the stored Procedure is executed as a Background Process.)

Common Strategy (web and db based)

Making an actual file in an Excel through QTP by writing .SQL queries and comparing it with an Expected sheet made manually in accordance to Business Rules. The comparison is done by an Excel compare Utility (.VBS file). The mismatched cell in the actual sheet is stored with a Red color and then the actual sheet is restored with the Time Stamping attached with the Original name.

Note: All the excel files stored are stored with Time Stamping to avoid overwriting of Exiting file.

3. Automated Testing of Complex Stored Procedures using Quick Test Professional 9(QTP) Functionality Testing Tool. 

4. Developing Common (.vbs) functions which are called in each and every Automated Script. Such as Bitmap storing, excel compare, QTP to QC bugs reporting and Excel Handling functions. 

5. Developing a Stable Recovery Scenario using QTP for handling application exceptions which in turn calls a function. 

6. Reporting Bugs from QTP to QC (Quality Center) during Runtime.

We have an excel sheet displaying all possible errors. Our QTP script calls a Common function(.vbs) which scans the entire screen and then matches it with the errors stored in the excel. It also takes a bitmap of the error and stores along with timestamp. If however a match is found it in turn calls another common function which Reports Bugs into QC.  

Component Wise Testing is done by running these QTP scripts independently on Regular Build basis. So defects fixed after the build are available to be viewed. 

Integration Testing All these Scripts are run using the Batch Run Tool QTP Utility in a sequence as this essentially results in Integration Testing of the various components. Since failure of one component directly affects the failure of another component and bugs are easily reported.

The same QTP Scripts can be run on both Development as well as QA environment as all these Scripts are environment independent. Reading all the URL's and Excel sheets paths from the Environment.ini placed on the Central Server.

 

Google
WWW www.mba.iiita.ac.in