I want my test results to be exported to an excel sheet or a notepad and then after every build send a mail to the email we provide? I was using earlier TestComplete5.0 which gave us the feasibility to sending the email automatically after every test run. I'm using QTP9.2 and request if any one has done earlier to let me know the steps or code how it can be done...
Use below code, modify as per your requirement.
<font class="small">Code:</font><hr /><pre>
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.DisplayAlerts = False
Set objWorkbook = objExcel.Workbooks.Open(path)
Set objWorksheet = objWorkbook.Worksheets(Sheet name)
objWorksheet.Cells(row, column).Value = "Pass" or "Fail" </pre><hr />
I don't think there is inbuilt feature provided by QTP to send email once execution is done. You can use code as follows
Dim objOutlook As Object
Dim objOutlookMsg As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
.To = "firstname.lastname@example.org"
.Cc = "email@example.com"
.Subject = "Hello World (one more time)..."
.Body = "This is the body of message"
.HTMLBody = "HTML version of message"
.Send 'Letīs go!
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
And for exporting your result also you will have to use Excel COM API's
could you explain me in detail as I'm having issues for that to modify?Also can i add the test description to it?
Its going to the excel file but not able to write
i have excel file Results.xls and worksheet results with 2 columns pass and fail.
Once the test executes it should populate these fields with the description of the test case which i give in my script and update either Pass or Fail based on the test
Regarding the mail it workds fine it sends the mail
Some how managed to get the results exported to excel using the following code.
use them in the scripts when ever u want to display a result....
modify them as per u r needs.
iParamCount = Datatable.getSheet("Results").getParameterCount
if iParamCount = 0 Then
iRowCount = Datatable.getSheet("Results").getRowCount
Datatable("S.No","Results") = iRowCount+1
Datatable("Status","Results") = sStatus
Datatable("Functionality","Results") = sFunctionality
Datatable("Date","Results") = dt