Posts: 35
Threads: 14
Joined: Feb 2008
Reputation:
0
02-25-2008, 04:13 AM
Hello ,
I was using QTP 9.2 with QC 9.2. My script needs excel data and this data can be changed by the client at any time . I have created a script but if I use File -> import from excel data it attaches the current data to my test .
Is there a way to avoid this and allow the test script to pickup data from the excel file . This way if the client changes the excel file data , my script does not have to be modified .
Please note currently I am using record and playback scripting only so if anyone can tell how this can be done , I'd really appreciate it
Again my test and data have to be uploaded to Quality centre finally .
Thanks
Posts: 15
Threads: 1
Joined: Feb 2008
Reputation:
0
02-26-2008, 06:19 PM
Hi Sonia,
You can import the required excel file to your local data table.
Suppose you want to import an excel file called Name.xls for which the path is C:\New\Name.xls
For this,just go to the expert view and write:
Data Table.Import("C:\New\name.xls")
When you will run the script, the data would be imported and you can view it in the Run Time table formed.Run Time table can be viewed from the result summary of your script.
Posts: 35
Threads: 14
Joined: Feb 2008
Reputation:
0
02-27-2008, 05:32 AM
Thank you for explaining it so clearly . I will do just that .
Sonia
Posts: 35
Threads: 14
Joined: Feb 2008
Reputation:
0
02-28-2008, 05:18 AM
Hi,
I did the above and it imported the excel file at run time . However I have two records in the datatable and for some resaon the script runs twice but only takes the first record. Could it be possible that the script is reloading the excel file for both iterations and hence only takes the first row of data
Thank you
Sonia
Posts: 15
Threads: 1
Joined: Feb 2008
Reputation:
0
02-28-2008, 12:37 PM
Hi Sonia,
Ya you are rite,if the script is running twice then offcourse it will take 1st row only each time.However,if you want to execute 2nd row also then you don need to execute the script again but you can simply use Data Table.SetNextRow after 1st row has been used.
Posts: 106
Threads: 28
Joined: Jan 2008
Reputation:
0
02-28-2008, 08:54 PM
Hi Deepak ,
Can't we use runsettings..Run for all row iterations?
Posts: 35
Threads: 14
Joined: Feb 2008
Reputation:
0
02-29-2008, 05:06 AM
Hi,
Actually I am only running the script once but the excel data has two rows of data . So that is why the script iterates twice , but takes the first row each time .
Is there a way to have the script take data from each of the excel table rows,
Thank you again for your help,
Sonia
Posts: 15
Threads: 1
Joined: Feb 2008
Reputation:
0
02-29-2008, 10:50 AM
Hi Sonia,
Above said explanation hby Brian is quite rite.You try doing that.