Sunday, May 24, 2009

Script for Highlighting the Objects

Hi All,

Hope most of you people might be knowing how to highlight an Object in Object Repository using "Highlight in Application" button.
Here i am providing a way of Highlighting the Objects of specific Class programmatically(thru script).

' script :
systemutil.Run "http://www.qtpking.blogspot.com/"
Dim obj Set obj=Description.Create
obj("micclass").value="Link"
Set x=browser("QTP for you ...").Page("QTP for you ...").ChildObjects(obj)
For i=0 to x.count-1
x(i).highlight
Next


'Note: Add 'Page' object into Obj.Repo. before execution
Just execute the above script & watch the output.....:)

Msgbox Vs Print Dialog

Hi All,

You might be familiar with usage of 'Msgbox' in the scripts for displaying the information,Variables,Values.
But from QTP 9.x series HP has introduced a new feature Called "Print" Statement.
The purpose of the Print Statement is similar to Msgbox , see below to have clear picture.
Msgbox:
Msgbox VBScript function is used to display information during the run session.
Note: The run session pauses until the message box is closed.
So while runnings batch testing,Driver scripts we have to make sure that we have not used "Msgbox" in our scripts. The run session pauses until the message box is closed & we cannot expect the test results until run session is completed.
Print :
Print Utility statement is used in our scripts to display information in the QuickTest Print Log window while still continuing the run session.
Note: The run session wouldn't pauses inspite of the display of QuickTest Print Log window.
So while runnings batch testing,Driver scripts if at all we have used 'Print' statements it would not effect the test script execution(Run session) & we would get the test results.
See the below Example
' Using Print Statement:
print "ASCII value of A : "&Asc("A")
print "ASCII value of a : "&Asc("a")
print "ASCII value of B : "&asc("B")
print "ASCII value of b : "&asc("b")

Output:




















Output:

Saturday, May 23, 2009

Function for Excel Cell Colors

Hi All,
Hope all of you are doing well....:)
Here i am providing an Userdefined Function for displaying the cell colors of Excel document.

' Function Defination:
Function ExcelCellColors_display(FilePath)
Dim xl
Set xl=CreateObject("Excel.Application")
xl.visible=True
xl.WorkBooks.Open FilePath
' Retrieving the rowcount used
rc=xl.Activesheet.usedrange.rows.count

' Clearing the existing Data in excel (If any)
For j=1 to rc
xl.Cells(j,1).interior.colorindex=null
xl.Cells(j,1).value=Null
xl.Cells(j,2).value=Null
xl.Cells(j,2).interior.colorindex=null
Next
xl.cells(1,1).value="Color"
xl.cells(1,2).value="Color Index"

' Filling the colors & colorindex values
For i=2 to 56
xl.Cells(i,1).interior.colorindex=i-1
xl.Cells(i,2).value=xl.Cells(i,1).interior.colorindex
Next
xl.ActiveworkBook.Save
wait(1)
xl.Application.quit
Set xl=nothing
End Function

'Function Declaration/Calling:
Call ExcelCellColors_display( "D:\Documents and Settings\Sree\Desktop\Excel_colors.xls")

Output:


Sunday, April 26, 2009

Get Size of Folder/File

Hi All,

Here iam providing a simple way of finding the size of required folder/file.
Try the below code & implement the same wherever & whenever applicable/required.

' Get the size of folder:
dim fso
foldername="Sreekanth"
Set fso = CreateObject( "Scripting.FileSystemObject" )
Set folder1 = fso.GetFolder( "D:\Documents and Settings\Sree\Desktop\"&foldername)
msgbox "Size of Folder "&foldername&" :- "&folder1.Size&" bytes"
Set fso=Nothing
' Output :











' Get the size of file:
Set fso = CreateObject( "Scripting.FileSystemObject" )
fname="qtpinf"
Set folder1 = fso.Getfile("D:\Documents and Settings\Sree\Desktop\"&fname&".doc")
msgbox "Size of File "&fname&" :- "&folder1.Size&" bytes"
Set fso=Nothing

' Output :






Saturday, April 18, 2009

QTP 10.0 Window - Key Elements

Hi All,
Here i am giving an overview of key elements of the QuickTest Window .
The QuickTest window displays your testing documents in the document area.
You can work on one test and one or more function libraries simultaneously. (For your convenience, you can display one active document in the document area, or you can cascade or tile your open documents.)

The document area of the QuickTest window can display the following:

Test:
Enables you to create, view, and modify your test in Keyword View or Expert View.
Function Library:
Enables you to create, view, and modify functions (operations) for use with your test.
Start Page:
Welcomes you to QuickTest and provides links to Process Guidance. You can use the shortcut buttons to open new and existing documents.
Key Elements in the QuickTest Window :
In addition to the document area, the QuickTest window contains the following key elements:

QuickTest title bar:
Displays the name of the active document. If changes have been made since it was last saved, an asterisk (*) is displayed next to the document name in the title bar.

Menu bar:
Displays menus of QuickTest commands.

Standard toolbar:
Contains buttons to assist you in managing your document.

Automation toolbar:
Contains buttons to assist you in the testing process.

Debug toolbar:
Contains buttons to assist you in debugging your document. (Not displayed by default)
Edit toolbar:
Contains buttons to assist you in editing your test or function library.

Insert toolbar:
Contains buttons to assist you when working with steps and statements in your test or function library.

Tools toolbar:
Contains buttons with tools to assist you in the testing process.

View toolbar:
Contains buttons to assist you in viewing your document.

Action toolbar:
Contains buttons and a list of actions, enabling you to view the details of an individual action or the entire test flow. (Not displayed by default)

Document tabs and scroll arrows:
Enables you to navigate open documents in the document area by selecting the tab of the document you want to activate (bring into focus). When there is not enough space in the document area to display all of the tabs simultaneously, you can use the left and right arrows to scroll between your open documents.

Keyword View:
Contains each step, and displays the object hierarchy, in a modular, icon-based table.

Expert View:
Contains each step as a VBScript line. In object-based steps, the VBScript line defines the object hierarchy.
Status bar: Displays the status of the QuickTest application and other relevant information.

You can show or hide the following panes from the View menu:
Active Screen:
Provides a snapshot of your application as it appeared when you performed a certain step during the recording session.
Data Table:
Assists you in parameterizing your test. The Data Table contains the Global tab and a tab for each action.
Debug Viewer pane:
Assists you in debugging your document. The Debug Viewer pane contains the Watch, Variables, and Command tabs.
Information pane:
Displays a list of syntax errors found in your test and function library scripts.
Missing Resources pane:
Provides a list of the resources that are specified in your test but cannot be found, such as missing calls to actions, unmapped shared object repositories, and parameters that are connected to shared object repositories. The Missing Resources pane then enables you to locate or remove them from your test.
Process Guidance panes:
Displays two panes that provide procedures and descriptions on how to best perform specific processes, such as creating a test in QuickTest. The Process Guidance Activities pane lists the activities that you can perform, such as adding steps to a test. The Process Guidance Description pane describes the tasks that you need to perform for a selected activity. Your organization may also provide you with process guidance that is accessible from these panes.
Available Keywords Pane:
Displays all the keywords available to your test. Enables you to drag and drop objects or calls to functions into your test.
Test Flow Pane:
Displays the hierarchy of actions and action calls in the current test, and shows the order in which they are run.
Resources Pane:
Displays all the resources associated with your current test and enables you to manage these resources.
You can customize the layout of the QuickTest window by moving, resizing, displaying, or hiding most of the elements. QuickTest remembers your preferred layout settings and opens subsequent sessions with your customized layout
Given below is the view of QTP 10.0 window:



Parameterization & Types of Parameters in QTP

Hi All,
I hope while learning/working on QTP you might have heard about the term "Parameterization".

"Parameterization" : Its a process of passing multiple values(test data/Input Data) for a constant value(Hard Coded) inorder to retest certain functionality/feature.

Data Driven Testing(Retesting) can be done using the Parameterization.

There are 4 types of parameters:
1) Test/action parameters
2) Data Table parameters
3) Environment variable parameters
4) Random number parameters


Test/action parameters :
Test parameters enable you to use values passed from your test. Action parameters enable you to pass values from other actions in your test.
To use a value within a specific action, you must pass the value down through the action hierarchy of your test to the required action. You can then use that parameter value to parameterize a step in your test. For example, suppose that Action3 is a nested action of Action1 (a top-level action), and you want to parameterize a step in Action3 using a value that is passed into your test from the external application that runs (calls) the test. You can pass the value from the test level to Action1, then to Action3, and then parameterize the required step using this action input parameter value (that was passed through from the external application).
Alternatively, you can pass an output action parameter value from an action step to a later sibling action at the same hierarchical level. For example, suppose that Action2, Action3, and Action4 are sibling actions at the same hierarchical level, and that these are all nested actions of Action1. You can parameterize a call to Action4 based on an output value retrieved from Action2 or Action3. You can then use these parameters in your action step.


Data Table parameters :
Enable you to create a data-driven test (or action) that runs several times using the data you supply. In each repetition, or iteration, QuickTest uses a different value from the Data Table.
For example, suppose your application includes a feature that enables users to search for contact information from a membership database. When the user enters a member's name, the member's contact information is displayed, together with a button labelled View 's Picture, where is the name of the member. You can parameterize the name property of the button using a list of values so that during each iteration of the run session, QuickTest can identify the different picture buttons.


Environment variable parameters:
Enable you to use variable values from other sources during the run session. These may be values you supply, or values that QuickTest generates for you based on conditions and options you choose.
For example, you can have QuickTest read all the values for filling in a Web form from an external file, or you can use one of QuickTest's built-in environment variables to insert current information about the computer running the test.

Random number parameters:
Enable you to insert random numbers as values in your test. For example, to check how your application handles small and large ticket orders, you can have QuickTest generate a random number and insert it in a number of tickets edit box.

Monday, March 23, 2009

Virtual Objects in QTP

Hi ,

Given below is an overview of Virtual Objects in QTP.

virtual objects :
--> You can teach QuickTest to recognize any area of your application as an object by defining it as a virtual object. Virtual objects enable you to record and run tests or components on objects that are not normally recognized by QuickTest.
--> Using the Virtual Object Wizard, you can map a virtual object to a standard object class, specify the boundaries and the parent of the virtual object, and assign it a name. You can also group your virtual objects logically by assigning them to collections.

steps for creating the virtual object :
1. In QuickTest, choose Tools > Virtual Objects > New Virtual Object. Alternatively, from the Virtual Object Manager, click New. The Virtual Object Wizard opens. Click Next.
2. Select a standard class to which you want to map your virtual object.
3. Click Mark Object.
4. The QuickTest window and the Virtual Object Wizard are minimized. Use the crosshairs pointer to mark the area of the virtual object. You can use the arrow keys while holding down the left mouse button to make precise adjustments to the area you define with the crosshairs. Click Next.
5.Click an object in the object tree to assign it as the parent of the virtual object
6. In the Identify object using box, select how you want QuickTest to identify and map the virtual object.

If you want QuickTest to identify all occurrences of the virtual object, select parent only.
QuickTest identifies the virtual object using its direct parent only, regardless of the entire parent hierarchy.
For example, if the virtual object was defined using Browser("A").Page("B").Image("C"), QuickTest will recognize the virtual object even if the hierarchy changes to Browser("X").Page("Y").Image("C").
If you want QuickTest to identify the virtual object in one occurrence only, select entire parent hierarchy.
QuickTest identifies the virtual object only if it has the exact parent hierarchy.
For example, if the virtual object was defined using Browser("A").Page("B").Image("C"), QuickTest will not recognize it if the hierarchy changes to Browser("X").Page("B").Image("C").Click Next.
7. Specify a name and a collection for the virtual object. Choose from the list of collections or create a new one by entering a new name in the Collection name box.
8. To add the virtual object to the Virtual Object Manager and close the wizard, select No and then click Finish.
To add the virtual object to the Virtual Object Manager and define another virtual object, select Yes and then click Next. The wizard returns to the Map to a Standard Class screen, where you can define the next virtual object.

Delete Cookies through QTP

Hi All,
Here i am providing the way of Deleting the Cookies from the browser.

' Way 1:
systemutil.Run "D:\Program Files\Internet Explorer\iexplore.exe"
Dim brw
Set brw=Description.Create()
brw( "micclass" ).Value ="Browser"
brw("CreationTime").Value=0
wait(2)

Browser(brw).WinToolbar("Class Name:=WinToolbar","nativeclass:=ToolbarWindow32","Location:=0").Press "&Tools"

Browser(brw).WinMenu("menuobjtype:=3").Select "Delete Browsing History..."

Browser(brw).Dialog("Class Name:=Dialog","text:=Delete Browsing History").WinButton("Class Name:=WinButton","text:=Delete c&ookies...").Click

Browser(brw).Dialog("Class Name:=Dialog","text:=Delete Browsing History").Dialog("text:=Delete Cookies").WinButton("Class Name:=WinButton","text:=&Yes").Click

Browser(brw).Dialog("Class Name:=Dialog","text:=Delete Browsing History").WinButton("Class Name:=WinButton","text:=&Close").Click

Browser(brw).Close

' Way 2 :
Function ClearCookies()
SystemUtil.Run "Control.exe","inetcpl.cpl"
Set objShell = CreateObject("Wscript.Shell")
Do Until Success = True
Success = objShell.AppActivate("Internet Properties")
Wait(1)
Loop
objShell.Sendkeys "%i"
Wait(1)
objShell.Sendkeys "{ENTER}"
Wait(1)
objShell.Sendkeys "%f"
Wait(1)
objShell.Sendkeys "%d"
Wait(1)
objShell.Sendkeys "{ENTER}"
Wait(4)
objShell.Sendkeys "{ENTER}"
End Function

' Call the above function
Call ClearCookies()

Retrieve Extension names of the files

Hi ,
How to Retrieve Extension names of the files ?
Check it out with the below function .

Function GetAnExtension(Required_File)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
GetAnExtension = fso.GetExtensionName(Required_File)
End Function

msgbox GetAnExtension("D:\Documents and Settings\Sree\Desktop\VBgrids.doc")


Output will be :



Using the Windows API in QTP

Hi All,
Here i am providing an overview of usage of Windows API in QTP.

Windows API :
Using the Windows API, you can extend testing abilities and add usability and flexibility to your tests and function libraries. The Windows operating system provides a large number of functions to help you control and manage Windows operations. You can use these functions to obtain additional functionality.
The Windows API is documented in the Microsoft MSDN Web site, which can be found at: http://msdn.microsoft.com/library/en-us/winprog/winprog/windows_api_start_page.asp?frame=true
A reference to specific API functions can be found at: http://msdn.microsoft.com/library/en-us/winprog/winprog/windows_api_reference.asp?frame=true
To use Windows API functions:
1. In MSDN, locate the function you want to use in your test or function library.
2. Read its documentation and understand all required parameters and return value(s).
3. Note the location of the API function. API functions are located inside Windows DLLs. The name of the DLL in which the requested function is located is usually identical to the Import Library section in the function's documentation. For example, if the documentation refers to User32.lib, the function is located in a DLL named User32.dll, typically located in your System32 library.
4. Use the QuickTest Extern object to declare an external function. For more information, refer to the QuickTest Professional Object Model Reference.
The following example declares a call to a function called GetForegroundWindow, located in user32.dll:
Extern. Declare micHwnd, "GetForegroundWindow", "user32.dll", "GetForegroundWindow"
5. Call the declared function, passing any required arguments, for example, hwnd = Extern.GetForegroundWindow().
In this example, the foreground window's handle is retrieved. You can enhance your test or function library if the foreground window is not in the object repository or cannot be determined beforehand (for example, a window with a dynamic title). You may want to use this handle as part of a programmatic description of the window, for example:
Window("HWND:="&hWnd).Close
In some cases, you may have to use predefined constant values as function arguments. Since these constants are not defined in the context of your test or function, you need to find their numerical value to pass them to the called function. The numerical values of these constants are usually declared in the function's header file. A reference to header files can also be found in each function's documentation under the Header section. If you have Microsoft Visual Studio installed on your computer, you can typically find header files under X:\Program Files\Microsoft Visual Studio\VC98\Include.

For example, the GetWindow API function expects to receive a numerical value that represents the relationship between the specified window and the window whose handle is to be retrieved. In the MSDN documentation, you can find the constants: GW_CHILD, GW_ENABLEDPOPUP, GW_HWNDFIRST, GW_HWNDLAST, GW_HWNDNEXT, GW_HWNDPREV and GW_HWNDPREV. If you open the WINUSER.H file, mentioned in the GetWindow documentation, you will find the following flag values:
/*
* GetWindow() Constants
*/
#define GW_HWNDFIRST 0
#define GW_HWNDLAST 1
#define GW_HWNDNEXT 2
#define GW_HWNDPREV 3
#define GW_OWNER 4
#define GW_CHILD 5
#define GW_ENABLEDPOPUP 6
#define GW_MAX 6
Example
The following example retrieves a specific menu item's value in the Notepad application.
' Constant Values:
Const MF_BYPOSITION = 1024

'API Functions Declarations
Extern.Declare micHwnd,"GetMenu","user32.dll","GetMenu", micHwnd
Extern.Declare micInteger,"GetMenuItemCount","user32.dll","GetMenuItemCount", micHwnd
Extern.Declare micHwnd,"GetSubMenu","user32.dll","GetSubMenu", micHwnd, micInteger
Extern.Declare micInteger,"GetMenuString","user32.dll","GetMenuString", micHwnd, micInteger, micString+micByRef, micInteger, micInteger
‘Notepad.exe
hwin = Window("Notepad").GetROProperty ("hwnd") ' Get Window's handle
MsgBox hwin
men_hwnd = Extern.GetMenu(hwin)' Get window's main menu's handle
MsgBox men_hwnd

‘Use API Functions
item_cnt = Extern.GetMenuItemCount(men_hwnd)
MsgBox item_cnt
hSubm = Extern.GetSubMenu(men_hwnd,0)
MsgBox hSubm
rc = Extern.GetMenuString(hSubm, 0,value, 64 ,MF_BYPOSITION)
MsgBox value

Sunday, March 22, 2009

Create Log Files in QTP

Hi All ,
Here i am providing the function which creates Log files in QTP.

'===========================================
' Function: WriteLog
' description : Writes a message to a log file. File is created
' inside a Log folder of the current directory or on the Desktop
' Parameters :
'strCode is a code to prefix the message with.
'strMessage is the message of file.
'===========================================
Function WriteLog(strCode, strMessage)
Dim objFS
Dim objFile
Dim objFolder
Dim strFileName
Set objFS = CreateObject("Scripting.FileSystemObject")
If Not objFS.FolderExists(objFS.GetAbsolutePathName(".") & "\log") Then
Set objFolder = objFS.CreateFolder(objFS.GetAbsolutePathName(".") & "\log")
End If
strFileName = objFS.GetAbsolutePathName(".") & "\log\" & year(date) & month(date) & day(date) & ".log"
Set objFile = objFS.OpenTextFile(strFileName, 8, True)
On Error Resume Next
objFile.Write Date & ", " & Time & ", " & strCode & ", " & strMessage & vbcrlf
' disable the on error statement
On Error GoTo 0
objFile.Close
Set objFS = Nothing
End Function

'Function Calling :
call WriteLog("Fail","Invalid User Credentials")

Output will be :

QTP - Testing Process

Hi All,
Here iam providing the Pictorial view of the Testing Process of the QTP.

Self Closing Message Box

Hi All,
As we all know that manual intervention is mandatory when we are using message boxes.
Until & unless we click "OK" messagebox will not closed.

Here i am providing a function through which mesage box closes automatically (without manual intervention)

' Function Defination
Function Selfclose_msgbox(msgboxtitle,boxcontent)
Dim x,y
Set x=CreateObject("WScript.Shell")
y=x.popup(boxcontent,2,msgboxtitle,4+32)
Set x=Nothing
Set y=Nothing
End Function

' Function Declaration/Calling :
Call Selfclose_msgbox("country Name","which country you are from")

Output will be :





This message box will be closed in 2 seconds automatically.

BreakPoints in QTP

Hi ,

Here i am providing the brief overview on "BreakPoints" in QTP.

Do understand the use of breakpoints & start implementing these accordingly.

Using Breakpoints :
We can use breakpoints to instruct QuickTest to pause a run session at a predetermined place in a component or function library. QuickTest pauses the run when it reaches the breakpoint, before executing the step. we can then examine the effects of the run up to the breakpoint, make any necessary changes, and continue running the component or function library from the breakpoint.
You can use breakpoints to:
* suspend a run session and inspect the state of your site or application.
* Mark a point from which to begin stepping through a component or function library using the step commands
* We can set breakpoints, and we can temporarily enable and disable them. After we finish using them, we can remove them from your component or function library.
Note: Breakpoints are applicable only to the current QuickTest session and are not saved with your component or function library.


Operations we can perform on Breakpoints:
* Setting Breakpoints
* Enabling and Disabling Breakpoints
* Removing Breakpoints


* Setting Breakpoints:
By setting a breakpoint, we can pause a run session at a predetermined place in a component or function library. A breakpoint is indicated by a filled red circle icon in the left margin adjacent to the selected step.
To set a breakpoint:
Perform one of the following:
*Click in the left margin of a step in script/function library where you want the run to stop
*Click a step and then:
Click the Insert/Remove Breakpoint button
Choose Debug > Insert/Remove Breakpoint
The breakpoint symbol is displayed in the left margin of the script or function library.
Note: Breakpoints are applicable only to the current QuickTest session and are not saved with your component or function library.


* Enabling and Disabling Breakpoints :
We can instruct QuickTest to ignore an existing breakpoint during a debug session by temporarily disabling the breakpoint. Then, when you run our component or function library, QuickTest runs the step containing the breakpoint, instead of stopping at it. When we enable the breakpoint again, QuickTest pauses there during the next run. This is particularly useful if your component or function library contains many steps, and you want to debug a specific part of it.
We can enable or disable breakpoints individually or all at once. For example, suppose we add breakpoints to various steps throughout your component or function library, but for now you want to debug only a specific part of your document. We could disable all breakpoints in your script or function library, and then enable breakpoints only for specific steps. After you finish debugging that section of your document, you could disable the enabled breakpoints, and then enable the next set of breakpoints (in the section you want to debug). Because the breakpoints are disabled and not removed, we can find and enable any breakpoint, as needed.
An enabled breakpoint is indicated by a filled red circle icon in the left margin adjacent to the selected step.
A disabled breakpoint is indicated by an empty circle icon in the left margin adjacent to the selected step.
Note: Breakpoints are applicable only to the current QuickTest session and are not saved with your component or function library.


We can:
Enable/disable a specific breakpoint
Enable/disable all breakpoints
To enable/disable a specific breakpoint:
Click in the line containing the breakpoint you want to disable/enable.
Choose Debug > Enable/Disable Breakpoint or press Ctrl+F9. The breakpoint is either disabled or enabled (depending on its previous state).
To enable/disable all breakpoints:
Choose Debug > Enable/Disable All Breakpoints or click the Enable/Disable All Breakpoints button. If at least one breakpoint is enabled, QuickTest disables all breakpoints in the component or function library. Alternatively, if all breakpoints are disabled, QuickTest enables them.


* Removing Breakpoints:
You can remove a single breakpoint or all breakpoints defined for the current component or function library.
To remove a single breakpoint:
Perform one of the following:
Click the breakpoint.
Click the line in your component or function library with the breakpoint symbol and:
Click the Insert/Remove Breakpoint button.
Choose Debug > Insert/Remove Breakpoint.
The breakpoint symbol is removed from the left margin of the QuickTest window.
To remove all breakpoints:
Click the Clear All Breakpoints button, or choose Debug > Clear All Breakpoints. All breakpoint symbols are removed from the left margin of the QuickTest window.

Working with Debug Viewer in QTP

Hi All,
Here i am providing an overview of Debug Viewer & its usage in QTP.

Using the Debug Viewer :
We use the Debug Viewer pane to view, set, or modify the current value of objects or variables in your function library, when it stops at a breakpoint, or when a step fails and you select the Debug option.

The Debug Viewer is useful for debugging operations (functions) in a business component, but is not intended for use with other types of component steps.

To open the Debug Viewer pane:
Choose View > Debug Viewer or click the Debug Viewer button.
The Debug Viewer pane opens.


The Debug Viewer tabs are used to display the values of variables and objects in the main script of the selected subroutine.
Debug Viewer consists of three tabs:
* Watch Tab
* Variables Tab
* Command Tab


Watch Tab:
You can view the current value of any variable or VBScript object in your function library by adding it to the Watch tab. As you continue stepping into the subsequent steps in your function library, QuickTest automatically updates the Watch tab with the current value for any object or variable whose value changes. You can also change the value of the variable manually when the function library pauses at a breakpoint.


To add an expression to the Watch tab:
Perform one of the following:
Click the expression and choose Debug > Add to Watch.
Click the expression and press Ctrl+T.
Right-click the expression and choose Add to Watch from the context menu.
In the Watch tab, paste or type the name of the object or variable into the Name column and press Enter to view the current value in the Value column.
Note: You can add an expression to the Watch tab from a function library (and not from a business component).


Variables Tab:
QuickTest automatically displays the current value of all variables in the current function in the Variables tab—up to the point where the function library is stopped or paused.

For example, if you are stepping through a function, as you step into each step, QuickTest adds the current value for any step variable to the Variables tab grid. As you continue stepping into the subsequent steps, QuickTest automatically updates the value displayed in the Variables tab for any variable whose value changes. You can also change the value of the variable manually, during the breakpoint pause.

Command Tab:
Use the Command tab to execute a line of script to set or modify the current value of a variable or VBScript object in your function library. When the run continues, QuickTest uses the value that you set.

Working with Reporter Object in QTP

Hi All,

Here iam providing an overview of Reporter Object in QTP.


Reporter Object is used for sending information to the test results. With the help of this object you can:
· Report the status of test results (like pass, fail, warning)
· Enable/Disable reporting of step(s) following the statement.
· Retrieve the folder path in which the current test's results are stored.
· Retrieve the run status at the current point of the run session.


There are some very important methods and properties associated with it.


"ReporterEvent" Method:
This is a very common method used with Reporter object.

Its syntax:
Reporter.ReportEvent EventStatus, ReportStepName, Details
Where EventStatus can be:

0 or micPass: If this step runs test passes which is shown in test report.

1 or micFail: If this step runs test fails which is shown in test report.

2 or micDone: Used to send message to the test report and does not affect status of test.

3 or micWarning: Again, used to send warning message to the test report and does not affect status of test.

ReportStepName -->name of step

Details --> are the user defined details for the given step.

For Example:
Reporter.ReportEvent micPass, "Creation Scenario Validation", " Successfully passed"


"Filter" property :
There can be situations where you don't want the full status displayed on the test report. This property can be used to selectively filter the status of your tests.

Its syntax:
Reporter.Filter = NewMode

Where NewMode can be: 0 or rfEnableAll: This is the default mode. All reported events are displayed in the Test Results.

1 or rfEnableErrorsAndWarnings: Only those events with a warning or fail status are displayed in the Test Results.

2 or rfEnableErrorsOnly: Only those events with a fail status are displayed in the Test Results.

3 or rfDisableAll: All events in the Test Results are disabled.


'ReportPath" Property :
This is used to get the path in which current test results are stored.

Its syntax:
Path_of_Results = Reporter.ReportPath


"RunStatus" Property:
This is used to get the current status of the run session

its syntax:
Reporter.RunStatus
For Example:
if Reporter.RunStatus = 0 then

flag=1;
end if

Have a nice day.......

Export QTP Result Reports into PDF

Hi All ,


Here iam providing a way for exporting QTP results into PDF.



QTP 9.x and earlier versions provides the native support for exporting your test results to HTML. What will you do if you need to export it in a pdf format?Solution for exporting our results to PDF format:

1. Download PDF Creator (http://www.download.com/PrimoPDF/3000-10743_4-10264577.html?part=dl-10264577&subj=dl&tag=button) from PrimoPDF (http://www.primopdf.com/)
2. Run the set up program, follow the instructions on the screen and install Primo PDF creator.
3. PrimoPDF is installed and can be accessible from File > Print (printer) option Menu.
4. Click OK and you will get this screen.
5. Select the radio button "EBook". Use Save As button to save the pdf in your desired location. Click OK
6. Your report in pdf format is ready.

Have a nice day...

QTP Support on MS Windows Vista

QuickTest Professional 9.2:
QuickTest Professional 9.2 supports Windows Vista 32-bit Edition.
Working with Windows Vista:
* The security settings in Microsoft Windows Vista may prevent you from performing a QuickTest Professional-related installation, such as a patch installation, or connecting to a Quality Center project (either directly or from QuickTest Professional). This can occur when the User Account Control (UAC) option in Windows Vista is set to ON, and you have not yet connected to a Quality Center project (if relevant).

Workaround:
To work with Quality Center, temporarily turn off the User Account Control (UAC) option, as follows:
1. Log in to Windows Vista as an administrator.
2. From the Control Panel, choose User Accounts > Change Security Settings.
3. Clear the Use User Account Control (UAC) to help protect your computer check box and click OK.
4. Connect to Quality Center as usual. After connecting to Quality Center, you can turn the User Account Control (UAC) option on again. Hereafter, you should be able to connect to Quality Center, as needed.

* Due to a problem opening DCOM permissions on Windows Vista, QuickTest does not run properly on a remote Windows Vista host from Quality Center.

Workaround:
Run RmtAgentFix.exe from the \bin folder.

* On Windows Vista, QuickTest Professional seat licenses may not work correctly if you are not logged on as an administrator. (Note that concurrent licenses work as usual.)
Workaround:
On Windows Vista, install QuickTest Professional and any QuickTest add-ins as an administrator. To do this, right-click setup.exe from the root folder of the QuickTest Professional installation CD and choose Run as administrator.Then, every time you open QuickTest, open it as an administrator. To do this, right-click the QuickTest Professional icon on your desktop and choose Run as administrator.

* On Windows Vista 32-bit, QuickTest Professional text recognition features (such as text checkpoints and output values, GetVisibleText and GetTextLocation test object methods, and TextUtil.GetText and TextUtil.GetTextLocation reserved object methods) are limited and are not always reliable.
Workaround: On Windows Vista, you can improve text recognition by applying the Classic Windows theme and by setting the mode key in the Windows Registry Editor to 3 - OCR only (described above).

* When using the Mercury Screen Recorder on Windows Vista, setting the Window's display settings to the Classic Windows theme may improve performance.
* Record and run session performance may be affected adversely when using the Mercury Screen Recorder on a computer running Windows Vista 32-bit or any 64-bit operating system. This is because some capture drivers (such as Blueberry or ASUS' Enhanced Display Driver) cannot be installed on these operating systems. Note that if you try to install the capture driver from the Screen Recorder Options dialog box while working on one of these operating systems, an error message is displayed.

QuickTest Professional 9.1:
QuickTest Professional 9.1 supports 'Windows Vista Beta 2-build 5384'.
Working with Windows Vista:
* When installing QuickTest Professional on Windows Vista Beta 2, the QuickTest icon is not installed on your desktop or in the Start menu. (A default icon is installed instead.)

Work-around:
Modify the icon manually.

* QuickTest Professional does not support the recording of operations on the Start menu of Windows Vista Beta 2.
* The security settings in Windows Vista Beta 2 may prevent you from connecting to a Quality Center project (either directly or from QuickTest Professional). This can occur when the User Account Control (UAC) option in Windows Vista is set to ON, and you have not yet connected to a Quality Center project.
Work-around:
To work with Quality Center, temporarily turn off the User Account Control (UAC) option, as follows:
1. Log in to Windows Vista as an administrator.
2. From the Control Panel, choose User Accounts -> Change Security Settings.
3. Clear the Use User Account Control (UAC) to help protect your computer check box and click OK.
4. Connect to Quality Center as usual. After connecting to Quality Center, you can turn the User Account Control (UAC) option on again. Hereafter, you should be able to connect to Quality Center, as needed.

* When working with Internet Explorer 7.0 Beta 3, QuickTest Professional may not recognize Web objects, even though the Web Add-in is installed and loaded.
Work-around:
In Internet Explorer 7.0 Beta 3, choose Tools -> Internet Options. In the Security tab, clear the Enable Protected Mode check box and click OK.

* Due to a problem opening DCOM permissions on Windows Vista Beta 2, QuickTest does not run properly on a remote Windows Vista Beta 2 host from Quality Center.
Work-around:
Run RmtAgentFix.exe from the \bin folder.

QuickTest Professional 9.0 and below:
QuickTest Professional 9.0 (and below) does not support Windows Vista.

VB Scripts Errors

Hi All,
Here i am providing the types of errors in VB script.

VB Script Errors :
1)Syntax Errors
2)Runtime Erros

1) Syntax Errors :
VBScript syntax errors are errors that result when the structure of one of your VBScript statements violates one or more of the grammatical rules of the VBScript scripting language. VBScript syntax errors occur during the program compilation stage, before the program has begun to be executed.
2) Runtime Errors:

VBScript run-time errors are errors that result when your VBScript script attempts to perform an action that the system cannot execute. VBScript run-time errors occur while your script is being executed; when variable expressions are being evaluated, and memory is being dynamic allocated.

Have a nice day.

WinRunner Vs QTP

Hi Folks,

Have a look on the differences on the both functionality testing Tools WinRunner & QTP.

Differences between win runner & Qtp :
  • WR is recommended only for windows application Testing
  • QTP supports Windows,Web,Activex,VB Applications by default & supports Peoplesoft,SAP,Siebel,oracle,.net,Mainframes environments also provided we install compatible Addins.

  • WR uses TSl as scripting language
  • QTP uses MS VBSript as a scripting language

  • WR doesnot have inbuilt Datatable
  • QTP has inbuilt DataTable .

  • WR supports only 4 types of checkpoints
  • QTP Supports 9 types of checkpoints ( additionally web checkpoints)

  • WR contains only script view
  • QTP contains Expert view/script view and also keyword view.

  • WR doesnot have activescreen feature
  • QTP have Active screen Feature

  • WR doesnt have Actions concept
  • QTP is a repository of actions

  • WR doesnt have environment variables concept
  • QTP supports environment variables

  • WR doesnt have interconnectivity feature with MQC
  • QTP supports this .

  • By WR we cannot test any performance issues of an appl.
  • By QTP we can accomplish upto certain extent using services object

  • WR cant run the QTP scripts.
  • We can Call the functions created in winrunner from qtp

  • WR doesnt support Debug viewer
  • QTP uses debug viewer

  • WR have two recording modes
  • QTP have three recording modes

  • WR cant Test multimedia Applications
  • QTP can Test multimedia Appl.

Have a nice day ...