I have a quick function question.
I am using functions, and have the following pseudo-code listed below. If I move the function definitions after main, do I need to declare the static function within main (as with other languages) thereby telling main of the existence of the function?
static function YourFunction()
#main - end
Re: WinRunner Functions.
Well I am not sure what you mean by "main" in your above question. But assuming you mean the main body of a WinRunner testcase [which is code not enclosed in a function] then the following forward references in the functions a(), b(), and c() execute without error:
This works because when the first line of testcode is EXECUTED [i.e. the call to the a() function] WinRunner has already INTERPRETED and loaded the a(), b(), and c() functions into memory.
But in the next example you get a runtime error [message: function c() is undefined] because code execution started before the c() function has been interpreted.
The rule seems to be forward references are fine, just as long as those vars and functions are eventually interpreted prior to an attempt to execute code which references them.
-Hope this helps, Terry Horwath