Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Sep 2001
    Mt. Prospect, IL, USA

    WinRunner Functions.

    Hello everyone...

    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()
    { statement1;



    #main - end


  2. #2
    SQA Knight
    Join Date
    Jul 1999
    Grand Rapids, MI

    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




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 07:32 PM.

Copyright BetaSoft Inc.