Monday, September 30, 2013

Delete Cookies, Browser temporary files, Browser History with QTP Script

While executing the Quick Test Professional Scripts, Sometimes there can be a need to clear the Internet Explorer Temporary files. So for Delete Cookies, Browser temporary files, Browser History with Quick Test Professional Script, there are several options available.

Option 1:
Function ClearBrowserHistory
Dim temp
Set fso = CreateObject ("Scripting.FileSystemObject")
Set winsh = CreateObject ("Wscript.Shell")
Set temp = fso.GetFolder (winsh.ExpandEnvironmentStrings("%TEMP%"))
On Error Resume Next

For each ofile in temp.Files
fso.DeleteFile ofile
Next

For Each osubfldr in temp.subfolders
fso.DeleteFolder (osubfldr),true
Next
wscript.quit
End Function

Option 2:
Webutil.DeleteCookies

'To clear temporary Internet files
Set WShell = CreateObject("WScript.Shell")
WShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8"

'To Clear Browsing History
WShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1"

Wait (10)

Option 3:
'To clear temporary Internet files
Set WshShell = CreateObject("WScript.Shell")
WshShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8"

'To clear browsing cookies
WshShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2"

'To Clear Browsing History
WshShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1"

Friday, September 6, 2013

HP QTP 11.5 UFT System Requirements

HP has recently launched the New Version of Quick Test Pro as named HP QTP UFT 11.5. For successfully install and run HP QTP 11.5 UFT in computer, there are some minimum system requirements.

These System Requirements are given as below. But if you use a system with stronger/later setups than the minimum requirements, performance may be improved.

Minimum System Requirements and Supported Environments for HP QTP 11.5 UFT:
  • Computer Processor:1.6 Ghz or higher  
  • Operating System:Windows XP Service Pack 3 
  • Memory:Minimum of 2 GB (for no more than three add-ins are loaded simultaneously) 
  • Color Settings:High Color (16 bit) 
  • Graphics Card:Graphics card with 64 MB video memory 
  • Free Hard Disk Space:2 GB of free disk space for application files and folders 
  • Browser:Microsoft Internet Explorer 7.0 or a later supported version

Notes: 
  • An additional 512 MB of RAM are required when using a virtual machine.
  • Additional memory is required when loading more add-ins and when using the Save movie to results option to capture movies during run sessions. 
  • You must also have an additional 1 GB of free disk space on the system disk (the disk on which the operating system is installed).

HP QTP 11.5 New Features

HP QTP, the best functional testing tool, is recently comes with a new version release. This HP QTP new version is hit the market with the name “HP Unified Functional Testing (UFT) 11.5”.

HP QTP 11.5 is a combination of QuickTestPro (QTP), Service Test (ST) and Mobile Testing as well. This is the major change in QTP since it is available in the market. HP QTP 11.5 creates this major change because of the end to end testing needs in the current market. So based on the requirement HP QTP 11.5 provides the testing ability as a GUI testing tool i.e. QTP, API testing tool i.e. Service Test and Mobile Testing from a single interface and that’s why now there is a no need for download separate tools.

HP UFT 11.5 Features:

QTP IDE Update:
  • HP UFT IDE (Integrated Development Environment) supports to work on multiple tests at the same time.
  • HP Unified Functional Testing IDE supports for editing more than one action at the same time.
  • HP QTP 11.5 IDE has improved statement completion, improved dynamic lists of values, code folding and code snippets.
  • Image based objects / controls identification (Insight Recording for GUI test).
  • QTP Recording identifies the object based on images.
  • Image-based testing feature can allow us to test applications on non-windows operating system as well.
  • Enhanced support for GUI Testing Environment.
Browsers:
  • HP UFT 11.5 Recording feature supports for
    • Internet Explorer 9
    • Mozilla Firefox Versions 4 to Versions 10
  • HP UFT 11.5 Play back supports for
    • Internet Explorer 9
    • Mozilla Firefox Versions 4 to Versions 10
    • Google Chrome

GUI Test support Add-ins:
  • Standard
  • Java
  • .NET
  • WPF
New and Improve Support:
  • Delphi
  • Oracle 11g, PeopleSoft 8.5 and Siebel 
  • SAP CRM 7.0 and SAP GUI 7.2
  • Office (MSAA)
Improved Check points:
  • Checks the text in dynamically or accessed PDF file content.
  • Supports for including or excluding multiple areas within a bitmap.
  • Supports for locate a bitmap area anywhere within the run time bitmap image.
  • Select External bitmap file as the bitmap source.
Supports for Mobile applications testing:
  • Install Perfecto Mobile QTP Add-in (UFT Mobile) and automate Mobile applications.

Thursday, August 29, 2013

VB Script - Close All Browser

Function Details:
This Vb Script Function is for "Close browsers except QC window" using VB Script.This function will close all the Internet Explorer window and tabs except HP Quality Center. To use this function simply copy paste it in to text file and save the file with .vbs Extension. When you double click on the .vbs file, the script will be executed and you can found the result.

Function CloseIE
    On Error Resume Next

    'Variable Declaration
    dim objShell, objWindow, strTitle

    'Set Variables and Object Values
    set objShell = CreateObject("Shell.Application") 'Create Shell Application Object
    strTitle = "HP Quality Center" 'Set Window Title Search Name
   
    for each objWindow in objShell.Windows 'Get Window Objects
        if InStr(objWindow.FullName,"iexplore")<>0 then 'Check Object Window Full Name with iexplore   
            if(objWindow.document.title<>"") then 'Check Object Window Title not Blank   
                if InStr(objWindow.document.title,strTitle)=0 then 'Check Object Window is not Quality  Center
                    objWindow.Quit 'Close IE
                end if   
            end if   
        end if
    next

    if objShell.Windows.Count>0 then 'Check Object Window Count
        For i=0 to objShell.Windows.Count
            Call CloseIE 'Recursively call Function
        next
    end if

End Function

Note :- To Use this Function write the below statement in top of the .vbs file.
Call CloseIE statement

Add Remove Object Repository Dynamically in QTP

HP QTP provides a great functionality for adding or removing Object Repository at run time or dynamically. For that ObjectRepositories Utility object of QTP is used. 

Find the below code for Add/Remove Object Repository dynamically in QTP during run time.

'*********************************************************
'Function Name: AddRemoveOR
'Purpose: Use for Add Or Remove Object Repository with Action Name
'Inputs:
    'repositoryPath=Repository Path for Add or Remove with Action
    'actionName=Action Name for Add for Add Or Remove Repository
    ' operationName=Operation Name to be Perform either "Add" or "Remove" Object  Repository
'Return Values: -
'Created By: Krutin Gandhi
'*********************************************************

Function AddRemoveOR(repositoryPath,actionName,operationName)  

    Dim qtApp,qtRepositories, actName, RepPath,  rPosition'Variable Declaration

    RepPath=repositoryPath 'TRS File Path
    actName=actionName   'Get Action Name
    Set qtApp = CreateObject("QuickTest.Application")    ' Create Application Object
    Set qtRepositories = qtApp.Test.Actions(actName).ObjectRepositories    ' Get Associated repositories list

        'Adding Repository to an action
        If operationName="Add" Then       
            If qtRepositories.Find(RepPath) = -1 Then
                qtRepositories.Add RepPath, 1    ' Add the Object Repository to the current action 
            End If

        'Remove Repository to an action
        Else if operationName="Remove" Then
            rPosition=qtRepositories.Find(RepPath) 'Find the Position of the Repository
            If  rPosition<>-1 then
                qtRepositories.Remove rPosition  ' Remove Repository From the Action
            End if           
        End If
    End If

    'Assign nothing
    Set qtApp= Nothing
    Set qtRepositories= Nothing
End Function