How to take backup of QTP Scripts(Automation Folde
I have kept my scripts @ C:\ (Complete Automation Folder)
However, I want to take a periodic backup of my scripts may be after every 10 days.
How can I achieve this? Has anybody worked on this before?
Please let me know.
Re: How to take backup of QTP Scripts(Automation F
Back up of your script after certain time period is normally done by Windows scheduler. So basically you need to create code that will take back up and also need to create code that will invoke QTP at particular time to run your code and take back up.
I am using below approach to take back up of whole QTP code at regular interval. There may be another approach to do same. [img]/images/graemlins/smile.gif[/img]
Kindly have a look of below code which may help you to resolve your query.
1) QTP CODE: (Saved at C:\ ABC_Backup location)
dim filesys, newfolder, newfolderpath
dateformat = replace(now, "/", "-")
dateformat = replace(dateformat, ":", "-")
newfolderpath = "give path where you want to take backup"&dateformat
‘ dataformat is just to identify on which date back up is taken.
If filesys.FolderExists("Path of Existing folder path that you want to take back up (Ex: C:\ABC) ") Then
Set newfolder = filesys.CreateFolder(newfolderpath)
filesys.CopyFolder "C:\ABC", newfolderpath
2) Create .VBS file for scheduler which you need to
configure through windows scheduler.
CODE FOR SCHEDULE.VBS
Set App = CreateObject("QuickTest.Application")
App.Visible = True
App.WindowState = "Maximized" ' Maximize the QuickTest window
App.ActivateView "ExpertView" ' Display the Expert View
App.open "C:\ ABC_Backup", False
'Opens the test in editable mode
Set qtTest = App.Test
qtTest.Run ' Run the test
qtTest.Close ' Close the test
Set qtTest = Nothing ' Release the Test object
Set App = Nothing ' Release the Application object
HOPE ABOVE CODE WILL HELP YOU [img]/images/graemlins/smile.gif[/img]