action not found error with loadandrunaction command
I have been using the loadandrunaction in my framework for some time. It seems to work almost all the time, but we have uncovered a few situations where it does not seem to behave correctly. We are using UFT 11.52 SP1 and are connecting to an ALM 11 project to run most of our functionality. My framework works with both GUI type tests and well as API tests(the main reason we moved to UFT 11.5 because of the integration.) There are 1 or 2 api tests(modules to us), that when called with report an "action not found" exception most of the time...but not always...sometimes it works. All of the folder paths are set appropriately in tool -> options(we actually modify this during run time). Below are 2 functions/subs that are being used.
Sub callModule(strModuleName, strIterations)
On Error Resume Next
strScriptLocation = GetScriptLocation(strModuleName)
Call LoadAndRunAction(strScriptLocation, "Action1")
If Err.Number <> 0 Then
Call ExceptionLog("Error calling module " & strModuleName , "Error number: " & Err.Number & " and Error description: " & Err.Description)
Call InfoLog("Module " & strModuleName & " called successfully")
On Error Resume Next
strScriptLocation = PathFinder.Locate(strScriptName)
If strScriptLocation <> "" Then
Call SuccessLog(strScriptName & " module called", strScriptName & " was found and called")
GetScriptLocation = strScriptLocation
Call ExceptionLog(strScriptName & " module not found", strScriptName & " module not found in the search path specified in Tools -> Options -> Folders" )
When the sub, callModule, fails, it returns "Error number: 1000 and Error description: Action was not found." I can find this file manually on my pc though. There has been a few times when I ran this in debug mode and it found the file....most of the time it did not. I can't understand what is wrong. Any ideas??
@tclasp, what I get back from with the function is the local location of the script has been pulled from ALM to my local temp directory. The actual path is, C:\Users\kuiro01\AppData\Local\Temp\TD_80\alm11\ba 14e951\Test\773\773\773. Within that directory you have the normal directories and files for a QTP/UFT script i.e. Action0, Action1, Default.xls, etc.
@vinodfg, We have tried this on multiple machines and experience the same issue. We are running the latest version of UFT with all patches installed(see my original post). I will try to pull the scripts down from ALM and run locally. I don't have much hope as it already pulls them down to my local machine during run-time.
I am still investigating this. Can anyone confirm it is working for them when calling an API(previously SeviceTest script) test from a GUI(previously just QTP) test. One note is that we have only found 1 or 2 tests that it is not working for, all others(about 20) work. I don't see any reason why these two would fail.
This behavior is only seen when invoking an API test from a GUI test(inside the framework) via the loadandrunaction command.
Refer the help docs... you can't use LoadAndRunAction to run APITest/Action.
You have to use the CallServiceTest statement, but still can't use it in the same way as LoadAndRunAction dynamically. There's a limitation & you have to insert the call using the Menu item Design->Call to Existing API...