Micro Focus QTP (UFT) Forums

Full Version: Conditional run of an action
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all

In my web app I am showing page A if company is A and page B if company is B...and so on.

How do i tell QTP to run a different action based on the value of the column "Company" in my Data table ?
Hi janriis,

You can acheive this as follows:

1. Create an action named say "Driver_Script"

2. Inside the Driver_Script action call your company-specific actions based on your conditions. (Tick "After the current step" option while inserting the company-specific actions inside the Driver_Script action)

The Driver_Script action will have code something like the below:

Code:
If Company = "A" Then
   RunAction "Action_A", oneIteration //number of action iteration may vary
   Else
   RunAction "Action_B", oneIteration
End If

You can make use of "LoadAndRunAction" instead of "RunAction" to avoid loading of unnecessary action(s) if you have QTP 10.