Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Write QTP results to an Excel sheet
#1
Solved: 10 Years, 9 Months ago
How to Write QTP results to an Excel sheet using functions?
Reply
#2
Solved: 10 Years, 9 Months ago
Hello navitha,

iam also new to QTP. but i found the below stuff as part of my search...
hope this information will be helpful...

We actually have few functions to add the results to the Excel File instead in the QTP Results Window.

Solution description: We will be using a seperate Sheet by name "Results" in which the Results of the Test will be appened.

There are 2 functions

1)
Code:
initOutExcel(sTablePath)

Description : This function is to initialize a particular Excel Where you want to update the Results of the QTP Tests.

2)
Code:
WriteResults(sTablePath,sStatus,sFunctionality,sDescription)

Description : This function appends the Result of a Test to the end of the existing results.

You can modify the below functions to suite your requitrement.

CODE:

Code:
Function initOutExcel(sTablePath)

  Datatable.addSheet "Results"

  Datatable.importSheet sTablePath, "Results","Results"

  iParamCount = Datatable.getSheet("Results").getParameterCount

  if iParamCount = 0 Then

     Datatable.getSheet("Results").addParameter "S.No",""

    Datatable.getSheet("Results").addParameter "Status",""

    Datatable.getSheet("Results").addParameter "Functionality",""

    Datatable.getSheet("Results").addParameter "Description",""

  End If

   Datatable.ExportSheet sTablePath,"Results"

End Function

Function WriteResults(sTablePath,sStatus,sFunctionality,sDescription)

  Datatable.addSheet "Results"

  Datatable.importSheet sTablePath, "Results","Results"

  iRowCount = Datatable.getSheet("Results").getRowCount

  Datatable.getSheet("Results").setCurrentRow(iRowCount+1)

  Datatable("S.No","Results") = iRowCount+1

  Datatable("Status","Results") = sStatus

  Datatable("Description","Results") = sDescription

  Datatable("Functionality","Results") = sFunctionality

  Datatable.ExportSheet sTablePath,"Results"

End Function


Thanks
Navya
Reply
#3
Solved: 10 Years, 9 Months ago
Hi navya,


Thanks for the response.You have given some useful information.That would be helpful for me.


Thanks
Navitha
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 1,593 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  How to write reports from scripts into excel anushreebehura 1 2,069 10-04-2016, 09:29 PM
Last Post: venkatesh9032
  Custom sort -Excel Sheet kiran 1 3,690 01-28-2014, 09:23 AM
Last Post: supputuri
  Can we save an exported Excel sheet directly from QTP? Akhila 2 3,138 11-28-2013, 10:30 AM
Last Post: Akhila
  Excel to HTML results keerthi286 1 2,567 04-19-2013, 08:21 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)