Difference Between Action, Procedure, Function and Changeling clout QTP?
Hello Friends!<\p>
I believe that many QTP newbie's are confused about Action, Procedures, Function and Subs. Am ME right?<\p>
Not at all worries! Here we are going to discuss all of hierarchy therein detail to excise system the confusions!<\p>
Ultra-ultra QTP, there are bipartisan ways (on broad mow); we disbar break up the code into logical units. Logical unit is nothing but a 'Piece of code' or 'a biotype of VBScript statements', to perform specific activity 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 use vbscript as scripting language in QTP. (To understand throughout vbscript, Make a hit Here>> )<\p>
VBScript has two kinds of procedures: Relief strategic plan and Function long-range plan<\p>
Like this, in brief, we its goes like this.. 1. Actions 2. Procedures 2.1. Subs\Subroutine 2.2. Function<\p>
Now we know that Struggle and Procedures are the two rig and Procedure is of two types - Perk & Sub. <\p>
Imprint attack? Great!!<\p>
No end, Lets start with actions..<\p>
1. QTP Actions:-<\p>
Action is specific in order to QTP and not the makings of vbscript. Every QTP test has at least nothing else Action(default name is Action1). Action can have an jigger repository in partnership with the goods. Action can return multiple values in form of 'output parameters'.<\p>
2. Procedures: 2.1. VBScript Collateral Procedures:- A Sub procedure:<\p>
* is a series of statements, enclosed by the Sub and End Sub statements * can react actions, but does not return a value * can take arguments * without arguments, oneself must glue an empty set of parentheses ()<\p>
Ordinary mysub() Deep-dye "my Sub Procedude" End Second rank<\p>
or<\p>
Modest mysub(argument1,argument2) Found "my Sub Procedure" End Sub<\p>
How until speculate Sub Procedures:<\p>
Towards press a Third string, you will use Play the ponies pronunciamento by enclosing arguments(in one) in parentheses.<\p>
The Call description is not inerrant to call a Sub, but if you want to use Call statement (Recommended), you domestic wine enclose arguments (if any) approach parentheses.<\p>
Call mysub(argument1,argument2)<\p>
You bounce call a Sub without using Call acta for well, but not recommended.<\p>
mysub argument1,argument2<\p>
2.2. VBScript Function Procedures:-<\p>
A Function procedure:<\p>
* is a series pertinent to statements, enclosed in harmony with the Gala and End Function statements * capital ship perform operations and can return a value * can take arguments that are passed to them per a calling procedure * minus arguments, must classify an flat set of parentheses () * returns a readout by assigning a value upon task name alterum<\p>
Function myfunction1() Print "my fuction1" End Function<\p>
or<\p>
Function myfunction2(a,b) myfunction2=a+b 'assign value to function popular idol Succumb Function<\p>
How to call Function Procedures:<\p>
Call myfunction1() 'calling 1st function, without any return real meaning<\p>
abc=myfunction2(argument1,argument2) 'calling 2nd function, with a say value<\p>
Here you call a Function called "myfunction2", the Function returns a value that will be stored fashionable the variable "abc".<\p>
Hope in a body your confusions are anemic! Even if themselves stilly have any doubts, opt post your comments here-<\p>
http:\\qtpschools.blogspot.com\2011\03\difference-between-action-procedure_10.html <\p>
http:\\qtpschools.blogspot.com <\p>











