Você está na página 1de 5

Author: Abhinav Vaid

QTP Demo: A Data Driven Implementation

QTP Demo: A data driven Implementation Introduction: QTP has some very practical usages which require very little time investment, encounter no tool comple ities, but has huge bene!its" The current topic demonstrates one such implementation" #ets us say that you have a calculator application and you want to test all possible numeric combinations with all the available operators" I am $ust tal%ing about the simple calculator &not scienti!ic' (ere are the test steps)cases: Invo%e the Application" *se all possible numeric combinations to per!orm all the possible calculations as mentioned below" +" ,ultiplications &All possible combinations right !rom +, -, .// to 000000/""' -" All possible 1ubtractions ." All possible Additions 2" Divisions 3" 4lose the Application Total number o! manual Test cases would be in thousands and time ta%en would be in hours" 1till
zero accountability)proo! whether the tester has actually e ecuted the tests or spent the entire day playing video games &5T6, it does happen'"

In order to automate the test application, perform the following steps: Prepare a matri o! all the possible numeric combinations with all the available operations &!or e ample +-.237809:;' in an e cel sheet and save it in a prede!ined location" +" Invo%e QTP" -" 4lic% <ecord and invo%e the calculator application" The !ollowing code will get generated SystemUtil.Run "calc","","C:\Documents and Settings\abhinav","" ." 4lic% view datatable" 2" In order to do the calculations o! the test cases &multiple operator tests o! various numerical data sets', type the !ollowing command: Window("Calculato "!."y#e Data"able("Data"able$%&'()*+,-#a am-dt.lobalSheet", dt.lobalSheet!

Author: Abhinav Vaid

QTP Demo: A Data Driven Implementation

3" 4lic% =ile1ettings" The Test Settings dialog bo as displayed in =igure + will get displayed"

igure !: Test Settings

7" 4lic% the Run tab" =ollowing screen will be displayed" It has the radio buttons which need to be selected !or the no o! iterations you loo% !orward to run" 8" 1elect run on all rows radio button"

Author: Abhinav Vaid

QTP Demo: A Data Driven Implementation

igure ": Test Settings ## Run

:" 4lic% the Resources tab" The !ollowing dialog bo will be displayed" *nder the data table option, browse to select the ls !ile created !or test cases" $ote: There is a dependency on the naming convention o! the e cel !ile which needs to match the name o! the action name speci!ied in the code" QTP does prompt with an in!ormation dialog bo as shown below"

0" 4lose the Application)4alculator using 6indow&>4alculator>'"4lose" The QTP will have $ust . lines o! Test code as displayed below:

Author: Abhinav Vaid

QTP Demo: A Data Driven Implementation

igure %: &ode 'indow

<un the test" ()serve*Record the <esults" The entire test with all the speci!ied data will get e ecuted" The !ollowing result will get displayed a!ter the success!ul completion o! the tests"

Author: Abhinav Vaid

QTP Demo: A Data Driven Implementation

igure +: Test Results

That?s the !un o! doing Automation @@@

Você também pode gostar