Skip to main content

Posts

Showing posts from February, 2012

How to Use Dll Files in QTP Scripts

How to Use Dll Files in Our QTP Scripts:   1.       Use the QuickTest Extern object to declare an external function.  The following example declares a call to a function called GetForegroundWindow , located in user32.dll :  extern.declare micHwnd, "GetForegroundWindow", "user32.dll", "GetForegroundWindow"  2.       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 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  Source: HP QTP help

How to include an Action template in new action automatically???

How to include an Action template in new action automatically??? Basically QTP does not provide any option to include a piece of text -template- in every new action.  However there is a workaround of doing this. We will call it as "Action Template". Steps to do: 1) Go to folder inside QuickTest Professional installation. Normally it can be found under C:\Program Files\Mercury Interactive\QuickTest Professional\dat 2)Inside folder create a file by the name "ActionTemplate.mst" 3)Open it in notepad and include the information you would like to see whenever a new action is created. Insert a new action in QTP and check it !!! '*************************************************************** Sample Action Template '######################################################## ' Test Case  Name        :     Test Case Name ' Test Case Description :     The objective of the testcase ' Author                         :     Jay(Author Name) '

Read Data From Sql DB

'The name of Server strCurrentEnv = "MyServername\JaySQL" 'The name of your database: dbName = "qtpDemo" 'SQL Server connection string(you need to enter your username and password) strConnection = "DRIVER={SQL SERVER}; Server=" & strCurrentEnv & "; DATABASE="& dbName& ";uid=sa; pwd=" Set conn = CreateObject("ADODB.Connection") conn.Open strConnection 'The SQL you want to run query = "Select * from dbo.hpTools" Set rs = conn.Execute(query) dbResults = rs.GetString print dbResults

Database Connection Strings For Sql, Oracle and Excel

Database Connection Strings For Sql, Oracle and Excel 'For Oracle Db strOracleConnection   = "provider=oraoledb.1;server=localhost;uid=scott;pwd=tiger;database=testdata" 'For Sql DB strSqlConnection=  "provider=sqloledb.1;server=localhost;uid=sa;pwd=;database=testdata" 'For Excel strExcelConnection = "DRIVER={Microsoft Excel Driver (*.xls)};DBQ=C:\Jay.xls;Readonly=True"

QTP Interview Questions

QUESTION 1 When a procedure is created in the Function Library editor, what is the extension on the file? A. .INI B. .TXT C. .QFL D. .VBS Answer: C QUESTION 2 What are the categories in the Step Generator? A. Object, Operation, Value B. Library, Built-in, Local Script C. Operation, Arguments, Return Value D. Test Objects, Utility Objects, Functions Answer: D QUESTION 3 In Test Settings ->Run the Data Table iteration options are for which data sheet? A. Local B. Global C. Run-time Data Table D. Design-time Data Table Answer: B QUESTION 4 What can you use to handle unpredictable testing exceptions? A. A Do Loop B. Recovery Scenario C. IFHEN statement D. Selectase statement Answer: B QUESTION 5 In which command can you associate a function library to a test? A. Run Options B. Test Settings C. View Options D. Function Definition Gen. 1. How many tabs are there in Test Settings (File->Settings) window A) 5 B) 6 C) 7 D) 8