liorde Honored Contributor.
Honored Contributor.

Launching a UFT script from ALM project, via VBS . How to ?

Hi there,

I would like to know if anyone has tried to launch a UFT test through VBS file (in the file system).
This thing is needed for a scheduled test run which I need to do for nightly regression runs.
This is the URL for the ALM server:
I FAIL in this phrase :
    ' connecting to the ALM server
    qtApp.TDConnection.Connect sServer ,sDomain, sProject, sUser, sPass, False

Anyone done this before?

1 Reply
Micro Focus Expert
Micro Focus Expert

Re: Launching a UFT script from ALM project, via VBS . How to ?

Hello there,

Hope you are doing great.

Please check the code below, it's an example about how can you connect your UFT host from ALM using vbs script:

nPath = "Root\UFT"
testSetName = "TestSet1"
RunSanity nPath, testSetName

Sub RunSanity(nPath, testSetName)
	Set App = CreateObject("QuickTest.Application")
	App.Visible = False
	Set qcApp = App.TDConnection

	domain = "Default"
	project = "xx"
	server = "http://x.x.x.x:8080/qcbin"
	user = "Admin"
	password = "xxx"

	If qcApp.IsConnected Then
	End If

	On Error Resume Next
		qcApp.Connect server, domain, project, user, password,False
		If err.Number>0 Then
			Wscript.Echo "Not able to log in on ALM, check the credentials"
			Exit Sub
		End If
	On Error GoTo 0
	Wscript.Echo "Success connection"

	Set tdc = qcApp.TDOTA

	Set TSetFact = tdc.TestSetFactory
	Set tsTreeMgr = tdc.TestSetTreeManager

	'Path with the test
	Set tsFolder = tsTreeMgr.NodeByPath(nPath)
	If tsFolder Is Nothing Then
		Wscript.Echo "Don't found the path: " & nPath
		Exit Sub
	End If
	Set tsList = tsFolder.FindTestSets(testSetName)
	If tsList.Count > 1 Then
		Wscript.Echo "Run the firts test"
	ElseIf tsList.Count < 1 Then
		Wscript.Echo "Don't found any test " & testSetName
		Exit Sub
		Wscript.Echo "Launching test"
	End If
	Set theTestSet = tsList.Item(1)

	Set Scheduler = theTestSet.StartExecution("")
	Scheduler.RunAllLocally = True
	Wscript.Echo "Success"
End Sub


Hope this information was useful.

If you find this or any other post resolves your issue, please be sure to mark it as an accepted solution.

If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the pond show your appreciation.

Best regards,

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.