GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Tech FAQs  >  QTP

 Print  |  
Question:  I m setting the excel sheet path in QTP for importing as : datatable.importsheet "C:Qtpabc.xls"
but if the location of excel sheet path changes to for eg:"D:Data"...the script fails as proper excel sheet path is not given..can u plz suggest how to use a environment variable/xml file to remove data path hard coding??




July 07, 2006 02:43:02 #1
 vasavi   Member Since: Visitor    Total Comments: N/A 

RE: I m setting the excel sheet path in QTP for import...
 

Hi,

    You can use Action and Test parameters to  parameterize the hard coded value of Excel sheet path, or even  you can go  for Environment variables.

Using Test and Action parameter:

  Follow following procedure

Go to Test Settings-> Parameters-> define the input parameters (for ex: path)

As Test parameter can't be used directly in Test script, goto Correspoding Action an right click

and go to Action properties  and define  Action parameter to use.(for ex: path1)

then goto Action Call Properties-> and set value for defined action parameter

as Test parameter(in value column for that parameter  click  on the '<>' to set value and set Test parameter as parameter type and set "path" variable to Action parameter(path1)

and use same action parameter in the  datatable.import sheet statement

datatable.importsheet path1

When we run the Test   we can give the path of Excel sheet in "Run  dialog box->Paramters" .

Using of Environment variable

define an environment varibale in Test->settings->Environment parameters

Select parameter type as "Userdefined" from list box and define the  parameter

and use directly in datatable.importsheet statement. Here we need to give value of path  before executing the script.

let me know if u have any qts

     

 

Back To Question