HTML reports in QTP

To get html reports after every execution follow the below steps which is one time configuration

1. Open registry
Start > Run > Regedit and click enter

2. Registry will be opened

3. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Logger\Media\Log

4. Change the active DWORD from 0 to 1.

5. Open QTP and run a test. After the execution, the HTML report will be generated and stored in the results folder with name "log"

Associating function library in QTP

Function library can be associated in design time or run-time depending on the framework used.

To associate the function library at design time

navigate to ‘File > Settings > Resources > Associate Function Library’ option in QTP. Click on '+' button and browse for the file and add it to the Test

To associate the function library at run time, you can use any of the following

1) Automation Object Model (AOM)

'Open QTP
Set objQTP = CreateObject("QuickTest.Application")
objQTP.Launch
objQTP.Visible = True

'Open a test
objQTP.Open "D:\Automation\Test1", False, False
Set objFL = objQTP.Test.Settings.Resources.Libraries

'check if it is already associated, else associate it
If objFL.Find("D:\Automation\FunctionLibrary.vbs") = -1 Then
  objFL.Add "D:\Automation\FunctionLibrary.vbs", 1
End


2) using ExecuteFile method.

ExecuteFile "D:\Automation\FunctionLibrary.vbs"

3) using LoadFunctionLibrary method.

LoadFunctionLibrary "D:\Automation\FunctionLibrary.vbs"

Action template in QTP

Action Template is a feature in QTP that allows you to include predefined template for every new actions by default. The template will be included automatically every time you create a new action.

This is a good practice to track few things like purpose, create by, revision history etc.

Example: If the below template is to be set as an action template,


'=========================================================================
'Action Name -
'Purpose -
'Created by -
'Date -

'Change History
'- - - - - - - - - - - - - -
'Date Changed by Comments
'
'=========================================================================

1. Open notepad and copy the above code to it.

2. Save the notepad as "ActionTemplate.mst"

NOTE: Use the double quote while saving the file as this wouldnt add .txt for the file extension.

3. Go to <dat> folder inside QTP installation folder.

Normally it can be found under C:Program Files\Mercury Interactive\QuickTest Professional\dat for versions of QTP below 11 and under C:Program Files\HP\Unified Functional Testing\dat for UFT 11.0 or above.

4. Add the ActionTemplate.mst file in the dat folder.

5. Open QTP and insert a new action. The new action should display the statements that you had saved in the Action Template.

Action Template in QTP