0% found this document useful (0 votes)
48 views5 pages

QTP Training: Data Driven Testing

'Data Driven Testing for Login Operation by fetching Test Data directly from a text file' 'Create an Automation Object and open the Test Data file using Automation Object 'Read Test Data and pass values 'Launch the Application 'Generate Statements for Login Operation 'Form Loop for multiple iterations '
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views5 pages

QTP Training: Data Driven Testing

'Data Driven Testing for Login Operation by fetching Test Data directly from a text file' 'Create an Automation Object and open the Test Data file using Automation Object 'Read Test Data and pass values 'Launch the Application 'Generate Statements for Login Operation 'Form Loop for multiple iterations '
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

QTP Training

QTP Fundamentals, Features and VB Script by G C Reddy (919247837478)([email protected])


QTP Guide QTP Online Training QTP Scripting QTP Training in Hyderabad SQL VB Script

DEC 18, 2010

Data Driven Testing

Data Driven Testing


**************************************************** ***** ''Test Requirement: Data Driven Testing for Login Operation by fetching Test data directly from a text file 'Pre-requisites: 'Test data file 'Test Flow: 'Create an Automation Object 'open the Test Data file using Automation Object 'Read test data and pass values 'Launch the Application 'Generate Statements for Login Operation 'Form Loop for multiple iterations '************************************************** Option Explicit Dim objFso, myFile, myLine, myField Set objFso=CreateObject("Scripting.FileSystemObject") Set myFile=objFso.OpenTextFile("C:\Documents and Settings\gcreddy\Desktop\gcreddy.txt") myFile.SkipLine Do Until myFile.AtEndOfStream=True myLine=myFile.ReadLine myField=Split(myLine,",")

SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe" Dialog("text:=Login").Activate Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set myField(0) Dialog("text:=Login").WinEdit("attached text:=Password:").Set myField(1) Wait (2) Dialog("text:=Login").WinButton("text:=OK").Click Window("text:=Flight Reservation").Close Loop myFile.Close Set objFso=Nothing *********************************************************** ***
2) 'Data Driven Testing for Login Operation by fetching from an excel file Dim objExcel, myFile, mySheet Set objExcel=CreateObject("Excel.Application") Set myFile=objExcel.Workbooks.Open("C:\Documents andSettings\gcreddy\Desktop\gcreddy.xls") Set mySheet=myFile.Worksheets("Sheet1") Rows_Count=mySheet.usedrange.rows.count For i= 2 to Rows_Count step 1 SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe" Dialog("text:=Login").Activate Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set mySheet.Cells(i,"A") Dialog("text:=Login").WinEdit("attached text:=Password:").Set mySheet.Cells(i,"B") Wait (2) Dialog("text:=Login").WinButton("text:=OK").Click Window("text:=Flight Reservation").Close Next myFile.Close objExcel.Quit Set objExcel=Nothing ************************************************ 3) Data Driven Testing by fetching Test data from a Database

Dim objCon, objRs 'Creating an Automation object in Database Connection Class, that can be used to connect to Databases Set objCon=CreateObject("Adodb.Connection") 'Creating an Automation object in Database Record set class that can be used to perform operations on DB tables(Records) Set objRs=CreateObject("Adodb.RecordSet") objCon.Provider=("Microsoft.Jet.OLEDB.4.0")' Generating Connection string forMS Access Database objCon.Open "C:\Documents and Settings\gcreddy\Desktop\gcreddy.mdb" objRs.Open "Select * from Login",objCon Do While objRs.EOF=False SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe" Dialog("text:=Login").Activate Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set objRs.Fields("Agent") Dialog("text:=Login").WinEdit("attached text:=Password:").Set objRs.Fields("Password") Wait (2) Dialog("text:=Login").WinButton("text:=OK").Click Window("text:=Flight Reservation").Close objRs.MoveNext Loop objRs.Close objCon.Close Set objRs=Nothing Set objCon=Nothing *******************************************************
Posted by G.Chandra Mohan Reddy at 12:05 AM Email ThisBlogThis!Share to TwitterShare to Facebook

Data Driven Testing-2

0 comments: Post a Comment Links to this post


Create a Link

Newer PostOlder PostHome


Subscribe to: Post Comments (Atom) Hybrid Framework LoadRunner Training Manual Testing QTP Certification

QTP FAQ QTP Framework QTP Guide QTP Online Training QTP Scripting QTP Software Download QTP Training in Hyderabad QTP Videos Quality Center Software Testing Documents SQL for Testers SQL Server Guide VB Script for QTP

QTP GROUP

Subscribe to G C Reddy QTP Group


Subscribe

Email: Visit this group


ABOUT ME

G.Chandra Mohan Reddy I am G C Reddy, Working as a Test Consultant in Hyderabad, INDIA. I am also providing Online training for QTP. View my complete profile
POPULAR POSTS

QTP Scripting QTP Guide VB Script for QTP QTP Basic Features An overview on Test Automation QTP Online Training QTP Interview Questions QTP Framework SQL Server Guide Automation Framework

BLOG PAGES

Web Testing Web Standards Windows Scripts Web Script Examples Data Driven Test Scripts

RECENT POSTS

INFO GC

G C Reddy Technologies. Picture Window template. Powered by Blogger.

You might also like