Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reusable function.
#1
Solved: 11 Years, 4 Months ago
Hi,

We use QTP 9.2 to test a web application at our work.
For this we need to create a script first that clears the cache & cookies on IE-6.
The script works fine when I record and playback.
I also want to use this script as a reusable script, which means before I run any script I want the cache and cookies cleared and then I want the other part of the application to run.
I have tried using Insert--> call to New Action ,but the first script opens until Tools and later it does not recognize the Internet options under it and fails.
But when I run the first script by itself it works fine.

Any help on this is greatly appreciated.

Thanks.
Reply
#2
Solved: 11 Years, 4 Months ago
You could use "Insert->Call to Existing Action" to insert the existing Action. This is only possible if the action is declared as reusable.

But be careful: The DataTable-Sheets of the external Action and all its sub-actions will get a new name, when integrated into another test. This new name is: "Actionname [Testname]".
So if your action accesses any of the DataTable-Sheets directly using their names, you have to keep this in mind.
In order to overcome this problem you can access your datatable-sheets like this:

Code:
Set myRegExp = new RegExp
myRegExp.Global = false
myRegExp.Pattern = "NameOfThisAction"

sheetSuffix =  myRegExp.Replace(DataTable.LocalSheet.Name, "")

Now the access to the sheet:
testValue = DataTable("myColumn",  "TheAction" & sheetSuffix)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a function in a Test Script from a function library anupam4j 3 6,127 06-26-2015, 12:31 AM
Last Post: babu123
  Non-reusable action - doubt srsaritha 1 3,510 10-16-2012, 05:04 PM
Last Post: richa07
  how to call reusable actions by passing parameters.? Arun091 0 3,881 08-16-2012, 07:28 PM
Last Post: Arun091
  Is there any mapping between script and reusable action. TurtleRock 2 3,172 12-20-2011, 09:56 AM
Last Post: Sathiya
  Doubt in non reusable actions pradeep singh 6 9,187 11-19-2011, 12:19 AM
Last Post: srsaritha

Forum Jump:


Users browsing this thread: 1 Guest(s)