Monday, April 15, 2013

User Defined Functions

Syntax:     Public | Private Function <Function Name> (parameters)

                <Statements>
                <Exit Function>
            End Function


Public: Indicates that the Function is accessible to all scripts.

Private: Indicates that the Function is accessible only to the script where it is declared

Function: It is a key word

Function Name: Name of the function

Parameters: List of variables that are passed to the function when it is called.

Statements: Any group of statements to be executed within the body of the Function procedure.

Exit Function: It causes an immediate exit from a Function.

Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com

Difference between Call to Copy Action and Call to Existing Action


Comment Call to Copy Call to Existing
Pre-requisite No Yes
Section in the test Action section External action section
Is action editable Yes No
Is data table editable Yes No
Is OR is editable Yes No
Statement RunAction “Copy of <Action name>”,One Iteration RunAction “ <Action name>[<test name>],OneIteration

Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com


Friday, April 12, 2013

Splitting Action

We can split an action that is stored with your test into two sibling actions or into parent-child nested actions. When you slit an action, the second action starts with the step that is selected when you perform the split action operation.

When do you split an action in your test that uses a local object repository?

1)    Quick Test makes a copy of the local object repository.
2)    The two actions have identical local object repositories containing all of the objects that were in the original local object repository.
3)    If we add objects to one of the split actions, the new objects are added only to the corresponding local object repository.

Navigation to Split an Action
    Select the step before which you want the new action to begin -> Choose Edit -> Actions -> Split Action -> Choose required options (Independent of each other or Nested) -> modify the name -> Click OK

When Splitting Action is not possible?


Split of action is not possible in following scenarios:
 

1.    An External Action is selected
2.    The first step of an action is selected
3.    while recording test
4.    while running test
5.    Working with read only test.

Script: Write a script to retrieve all Action names
    Set aomObj=CreateObject(“QuickTest.Application”)
    Set aomObjList=aomObj.Test.Actions
    Msgbox aomObjList.Count
    For val=1 to aomObjList.Count
        Msgbox aomObjList(val).Name
    Next


Script: Write a Script to add shared object repository for Action1 during runtime

    Set objAom=CreateObject("QuickTest.Application")
Set objRep=objAom.Test.Actions("Action2").ObjectRepositories
ObjRep.Add "D:\Vamsi\Automation\QTP training\loginflight.tsr"


Script: Write a script to retrieve count all associated shared repository in all actions in a test.
   
    Set aomObj=CreateObject("QuickTest.Application")
cnt1=0
Set aomObjList=aomObj.Test.Actions
msgbox aomObjList.Count
For val=1 to aomObjList.Count
        Set cnt=aomObj.Test.Actions(aomObjList(val).Name).ObjectRepositories
        cnt1=cint1+cnt.Count
Next
msgbox cnt1


Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com

Changing Action properties




In corresponding action right click -> Actions -> Select Action properties

                                                OR

Keyword view -> right click on required Actions -> Select Action properties.


Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com



Inserting Calls to Actions

There are three types of actions calls that can be inserted

1.    An “Insert Call to New…” will create a new action in the current test.
2.    An “Insert Call to Copy…” inserts a copy of the specified action into the current test. If the copied action uses checkpoints and OR objects, these are also copied.
3.    An “Insert Call to Existing…” allows insertion of a call ot a reusable action present in the current test or in another test.

Navigation for Insert Call to Copy action:
Insert menu -> Call to Copyof Action… -> Browse the test from which the action to be called -> Select the action -> Select the location -> click OK
                        OR
Place the curser where do u want to call ->right click on test pane -> Action -> select Call to Copyof Action… -> Browse the test from which the action to be called -> Select the action -> Select the location -> click OK

Navigation for Insert Call to Existing action:
Insert menu -> Call to Existing Action… -> Browse the test from which the action to be called -> Select the action -> Select the location -> click OK
                        OR
Place the curser where do u want to call ->right click on test pane -> Action -> select Call to Existing Action… -> Browse the test from which the action to be called -> Select the action -> Select the locaiton -> click OK

Note: When using call to existing action, the action that we want to call to be declared as a reusable action.


Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com

Types of Actions

There are three types of actions:

1.     Normal/Non-reusable action : An action that can be called only in the test in which is resides and can be called only once 

2.     Reusable action: An action that can be called multiple times by the test in which it resides and can also be called by other tests. 

3.     External reusable action : A reusable action stored in another test. External actions are read-only in the calling test, but we can choose to use a local, editable copy of the Data Table information for the external action.


Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com 

Actions

Actions are used to divide scripts into logically related groups of QTP statements. They are similar to VB Script functions
QTP Scripts are maintained with scenario and each module of the script is called as action.
Every Script will have one default action is Action1
A script can have max 255 actions.
Every action of the script will have a sheet in the data table and the sheet name will be same as that of action.
Every action can access the data from its own action sheet of global sheet.
Actions are used for easy implementation of script re-usability.
Actions maintains scripts and repositories also

Creating a new Action:

    Insert menu → Call to New Action → ( Insert Call to New Action window opens ) , Enter Action name → Select required location ( At end of the test, After the current step ) → Click OK button.
                        Or
    Right click on script editor → Select Actions → Insert Call to New → ( Insert Call to New Action window opens ) , Enter Action name → Select required location ( At end of the test, After the current step ) → Click OK button.


Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com

AI in Software Testing: How Artificial Intelligence Is Transforming QA

For years, software testing has lived under pressure: more features, faster releases, fewer bugs, smaller teams. Traditional QA has done her...