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] Subject\john\Repository\Rep.tsr"
App.Test.Settings.Resources.Libraries.Add "[QualityCenter] Subject\john\Repository\Lib.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.
nice post!!
ReplyDeleteGetting error "This operation can be performed only before the application start" for line2.
ReplyDeleteThis is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine. ingilizce kursu
ReplyDeleteI found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information levent ingilizce kursları
ReplyDelete