Wednesday, September 3, 2014

Actions in QTP


With the help of actions we can divide our script to multiple sections on basis of screen, login etc
So with the help of action we can divide our script in smaller modules which increase portability & reusability so it will easy to maintain, update and debug our scripts.

à By default QTP records script in 1 action only.

à We can add actions in  script before recording, while recording and after recording.




Advantage of multiple Actions script:

1à By action we divide our script to multiple section so finally our script become modular so it is easy to understand and easy to debug.

2à We can use actions in other script as well so it increases reusability of code.




Type of Actions

1-> Normal Action/New Action.

Whenever we create any new action it is called Normal/New action.

2-> Non reusable Action

Actions which cannot be call by other scripts are called non re-usable action.
This type of actions can be copied by other script not called.(we can use “Insert Call to Copy of Action” only)

3-> Reusable action.(By Default)

Actions that can be used by other script by calling it are called reusable action.
If I am calling a reusable action that action display only read only format to me, can’t be change by me.

Right Click on Action –> Action Properties -> Select checkbox at bottom to make it reusable.

This type of actions can be copied by other script and we can call action as well.(we can use “Insert Call to Copy of Action”, “Insert Call to Existing Action)



4-> External Action.

If I am calling a reusable action that action become external action to me.




Convert Single Action Script to Multi Action Script

Split Existing Action

                Action can be split by 2 ways

                 à Independent to each other : Final action will be independent to each other
                 à Nested Action ( Parent and Child format)



                                  REUSBILITY OF ACTIONS


We can use already created actions by 2 ways

 à Insert  Call to Copy of Actions

        -- Here we copy the original action in our script so now it become part of my script, we can
             change enhance code of action.

     We can copy both Reusable and Non Reusable actions.

 à Insert Call to Existing Action


      -- Here we call the original action in our script so our scrip just call that action in read only   
          format, we can’t modify that action.

 

Note:: We can call only reusable action
           We can copy both reusable and non reusable actions


No comments:

Post a Comment