Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inserting comments along with name of the script in excel
#1
Not Solved
Hi All,
I am running qtp scripts in batch mode using the following code,

Now i want to insert description of that particular scenario along with its name

Currently using below code:

Code:
set qtp = CreateObject("Quicktest.Application")
qtp.Launch
qtp.visible = True
call moduledriver("EXECUTABLEFOLDER")
qtp.quit




'Aim : Gets folders and subfolders and runs test scripts
'********************************************************
Code:
Function moduledriver(modulename)

set fso = createobject("Scripting.FilesyStemObject")
set module= fso.getfolder("D:\Sanity\"&modulename)
set folders=module.subfolders
i=2
for each tmp in folders
testname = tmp.name

qtp.open tmp.path
qtp.test.run
res=qtp.test.lastrunresults.status
'ts = replace (replace(now,"/","_"),":","_")
t1=time
t2=date
call writeresults(modulename,i,testname,res,t1,t2)
i=i+1
next
end function


'Aim :To writes result in excel sheet
'*************************************************************************

Code:
'function writeresults(modulename,rowno,testname,res,t1,t2)
'set xl= CreateObject("Excel.Application")
'set wb = xl.workbooks.open("D:\Sanity\Sanity_Result\Results.xls")

'ts = replace (replace(now,"/","_"),":","_")
'wb.saveas "D:\Sanity\Sanity_Result\Results"&ts
'set ws= wb.worksheets(modulename)
'ws.cells(rowno,1) = testname
'ws.cells(rowno,2)= res
'ws.cells(rowno,3)= t1
'ws.cells(rowno,4)= t2
'wb.close
'xl.quit
'end function

function writeresults(modulename,rowno,testname,res,t1,t2)
set xl= CreateObject("Excel.Application")
set wb = xl.workbooks.open("D:\Sanity\Sanity_Result\Results.xls")
set ws= wb.Sheets("Sanity_TestSuite")
wsrange=ws.UsedRange.Rows.Count
'msgbox(wsrange)
ws.cells(wsrange+1,1) = testname
ws.cells(wsrange+1,2)= res
ws.cells(wsrange+1,3)= t1
ws.cells(wsrange+1,4)= t2
wb.Save

wb.close
xl.quit
end function

********************************************************

Please suggest me with other piece of code.

Regards,
Prashanth.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  VB Script to separate upper & small Letters from a string and store in excel pradeep537 1 2,242 08-05-2016, 12:26 AM
Last Post: Ankur
  UFT taking different script execution timings while comparing 2 excel files. sudheer 0 2,366 06-26-2015, 03:28 PM
Last Post: sudheer
  How to read and write in excel through QTP script shwetha_m 5 29,777 03-14-2014, 02:58 PM
Last Post: venkatesh9032
  QTP 11, Win 7 - Issue while saving the Excel through the script.bu fine in XP sivasuman 0 2,355 11-15-2013, 01:38 PM
Last Post: sivasuman
  Datatable header inserting error Prashanth 0 2,754 05-21-2013, 03:39 PM
Last Post: Prashanth

Forum Jump:


Users browsing this thread: 1 Guest(s)