Editorial / Best Answer
Answered by:
srinivas Potnuru
Hi all,
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) initOutExcel(sTablePath)
Description : This function is to initialize a particular Excel Where you want to update the Results of the QTP Tests.
2) 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:
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
How to write QTP results to a text file or an Excel file ?
Please Can anybody provide the exact code for it
Urgent...............................
Thanks in advance
Uday
Editorial / Best Answer
Answered by: srinivas Potnuru
Hi all,
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) initOutExcel(sTablePath)
Description : This function is to initialize a particular Excel Where you want to update the Results of the QTP Tests.
2) 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:
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
Related Answered Questions
Related Open Questions