Monday 21 October 2013

Actions in qtp and type

What is action?

Acion is nothing but the set of task to perform some task, Every statement have to do some task in the application. This is called Action


Purpose of the Action

-> Reusability
-> Readability
-> easily locating errors

Types of Actions

-> Resuable Actions ( Default in QTP 11)
-> Non reusable Actions
-> External Actions
-> Opertions on Action


Example

As per the requirement create 3 Actions


Create a New Action                             Split Action

1) Create Required No of Action     1) Generate Entire Script into
(n-1)                                                         Default Action
Ex. Above Requirement we create          
only 2 action. + default Action=
total 3 Actions

2) Generate Script for our                2) Split the default Action. We can
every Action.                                        split one Action into two Action
                                                           at a time. not more than that.




1) Create a new Action


If we want to create a three Action as per our requirements, create 2 (n-1) Action, by using below method. we have already default Action, so totally three Actions we have in application.

INsert -> Call to New Action


Rename Action

Edit -> Action -> Rename Action


Delete Action

Select action From drop down box -> Edit -> Action -> Delete Action (But we cannot delete the Default Action. Atleast we have one Action in test)


Rename Action

Select action From drop down box -> Edit -> Action -> Rename Action




Test Pane in left side

View - Test Pane  ( its showing the sequence for Action Executions. we can change the test flow using drag and drop.)

Action Drop down

Its shows the all Actions in alphabetical order.



2) Split Action

If we our requirements using the Split Action, we should write all the script  under one Action, then we can split into one Action into Another Action.

We have below two options while Split the Actions

INdependent of each other  -> Max we used
Nested



How to change from Reusable Action to Non Reusable Action

1)Select the Reusable Action From Drop down box in Test pane
2) Edit -> Action -> Action Properties -> UNcheck the Reusable Action -> Click ok



How to record using three different Actions

1) Select First Action record whatever we want under this Action.
2) select newxt Action Still in under Recording mode, and record the which ever we want under Second Action.
3) Select Third Action Still under Recording Mode, and record which ever we want under third Actions.



How to call Existing Action


-> We should call the only Existing Reusable Action.we cannot call the non-Reusable Action existing in test.

-> Insert -> Call to Existing Action -> Select the test and select the Existing Resusable Action present in the test.

->  we cannot make any changes in the test which we are call  to Existing Action. Its Read only mode.


How to call to copy of Action

-> We can call both Reusable Action and non-Reusable Action existing in test.

-> Insert -> Call to copy of Action -> Select the test and select the Existing Resusable Action present in the test.

-> we can add, delete, Modify the Action. Because its Write Mode.



Action Parameters


Two type of Action Parameters

1) Input Parameters -> we can pass multiple dynamic values
2) Ouput parameters     -> Its used for return the ouput


-> Select the Action where we implement the input parameter for use dynamic values -> Edit -> Action -> Action Parameters

->  In window select Parameters tab. under this tasb we can see the below two options

a) Input Parameters
b) ouput Parameters


From TEST1 : Give the Variable name, Variable Type, Default Value, Descriptions and click ok




->From TEST1, Connect the parameters or passing the values

and set the parameter as synex: Parameter("Parameter Name ")

Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set Parameter("UserName")
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Passwd").SetSecure Parameter("Password")
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").Click




-> From TEST2,  Create new test and call the Existing Action and set the parameter value in under default action new test. set the parameter value as

RunAction "Login [Login]", oneIteration,"Ajay","raj"





-> This is for we are passing one one dynamic Values. But if we want to pass more than one values, that time we need resources like datatable,Excel etc..





-> give the Defualt value in Parent Action Parameter



No comments:

Post a Comment