How to tell if script is run from QC/ALM or from UFT?
Question ID: 106048

I have some scripts that I want to behave differently if they are run locally vs. running from QC/ALM. How can I determine if my test is being run from QC/ALM or if it is just being run directly from UFT?

Marked as spam
Posted by (Questions: 386, Answers: 64)
Asked on April 28, 2015 3:31 pm
Answers (1)
Private answer

You can use QCUtil.CurrentTestSetTest to check. If it is run locally, the value will be blank. If it's being run from ALM, the value will be [1].

QCutil.IsConnected will return true if connected, false if not.

Dim CurrentTSTest
If qcutil.IsConnected Then
Reporter.ReportEvent micPass,''Connected to QC'', ''Connected to Quality Center Server: '' & qcutil.QCConnection.ServerName & vbcrlf & _
''Project : '' & qcutil.QCConnection.ProjectName & vbcrlf & '' Domain : '' & qcutil.QCConnection.DomainName
Set CurrentTSTest = qcutil.CurrentTestSetTest
if CurrentTSTest is Nothing then
Reporter.ReportEvent micFail,''IsExecutedFromQC'', ''QTP is connected to quality center server. But the test is **not** executed from a Testlab in QC''
IsExecutedFromQC = FALSE
Reporter.ReportEvent micPass,''IsExecutedFromQC'', ''The test is executed from a Testlab in QC''
msgbox CurrentTSTest.Name
IsExecutedFromQC = TRUE
end if
Reporter.ReportEvent micDone,''IsExecutedFromQC'', ''QTP is not connected to quality center server''
IsExecutedFromQC = FALSE
end if

Marked as spam
Posted by (Questions: 16, Answers: 807)
Answered on April 28, 2015 3:31 pm
Thanks, that helps a lot!
( at April 28, 2015 3:32 pm)

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

Scroll to Top