Are you looking for job change in software testing/QA or interested in learning HP QTP from an ideal trainers ? your search will come to an end with www.testleaf.com - The Chennai's best test automation workshops. contact 9500006373 for more details.

Monday, December 31, 2012

Actions in QTP


As mentioned by QTP, Each QuickTest test comprises calls to Actions. Actions are units that divide your test into logical sections. When you create a new test, it contains a call to one . By dividing your tests into calls to multiple actions, you can design more modular and efficient tests. 

-Actions help divide test into logical units, such as the main sections of a Web site, or specific activities that you perform in application. 

-A test comprises calls to actions. When a new test is created, it contains a call to a single action. By creating tests that call multiple actions, can design tests that are more modular and efficient. 


-An action consists of its own test script, including all of the steps recorded in that action, and any objects in its local object repository.

-Can divide test into multiple actions by creating new actions and inserting calls to them, or by inserting calls to existing actions.


There three types of action in QTP:
 
  Non-reusable action: an action that can be called only in the test with which it is stored, and can be called only once.
  Reusable action: an action that can be called multiple times by the test with which it is stored (the local test), as well as by other tests.
  External action: a reusable action stored with another test. External actions are read-only in the calling test, but can choose to use a local, editable copy of the Data Table information for the external action.


A reusable action can be called multiple times within a test and can be called from other tests. Non-reusable actions can be copied and inserted as independent actions, but cannot be inserted as calls to the original action.
** Priority in Object Repository

Call an action from within an action called nesting. 
Maintain the modularity of your test.
Run one or more actions based on the results of a conditional statement.

Example
Create test based on the user type

To nest an action within an existing action:
Highlight the step after which to insert the call to the action.
Insert Call

Split Action
Split an action into two sibling actions or into parent-child nested actions. When an action is split, the second action starts with the step that is selected. 


Can’t split an action and the option is disabled when:
-an external action is selected
-recording a test
-running a test
-read-only test

Inserting Calls to Copies of Actions


When to use?
    It is best to use this functionality
When the action can be partly used with the associated resources through edition of test steps and likely to be standalone test unit.
When the user knows that this functionality is likely to change in the future hence doesn’t want to be reusable.

Inserting Calls to Existing Actions


When to use?
    It is best to use this functionality
When the functionality in the action can be completely used in another action such as a Login.
When the user likely to maintain a reusable actions for easier maintenance.

Remove Action

 
Removing a Non-Reusable Action
Removing a Call to a Reusable or External Action from the Test Flow
Removing a Reusable or External Action from a Test


Action Template:

Action template can include one or more statements in every new action in test. An action template applies only to actions created on your computer.

To create an action template: 


Create a text file containing the comments, function calls, and other statements that to be included in action template. The text file must be in the structure and format used in the Expert View.
Save the text file as ActionTemplate.mst in your <QTP Installation Folder>\dat folder. All new actions you create contain the script lines from the action template.


Note: Only the file name ActionTemplate.mst is recognized as an action template. 

RunAction:


RunAction is the key word to call an existing actionand execute the same

Syntax: 
RunAction ActionName, [Iteration , Parameters]
Eg:
1.RunAction “Create", allIterations
2.RunAction “Login", oneIteration, Parameter
retVal = RunAction (ActionName, IterationQuantity, Parameters)

Exit Action:

 
Exit an action before it runs in its entirety. May want to use this option to return the current value of the action to the value at a specific point in the run or based on the result of a conditional statement.
ExitAction. Exits the current action, regardless of its iteration attributes.
ExitActionIteration. Exits the current iteration of the action.
ExitRun. Exits the test, regardless of its iteration attributes.

LoadAndRunAction Statement: 

 
This is only available from QTP 10.0 +
Loads the specified action when this step runs, and then runs the action.
The action is loaded only when the step runs (and not when the test opens). Therefore the action is never listed in:
The Resources pane in QuickTest.
The Test Flow pane in QuickTest.
The Missing Resources pane in QuickTest.
The Dependencies tab in the Quality Center Test Resources module.
 

Syntax:
LoadAndRunAction(TestPath, ActionName, [Iteration], [Parameters]) 


 

7 comments:

  1. This content creates a new hope and inspiration with in me. Thanks for sharing article like this. The way you have stated everything above is quite awesome. Keep blogging like this. Thanks.
    Best Digital marketing company in Chennai
    Best Digital marketing services in Chennai

    ReplyDelete

  2. thanks for the information it will one of the good blog, i need more news from this topic.
    Back to original

    ReplyDelete
  3. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
    Digital Marketing Company in India

    ReplyDelete
  4. Thanks for this blog. provided great information. All the details are explained clearly with the great explanation. Thanks for this wonderful blog. Step by step processes execution are given clearly.Know the details about different thing.
    Web Development Company in India

    ReplyDelete
  5. Thanks for this blog. provided great information. All the details are explained clearly with the great explanation. Thanks for this wonderful blog. Step by step processes execution are given clearly.Know the details about different thing.
    Web Development Company in India

    ReplyDelete
  6. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
    Android App Development Company
    iOS App Development Company

    ReplyDelete
  7. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    Fitness SMS
    Fitness Text
    Salon SMS
    Salon Text
    Investor Relation SMS
    Investor Relation Text

    ReplyDelete