Sunday 24 November 2013

QTP Passing Parameters to a Function/Sub - Pass By Value & Pass By Reference



You can pass parameters to a function or sub procedure by value or by reference. Let’s see what both these terms mean.

Passing Parameters by Value (byVal).

 With this way of passing parameters, only a copy of the original parameters is passed. This means that whatever modifications we make to the parameters inside the function, it doesn’t affect the original parameters.


Sample Code 1: Passing parameters by value to a function

Dim val
val=5

'Function Call
fnFunc val
msgbox "Original Value: " & val 'msgbox displays value 5

'Function Definition
Function fnFunc(byVal val)
  val = val + 2
  msgbox "New Value: " & val 'msgbox displays value 7
End Function

In the above example you would see that the new value get changed to 7 but it doesn’t get reflected to the original value which still shows the value as 5 only.


Passing Parameters by Reference (byRef).

In this case, the reference of the original value is passed as the parameter to the function. Therefore, whatever change is done to the parameter inside the function, the same is reflected in the original parameter also. By default, values are passed by reference in a function. i.e., even if you don’t use byRef keyword, the parameters are passed by reference.


Sample Code 2: Passing parameters by reference to a function

Dim val
val=5
'Function Call
fnFunc val
msgbox "Original Value: " & val 'msgbox displays value 7
'Function Definition
Function fnFunc(ByRef val)
  val = val + 2
  msgbox "New Value: " & val 'msgbox displays value 7
End Function

Since the original parameter is passed as reference to the function, both the original and new value has the updated value 7.

Differnce between Sub and Functions in QTP


1. QTP Actions:-

Action is specific to QTP and not the part of vbscript. Every QTP test has at least one Action(default name is Action1).
Action can have an object repository associated with it. Action can return multiple values in form of 'output parameters'.

2. Procedures:
2.1. VBScript Sub Procedures:-

A Sub procedure:

    * is a series of statements, enclosed by the Sub and End Sub statements
    * can perform actions, but does not return a value
    * can take arguments
    * without arguments, it must include an empty set of parentheses ()


Sub mysub()
  Print "my Sub Procedude"
End Sub

or

Sub mysub(argument1,argument2)
  Print "my Sub Procedure"
End Sub

How to call Sub Procedures:

To call a Sub, you will use Call statement by enclosing arguments (if any) in parentheses.


The Call statement is not necessary to call a Sub, but if you want to use Call statement (Recommended), you must enclose arguments (if any) in parentheses.

Call mysub(argument1,argument2)

You can call a Sub without using Call statement as well, but not recommended.

mysub argument1,argument2


2.2. VBScript Function Procedures:-

A Function procedure:

    * is a series of statements, enclosed by the Function and End Function statements
    * can perform operations and can return a value
    * can take arguments that are passed to it by a calling procedure
    * without arguments, must include an empty set of parentheses ()
    * returns a value by assigning a value to function name itself


Function myfunction1()
  Print "my fuction1"
End Function

or

Function myfunction2(a,b)
myfunction2=a+b  'assign value to function name
End Function


How to call Function Procedures:

Call myfunction1() 'calling 1st function, without any return value

abc=myfunction2(argument1,argument2)  'calling 2nd function, with a return value

Here you call a Function called "myfunction2", the Function returns a value that will be stored in the variable "abc".

Hope all your confusions are gone! But if you still have any doubts, please post your comments!


Difference between waitproperty and checkproperty in qtp


Wait Property

As per the name, waitProperty waits till the condition met
or the maximum time specified.

For ex:B().p().webbutton().waitproperty "Enabled",true,30000
So here QTP waits till the button is enabled or waits for
max of 30 Secs and if the button is not enabled, then the
step fails.


Check Property

Where as CheckProperty is to verity whether the value is
matched or not and returns a Boolean value

Ex:
B().p().webbutton().CheckProperty "Enabled",true,30000
Here QTP verifies whether the button is enabled or not and
waits for 30 sec and returns true if the button enable else
return false.

Saturday 23 November 2013

Error Handling in VB Script


To avoid application may get system failure or Crash, we can use the Error Handling in VB Script



-> On Error Resume Next   (if we want bypass the error, we can use this statement)

-> On Error goto 0     (Deactivate On error Resume Next)

-> Error objects (Err) has

    -> Description Property  (while running we get error description. err.Description())
    -> HelpContext Property
    -> Helpfile Property    (When error occurred we go for help file content using this property)
    -> Number Property   ( Its throw error number)
    -> Source Property   (from where this error occurred)

  Methods are
    -> Clear Method ( Its automatiocally invoked while end of function)
    -> Raise Metod  (used for user defined method)





Programming Script
------------------
1)

On Error Resume Next

Dim a,b

a=12

b 9

msgbox a+b


o/p   12

The above script we have Error (b 9), but "on Error Resume next" bypass the error and move to next statement.


2)

On Error Resume Next

Dim a,b

a=12

b 9

msgbox a+b

on Error goto 0

b 9


o/p  12   and show error too

The above script deactivate the "on error resume next" uding "on error goto 0" statement.



3)

On Error Resume Next

Dim a,b

a=12

b 9

msgbox a+b

msgbox "Error Source = " &err.source
msgbox "Error Description =" &err.Description
msgbox "Error Number = " &err.Number
msgbox "" &err.Clear



o/p
 12 
Error Source = Microsoft VBscript Runtime error
Error Description = Wrong number of arguments or invalid property assignment
Error Number = 450

Sunday 10 November 2013

GetTOProperty,SetTOProperty,GetROProperty



Test Object - Object value and property present in the Object Repository and

application while recording.

Is an object that QuickTest creates in the test to represent the actual object in the application.QTP stores information
about the object that will help to identify and check the object during the test run.


Runtime Object - Object value and property present in corrent application

while execution.

Is an actual object in the application on which methods are performed during the test run.

GetTOProperty - We can retrieve any property value of the test object.

Ex:


systemutil.Run "iexplore.exe", "http://www.google.com"

Set oWebEdit=Browser("Google").Page("Google").WebEdit("q") 'Create webedit object

Set TOProperties=oWebEdit.GetTOProperties 'Get TO Properties

For i = 0 to TOProperties.count - 1 'Looping through all the properties
    sName=TOProperties(i).Name ' Name of the property
    sValue=TOProperties(i).Value 'Value of the property
    isRegularExpression=TOProperties(i).RegularExpression 'Is it a Regular expression
    Msgbox sName & " -> " & sValue & "->" & isRegularExpression
Next

'##############
'### Result:###
'##############
' type -> ext -> true
' name -> q -> true
'### End of Script ####




SetTOProperty - We can set any property value of the test object.


EX:

oldName = oWebEdit.GetTOProperty("name")
msgbox "Old Name ->" & oldName
oWebEdit.SetTOProperty "name","New Value"
NewName = oWebEdit.GetTOProperty("name")
msgbox "New Name ->" & NewName

'##############
'### Result:###
'##############
' Old Name ->q
' New Name ->New Value
'### End of Script ###



GetROProperty - We can retrieve any property value of the Runtime object.

Ex :

Browser("Page").Page("Page").Navigate "www.google.com"
Browser("Page").Page("Page").WebEdit("q").set "arunrajvdm"
msgbox Browser("Page").Page("Page").WebEdit("q").GetROProperty("value")


We can not set any property value of the Run time object.

QTP object spy



Its used to know object hierarchy, object Property, object operations and

property value. Everything visible in object spy, so that testers easily

know about how developers coded on the perticular object.

Object Hierachy - Show the object parent- child Hierarchy
Properties - The properties are same for all corresponding object.But different property value for all the objects. 

Ex: All the properties are same for all WinButton object. But Property values are different.

That means WinButton class have the same properties for all WinButton object

in application, But have different value.

Operations - The operations are same for all class of the object.  That

means WinButton class have the same operations for all WinButton object in

application.



Standared object

Developer created the all object using Native class,Object class. Win Button

values are

Native Class = Button
Object Class = Button

But Visual basic assign the value for class name to WinButton

Class = WinButton

These kind of objects are called Standared Object.


some common object properties are

Class name = class name of the object 
regexpwndclass = its same as class name assigned by QTP
text = name of the object in application
regexpwndtitle = its same as text assigned by QTP
x,y = The X and Y axis value in the application.
abs_x,abs_y = The X and Y value is the desktop screen absolute location,  if

application location change in window, this value change automatically.
Focused = its focused or not
Enables = ITs enaabled or disabled
Height = this value assigned by desktop screen location, if application

location change in window, this value change automatically.



object spy operation

-> Highlight in application -> its hughlight the object in application

QTP Smart Identification for identify the object in application


-> Whenever the QTP unable to find an object in application because of the

object got changed or the object are not unique, then the script get fails.

-> if we configure the smart identification for the object class , then

there is get chance to QTP able to identify the object.

-> smart identification is more complex, but its flexible.

-> smart identification has two type of property

a) Base filter Properties
b) Optional filter Properties

a) Base filter properties

    These are the fundamental properties of the perticular object class,

that can not be changed.
EX: For link html tag always <A>
    For Edit Html Tag always INPUT
These are base filter properties which are not changed always.

b) Optional Filter Properties

Except Base Filter Properties, rest of the properties are called Optional

Filter Properties.


Smart Identification Process

1) After Mandatory Properties and Assistive properties only QTP move into

Smart Identification. So Smart identification not check the properties from

Mandatory and Assistive properties.

2) Smart identification starts to find the all object in the perticular

page. That means

Browser("Page").Page("Page").WebEdit("q").click

Its take all the object in this page -> Browser("Page").Page("Page")

3) Then its take all object and compare those object with base Filter

properties, so now its reduce the count of the object.

4) then its take that object and compare with optional filter properties to

find out the expected correct objetc.

5) If object unable to find by QTP for above process then its move to

ordinal identifier.

QTP Object Identification




1) QTP identify the class of the object when it learns object. The class

name can be WebEdit,WebLink,WebButton etc..

2) Then its identify the object by Mandatory Properties of the object, if

correct object get identifed then stop this secode step. if not its move to

next step

3) Then its identify th object first property of the Assistive Properties.

If correct object get identified then its stop this step. If not then its

verify the second property of the Assistive property and so on. This process

continues still correct object get identified. If object unable to find for

all Assistive property then is move to next step.

4)if smart identification check box disabled or QTP fail to identify the

object by smart identifiaction, then its move into next step.


5) Ordinal Identifier

QTP goto ordinal identifier, if QTP unable to find by Mandatory Property and

Assistive Property

Its have below two property

-> Index = assign default assign to the duplicate objects.

Ex: if all the buttons in application have same Mandatory and Assistive

Property that means al buttons have same name "ok" and same class name. So

then QTP move to ordinal identifier. Its assign index value for all same

kind of object as below

-> First OK button - Assignt the index value as 1
-> Second OK button - Assignt the index value as 2
-> Third OK button - Assignt the index value as 3

So by index value QTP identify the objects. if any place changes on two ok

button in application, its shows error. Because ordinal identifier values

are related with neibghours object value. so if any place changes on

neighbours object, its shows error.


-> Location = Each and every object have different location. So by location

its identify the object if they have same Mandatory and Assistive Property

too.


-> Creation time  - Its only for web. that means if IE open first, then its

assign creation time index value as zero. and so on.

Saturday 9 November 2013

Steps need to taken if QTP is unable to identify objects in the browser


--Make sure web addin is loaded

--Always make sure QTP and the test are open BEFORE the web browser.

--if the above are true, you may need to reinstall QTP. It could be corrupt.

--Run code in debug mode(i.e. using F10 and F11 to step over the code). If the problem is fixed, you have a sync issue.

-> Dose the Applications uses any AJAX Components?

If So You Need To Install WebExtensibility Add-In.

QTP 9.2 and below versions do not have any special support for this.

QTP 9.5 will come with this Add In.

You Can install it from imstallation DVD.

QTP Object Repository Type


1)Local object repository
2)Shared object repository


Local Repository = This repository only used by the one test where we can create the local repository. we cannot use the same object presend in the local repository into the different test.

If we change any object values in local repository, its effect only one test.


Shared Reposity = we can use this object which we present in the OR into any tests by adding the shared repository.

If we are change any object property values in shared object repository, then its effect all the tests which we are using the shared object repository.

In Real time we are using only shared object repository. Becaue all the team members using same object repository. For Edit accedd for shared object repository will give to only one person.

Shared Repository saved as file extension *.tsr



-> Steps for create shared object Repository

1) Create the local object Repository in test
2) Resources-> Object Repository -> File -> Export Local Objects -> and save the object Repository with Extension .tsr in local disk
3) Then we can use this shared object repository into any tests.

-> Steps for using Shared object Repository in Tests

1) Open the new tests
2) Resources -> Associate Repositories -> Add Repository -> Add Action -> click ok
3) Now all the object present in the shared object repository will use in current test.But here all the object details are in view mode only. we cannot Edit the objects.


-> Edit object property value in shared object repository using object repository manager

we cannot edit the object preoperty value directly from object repository. we have the object repository manager option for Edit the object property value.

1) Resources -> Object Repository Manager -> open the shared Repository from local machine
2) File -> Enable Editing in object repository manager
3) Now we can Edit/Add the object property value as per the requirements and save the changes. These changes are effect to all tests which tests are using this same shared object repository.


-> Steps for compare the shared object repository using Object Repository- Comparison tool in object repository manager.

if we want to compare two shared object repository and find out the difference in object, we can use this object repository comparison tool.

1) Resources -> Object Repository Manager -> open the shared Repository from local machine
2) Tools-> Object Repository Comparison Tool
3) give the two object repository and clik ok. its compare both files and give the object statistics as below

Identical objects in both file -> its have similiar object in both.
Identical Descriptions and different name -> same desciptions and different name in the object.
Similiar description -> both have similiar description.


-> Combine two shared repository into one using object repository Merge tool.

1) Resources -> Object Repository Manager -> open the shared Repository from local machine
2) Tools-> Object Repository Merge Tool
3) give the two object repository and clik ok. Then save into different object repository name.

QTP Object Repository



-> It store the object information ( Object Properties and corresponding values).

-> Which are the object is stored in object repositry is called Test object.

-> During the recording Generate the vb script operation which object present in the application and store the object information in object repository.


-> objest repository have the following object informations

Ex: Dialog("login").WinEdit("AgentName").set "arunrajvdm"

login object informations are in OR

-> Properties and values

Name = Login
Class = dialog
Repository  = local or shared
text = login
nativeclass= #32770


How to identify the object in AUT using OR

During the runtime Its compare the object type, object name and html tag from Object repository (These values are stored into OR while recording) and compare with object type, object name and html tag present in the application. once it match then QTP identify the object and perform the operation mentioned in QTP script.

if there is any mismatch the object information, then its throw the error like object was not found in the object repository


Ex: Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set "arunrajvdm"

object details from OR (under Test object Details)

Type = text
name = Email
html tag = INPUT


object details from AUT

Type = text
name = Email
html tag = INPUT

if both are matched then QTP identify the object.


Operations on object repository

1) Delete the object from OR

select the object and delete

2) Add the objects in object repository

we have the add symbol (+) to add the object in object repository.

3) Change logical name (Object name while in recording)


If we are change logical name, its not effect for QTP identify the object. Because QTP identify the object by using object Type, name, html tag.

Ex: Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set "arunrajvdm"

object details from OR (object Properties Details)

Logical name = Email

5)  Higlight in the application

This option used for identify the object in application from which object present in the object repository.

if we change the logical name. then its diffcult to identify the object in application. So we have one option for highlighe in the application. From that we can identify the object.


6) Locate in the Repository

This option used for identify the object in Object repository from which object present in the application.


7) Change the property value in Object Repository

Ex: Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set "arunrajvdm"

Type = text
name = Email
html tag = INPUT

we should not change above property value because if we change the above value, then QTP unable to find the object.

if any object property value present application will change according to the requirements, that time we no need to change the entire script. that time we can use this option for change property value based on the requirements.

After property value change then we no need to change the script, because the script always use the logical name. the logical name remains samein the object respository. then we no need to change.

Environment Variables


If we are using global varibals, its global only for that Action. The Action2 are not able to access the Action1 Global variable.


But if we are using the Environment variables, the All actions under the test is able to access.Test case variables mainly treated as Environment variable in real time.


File -> Settings- Environment

1) Built in Environment Variables

-> Pre-Defined Variables, its Read only
-> Its have the value only at run time

Ex:

msgbox Environment.Value("ActionName")

ActionName is Pre-Defined Variables


if we try to change the pre-Defined variables, its get system Error.

Ex: Environment.value("OSVersion")='"windows"     'got Error



2) User Defined Environment Variable

set the user defined variable as below

File -> Settings- Environment -> select veriable type as User-Defined -> Add the variable name and variable value

Ex:

msgbox Environment.Value("Env_1")


we cannot create user defined variable which we have the same name as built in function.

Set the value into user Defined Environment Variable

We can change the user define function value in run time.

Ex:

msgbox Environment.Value("Env_1")
Environment.Value("Env_1") ='QTP Domain"
msgbox Environment.Value("Env_1")

o/p  Value1
QTP Domain


Remove the value from user Defined Environment Variable


Ex:

msgbox Environment.Value("Env_1")
Environment.Value("Env_1") ='QTP Domain"
msgbox Environment.Value("Env_1")

Environment.Value("Env_1") =Nothing
msgbox Environment.Value("Env_1")

o/p  Value1
QTP Domain
Show Error object variable not set




External Environment Variables


1) Using XML file

syntax for create XML file

<Environment>
    <Variable>
        <Name>User_ID</Name>
        <Value>arunrajvdm</value>
    </Variable>
</Environment>

Script

Environment.LoadFromFile "E:\Environment1.xml"
Msgbox Environment.value(User_ID)



Display the external XML file name path for loaded External variablee

filename1=environment.ExternalFileName
msgbox filename1




QTP User Defined Function

⇒Function Library & Associating Function library to a Test

Different Types of Library files
Different types of library files are ".qfl" files,".Vbs" files

Steps to follow to create Function Library:

1. Functions are created manually:
     File-->New-->Function library(Enter the functions)

2. Save the functions:
      File--> Save (File is saved as .qfl file)

3. Associating Function library to a Test:
     Test --> Settings --> Choose Resources tab --> Choose + button so select the ".qfl" file --> browse and select the ".qfl" file -->
      click OK.


How to use library files in QTP & how we can call these files in to script?

We can load the external Library files by using 2 ways:

1. Choose Test --> Settings --> Choose Resources tab --> Choose + button so select the library file -->  browse and select the
     library file --> click OK.

2.  We can load the library files using Scripting:

Use execute file function to load library files:

Step1. Open a notepad and paste the below function

Example:

'Code in External Library file(sample.vbs file).

function SumOfTwoNumbers(a,b)
Dim sum
sum=a+b
SumOfTwoNumbers=sum
End Function


Step2. Save the notepad as a .vbs file(sample.vbs) in path "D:\Sample.vbs"

Step3. Paste the below code in QTP and execute,You will find that the below code access function from the "sample.vbs" file
Example:

executefile "D:\Sample.vbs"
x=10
y=5
result=SumOfTwoNumbers(x,y)
msgbox result

QTP Automation Framework


Data Driven Technology (Read the Data)


with using different set of test data, we can test the application and

verify the application deals with different set of data.

its have limited functionality. not complex one.

Ex:

Job Portal,Hotel/Travel,INsurance,Financial, Tourism, Forums,eCommerce

Script framework

-> Read the test data from Excel or notepad. we should create the user

defined functions for Read test data. Then those data stored into variable.

-> Perform the data related operation using the above variable on AUT.

-> Then finally results are data are stored in excel.

-> we no need to have vb script strong knowledge person for maintain this

framework. Because as long as the functionality has not been changed. We

always user deals with set of new test data on AUT. And verify how the

application behave while load these data.

Advantage

Effective - if we need to test thousands of test data by using manual

testing. its take more time consuming. but using data driven Technology we

can effectively perform the application. and less time consuming. so we can

cut down the test life cycle effectively

Reusable - As long as there is no change in test script, we can Reusable

script in any time

Accurate


Keyword Driven Framework (Read the keyword)

1) Create the test cases for each an every operation.

2) And create associated test steps to perform the test cases. Both test

case and test steps in differnt sheets.

3) Each an every test steps associated with keyword. By using keyword we can

perform the operations on AUT.

Test case : Ex. login into the application

Test Steps :  Open application
        Enter the username
        Enter the password
        click ok

Keyword    :    browser_open
        edit_input
        edit-input
        button_click


Main Script : Its main script for reading the input from excel and call the

function respect to the keywords

Driver - its have the vbScript for reading the keywords and reading data

from excel.

Web based function (Keyword) - Each an every keyword have set of operation

on the application.

4) This framework used for frequent changes functionality on the

application, but less test data. we can look only the test case and test

steps often when any changes on the application.

Components of Keyword driven Framework


Main Script : List of the keywords associated with function.


Web Method

its have the eache an every operation performed in the application


Driver

Its have what are the keyword want to execute. each an every keyword

associate with each an every functions

To generate the error report

Get the test data



Hybrid Framework ( both Read the Data and Read the keyword)

Its combine both keyword and data driven framework

1) we can create the Test cases, Test steps,Test data.

2) And read both keywords and Test data in driver.

Unified Functional Testing (UFT)


This is advanced version of QTP. This is also called QTP 11.5


UFT = QTP+Service Tools


QTP supports only Functional and regression testing for GUI based and web based application.


UFT also suppors the API (Application Programming interface). Also its supports msoffice 2007 directly



After QTP 11, they didnt release any version. They release only batches accoring to new technology.


New Features in UFT

Key Elements of QTP



a) Add in Mangager
b) Test Pane
c) Active Screen
d) Data Table
e) Debug Viewer
f) Information Pane
g) Missing Resources pane
h) QTP Commands



a) Add-In Manager

list of available Add-in our organization. we can select more than Add in. if we select any unnecasary options, its not a problem. but its reduce tool performance.


b) Test Pane

Area which we generate Edit/ View the executable statements.

Test - one or more Actions to perform a task/tasks

Action - Set of statements to perform a task /tasks . Actions ar reusable and equalant feature for functions.

Statement/Step/Instruction - its minimal executable unit.

But using colon(:), we can combine the two statement.

Ex 1:  msgbox "QTP" : msgbox "vb script"

This example have two statement in single line by using comma.

Using underscore (_), we can split the statement into two lines.


Ex 2 : msgbox _
    QTP

This example have two line but single statement.



Test pane have two views

-> Keyword view - Test in GUI format.

-> Expert View - Test in vb script format.



c) Active Screen

Its capture and holds the screen shot for every user operation on AUT(Application Under Test).

Advantage - we can easily undestand the script by screenshot
disadvantage - Its occupy the more memory space. so tool peromance will reduce.


View -> Active Screen

follow below method if we dont want capture screen shot in Active screen

View -> Options -> Active screen -> Default level -> reduce the capture level


d) Data Table

View -> Datatable

Its integrated spreadsheet for data related operations.Each and every test have one Data Table. Its have two type of sheets

-> Global - its common for all Actions

-> Action -> Each and every Action have seperate Actions.

have two type of datatable

-> Design time datatable (QTP Main window)
-> Run time datatable (QTP Result window)

Usage of Datatable

1) Enter test data directly into datatable and connect to the test
2) Import data from external file (Excel,Notepad) and connect to the test ( Rightclick -> File -> Import from file)
3  Import data from database and connect to the test ( Rightclick -> Sheet -> Import -> from database)



e) Debug Viewer

if the test is not provide the correct result or the test is not run fine, that time we need Debug viewer.

view -> Debug Viewer

Its used to debug tests with help of Vb script Debug commends.


f) Information Pane

View - Information

Its shows syntax Error automatically while save the test.


g) Missing Resources pane

Its showing missing resources which we are attached file in test.


h) QTP Commands

Record
Run
Stop

its available in Menu bar, Tool bar and use short cut keys.



QTP Tools Menus (10)


1) File Menu:

Create New test

save test in QC/ALM

QC = Quality Center, Another name of QC is ALM (Application lifecylcle management)

Export test to ZIP file.

Import test from ZIP file.

Settings - we can associate External Resource file into QTP except Object Repository.

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.

Monday 4 November 2013

Differences between qtp and vb


Difference between QTP script and VB Script.

-> VB Script does not recognize the object. QTP only identify and recognize

the objects.

-> VB script used for above Enhancing tests in QTP.

-> QTP Script follow the vb script syntax. But QTP tool only identify the

object.


Difference between QTP Tool Feature and Vb Script Feature

-> Vb script features are fast Execution compare to QTP Tool Feature

-> If we are using the QTP Tool feature script, its create the internal

registry file. So its occupy the memory location while execution. So the

execution process get slow.

-> But VB Script is not have created internal registry file. so its so fast

in execution.

-> QTP Tool Feature script may corrupt. But VB Script is not corrupt.

-> QTP Tool feature script have limitations.But Vb script doesnt have any

limitation.

Example 1:

For verify Login Operation.

QTP Tool Feature -> insert check point for verify the login operation. it

will create the internal registry file. so its slow for execution.

Vb Script Feature -> Using Conditional statement like IF-ELSE statement

verify the login operation. So its not create internal registry file. SO its

execution fast.


Example 2:


For verify the transaction timing.

QTP Tool feature provide the insert transaction point from start point to

end point for verify the transaction timing. QTP print the output in QTP

Result window. But we cannot export this value into External file adn not

print locally. Because QTP tool feature script have some limitations.

But VB Script feature we use timer function, we can export values into

external file. we can print the value into internally. because vb script

doesnot have any limitations.

From above example, all the tests are used for externally by vb script

feature. But some limitations test are used for externally by QTP script.

QTP Test Design

1)  Test Design - Generating basic tests.

Means creating plan navigation.

Two methods for Generating basic tests

i) Object Repository based tests.

-> Recording

-> Keyword Driven Methodolgy (Generating tests manually using shared object

repository without recording)


ii) Descriptive Programming (without OR)/ Programmatic Descriptions

-> Static Programming

-> Dynamic Programming


iii) Hybrid Approach (Mixed minimum two approach)

Mixed using OR based and Descriptive programming.




2) Test Design - Enhancing Tests ( Its critical)


-> Modifying test and Enhancing test both are different

Modifying Test = Based on change in requirement we modify the test scripts.

Enhancing Test = Irrespetive of requirements we add below steps into the

script.

Inserting verification Point
Adding Comments
Error handling information
Synchronization if required
parenthesis if required


-> 12 Enhancing Methods

Inserting Checkpoint (QTP Tool Feature) -> 9 standared and 3 hidden

checkpoint. File content checkpoint newly added in UFT. But QTP 11.0 does

not have this feature. so its have only 11 checkpoint

Its verification point. its take the input value from user (Expected Result)

and compare with (Actual result) during execution and provide the (Test

result).


Inserting output values -> Totally 7 ouput values.File content output value

newly added in UFT. But QTP 11.0 does not have this feature. so its have

only 6 output value

It captures output during execution and stored in runtime datatables


Parameterization - Process of replacing constant values with parameter.

Advantage  is to pass dynamic values, to pass multiple values.


Synchronization -  sync the speed of QTP and test application in order to

get currect result during the execution.

QTP Test Planing

Manual Test Process

Its have 4 phases.

a) Test Planing
b) Test Design
c) Test Execution
d) Test Closure



QTP Test Process

Its have 6 phases or stages in below

a) Planning

-> Get Technology and Application environment details( UI Design technolgy

and database) from development team for select Add-ins like java, SAP based

on the application. we no need these details in manual testing because we

can apply  our manual testcases into any add-ins like sap,Java,People soft.

Becuause we need this teps for functional automation tools based on objects

present in the front end application to perform the test process. But

exceptional case is database testing, we no need front end application from

database testing in QTP.

Because QTP have integrated SQL engine to communicate database data directly with using database information.

-> Analyze the AUT (Application Under Test) in terms of object

identification.


    i) By record and playback we can ensure that QTP recognize object

correctly.
    ii) using object spy we get object information
    iii) using view option in object repository -> map objects between

application and OR

-> Select areas or testcases for automation

we select three common areas

    i) Test and execute on every build Ex.sanity testing
    ii) Test and execute on every modified build. Ex. Regression Testing
    iii) Test and executed with multiple set of test data. Ex. Data

Driven Testing.


Static Testing - Constant
Regression Testing - Dynamic

-> Tool Setting Configuration and globalized

we have two below Tool Setting Configuration feature for all tools include

QTP

 i) Constant Feature ( Its cannot modified,constant. Ex: UFT,Data Table, OR)
 ii) Configurable Feature ( According to need we customized Ex:Object

Identification, Tool ooptions, virtual object configuration, test settings

etc)


Globalized Configuration:

Providing common configuration for all machine.

QTP is desktop application, one-Tier application. This is not client Server

application, does not store any data in database.


For client-server application, if we set any settings in server side, its

applicable for all system. But QTP is not client sever application for

settting the same configuration for all members in team.

But in QTP is achieved gloabl settings using Generate scripts.


-> Automation Framework design and implementation

Automation Framework Design is Company level ( We design framework for one

time, its used for many projects)

Automation Framework implementation is project level

Its Systmatic approach for automate software test process.


Without automation frame work too we can automate.





When we start Test Automation Process?

There is no global explanation depends on

Three possibilites


i) start Automation at beginning of the project.

ii) After completion of comprehensive testing, we can start Automation

testing. After completion of first cycle of testing by manual.its mid of the

project.

iii) Start automation after completed all manual cases. that means after

complate all release we are start Automation.

QTP Test Planing

Manual Test Process

Its have 4 phases.

a) Test Planing
b) Test Design
c) Test Execution
d) Test Closure



QTP Test Process

Its have 6 phases or stages in below

a) Planning

-> Get Technology and Application environment details( UI Design technolgy

and database) from development team for select Add-ins like java, SAP based

on the application. we no need these details in manual testing because we

can apply  our manual testcases into any add-ins like sap,Java,People soft.

Becuause we need this teps for functional automation tools based on objects

present in the front end application to perform the test process. But

exceptional case is database testing, we no need front end application from

database testing in QTP.

Because QTP have integrated SQL engine to communicate database data directly with using database information.

-> Analyze the AUT (Application Under Test) in terms of object

identification.


    i) By record and playback we can ensure that QTP recognize object

correctly.
    ii) using object spy we get object information
    iii) using view option in object repository -> map objects between

application and OR

-> Select areas or testcases for automation

we select three common areas

    i) Test and execute on every build Ex.sanity testing
    ii) Test and execute on every modified build. Ex. Regression Testing
    iii) Test and executed with multiple set of test data. Ex. Data

Driven Testing.


Static Testing - Constant
Regression Testing - Dynamic

-> Tool Setting Configuration and globalized

we have two below Tool Setting Configuration feature for all tools include

QTP

 i) Constant Feature ( Its cannot modified,constant. Ex: UFT,Data Table, OR)
 ii) Configurable Feature ( According to need we customized Ex:Object

Identification, Tool ooptions, virtual object configuration, test settings

etc)


Globalized Configuration:

Providing common configuration for all machine.

QTP is desktop application, one-Tier application. This is not client Server

application, does not store any data in database.


For client-server application, if we set any settings in server side, its

applicable for all system. But QTP is not client sever application for

settting the same configuration for all members in team.

But in QTP is achieved gloabl settings using Generate scripts.


-> Automation Framework design and implementation

Automation Framework Design is Company level ( We design framework for one

time, its used for many projects)

Automation Framework implementation is project level

Its Systmatic approach for automate software test process.


Without automation frame work too we can automate.





When we start Test Automation Process?

There is no global explanation depends on

Three possibilites


i) start Automation at beginning of the project.

ii) After completion of comprehensive testing, we can start Automation

testing. After completion of first cycle of testing by manual.its mid of the

project.

iii) Start automation after completed all manual cases. that means after

complate all release we are start Automation.

Software Test Process (STLC)


a) Test Planning

test lead or test managers are conduct this steps. But all team members

contributions are required.

b) Test design

After understand the requirements, derived test scenario, Test case

documentation, test data collection.

c) Test Execution

Forming test batches->
Sanity testing ( Verify the build is acceptable or not by executing basic

functionalities like login) ->
 Comprehensive testing ( Executing all possible cases)
Defect reporting and tracking
Retesting and modified the build
final regress testing

d) Test Closure

Evaluating the Exit Creteria
Collecing all artifacts from test activities
Preparing the test summary report ( Summarize all test activities)
Finally send test deliverable to customer



Software Quality Standards (Its prvide terminology for Process standared and

documentation standared in organization)

a) ISO Standards

ISO -> Europe based. Its provide terminology for terms like what is 

verification, what is regression etc.. Its provide standared for preapre

documentation


b) IEEE Standards

IEEE= INSTITUE OF ELECTRICAL AND ELECTRONIC ENGINEERING, US Based

organization. Its provide the standared about test process from test

planning to test closure.

c) CMM/CMMI Standards

Capability Maturity Model Integration - Provide the process for the software

development.


Difference between Quality and testing

if we are good in testing, its improve the Quality.


Focusing Area for tester

a) Understanding the Software Requirements.

Deriving the test scenario and oulines frin software requirements

b) Test case Documentation

input, pre-condition, Post-Condition, Expected result for verify test

conditions

c) Test Data Collection

collect the data for required test execution.


d) Test Execution

Sanity Testing, Comprehensive Testing, ReTesting, Regression testing

e) defect Reporting & Tracking


Unified Functional Testing (UFT)

This is advanced version of QTP. This is called QTP 11.5

Software testing

Testing the software whether its working or not as per the requirements.


-> Learning object for software testing

SDLC MODELS

software tetsing also one method of SDLC models.SDLC means systematic

approach to devlop the software application.

SDLC have the many models. its differentiate into two models

1) Sequential Model  ( One stage is input of next stage. so each an every

step should wait before stage should get completed. Ex. Waterfall,V-Model

2) Incremental/Iterative models ( Divide SDLC into incremental. Then Add

requirement every step.ex: Agile model, Spiral model.  its more exapanse,

but success rate is high.)




Test Levels

a) Unit Testing or Componant Tetsing or Module Testing or program testing.

Developers conduct this testing using white box technique (Structured based

technique).Testing individual componanent


b) Integration Testing.

Its also conducted by devlopers. Its verify interface between the two

componanents.

c) System Testing

Independant tester or seperate tetsing team conducted the system testing

using black box techniques (Specification based testing)



d) Acceptance Testing

Customers or end used peoples are done this type of testing. verified the

system meet the full requirements.




Test Types

a) Functional Testing

Verify the component or system functionality with respect to functionality

secure testing, functionality testing

b) Non-Functional Testing

Verifying the system quality attributes.

stress, load,configuration, recovery testing



Test Design Techniques (Testing with all possible input and pre-conditions

is called Exhaustive testing. In order to reduce input, we used test design

technique)

a) White box Techniques

Its used by developers like statement testing, condition tetsing, decision

testing

b) Black box Techniques

Independent testers used this technique like equalent clauses or equalent

partition  , Boundary value analysis, decision table testing, state

transition testing, usecase testing.

c) Experiance based Techniques

Its informal way. there is no documentation to follow. if we have no time,

then we move to Experiance testing like exploratory testing,error gussing

testing.