Sunday 13 January 2013

ACTIONS IN QTP



Actions in QTP

-> We can divide the test into differnt Action.
-> Devide the test into logical units.

Types of Action :

-> Non Re Usable Actions
-> Re usable Actions
-> External Actions

Operations on Actions:

* Creating Actions
* Splitting Action
* Renaming Actions
* Deleting Actions
* Calling an Actions
* Copying Actions
* Making an Action Reusable/Non Reusable

1) Creating Actions

 Insert -> call to new Action

2) Splitting Action

we can split the action into two differnt pieces. We select the row which from you can split the Action

Edit -> Spilt Action

Note : At a time we can split one action into two Actions.

3)Renaming Action

Slect desired action from drop down box -> Edit menu -> Rename Action

4) Deleting Action

Select desired action from drop down box -> Edit menu -> Delete Action

5)Insert into Copying an Action

When you insert copying action to your test, The original action is copied in this entirely including local repository, checkpoints, parameterization etc. and any defined action parameters. take copy and insert in our test.

Select desired location -> Insert -> call to copy action -> Select from which test -> select action from the test -> Select desired location -> click ok

Note : We can edit this copied action from with out effect of parent action.

6)Insert call to Existing Action

-> We can insert the call to a reusable action that is stored in your current test(Local Action)

Select desired location -> Insert -> call to Exiating action -> Select from which test -> select action from the test -> Select desired location -> click ok

Note : we can view and use all the options in called existion action, but you cannot modify them.

7) Making an action reusable :

Select Non reusable Action -> Edit-> Action -> Action properties -> check reusable action check box -> click ok

Action Syntex in Expert view

calling Action w/o parameter :

Syntex in called Action RunAction "Name of calling Action", NumberofIteration

Calling Action parameter :

Syntex in called Action -

RunAction "Name of calling Action", NumberofIteration, ParameterValue

Ex : RunAction "Action1 [parameter1]", oneIteration, "raj", "50df030ffc1070aa"

Stored Action Return Value into Variable

Syntex in called Action -

RetValu = RunAction ("Name of calling Action", NumberofIteration, ParameterValue)
ExitAction


Exit Actions are

ExitAction -> Exits from current Action
ExitActionIteration -> Exits from correct iteration of the Action. But not come out from Action completey.
ExitRun -> Exist from the current test.
ExitGlobalIteration -> Exist from current test/Global iteration.


Difference between Action and Function?

  Action is a collection of Vb statements in QTP. It does not return any values.Function collection of Vb statements in QTP.
    It returns single value.

  We can call functions within actions but we can't call actions within functions

  Generally functions are saved with ".vbs" extention where as actions will save with ".mts".

  Every Action will have its own Datatable where as function does not.

  Action can have a object repository associated with it while a function can't. A function is just lines of code with
    some/none parameters and a single return value while an action can have more than one output parameters.

  Action can contains Object Repository, Data table, Active screen etc. whereas function do not have these features.

  Action is internal to QTP whereas Function is just lines of code with some/none parameters and a single return value.

  Action can/can not be resuable whereas functions are always reusable.

  Action Parameter have default values whereas VB script function do not have any default values.

  Action parameter type are byvalue only where vbscript functions can be passed byref.

  Action can have multiple output(returning) values whereas function can return only single value.