Tuesday, October 19, 2010

Launch IE maximized mode using QTP

Launch IE maximized mode using QTP


SystemUtil.Run "iexplore.exe",strURL,strExePath, ,3


It takes five parameters.


3 is for opening IE in Maximized mode evertime launching from the above command in QTP.



VBScript DIM Preserve two dimensional array QTP

DIM PRESERVE 2D array VBScript

Example usage:

WRITING into 2D array
Dim b()
for i=0 to n
   for j=0 to m
            ReDim b(i,j)
             b(i,j)= Datatable.Getsheet().getparameter().value
    next
next


READING from 2D array
For i=0 to n
   for j=0 to n
             msgbox b(i,j)
   next
next

RAWVALUE QTP

QTP Datatable.RawValue

While you read from excel, cells which contain formula's like =Today(), =Date()
may not reflect the same text when you retreive them.

Workarounds
1. So you might change in the cells in Excel as follows:
=Text(TODAY())

2. use
vCellValue=Datatable.GetSheet("sheetname").getParameter("ColumnName").RAWVALUE
instead of 
vCellValue=Datatable.GetSheet("sheetname").getParameter("ColumnName").VALUE

WinObject QTP

QTP AUT: Windows Application

When you are automating Windows application using QTP, many times you see objects recognised as
WinObject.

Possible workarounds to automate such window or dialog boxes are the following:


  1. Use SendKeys method, that actually sends any keyboard operations on screen. 
Note : Before using SendKeys, Activate the window on which you want to send the keys

    2.  You may use, WinObject.type "1234"

QTP Action Parameters

QTP Action Parameters

When you are adding new actions in a Action-driven framework,
make sure if the action is taking input parameters or not.

If it is taking Input parameters , you can insert input parameters by selecting Action Properties
click Parameters tab, click on + button, type the parameter name, its type and click OK

Important points on QTP Actions

  1.  By default, Action is reusable action.
  2. All functions defined inside action are local to that action only.
  3. When you insert new action, Action2 is executed only after Action1 which is already created.
  4. Each action created has its own Datatable and Object Repository specific to Action.
  5. Action0 folder is created for each QTP test, when you open script.mts in Action0 folder,
 you can see
RunAction Action1, OneIteration by default.

QTP when it startsrunning a Test, it actually reads "script.mts" from Action0 and calls respective Actions sequentially mentioned in the file.

Saturday, July 31, 2010

WinEdit, WebEdit - Set text/Number error in QTP

When you are facing difficulties in setting a number or text in a windows or web application
the edit fields have some unique properties that will validate the input you enter.

Use the following
Window().Dialog().WinEdit().type "123-00-1234"
instead of
Window().Dailog().WinEdit().set "123-00-1234"

VBSCRIPT > REDIM PRESERVE clear example


VBSCRIPT > REDIM PRESERVE example

THROWS - subscript out of error
dim a()
i=0
for i =0 to 5
a(i)=i ' subscript out of error at this line
next
----------------------
dim a()
i=0
for i=0 to 5
REDIM a(i)
a(i)=i
next

'output
for i=0 to ubound(a)
msgbox a(i)
next

'OUTPUT : 5
' Where are the values 0,1,2,3,4 ??? strange ??
' these values have been overwritten each time and only last updated value is stored in a(i)

'TO PRESERVE Previously stored value in array, we use -PRESERVE keyword as follows
dim a()
i=0
for i=0 to 5
REDIM PRESERVE a(i)
a(i)= i
Next

'to retrieve output
for i=0 to ubound(a)
msgbox a(i)
next
'OUTPUT : 0,1,2,3,5

Saturday, June 26, 2010

QTP : General Run Error

QTP : General Run Error

Recently, i have faced this Error while i was running my QTP code.
I had to really waste my time to debug what went wrong...but could not find it as QTP was only
throwing "General Run Error".
After much time spent on checking code line by line , found that it is due to a variable declared and used twice at different points in function libraries, and loaded at runtime with different values.

Hope you find this info useful.

WorkAround: Checkout if any variable is used twice at different lines of your code.
Recommendation: Use Option Explicit which will mandate you to declare variable declarations in your code snippets.

QTP Unplugged

One of the rarest book on Software automation tool, HP's QuickTest Professional priced currently at the time of writing this post Rs. 525. Which is available to order online on the below url.

QTP Unplugged >> http://knowledgeinbox.com/store
(sign in not required)

Day 2 Day testing - First Blog post

Hi there,
Welcome to Day2DayTesting blog.
This blog is for all testing professionals who can update their daily challenges faced in their day2day activities while testing their Software applications.

PS: please do not post any information/data which is confidential. This Post aims to be a read-in blog that talks about day 2 day challenges and the workarounds to overcome them. Please post in general.