UFT (formerly QTP) provides a good mix of built-in environment variables. These can help you design efficient cross-platform and machine independent tests. With a simple one line syntax, you can find out current system configuration, test directories and more during run time.

There is, however, one important thing missing in built-in environment variables.

UFT Build Version

UFT build version changes when you install a new service patch on top of your existing UFT installation. This info can be helpful in troubleshooting those cases where Everything-was-working-fine-till-yesterday-and-today-it-is-no-more-working.

It is a good practice to include UFT build version as part of your test report.

How to retrieve UFT Build Version during run time programmatically?

Here is how you can programmatically retrieve UFT build version from the Windows registry.

In 64 bit Windows OS, the UFT registry keys can be located at

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercury Interactive\QuickTest Professional\CurrentVersion\

while in 32 bit Windows OS, the UFT registry keys can be located at

HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\CurrentVersion

uft-build-registry

The code below is written for 64 bit OS. It can be tweaked using the registry path available above to work for 32 bit OS.

Function UFTVersionInRegistry (strRegistryKey, strDefault )
Dim WSHShell, strValue
On Error Resume Next
Set WSHShell = CreateObject("WScript.Shell")
strValue = WSHShell.RegRead( strRegistryKey )

if err.number <> 0 then

'The default value is assigned in case of error'

UFTVersionInRegistry= strDefault
else
UFTVersionInRegistry=strValue
end if

set WSHShell = nothing
End Function

major = UFTVersionInRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercury Interactive\QuickTest Professional\CurrentVersion\Major","Major version number does not exist")
minor = UFTVersionInRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercury Interactive\QuickTest Professional\CurrentVersion\Minor","Minor version number does not exist")
build = UFTVersionInRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercury Interactive\QuickTest Professional\CurrentVersion\build","Build number does not exist")

msgbox "UFT version is: " & major & "." & minor & " Build Version is: " & build

 How to retrieve UFT build version manually?

While you’re inside the UFT IDE, you can check the build version by going to Help > About HPE Unified Functional Testing

locate-uft-build-version

If you want to keep track of further articles on UFT (QTP). I recommend you to subscribe by Email and have new UFT articles sent directly to your inbox.

Subscribe to get free updates on UFT!

LearnQTP is the most popular site on UFT (formerly QTP).

Enter your first name and email address below to instantly subscribe and download an eBook on Optimizing UFT Scripts. In future, we will make sure you get new tips & tricks on UFT delivered direct to your email box.

Please check your email and confirm free subscription!