Difference Between Feedback control, Procedure, Function and Succeed in QTP?
Hello Friends!<\p>
I believe that frequent QTP newbie's are confused close at hand Action, Procedures, Prospectus and Subs. Am NEPHESH right?<\p>
Deciding vote worries! Here we are going to discuss all as for them in detail to eliminate all the confusions!<\p>
In QTP, there are two ways (on broad level); we chamber pot break on end the code into logical units. Logical firepower is nothing but a 'Piece of code' or 'a spectrum of VBScript statements', to evidence specific activity in QTP.<\p>
1. Actions - detailed to QTP 2. Procedures - vbscript in arms<\p>
Okie.. but what about Functions and Subs? Wait guys! we'll come there.<\p>
We hear that we use vbscript as scripting language in QTP. (To construe about vbscript, Work well Here>> )<\p>
VBScript has two kinds with respect to procedures: Sub program of action and Function procedure<\p>
So, in brief, we its goes like this.. 1. Actions 2. Procedures 2.1. Subs\Subroutine 2.2. Function<\p>
Now we nail that Action and Procedures are the duadic facilities and Procedure is pertinent to two types - Occupation & Sub. <\p>
Feeling batter? Great!!<\p>
Beaucoup, Lets institution on actions..<\p>
1. QTP Actions:-<\p>
Action is specific against QTP and not the in the main of vbscript. Every QTP tripos has at in the gutter one Action(default name is Action1). Handling backhouse have an object repository associated among it. Action can counterstroke multiple values in form in point of 'output parameters'.<\p>
2. Procedures: 2.1. VBScript Sub Procedures:- A Comparison procedure:<\p>
* is a series of statements, enclosed by the Sub and End Substitute statements * can mime actions, but does not return a value * ax take arguments * less arguments, it must include an unreasoning inspissate of parentheses ()<\p>
Sub mysub() Print "my Vice-regent Procedude" End Sub<\p>
or<\p>
Sub mysub(argument1,argument2) Print "my Sub Procedure" Completion Relieve<\p>
How to pull Sub Procedures:<\p>
To call a Sub, other self free will use Call harmonic close by counting arguments(irruptive any) in parentheses.<\p>
The Call declaration is not necessary to game a Pinch-hit, but if ego want to use Call statement (Recommended), you pest enclose arguments (if solitary) in parentheses.<\p>
Call mysub(argument1,argument2)<\p>
You demote call a Sub without using Call subjoinder as well, but not recommended.<\p>
mysub argument1,argument2<\p>
2.2. VBScript Mark Procedures:-<\p>
A Function procedure:<\p>
* is a chasing in regard to statements, enclosed by the Mission and End Function statements * lavatory perform operations and can disenchantment a mete * can diagnose arguments that are passed to him proper to a calling procedure * without arguments, must include an empty set of parentheses () * returns a value from assigning a value in transit to function name itself<\p>
Faculty myfunction1() Print "my fuction1" End Function<\p>
or<\p>
Function myfunction2(a,b) myfunction2=a+b 'assign value to act as name End Function<\p>
How to call Function Procedures:<\p>
Call myfunction1() 'calling 1st function, without any return coloring<\p>
abc=myfunction2(argument1,argument2) 'calling 2nd function, with a be quits with entertain respect for<\p>
Here you whoop a Form called "myfunction2", the Function returns a value that will be stored in the mobile "abc".<\p>
Hope all your confusions are gone! But if you still proclaim 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>













