Friday, June 4, 2010

QC-Download QTP Scripts

' Script to download QTP test from QC and save into local disk
'05/02/2006
'Does not use extended storage offerred by QC, which can be another way to do the same

***************************************************************************
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtUpdateRunOptions 'As QuickTest.UpdateRunOptions ' Declare an Update Run Options object variable
Dim qtRunResultsOptions 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable
Dim blsSupportsVerCtrl ' Declare a flag for indicating version control support
Dim td As New TDConnection
Dim tstMgr As TestSetTreeManager
Dim tsttr As TestSetFolder
Dim tsetFact As TestSetFactory
Dim tsetList as List


strTargetPath = CreateInputDialog ("Enter the Target Script Path")

strQCFolderPath = CreateInputDialog ("Enter the QC Folder Path that contains Tests")

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible


' Make changes in a test on Quality Center with version control
qtApp.TDConnection.Connect "http://tdserver/tdbin", _ "MY_DOMAIN", "My_Project", "UID", "Pwd", False ' Connect to Quality Center

If qtApp.TDConnection.IsConnected Then ' If connection is successful

blsSupportsVerCtrl = qtApp.TDConnection.SupportVersionControl ' Check whether the project supports vervion control

'Retrive all the Test from QC and Save them to Local Disk

Set tstMgr = td.TestSetTreeManager
Set tsttr = tstMgr.NodeByPath("Path\Test")
Set tsetFact = tsttr.TestSetFactory
Set tsetList = tsetFact.NewList("")
For Each tset in tsetList

' Msgbox tset.Name

qtApp.Open "[QualityCenter] Subject\tests\test1", False ' Open the test

If blsSupportsVerCtrl Then ' If the project supports version control
qtApp.Test.CheckOut ' Check out the test
End If

' Prepare the UpdateRunOptions object

Set qtUpdateRunOptions = CreateObject("QuickTest.UpdateRunOptions") ' Create the Update Run Options object
' Set the Update Run options: update the Active Screen and test object descriptions. Do not update checkpoint values
qtUpdateRunOptions.UpdateActiveScreen = True
qtUpdateRunOptions.UpdateCheckpoints = False
qtUpdateRunOptions.UpdateTestObjectDescriptions = True



' Prepare the RunResultsOptions object
Set qtRunResultsOptions = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtRunResultsOptions.ResultsLocation = "" ' Set a temporary results location



'Save the Open Test into Target Path Specified
qtApp.Test.SaveAs targetQTPscriptPath



If blsSupportsVerCtrl And qtApp.Test.VerCtrlStatus = "CheckedOut" Then ' If the test is checked out
qtApp.Test.CheckIn ' Check it in
End If

Next
qtApp.TDConnection.Disconnect ' Disconnect from Quality Center

Else

MsgBox "Cannot connect to Quality Center" ' If connection is not successful, display an error message.

End If

'Exit QuickTest

qtApp.Quit
Set qtApp = nothing

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

15 comments:

Anonymous said...

Thanks, a very helpful script.

Anonymous said...

I'm extremely impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it is rare to see a great blog like this one nowadays.

Also visit my web site Newest healthcare advancements with regard to moobs therapy

Anonymous said...

Saved as a favorite, I really like your blog!

Feel free to surf to my blog post Is Gynexin Successful Against Man Boobs?

Anonymous said...

What's up, every time i used to check web site posts here early in the morning, because i like to gain knowledge of more and more.

My site wealthwayonline.com

Anonymous said...

I visited several sites but the audio feature for audio songs existing at this website is truly excellent.


Also visit my site Louis Vuitton Handbags Outlet

Anonymous said...

Nice blog here! Also your website loads up very fast!

What web host are you using? Can I get your
affiliate link to your host? I wish my web site loaded up
as fast as yours lol

my web blog: Abercrombie and Fitch

Anonymous said...

Thanks for finally writing about > "QC-Download QTP Scripts" < Liked it!

Look into my web site ... Louis Vuitton Bags

Anonymous said...

Fantastic beat ! I would like to apprentice even
as you amend your web site, how can i subscribe for a blog website?
The account aided me a acceptable deal. I were a
little bit familiar of this your broadcast provided vibrant clear idea

Visit my web blog - Home Page

Anonymous said...

Everyone loves what you guys tend to be up too. This type of clever work and reporting!
Keep up the superb works guys I've added you guys to my own blogroll.

Here is my webpage Air Jordan 2013

Anonymous said...

Inspiring quest there. What occurred after? Good luck!


Feel free to surf to my page: Louis Vuitton Handbags Outlet

Anonymous said...

Your style is very unique compared to other people I have read stuff from.
Many thanks for posting when you have the opportunity, Guess I will just book mark this blog.



Review my webpage - Abercrombie Paris

Anonymous said...

If some one wishes expert view concerning blogging after that i advise him/her to go to see this website,
Keep up the pleasant job.

Also visit my page: Boutique Air Max

Anonymous said...

Thanks for finally writing about > "QC-Download QTP Scripts" < Liked it!

Feel free to surf to my web page ... Michael Kors Outlet ()

Anonymous said...

Thanks for your marvelous posting! I seriously
enjoyed reading it, you could be a great author.I
will make sure to bookmark your blog and will often come back sometime soon.

I want to encourage you to continue your great work, have a nice afternoon!



Here is my blog :: visit this link

Anonymous said...

This is the right webpage for everyone who really wants to understand this topic.
You understand a whole lot its almost tough to argue with you (not that I actually would want to…HaHa).
You definitely put a brand new spin on a subject which
has been discussed for many years. Wonderful stuff,
just great!

Here is my web-site Louis Vuitton Pas Cher