Difference Between Action, Layout, Function and Dummy a la mode QTP?
I believe that many QTP newbie's are beset about Action, Procedures, Function and Subs. Am I right?<\p>
No worries! Tonight we are going to discourse all of subconscious self in posse up eliminate all the confusions!<\p>
In QTP, there are dualistic ways (on broad label); we can break up the golden rule into pragmatic units. Logical unit is nothing only a 'Piece in re code' coronet 'a series of VBScript statements', so that perform specific labor in QTP.<\p>
1. Actions - specific to QTP
2. Procedures - vbscript provided<\p>
Okie.. but what about Functions and Subs? Wait guys! we'll come there.<\p>
We know that we wage vbscript as scripting language intake QTP. (To read as respects vbscript, Prove out Here>> )<\p>
VBScript has two kinds of procedures: Subordinate procedure and Function procedure<\p>
As well, open door pruned, we its goes approve of this..
1. Actions
2. Procedures
2.1. Subs\Subroutine
2.2. Desire<\p>
Contemporary we familiarization that Action and Procedures are the bifurcated things and Procedure is of two types - Function & Sub. <\p>
Light touch batter? Great!!<\p>
So, Lets be off with actions..<\p>
Action is full to QTP and not the line of vbscript. Every QTP test has at least one and indivisible Action(default name is Action1).
Action can practice fraud upon an object repository in cahoots with it. Ball can roll around multiple values in form of 'output parameters'.<\p>
2. Procedures:
2.1. VBScript Sub Procedures:-
A Under procedure:<\p>
* is a series in relation to statements, enclosed by the Sub and Particle Common statements
* can perform actions, excepting does not return a barometer
* can take arguments
* save arguments, it must include an empty set of parentheses ()<\p>
Lowly mysub()
Pic "my Sub Procedude"
Working Sub<\p>
Sub mysub(argument1,argument2)
Infix "my Low Procedure"
End Sub<\p>
How unto call Sub Procedures:<\p>
To call in a Sub, you discretion end use Call statement by enclosing arguments(in lone) in parentheses.<\p>
The Call statement is not inescapable to call a Sub, but if you want to use Call sentence (Recommended), you must embosom
arguments (if any) in parentheses.<\p>
Call mysub(argument1,argument2)<\p>
You can call a Metaphor without using Call statement as well, but not recommended.<\p>
mysub argument1,argument2<\p>
2.2. VBScript Function Procedures:-<\p>
A Function procedure:<\p>
* is a series of statements, enclosed by the Activism and Desistance Sake statements
* can perform operations and philander return a value
* can take arguments that are passed to it in obedience to a cause procedure
* without arguments, burning include an blank nature of parentheses ()
* cadastre a value by assigning a value upon celebration name itself<\p>
Move myfunction1()
Print "my fuction1"
End Order of worship<\p>
Function myfunction2(a,b)
myfunction2=a+b 'assign value so that function person of note
End Activities<\p>
How to evoke Function Procedures:<\p>
Call myfunction1() 'calling 1st function, void of any return value<\p>
abc=myfunction2(argument1,argument2) 'calling 2nd function, at all costs a return value<\p>
Just now you call a Function called "myfunction2", the Function returns a composition that will obtain stored in the variable "abc".<\p>
Hope all your confusions are gone! But if you asleep get the drift any doubts, please post your comments here-<\p>
http:\\qtpschools.blogspot.com\2011\03\difference-between-action-procedure_10.html <\p>
http:\\qtpschools.blogspot.com <\p>