Launch QTP with QC Connection and Add-ins using vbscript

Suppose you are working on an Java application and you are using Java add-in and say Oracle add-in. Also, you are running your test from QC. One way to do this is simply open QTP, select required add-ins, connect with QTP manually and then open your test by browsing to its location. This’ll take about 10 mins, i beleive.
Yeah…!!! But what can I do?
Well, you can do a lot! In this post we’ll see how to launch qtp with all required settings, add-ins, and connection with QC, and even open a particular test by default.
Everything is done in just one click… Sounds great??  Okie… here we go…!

Set App = CreateObject(“QuickTest.Application”) ‘ Create the Application object
App.SetActiveAddins Array(“Web”, “Java”, “Oracle”) ‘Set the required Add-Ins
App.Launch ‘ Start QuickTest
App.Visible = True ‘ Make the QuickTest application visible
App.New ‘ Open a new test
‘App.Open “D:John” ‘-  use this if you want to open existing test
If Not App.TDConnection.IsConnected Then
    App.TDConnection.Connect “http://<server url>”,”<domain name>”,”<project name>”,”<user name>”,”<password>”,False ‘ remove <> brackets
End If
App.Options.Run.ViewResults = False
App.Test.Actions(“Action1”).ObjectRepositories.Add “[QualityCenter] SubjectjohnRepositoryRep.tsr”
App.Test.Settings.Resources.Libraries.Add “[QualityCenter] SubjectjohnRepositoryLib.vbs”
‘App.Test.Actions(“Action1”).SetScript “‘TestCaseId:  “&vbCrlf&”‘TestCaseName:  “&vbCrlf&”‘Description:  “&vbCrlf&”‘Created By:  John”&vbCrlf&vbCrlf&vbCrlf&”‘*******************************Prerequisites********************************”&vbCrlf &”‘Application should be open and login”&vbCrlf &”‘*******************************************************************************”

Set App = Nothing ‘ Release the Application object

In case of any queries, please leave your comments.

1 thought on “Launch QTP with QC Connection and Add-ins using vbscript”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top