For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
Course Name Date Time Duration Type Location
An important update from QtpSudhakar. I stopped giving classroom training in MindQ Systems. I have bigger plans and I want to put an end to regular classroom training because very less people are practicing. From now onwards every session of mine is going to have explanation and practice. Everyone should practice in presence of mine and should go out of classroom with practical knowledge. So I started my own institute AnyTechLabs in Madhapur. Please reach out to +91-8328152362 for course details. Visit AnyTechLabs.com for address details.
Selenium + Cucumber 24th October 7.30 AM IST to 9.00 AM IST 45 Days WeekDay Online

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Tuesday, November 18, 2014

Prepare QTP/UFT Tests Batch Execution Using AOM

'Author  - QtpSudhakar.com
'Purpose - To Run a Test Batch for all tests in side of a folder
'   - This will create a CSV file which will have all the status of execution
'How to Use - Specify the Folder Path of where tests are stored
'   - Make sure you don't have any other empty folders without QTP test
'   - Give TestPath, Save the code into VBS file and Double click on vbs file
'For any doubts contact https://www.facebook.com/Qtpsudhakarblog

'Declare Variables
Dim TestsFolderPath 'To specify Tests folder path
Dim QtApp 'To store Qtp Automation Object
Dim fso 'To access file system
Dim fld 'To store the test folder object
Dim tFlName 'Unique File name to store Test Results
Dim fl 'To store Result File Object
Dim fldLst 'To store Child Folders(tests) of base folder
Dim f 'To store each QTP Test Folder
Dim tPath 'To store QTP Test Path
Dim tName 'To Store QTP Test Name
Dim WSH 'To open the created CSV result file

'Specify Base Tests Folder Path

'Create QTP Automation Object
Set QtApp = CreateObject("QuickTest.Application")
QtApp.launch 'open QTP
QtApp.visible=True 'Make it visible

'Create File system object
Set fso = CreateObject("scripting.filesystemobject")

'Get the base Tests folder
Set fld=fso.GetFolder(TestsFolderPath)

'Generate a unique file name with date and time
tFlName="TestExecution_"&Replace(replace(replace(now,"/","_"),":","_")," ","_")&".csv"

'Create the CSV file with the created name
Set fl=fld.CreateTextFile(tFlName)

'Get Subfolders from main folder
Set fldLst=fld.SubFolders

'Write first row as columns in CSV file
fl.WriteLine "TestName,TestPath,Status"

'Get each folder path and name to execute the test
For Each f In fldLst
 tPath=f.Path 'Get Test Path
 tName=f.Name 'Get Test Name
 QtApp.open tPath 'Open Test in QTP
 QtApp.test.run 'Execute Test
 'Write Test result status into CSV file
 fl.WriteLine tName&","&tPath&","&QtApp.test.LastRunResults.status

'Close CSV file

'Get CSV File Path

'Create WSH object to open the CSV file
set wsh=CreateObject("wscript.shell")
wsh.Run tStatusFilePath 'Open CSV file

'Release Variables
Set WSH=Nothing
Set f=Nothing
Set fldLst=Nothing
Set fl=Nothing
Set fld=Nothing
Set fso=Nothing
Set QtApp=Nothing

No comments :

Post a Comment