Document toolboxDocument toolbox

Rules for Mapping Custom Actions

  • The parameter types supported by Qualitia QTP / UFT are String, integer, and Array.
  • Error Resume Next Statement

Add the On Error Resume Next statement at the beginning of the function and the On Error Goto 0 statement before the function end.

For Example,

Function Test()

            On Error Resume Next          

            On Error Goto 0

     End Function

  • Execution Report Value

All custom actions shall return following integer values only as shown in the following table.

ReturnDescription
PassFor passed test cases
FailFor failed test cases
DefectFor defective test cases

No two custom actions can have the same function name in the same class.

Once the custom action is mapped into Qualitia and used in a test case, do not change the existing signature or other details of the action. The logic of the action can be modified. Also do not delete the action that has been used in the Test Case.

  • Add the following block to report the function execution status back to Qualitia Report

For example,

If err.number = Pass Then

            WaitFor = Pass

            WriteStatusToLogs "Action: "&strMethod&vbtab&_

            "Status: Passed " &Vbtab&_

            "Message: Waited successfully for "&intWaitTime&" secs"

     Else               

            WaitFor = Fail

            WriteStatusToLogs "Action: "&strMethod&vbtab&_

"Status: Failed" &Vbtab&_

            "Message: An error occurred during the wait"

     End If

Assign the execution report value as Pass or Fail to the function. You can also assign the value using variables ‘STATUS_PASSED’, ‘STATUS_FAILED’ and ‘STATUS_DEFECT’. The WriteStatusToLogs is used to display the message in Qualitia execution report.

  • Return a Value or Store a Value in a Variable

To return a value/store a value in variable from custom action, we need to use the following code:

For example,  AddItemToStorageDictionary strKey, strValue

The required value, strValue will be stored in the variables strKey and it can be used across the test case to retrieve the variable value. 

  • Using or Passing integer values in Qualitia

To use any value as an integer inside the custom action, make sure to use Cint() and specify the data type as String while mapping the custom action in QFD.

  • Debugging a Custom Action

If you wish to debug the action, then create a test case in Qualitia using the newly created custom action.

Perform a dry run of the test case and once UFT is invoked, insert a debug point.