Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling a function using the variable name read from XL
#1
Solved: 10 Years, 9 Months ago
I'm a novice in QTP. Actually, our team is developing a framework for our web application. We just need to confirm something regarding the function call in QTP.

Scenario:

We have myltiple tasks list (which is stored in a xl) which needs to be completed for completing a workflow in our application. We are plaaning to store these tasks as rows in an xl. We need to read this taks to a variable and have to call the function corresponding to that task from the library. The function name will be same as the task name.
i.e let task 1=aabbcc , here we have to call a function names AABBCC() in the script. We are reading the task from XL to a variable Var=AABBCC then we have to call the function AABBCC() Coolwithout using select case(because we have 200+tasks in our system!!Sad )

Can anyone help me out in this?

Thanks in Advance!!
Reply
#2
Solved: 10 Years, 9 Months ago
Hi,

At first, import all the data from the excel sheet to the QTP data table. Create a Driver Script action where you will be calling all the actions related to specific task. In the Driver Script action write the following code:

Code:
getTaskCount = DataTable.LocalSheet.GetRowCount
For counter=1 To getTaskCount
    DataTable.SetCurrentRow(counter)
    RunAction DataTable("Tasks",dtLocalSheet), oneIteration
Next

It really doesn't matter how many tasks you have in the data table, it will go on calling the actions as many time as you want Smile

Hope this will help you. Plese write if want further clarifications
Reply
#3
Solved: 10 Years, 9 Months ago
Thanks Prabhat. We are just in the planning phase. Once I try this out I'll get back to you. Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Want to read the data from excel and set read value in the JavaTable rajeevk7 0 2,167 07-10-2017, 04:20 PM
Last Post: rajeevk7
  Calling a function in a Test Script from a function library anupam4j 3 5,902 06-26-2015, 12:31 AM
Last Post: babu123
  Get the function name calling the function Shridevi.Salagare 1 3,610 09-07-2013, 05:07 AM
Last Post: jacosta
  Calling a HP Service Test Skript Gandalf2005 0 2,021 09-05-2012, 07:53 PM
Last Post: Gandalf2005
  Calling of function hamzaz 5 4,374 07-25-2012, 12:44 PM
Last Post: Shridevi.Salagare

Forum Jump:


Users browsing this thread: 1 Guest(s)