Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing to Run time data table
#1
Not Solved
First of all, I would like to thank all the volunteers who have been replying so patiently and promptly.

I have my test data in excel spreadsheet. I 'm using CreateObject(Excel Application) method to associate the test data. I am executing the script and am able to perform the required action on the application and producing the results.

But I want to make few more enhancements so we can manage the results more easily.

1. During my run session, the test data is NOT visible in Design time data table. How to make the data visible during the test run and be able to see the record that qtp is currently working on so we can keep track of how many rows it ran and how many more left?
2. How to write a message or variable value to my run time data table when the test executes each record from the spreadsheet? This will enable me to keep a record for future references.

Your reply is greatly appreciated. Thanks in advance.
Reply
#2
Not Solved
Hi Neetha,
1>
Code:
Set xl = createobject("Excel.Application")
xl.Application.Visible = true
Set workbook = xl.Workbooks.Open ("C:\Desktop\KED.xls")
Set sheet = Workbook.worksheets ("TESTCASE")
row = sheet.usedrange.rows.count
col = sheet.usedrange.columns.count
For i=1 to row
    For j=1 to col
a=sheet.cells(i,j).value    'place here the row name so that when it enters the loop u will be able to see for which row the code is working presently
    Next
Next
xl.Quit
Set xl = nothing
2> take the output in a variable then set in specific cell.
---------suppose output comes in variable b then
Code:
sheet.cells(k,h).value =b
' also if u want output in runtime datatable then you can add a sheet in the beginning (datatable.add) and write value in it during runtime.
'u can employ print/msgbox keywords to display the output value too.
Reply
#3
Not Solved
Thanks for the quick reply Aditi. I tried to implement your code.

1. The spreadsheet is visible with this line of code you mentioned.
Code:
xl.Application.Visible = true
But, how to keep the cursor focus on the row that the application is currently working on. Can you please provide the code for it?

2. I am able to write the data on to the spreadsheet with the help of your code
Code:
sheet.cells(k,h).value =b

But, I am getting error message when I try to write on run time data table.
Error was saying "The set DataTable.Value operation failed. The <D> column does not exist.
Code:
"DataTable.Value("D", dtGlobalSheet) = a .

Can you please help me out?
Reply
#4
Not Solved
Hi Neetha,
The simplest way that I can suggest is Import the sheet to DataSheet and then run the script based on your datasheet, which will show you the current row which is executing and you can always update the values back in the datatable. At the end of the test export the data table back to the location.

Hope this would be helpful. Let me know if you need any help on this.
Thanks,
SUpputuri
Reply
#5
Not Solved
Thanks for the reply.
I know that I can import the data to the design time data table and parameterize the test to see the current row during the execution. But, my tool hides the data table as soon as the run starts. I think some settings have got changed and I 'm not able to set it back. The test works fine and the data table is visible after the execution completes.

Any help is appreciated. Thanks.
Reply
#6
Not Solved
Just pause the script and it on View > Data menu item.
Thanks,
SUpputuri
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  data table use uft_usr 1 2,095 06-29-2016, 05:23 PM
Last Post: Ankesh
  QTP not recogonising object during run time Lavanya N 2 3,479 10-28-2015, 12:46 PM
Last Post: vinod123
  How to Export run result viewer with CAPTURED DATA and save it in PDF,or Doc,or HTML akhandesh 0 2,771 07-16-2015, 06:03 PM
Last Post: akhandesh
  Writing values to DataTable chewbecca 2 2,939 04-09-2015, 05:48 PM
Last Post: chinnikrishna
  Reading and writing is the same text file poulomi21b 2 5,767 07-08-2014, 12:39 PM
Last Post: poulomi21b

Forum Jump:


Users browsing this thread: 1 Guest(s)