Monday, July 18, 2011

Difference between Public and Global variables in QTP

What is the difference in Public and Global variables ?

  • All variables declared in a QTP Action are Public by default.

"Variables declared in  Action1, for example can be accessed in all functions declared inside Action1."    Scope: Within the Action where the variable is declared.

  • All variables declared in .vbs file are called global and are public by default.

 "Why these are called Global variables because, Once you declare a variable in .vbs file,this .vbs file is going to be executed first and then the QTP test action script. So variables declared in .vbs files can be accessible from all Actions at ease."Scope: Globally available to all actions.
--

No comments:

Post a Comment