QTP10.com is a new and completely free website that offers help in all the versions of HP QTP (including latest version 10). More importantly, it offers free code for users of HP QuickTest Professioal. This site helps you in learning the basics of QTP and descriptive/advanced programming in (QTP) on various environments like - .Net, Infragistics, Web, Windows, etc.

Note -
This blog is NOT affiliated with HP / Hewlett-Packard in any way. The data/questions come from various sources and we have our own testing questions. I am just another Software Tester like you.

Modular Automation Framework Checklist for the Smoke Testing

Ensure a Automation test suite that has the following features:

  • Re-usability –  Develop a robust function library to be used across the projects and within the application.
  • Robustness – Develop a robust test suite that can be easily used for testing the application in different environments e.g. development, testing and production.
  • Portability – To ensure easy installation of the suite in different environments.
  • Modularity – Develop modular scripts to ensure maintainability, scalability and readability of the scripts.
  • Scalability - Scalable scripts which can be upgraded/ enhanced.
  • Maintainability – The approach should be such where in major effort goes in to the planning and developing the scripts where as least possible effort is required to maintain the same.
  • Data Driven Testing – To perform positive and negative tests using data driven scripts.
  • To achieve this, we need to a checklist for Automation Framework Planning:
  1. Identify the Scenarios / Test Cases for Smoke – 6 Identified Done
  2. Execute the Scenarios / Test Cases Manually at least 5 times - Done
  3. Get the Scenarios approved from QA Manager / Product Manager / Client - Done
  4. Create the Folder Structure – Done, C:\AST
  5. Create the shared object repository - Done
  6. Identify the Actions for the approved scenarios – Done with 8 Actions
  7. Create test data (take inputs from the manual testing team / SME’s) - Done
  8. Generate the Actions / Action library by hard coding the data – 8 reusable created, 0-pending
  9. Separate the data from the Actions / Reusable – Done
  10. Integrate / call the Actions in the main test - Done
  11. Execute & debug the Actions / Reusable - Done
  12. Get the Actions reviewed by the lead / manager / client - Done
  13. Create the AOM - Done
  14. Use Environment Variables - Done
  15. –Build in, user defined Functions
  16. Schedule the Smoke Test - Done

QTP Code - Execute Stored Procedures

 

 

Recently one reader ask me this question. So here are some codes that should help you execute a stored procedure.

As per wiki -

A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a proc, sproc, StoPro, or SP) are actually stored in the database data dictionary.

Typical uses for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures are used to consolidate and centralize logic that was originally implemented in applications. Large or complex processing that might require the execution of several SQL statements is moved into stored procedures, and all applications call the procedures only.

 

 

Code example 1:

 

' set the parameters of your database here
strDatabaseName = ""
strUser = ""
strPassword = ""
strStoredProcedureName = ""

' create the database object
Set objDB = CreateObject("ADODB.Command")

 

' set the connection string
objDB.ActiveConnection =
"DRIVER={Microsoft ODBC for Oracle}; " & _
                         "SERVER=" & strDatabaseName & _
                         ";User ID=" & strUser & ";Password=" & strPassword & " ;"

' set the command type to Stored Procedures
objDB.CommandType = 4
objDB.CommandText = strStoredProcedureName

' define Parameters for the stored procedure
objDB.Parameters.Refresh

 

' set parameters for stored procedure (i.e. two parameters here)
objDB.Parameters(0).Value = "Param1"
objDB.Parameters(1).Value = "Param2"

' execute the stored procedure
objDB.Execute()

 

' destroy the object
Set objDB = Nothing

 

How to Call SQL stored procedure from QTP?


Function RunStoredProcedure(StoredProcedureName)
sDatabaseName=”ABC”
sUID=”xyz”
sPWD=”ABC_xyz” ‘ Create the database object
Set cm = CreateObject(”ADODB.Command”)
‘ Activate the connection.
cm.ActiveConnection = “DRIVER={Microsoft ODBC for Oracle}; ” &_
“SERVER=” & sDatabaseName & “;User ID=” & sUID & “;Password=” & sPWD & ” ;”
‘ Set the command type to Stored Procedures
cm.CommandType = 4
‘ Stored Procedures
cm.CommandText = StoredProcedureName
‘ Define Parameters for the stored procedure
cm.Parameters.Refresh
‘ Pass input value. Assuming Stored Procedure requires 2 parameters
cm.Parameters(0).Value = “Kuldeep”
cm.Parameters(1).Value = “Kumar”
‘ Execute the stored procedure
cm.Execute()
Set cm = Nothing
End Function

how to query an access database by QTP

Simple QTP Script/code example of how to query an access database.

 

This is my tutorial on how to build a query that you can use in VBScript to extract information from a database.
The level of difficulty for this tutorial is beginner to intermediate.


You need to know basic VBScript syntax and need to have a copy of MS Access.

 


Code Starts from here:

 

dim objDB
dim objRS
dim intCounter

 

' create a database and recordset objects
Set objDB = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.RecordSet")

 

' configure the connection
objDB.Provider="Microsoft.Jet.OLEDB.4.0"
objDB.Open
"c:\MyTestDatabase.mdb"

 

' count the number of records in the employee table
objRS.Open "SELECT COUNT(*) from Employee" , objDB

 

Msgbox "There are " & objRS.Fields(0).Value & " records in the employee table."

 

' destroy the objects
Set objDB = Nothing
Set objRS = Nothing

Tips for Working on QTP

1# How to open the Application Browser?


We can do this with the following code:

Set objIE = CreateObject("InternetExplorer.Application")
objIE.visible = True
objIE.Navigate environment("URL_ENV")‏

Here the URL specified in the Environment file will be navigated. But if we want to directly place the URL in the above mentioned code, replace the third line with the below mentioned line:

objIE.Navigate www.google.com

2# How to check if a parameter exists inside the DataTable or not?

Use the following code:

On Error Resume Next
val=DataTable("ParamName",dtGlobalSheet)
if Err.number<> 0 then
'Parameter does not exist
else
'Parameter exists
end if

If no error is there, then Err.number = 0

3# How to know if my checkpoint passes or not?
chk_PassFail = Browser(...).Page(...).WebEdit(...).Check (Checkpoint("Check1"))
if chk_PassFail then
MsgBox "Check Point passed"
else MsgBox "Check Point failed"
end if

"if chk_PassFail" means if chk_PassFail="True". In the above mentioned code, a Boolean value is returned to the variable chk_PassFail.

4# How can I generate a random number?

The below mentioned code generates a random number in the range of 100-999:

RandomNumber (100,999)‏

5# My test fails due to checkpoint failing, how can I see the result of my checkpoint without affecting my test case to checkpoint failure?

Reporter.Filter = rfDisableAll 'Disables all the reporting events like Pass or even Fail
chk_PassFail = Browser(...).Page(...).WebEdit(...).Check (Checkpoint("Check1"))
Reporter.Filter = rfEnableAll 'Enable all the reporting events like Pass or even Fail
if chk_PassFail then
MsgBox "Check Point passed"
else
MsgBox "Check Point failed"
end if

6# What is the difference between an Action and a function?
Action is a thing specific to QTP while functions are a generic thing which is a feature of VB Scripting. 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.

7# Where to use function or action?
Well answer depends on the scenario. If you want to use the OR feature then you have to go for Action only. If the functionality is not about any automation script i.e. a function like getting a string between to specific characters, now this is something not specific to QTP and can be done on pure VB Script, so this should be done in a function and not an action. Code specific to QTP can also be put into an function using DP. Decision of using function/action depends on what any one would be comfortable using in a given situation.


8# When to use a Recovery Scenario and when to us On Error Resume Next?
Recovery scenarios are used when you cannot predict at what step the error can occur or when you know that error won't occur in your QTP script but could occur in the world outside QTP, again the example would be "out of paper", as this error is caused by printer device driver. "On error resume next" should be used when you know if an error is expected and don't want to raise it, you may want to have different actions depending upon the error that occurred. Use err.number & err.description to get more details about the error.

9# How to use environment variable?
A simple definition could be... it is a variable which can be used across the reusable actions and is not limited to one reusable action. We can use Environment variables like a global variables.
There are two types of environment variables:

1. User-defined
2. Built-in


We can retrieve the value of any environment variable. But we can set the value of only user-defined environment variables.


To set the value of a user-defined environment variable:
Environment (VariableName) = NewValue


To retrieve the value of a loaded environment variable:
CurrValue = Environment (VariableName)


Example
The following example creates a new internal user-defined variable named MyVariable with a value of 10, and then retrieves the variable value and stores it in the MyValue variable.


Environment.Value("MyVariable")=10
MyValue=Environment.Value("MyVariable")‏

10# How Should I rename my checkpoint inside QTP?
Example:
Browser("Google").Page("Google").WebEdit("Search").Check CheckPoint("Search")


In the above example, the user would like to change the name of the CheckPoint object from "Search" to something which is of our convenience.


Note:

This functionality is new to QuickTest Professional 9.0 and above.This is not available for QTP 8.2 and below.

1. Right-click on the Checkpoint step in the Keyword View or on the Checkpoint object in Expert View.
2. Select "Checkpoint Properties" from the pop-up menu.
3. In the Name field, enter the new checkpoint name.
4. Click . The name of the checkpoint object will be updated within the script.
Example:
Browser("Google").Page("Google").WebEdit("Search").Check CheckPoint("Search")‏

Note:
You must use the QTP user interface to change the name of the checkpoint. If you manually change the name of the checkpoint in the script, QTP will generate an error during replay. The error message will be similar to the following:

"The "" CheckPoint object was not found in the Object Repository. Check the Object Repository to confirm that the object exists or to find the correct name for the object."

The CheckPoint object is not a visible object within the object repository, so if you manually modify the name, you may need to recreate the checkpoint to resolve the error.

11# Does QuickTest Professional support Internet Explorer 7.0?
QuickTest Professional 9.1 and above
QuickTest Professional 9.1 and above supports Microsoft Internet Explorer 7.0 Beta 3. Internet Explorer version 7.0 is now certified to work and to be tested with QTP9.1 and above.


QuickTest Professional 9.0
QuickTest Professional 9.0 supports Internet Explorer 7.0 Beta 2.


QuickTest Professional 8.2 and below
QuickTest Professional 8.2 and below do not include support for Internet Explorer 7.0.

Does QuickTest Professional support Firefox?


QuickTest Professional 9.1 and above:
QuickTest Professional 9.1 provides replay support for Mozilla Firefox 1.5 and Mozilla Firefox 2.0 Alpha 3 (Alpha-level support for Bon Echo 2.0a3).
Notes:

QuickTest Professional 9.1 will not record on Firefox. You can record a test on Microsoft Internet Explorer and run it on any other supported browser, such as Firefox.

The .Object property for web objects is not supported in Firefox.

12# How to check if a dropdown item contains some values?

Here we have a dropdown list named Items which contains 3 items :Item1, Item2 and Item3. We want to check if Item3 is there in the dropdown or not.

str_ItemType=Browser("..").Page("..").WebList("lst_itemType").
GetROProperty("all items") str_ItemType1=Instr(str_ItemType,"Item4")‏

If str_ItemType1=0 Then

Reporter.ReportEvent 0,"Item Type","Verify that Items dropdown list does not contains Item4"

Else
Reporter.ReportEvent 1,"Item Type","Verify that Items dropdown list does not contains Item4"

13# What is the lservrc file in QTP?
The lservrc file contains the license codes that have been installed

The lservrc file contains the license codes that have been installed. Whenever a new license is created, the license code is automatically added to this file. The lservrc file is a text file, with no extension.

File Location:
1) For a Concurrent (Floating) license installation:

"#server installation directory#\#language#"

Example:
C:\Program Files\XYZ Technologies\ABC Server\English\lservrc

2) For a Seat (Stand-alone) license installation:

#AQT/QTP installation directory#\bin"

Example:
C:\Program Files\Mercury Interactive\QuickTest Professional\Bin\lservrc

14# What to do if you are not able to run QTP from quality center?
This is for especially for newbie with QTP.
Check that you have selected Allow other mercury products to run tests and components from Tools--> Options--> Run Tab.

15# Does QuickTest Professional support Macintosh operating systems?
No, QTP is not expected to run on this OS.

QTP Customised Result Reports

Below is the code for creating a customised entry in the results:

 

' Example usage
CustomReportEntry micFail, "Custom Report Example", "<DIV align=left>This is a <b>custom</b> report entry!</DIV>"

' =============================================================
' function: CustomReportEntry
' desc : Creates a customized entry in the result file, you
' can use standard HTML tags in the message.
' params : strStatus is the result, micPass, micFail etc
' strStepName is the name of the step
' strMessage is the failure message, this can contain
' html tags
' returns : Void
' =============================================================
Function CustomReportEntry(strStatus, strStepName, strMessage)

' create a dictionary object
Set objDict = CreateObject("Scripting.Dictionary")

' set the object properties
objDict("Status") = strStatus
objDict("PlainTextNodeName") = strStepName
objDict("StepHtmlInfo") = strMessage
objDict("DllIconIndex") = 206
objDict("DllIconSelIndex") = 206
objDict("DllPAth") = "C:\Program Files\Mercury Interactive\QuickTest Professional\bin\ContextManager.dll"

' report the custom entry
Reporter.LogEvent "User", objDict, Reporter.GetContext

End Function 'CustomReportEntry

QTP Script ARRAY Basics

Array Basics

Some basic info about creating and using arrays.

' The easiest way create an array is to simply declare it as follows
Dim strCustomers()

' Another method is to define a variable and then set it as an array afterwards
Dim strStaff
strStaff = Array("Alan","Brian","Chris")

' Yet another way is to use the split command to create and populate the array
Dim strProductArray
strProductArray = "Keyboards,Laptops,Monitors"
strProductArray = Split(strProductArray, ",")

' To itterate through the contents of an array you can use the For Each loop
Dim strItem
For Each strItem In strProductArray
MsgBox strItem
Next

' This will also itterate through the loop
Dim intCount
For intCount = LBound(strProductArray) To UBound(strProductArray)
Msgbox strProductArray(intCount)
Next

' This will itterate through the array backwards
For intCount = UBound(strProductArray) To LBound(strProductArray) Step -1
Msgbox strProductArray(intCount)
Next


' To add extra data to an array use Redim Preserve
Redim Preserve strProductArray(3)
strProductArray(3) = "Mice"

' To store the contents of an array into one string, use Join
Msgbox Join(strProductArray, ",")

' To delete the contents of an array, use the Erase command
Erase strProductArray

QTP object identification

Object Identification: -
QTP’s object identification concept is based on 4 types of properties and an ordinal identifier.
Types of properties:
• Mandatory properties
• Assistive properties
• Base Filter properties
• Optional Filter properties
A test engineer can specify list of mandatory properties, assistive properties, base filter properties, optional filter properties and ordinal identifier.

QTP will learn the information in the following way: -
First of all QTP will learn all the specified mandatory properties and then think whether these properties are sufficient to identify the object uniquely. If it feels sufficient it will stop learning. Otherwise it will learn the 1st assistive property. Then once again think whether all the properties are sufficient for identifying the object uniquely. If at all it feels sufficient it will stop learning otherwise it will learn the 2nd assistive property and then think again whether all these properties are sufficient for identifying the object uniquely. This process continues till the QTP get satisfied or up to the end of the assistive properties list.


If still QTP feels not satisfied then finally it will learn the ordinal identifier. All the properties learnt during this process will be stored in the object repository.
If at all the smart identification option is selected then the QTP will learn the base filter properties, optional filter properties along with the mandatory properties and stores the base filter properties and optional filter properties separately and secretly and then continues with the same procedure as above.


QTP uses the learnt information in the following way to identify the object: -
First of all QTP will use all the properties present in the object repository except ordinal identifier and tries to identify the object. If it fails then it will enter into the smart brain by forgetting about all the properties present in the object repository and then considers all the base filter properties and try to match with all the objects in the AUT. The objects that are matched with all these properties are formed as a list and if the list is containing only one object then that is the object. Otherwise it will take the support of first optional filter property and try to match with the objects in the list. Whatever the objects that are matched with this property will be formed as a new list and if the list contains only one object then that is the object. Otherwise it will take the support of 2nd optional filter property and try to match with all the properties in the new list. This procedure continues till the list contains one object or up to the end of the optional filter properties list.


If still the QTP is unable to identify the object then it will go to the object repository and if at all the ordinal identifier is available in the object repository then it will identify the object roughly using the ordinal identifier.
Smart Identification: - Smart Identification is a mechanism provided by QTP, which is used for identifying the objects even though some properties are dynamically changed.


Ordinal Identifiers: - There are 3 types of ordinal identifiers.
1. Location
2. Index
3. Creation Time


1. Location: If at all the Location is selected as an ordinal identifier then the QTP will generate the sequence of numbers from 0,1,2,… based on the sequence of the objects located in the application.
2. Index: If at all the index is selected as an ordinal identifier then the QTP will generate the sequence of numbers from 0,1,2,… based on the sequence of the programs of the corresponding objects.
3. Creation time: If at all the creation time is selected as an ordinal identifier then the QTP will generate the sequence of numbers from 0,1,2,... based on the loading time of a web page.

VB scripts basics for QTP

What is VBScript?

  • VBScript is a scripting language
  • A scripting language is a lightweight programming language
  • VBScript is a light version of Microsoft's programming language Visual Basic

How Does it Work?

When a VBScript is inserted into a HTML document, the Internet browser will read the HTML and interpret the VBScript. The VBScript can be executed immediately, or at a later event.

How to Put VBScript Code in an HTML Document



<html>
<head>
</head>
<body>
<script type="text/vbscript">
document.write("Hello from VBScript!")
</script>
</body>
</html>


Download the Complete VB script Tutorial for QTP


InStr Returns the position of the first occurrence of one string within another. The search begins at the first character of the string


InStrRev Returns the position of the first occurrence of one string within another. The search begins at the last character of the string


LCase Converts a specified string to lowercase


Left Returns a specified number of characters from the left side of a string


Len Returns the number of characters in a string


LTrim Removes spaces on the left side of a string


RTrim Removes spaces on the right side of a string



Trim Removes spaces on both the left and the right side of a string



Mid Returns a specified number of characters from a string



Replace Replaces a specified part of a string with another string a specified number of times



Right Returns a specified number of characters from the right side of a string



Space Returns a string that consists of a specified number of spaces



StrComp Compares two strings and returns a value that represents the result of the comparison



String Returns a string that contains a repeating character of a specified length



StrReverse Reverses a string



UCase Converts a specified string to uppercase



Other Functions


Function


CreateObject Creates an object of a specified type


Eval Evaluates an expression and returns the result


GetLocale Returns the current locale ID



GetObject Returns a reference to an automation object from a file



GetRef Allows you to connect a VBScript procedure to a DHTML event on your pages



InputBox Displays a dialog box, where the user can write some input and/or click on a button, and returns the contents



IsEmpty Returns a Boolean value that indicates whether a specified variable has been initialized or not



IsNull Returns a Boolean value that indicates whether a specified expression contains no valid data (Null)



IsNumeric Returns a Boolean value that indicates whether a specified expression can be evaluated as a number



IsObject Returns a Boolean value that indicates whether the specified expression is an automation object



LoadPicture Returns a picture object. Available only on 32-bit platforms



MsgBox Displays a message box, waits for the user to click a button, and returns a value that indicates which button the user clicked



RGB Returns a number that represents an RGB color value



Round Rounds a number



ScriptEngine Returns the scripting language in use



ScriptEngineBuildVersion Returns the build version number of the scripting engine in use



ScriptEngineMajorVersion Returns the major version number of the scripting engine in use



ScriptEngineMinorVersion Returns the minor version number of the scripting engine in use



SetLocale Sets the locale ID and returns the previous locale ID



TypeName Returns the subtype of a specified variable



VarType Returns a value that indicates the subtype of a specified variable

QTP Interview Questions for Beginners - Part 1

1. What are the Features & Benefits of Quick Test Pro(QTP)..?

1. Key word driven testing
2. Suitable for both client server and web based application
3. VB script as the script language
4. Better error handling mechanism
5. Excellent data driven testing features

 

2. How to handle the exceptions using recovery scenario manager in QTP?

You can instruct QTP to recover unexpected events or errors that occurred in your testing environment during test run. Recovery scenario manager provides a wizard that guides you through the defining recovery scenario. Recovery scenario has three steps
1. Triggered Events
2. Recovery steps
3. Post Recovery Test-Run

3. How to handle the exceptions using recovery scenario manager in QTP?

You can instruct QTP to recover unexpected events or errors that occurred in your testing environment during test run. Recovery scenario manager provides a wizard that guides you through the defining recovery scenario. Recovery scenario has three steps:
1. Triggered Events
2. Recovery steps
3. Post Recovery Test-Run

 

3. What is the use of Text output value in QTP?

Output values enable to view the values that the application talks during run time. When parameterized, the values change for every iteration. Thus by creating output values, we can capture the values that the application takes for each run and output them to the data table.

 

4. How to use the Object spy in QTP?

There are two ways to Spy the objects in QTP
1) Thru file toolbar
---In the File Tool Bar click on the last toolbar button (an icon showing a person with hat).
2) Thru Object repository Dialog
---In Object repository dialog click on the button “object spy...”
In the Object spy Dialog click on the button showing hand symbol.
The pointer now changes in to a hand symbol and we have to point out the object to spy the state of the object
If at all the object is not visible or window is minimized then Hold the Ctrl button and activate the required window to and release the Ctrl button.

 

5. What is the file extension of the code file & object repository file in QTP?

File extension of
-- Per test object rep: - filename.mtr
-- Shared Object rep: - filename.tsr
-- Codes file extension id: - script.mts

 

6. Explain the concept of object repository & how QTP recognizes objects?

Object Repository: displays a tree of all objects in the current component or in the current action or entire test (depending on the object repository mode you selected).
We can view or modify the test object description of any test object in the repository or to add new objects to the repository.
Quick test learns the default property values and determines in which test object class it fits. If it is not enough it adds assistive properties, one by one to the description until it has compiled the unique description. If no assistive properties are available, then it adds a special Ordinal identifier such as objects location on the page or in the source code.

 

7. What are the properties you would use for identifying a browser & page when using descriptive programming?

"Name" would be another property apart from "title" that we can use.
OR
We can also use the property "micClass".
Ex: Browser("micClass:=browser").page("micClass:=page")....

 

8. What are the different scripting languages you could use when working with QTP?

Visual Basic (VB), XML, JavaScript, Java, HTML

 

9 Give example where you have used a COM interface in your QTP project?

COM interface appears in the scenario of front end and back end. for eg:if you r using oracle as back end and front end as VB or any language then for better compatibility we will go for an interface. of which COM will be one among those interfaces. Create object creates handle to the instance of the specified object so that we program can use the methods on the specified object. It is used for implementing Automation(as defined by Microsoft).

 

10. Few basic questions on commonly used Excel VBA functions.

Common functions are:
Coloring the cell
Auto fit cell
Setting navigation from link in one cell to other
Saving

 

11. Explain the keyword create object with an example.

Creates and returns a reference to an Automation object
Syntax: CreateObject(servername.typename [, location])
Arguments
SERVERNAME: Required. The name of the application providing the object
TYPENAME: Required. The type or class of the object to create
LOCATION: Optional. The name of the network server where the object is to be created

 

12. Explain in brief about the QTP Automation Object Model.

Essentially all configuration and run functionality provided via the QTP interface is in some way represented in the QTP automation object model via objects, methods, and properties. Although a one-on-one comparison cannot always be made, most dialog boxes in QTP have a corresponding automation object, most options in dialog boxes can be set and/or retrieved using the corresponding object property, and most menu commands and other operations have corresponding automation methods. You can use the objects, methods, and properties exposed by the QTP automation object model, along with standard programming elements such as loops and conditional statements to design your program.

 

13. How to handle dynamic objects in QTP?

QTP has a unique feature called Smart Object Identification/recognition. QTP generally identifies an object by matching its test object and run time object properties. QTP may fail to recognize the dynamic objects whose properties change during run time. Hence it has an option of enabling Smart Identification, wherein it can identify the objects even if their properties changes during run time.
Check this out-
If QuickTest is unable to find any object that matches the recorded object description, or if it finds more than one object that fits the description, then QuickTest ignores the recorded description, and uses the Smart Identification mechanism to try to identify the object.
While the Smart Identification mechanism is more complex, it is more flexible, and thus, if configured logically, a Smart Identification definition can probably help QuickTest identify an object, if it is present, even when the recorded description fails.
The Smart Identification mechanism uses two types of properties:
Base filter properties—the most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object. For example, if a Web link's tag was changed from to any other value; you could no longer call it the same object. Optional filter properties—other properties that can help identify objects of a particular class as they are unlikely to change on a regular basis, but which can be ignored if they are no longer applicable.

 

14. What is a Run-Time Data Table? Where can I find and view this table?

In QTP, there is data table used, which is used at runtime.
-In QTP, select the option View->Data table.
-This is basically an excel file, which is stored in the folder of the test created, its name is Default.xls by default.

 

15. How does Parameterization and Data-Driving relate to each other in QTP?

To data drive we have to parameterize i.e. we have to make the constant value as parameter, so that in each iteration (cycle) it takes a value that is supplied in run-time data table. Through parameterization only we can drive a transaction (action) with different sets of data. You know running the script with the same set of data several times is not suggestible, & it's also of no use.

 

16. What is the difference between Call to Action and Copy Action.?

Call to Action: The changes made in Call to Action, will be reflected in the original action (from where the script is called).But where as in Copy Action, the changes made in the script, will not affect the original script (Action)

 

17. Discuss QTP Environment.

QuickTest Pro environment using the graphical interface and Active Screen technologies - A testing process for creating test scripts, relating manual test requirements to automated verification features - Data driving to use several sets of data using one test script.

 

18. Explain the concept of how QTP identifies object.

During recording QTP looks at the object and stores it as test object. For each test object QT learns a set of default properties called mandatory properties, and look at the rest of the objects to check whether this properties are enough to uniquely identify the object. During test run, QT searches for the run time objects that match with the test object it learned while recording.

 

19. Differentiate the two Object Repository Types of QTP.

Object repository is used to store all the objects in the application being tested. 2 types of object repository per action and shared. In shared repository only one centralized repository for all the tests, where as in per action for each test a separate per action repository is created.

 

20. What the differences are and best practical application of each.

Per Action: For Each Action, one Object Repository is created.
Shared: One Object Repository is used by entire application

21. Explain what the difference between Shared Repository and Per_Action Repository

Shared Repository: Entire application uses one Object Repository, that similar to Global GUI Map file in WinRunner
Per Action: For each Action, one Object Repository is created, like GUI map file per test in WinRunner

 

22. Have you ever written a compiled module? If yes tell me about some of the functions that you wrote.

I used the functions for capturing the dynamic data during runtime. Function used for Capturing Desktop, browser and pages.

23. What projects have you used WinRunner on? Tell me about some of the challenges that arose and how you handled them.

PBS: WR fails to identify the object in GUI. If there is a non standard window object cannot recognize it, we use GUI SPY for that to handle such situation.

 

24. Can you do more than just capture and playback?

I have done dynamically capturing the objects during runtime in which no recording, no playback and no use of repository is done AT ALL.
-It was done by the windows scripting using the DOM (Document Object Model) of the windows.

 

25. How to do the scripting. Are there any inbuilt functions in QTP as in QTP-S.? What is the difference between them? How to handle script issues?

Yes, there's an in-built functionality called "Step Generator" in Insert->Step->Step Generator -F7, which will generate the scripts as u enter the appropriate steps.

26. What is the difference between check point and output value.

I would like to add some stuff to Kalpana's comments.
It is as follows:-
An outPut value is a value captured during the test run and entered in the run-time but to a specified location.
EX:-Location in Data Table [Global sheet / local sheet]

 

27. IF we use batch testing the result shown for last action only in that how can i get result for every action.

u can click on the icon in the tree view to view the result of every action.

 

28. How the exception handling can be done using QTP

It can be done using the Recovery Scenario Manager which provides a wizard that guides you through the process of defining a recovery scenario. FYI The wizard could be accessed in QTP> Tools-> Recovery Scenario Manager.......

 

29. How many types of Actions are there in QTP?

There are three kinds of actions:
Non-reusable action—an action that can be called only in the test with which it is stored, and can be called only once.
Reusable action—an action that can be called multiple times by the test with which it is stored (the local test) as well as by other tests.
External action—a reusable action stored with another test. External actions are read-only in the calling test, but you can choose to use a local, editable copy of the Data Table information for the external action.

 

30. I want to open a Notepad window without recording a test and I do not want to use SystemUtil.Run command as well. How do I do this?

 

U can still make the notepad open without using the record or System utility script, just by mentioning the path of the notepad "( i.e., where the notepad.exe is stored in the system) in the "Windows Applications Tab" of the "Record and Run Settings window. Try it out.

Managing QTP Test Scripts - QTP Tutorial 2

We can use the File menu to create, open, save, zip, unzip, and print tests, as well as create standalone, portable tests.

This section includes:

  • Creating a New Test
  • Opening an Existing Test
  • Saving a Test
  • Creating Portable Copies of Your Tests
  • Zipping a Test
  • Unzipping a Test
  • Printing a Test

Creating a New QTP Test


    To create a new test, click the New button or select File > New > Test. A new test opens, with a new action selected in the Keyword View. You are ready to start creating your test.

    If the test you select was last saved in an older version of QuickTest, you may be asked whether to convert the test to the current version or view it in read-only format.

    To open an existing test:

  • (Optional) Connect to a Quality Center server and project.
  • Select File > Open > Test, or click the Open down arrow and select Test. The Open Test dialog box opens.
  • In the sidebar, select the location of the test, for example, File System or Quality Center Test Plan.
  • Browse to and select a test. You can select the Open in read-only mode option at the bottom of the dialog box. Click Open. The test opens and the title bar displays the test name.
  • Note: If the test is stored in a version control-enabled Quality Center project, the Open button contains a down arrow, enabling you to open the test and immediately check it out.

    Tip: You can open a recently used test by selecting it from the Recent Files list in the File menu.

Saving a Test


You can save a new test or save changes to an existing test.

Tip: If changes are made to an existing test, an asterisk (*) is displayed in the title bar until the test is saved.

Note: You must use the Save As option in QTP if you want to save a test under another name or create a copy of a test. You cannot copy a test or change its name directly in the file system or in Quality Center.

To save a new test:

  1. (Optional) Connect to a Quality Center server and project. QTP information, see Connecting to and Disconnecting from Quality Center.
  2. Click the Save button or select File > Save to save the test. The Save QTP Test dialog box opens.
  3. In the sidebar, select the location to save the test, for example, File System or Quality Center Test Plan.
  4. Browse to and choose the folder in which to save the test. Note: In the file system, QTP suggests a default folder called Tests. For all supported operating systems except Windows Vista, this folder is located under your QTP Professional installation folder. For Windows Vista, this folder is located under MyDocuments\HP\QTP Professional.
  5. Type a name for the test in the File name box. Note that the test name cannot exceed 220 characters (including the path), cannot begin or end with a space, and cannot contain the following characters: \ / : * ? " < > | % '
    If you save the test to Quality Center, the file path must not contain two consecutive semicolons (;;).
  6. If you are recording and want to save the Active Screen files with your test, confirm that Save Active Screen files is selected. If you clear this box, your Active Screen files will not be saved, and you will not be able to edit your test using the options that are normally available from the Active Screen.
  7. Clearing the Save Active Screen files check box can be especially useful for conserving disk space once you have finished designing the test and you are using the test only for test runs.
  8. Tip: If you clear the Save Active Screen files check box and then later want to edit your test using Active Screen options, you can regenerate the Active Screen information by performing an Update Run operation.

Note: You can also instruct QTP not to capture Active Screen files while recording or to only capture Active Screen information under certain conditions. You can set these preferences in the Active Screen pane of the Options dialog box.

Click Save. QTP displays the test name in the title bar.

To save changes to an existing test:

  1. Click the Save button to save changes to the current test.
  2. Select File > Save As to save an existing test to a new name or a new location. If you select File > Save As, the following options are available:
  • Select or clear the Save Active Screen files check box to indicate whether or not you want to save the Active Screen files with the new test. For more information, see step 6 above.
  • Select or clear the Save test results check box to indicate whether or not you want to save any existing test results with your test.

Note that if you clear this box, your test result files will not be saved, and you will not be able to view them later. Clearing the Save test results check box can be useful for conserving disk space if you do not require the test results for later analysis, or if you are saving an existing test under a new name and do not need the test results.

Creating Portable Copies of QTP Test Scripts


Tests and their resource files are often stored on a network drive or in Quality Center, as this enables the reuse of actions and other resources, and helps ease test management.

Sometimes, you may need to open or run a test when you do not have access to a network drive or Quality Center. For example, you may need to create a portable copy of a test for use when travelling to other sites. You can save a standalone copy of your test and its resource files to a local drive or to another storage device using the File > Save Test with Resources command.

When you save a test in this manner, QTP creates a copy of the following and saves the files in the location you specify:

  • Source test. QTP saves a copy of this test in the location you specify.
  • Resource files. QTP saves a copy of all resource files associated with the source test, such as function libraries and shared object repositories. QTP stores these files in sub-folders of the copied test.
  • Called actions. QTP saves a copy of any external actions called by the source test. For example, if Test A calls actions that are stored in Test B, QTP creates a local copy of the actions stored in Test B and stores them in a sub-folder of Test A. The sub-folder has the same name as the test from which the called actions were copied. In this example, the sub-folder is named Test_B. QTP also creates a copy of any resources associated directly with these actions, such as its local shared object repositories and action sheets in the Data Table. QTP does not, however, save the resource files associated with Test B, so you must ensure that these resources are associated with the source test, Test A.
    This enables you to modify or run the test without access to a network drive or Quality Center.

Tip: If you use QTP with a concurrent license but do not have access to the concurrent license server (for example, during a business trip), you can install a commuter license.

Zipping QTP Test Scripts
QTP tests contain a series of configuration, run-time, setup data, and (optionally) Active Screen files. QTP saves these files together with the test. You can zip these files to conserve space and make the tests easier to transfer.

To zip a test:

  • Do one of the following:
    Select File > Export Test to Zip File to open the Export to Zip File dialog box.
  • Select the Archive test and resource files in a .zip file check box in the Save Test with Resources dialog box (File > Save Test with Resources).
  • Type a zip file name and path, or accept the default name and path, and click OK. QTP zips the test and its associated files.

Unzipping a Test


You can unzip a test when needed.

To unzip a zipped test:

  • Select File > Import Test from Zip File. The Import from Zip File dialog box opens.

  • Enter or select the name of the zip file that you want to unzip, choose a target folder into which you want to unzip the files, and click OK. QTP unzips the test and its associated files.

Print QTP Test Scripts


You can print your entire test from the Keyword View (in table format). You can also print a single action either from the Keyword View (in table format) or the Expert View (in statement format). When printing from the Expert View, you can also specify additional information that you want to be included in the printout.

To print from the Keyword View:

  • Click the Print button or select File > Print. A standard Print dialog box opens.
  • Click OK to print the content of the Keyword View to your default Windows printer.


Tip: You can select File > Print Preview to display the Keyword View on screen as it will look when printed. Note that the Print Preview option works only with tests created using QTP 8.0 and later.

To print from the Expert View

  • Click the Print button or select File > Print. The Print dialog box opens.
  • Specify the print options that you want to use.
    If you want to print to a different printer, or change your printer preferences, click Setup to display the Print Setup dialog box.
  • Click Print to print according to your selections.
  • Go Back to –> QTP Tutorial Learn QTP – Design QTP Scripts

Create QTP Test Scripts – QTP Tutorial 1

You can create tests using the keyword-driven methodology, step recording, or a combination of both. The keyword-driven methodology enables you to select keywords to indicate the operations you want to perform on your application. Step recording enables you to record the operations you perform on your application.

After you create your tests, you can enhance them using checkpoints and other special testing options.

This section includes:

  • About Creating Tests
  • Deciding Which Methodology to Use - Keyword-Driven or Recording
  • Enhancing Your Test
  • Using Relative Paths in QTP

About Creating Tests


You can create tests using the keyword-driven methodology, step recording, or a combination of both.

Creating tests using the keyword-driven methodology requires an infrastructure for all of the required resources. Resources include shared object repositories, function libraries, and recovery scenarios. Setting up the infrastructure requires in-depth knowledge of your application and a high level of QTP expertise.

Although setting up the infrastructure may initially require a longer time-investment in comparison to recording tests, using the keyword-driven methodology enables you to create tests at a more application-specific level and with a more structured design. This enables you to maintain your tests more efficiently and provides you with more flexibility than a recorded test.

In some cases, you may want to let QTP generate test steps by recording the typical processes that you perform on your application. As you navigate through your application, QTP graphically displays each step you perform as a row in the Keyword View. A step is anything a user does that changes the content of a page or object in your application, for example, clicking a link or typing data into an edit box. Recording may be easier for new QTP users or when beginning to design tests for a new application or a new feature.

While creating your test, you can insert checkpoints. A checkpoint compares the value of an element captured when the object was saved in the object repository, with the value of the same element captured during the run session. This helps you determine whether or not your application is functioning correctly.

When you test your application, you may want to check how it performs the same operations with different data. This is called parameterizing your test. You can supply data in the Data Table, define environment variables, instruct QuickTest to generate random numbers, and so on.

Deciding Which Methodology to Use - Keyword-Driven or Recording


You can create the steps in your tests using the keyword-driven methodology, recording, or a combination of both.

Recording Tests
Recording can be useful in the following situations:

  • Recording helps novice QTP users learn how QTP interprets the operations you perform on your application, and how it converts them to QTP objects and built-in operations.
  • Recording can be useful for more advanced QTP users when working with a new application or major new features of an existing application (for the same reasons described above). Recording is also helpful while developing functions that incorporate built-in QTP keywords.
  • Recording can be useful when you need to quickly create a test that tests the basic functionality of an application or feature, but does not require long-term maintenance.

Creating Tests Using Keyword-Driven Testing


Keyword-driven testing advantages include the following:

  • Keyword-driven testing enables you to design your tests at a business level rather than at the object level. For example, QTP may recognize a single option selection in your application as several steps: a click on a button object, a mouse operation on a list object, and then a keyboard operation on a list sub-item. You can create an appropriately-named function to represent all of these lower-level operations in a single, business-level keyword.
  • By incorporating technical operations, such as a synchronization statement that waits for client-server communications to finish, into higher level keywords, tests are easier to read and easier for less technical application testers to maintain when the application changes.
  • Keyword-driven testing naturally leads to a more efficient separation between resource maintenance and test maintenance. This enables the automation experts to focus on maintaining objects and functions while application testers focus on maintaining the test structure and design.
  • When you record tests, you may not notice that new objects are being added to the local object repository. This may result in many testers maintaining local object repositories with copies of the same objects. When using a keyword-driven methodology, you select the objects for your steps from the existing object repository. When you need a new object, you can add it to your local object repository temporarily, but you are also aware that you need to add it to the shared object repository for future use.
  • When you record a test, QTP enters the correct objects, methods, and argument values for you. Therefore, it is possible to create a test with little preparation or planning. Although this makes it easier to create tests quickly, such tests are harder to maintain when the application changes and often require re-recording large parts of the test.
  • When you use a keyword-driven methodology, you select from existing objects and operation keywords. Therefore, you must be familiar with both the object repositories and the function libraries that are available. You must also have a good idea of what you want your test to look like before you begin inserting steps. This usually results in well-planned and better-structured tests, which also results in easier long-term maintenance.
  • Automation experts can add objects and functions based on detailed product specifications even before a feature has been added to a product. Using keyword-driven testing, you can begin to develop tests for a new product or feature earlier in the development cycle.
  • Enhancing Your Test


    You can use a variety of options to enhance your existing tests. This section describes some of the ways in which you can enhance your existing tests.

    Checkpoints
    You can add checkpoints to your test. A checkpoint is a step in your test that compares the a specified item during a run session with the values stored for the same item within the test. This enables you to identify whether or not your application is functioning correctly. There are several different checkpoint types.

    Tip: You can also use the CheckProperty method, which enables you to verify the property value of an object without using the checkpoint interface.

Parameterization
You can parameterize your test to replace fixed values with values from an external source during your run session. The values can come from a Data Table, environment variables you define, or values that QTP generates during the run session.

Output Values
You can retrieve values from your test and store them in the Data Table as output values. You can subsequently use these values as an input parameter in your test. This enables you to use data retrieved during a test in other parts of the test.

Actions
You can divide your test into actions to streamline the testing process of your application.

Programming Statements


You can use special QTP options to enhance your test with programming statements. The Step Generator guides you step-by-step through the process of adding recordable and non-recordable operations (methods and properties) to your test. You can also synchronize your test to ensure that your application is ready for QTP to perform the next step in your test, and you can measure the amount of time it takes for your application to perform steps in a test by defining and measuring transactions.

You can also manually enter standard VBScript statements, as well as statements using QTP test objects and operations, in the Expert View

Using Relative Paths in QTP

QTP enables you to define the path to a resource that you are adding to the file system or to Quality Center, as a relative or an absolute path.

Note: If you are working with the Resources and Dependencies model with Quality Center 10.00, specify an absolute Quality Center path.

When you specify a path to a function library, shared object repository, recovery scenario, or environment variable file, QTP checks if the path, or the initial part of the path, exists in the Folders pane of the Options dialog box (Tools > Options > Folders node). The Folders pane contains a search list in which you can define where QTP searches for tests, actions, or files.

QTP then opens one of the following two dialog boxes, depending on whether the path you specified, or a part of the path, exists in the Folders pane.

Note: If you are connected to QualityCenter 10.00, these dialog boxes are displayed only if you select a path in the file system or in a QualityCenter 9.x project.

Notes:

You can choose not to show one or both of these dialog boxes when you enter a path to a resource by selecting the Do not show this message again check box. To show these dialog boxes again, select the Remind me to use relative paths when specifying a path to a resource check box in the Folders pane of the Options dialog box. This check box is selected by default when you first start QTP.


Go Back to-> QTP Tutorial Learn QTP – Design QTP Scripts

QTP Tutorial Learn QTP – Design QTP Scripts

This section contains the following:

Section 1: Theoretical tutorials

Section 2: Practical Tutorials
Site is under construction. We will update this section soon.

QTP Testing process

The QTP (QuickTest Professional) testing process consists of the following main phases:

1. Analyzing your application
The first step in planning your test is to analyze your application to determine your testing needs.

 

  • What are your application's development environments (for example Web, Java, or .NET)? You will need load QTP add-ins for these environments to enable QTP to identify and work with the objects in your application.
  • What business processes and functionality do you want to test? To answer this, think about the various activities that customers perform in your application to accomplish specific tasks.
  • Consider how to divide these business processes into smaller units. You will be creating actions based on these tasks. Smaller and more modular actions make your tests easier to read and follow, and help ease maintenance in the long run.

  • At this stage, you can already begin creating test skeletons and adding actions to them.

 

2. Preparing the testing infrastructure
Based on your testing needs, you determine what resources are required and create these resources, accordingly. Resources include shared object repositories containing test objects (which are representations of the objects in your application), function libraries containing functions that enhance QTP functionality, and so on.

 

You also need to configure QTP settings so that QTP will perform the tasks you need, such as displaying a results report every time you run a test.

 

3. Building your tests and adding steps to them
After the testing infrastructure is ready, you can begin building your tests. You can create one or more empty tests and add actions to them to create the testing skeletons. You associate your object repositories with the relevant actions, and associate your function libraries with the relevant tests, so that you can insert steps using keywords. You may also need to configure test preferences at this point.

 

4. Enhancing your test
Inserting checkpoints into your test lets you search for a specific value of a page, object, or text string, which helps you determine whether your application is functioning correctly.

Broadening the scope of your test, by replacing fixed values with parameters, lets you check how your application performs the same operations with multiple sets of data.

Adding logic and conditional or loop statements enables you to add sophisticated checks to your test.

 

5. Debugging, running, and analyzing your test
You debug a test to ensure that it operates smoothly and without interruption. After the test is working correctly, you run it to check the behaviour of your application. While running, QTP opens the application and performs each step in your test.

You examine the test results to pinpoint defects in your application.

6. Reporting defects
If you have Quality Center installed, you can report the defects you discover to a database. Quality Center is the HP test management solution.

RegisterUserFunc statement in QTP

You can use the RegisterUserFunc statement to instruct QuickTest to use your user-defined function as a method of a specified test object class for the duration of a test run, or until you unregister the method.

Note: If you call an external action that registers a method (and does not unregister it at the end of the action), the method registration remains in effect for the remainder of the test that called the action.

To register a user-defined function as a test object method, use the following syntax:

RegisterUserFunc TOClass, MethodName, FunctionName, SetAsDefault

 

 

Item

Description

TOClass

Any test object class.
Note: You cannot register a method for a QuickTest reserved object (such as DataTable, Environment, Reporter, and so forth).

MethodName The name of the method you want to register (and display in QuickTest, for example, in the Keyword View and IntelliSense). If you enter the name of a method already associated with the specified test object class, your user-defined function overrides the existing method. If you enter a new name, it is added to the list of methods that the object supports.
FunctionName The name of the user-defined function that you want to call from your test. The function can be located in your test or in any associated function library.
SetAsDefault

Indicates whether the registered function is used as the default method for the test object.
When you select a test object in the Keyword View or Step Generator (tests only), the default method is automatically displayed in the Operation column (Keyword View) or Operation box (Step Generator) (tests only).

Tip: If the function you are registering is defined in a function library, it is recommended to include the RegisterUserFunc statement in the function library as well so that the method will be immediately available for use in any test using that function library.

 

For example, suppose that the Find Flights Web page contains a Country edit box, and by default, the box contains the value USA. The following example registers the Set method to use the MySet function to retrieve the default value of the edit box before the new value is entered.

Function MySet (obj, x)

       dim y

       y = obj.GetROProperty("value")

       Reporter.ReportEvent micDone, "previous value", y

       MySet=obj.Set(x)

End Function

RegisterUserFunc "WebEdit", "Set", "MySet"

Browser("MercuryTours").Page("FindFlights").WebEdit("Country").Set "Canada"

Tips for Working with User-Defined Functions in Qtp

When working with user-defined functions in QTP, consider the following tips and guidelines:

  • For an in-depth view of the required syntax, you can define a function using the Function Definition Generator and experiment with the various options.
  • When you register a function, it applies to an entire test object class. You cannot register a method for a specific test object.
  • If you want to call a function from additional test objects, you can copy the RegisterUserFunc line, paste it immediately after another function and replace any relevant argument values.
  • It is recommended to include the RegisterUserFunc statement in the function library so that the method will be immediately available for use in any component using that function library.
  • To use an Option Explicit statement in a function library associated with your component, you must include it in all the function libraries associated with the component. If you include an Option Explicit statement in only some of the associated function libraries, QTP ignores all the Option Explicit statements in all function libraries.
  • Each function library must have unique variables in its global scope. If you have two associated function libraries that define the same variable in the global scope using a Dim statement or define two constants with the same name, the second definition causes a syntax error. If you need to use more than one variable with the same name in the global scope, include a Dim statement only in the last function library (since function libraries are loaded in the reverse order).
  • By default, steps that use user-defined functions are not displayed in the test results tree of the Test Results window after a run session. If you want the function to appear in the test results tree, you must add a Reporter.ReportEvent statement to the function code. For example, you may want to provide additional information or to modify the component status, if required.
  • If you delete a function in use from an associated function library, the component step using the function will display the “?” icon. In subsequent run sessions for the component or business process test, an error will occur when the step using the non-existent function is reached.
  • If another user modifies a function library that is referenced by a component, or if you modify the function library using an external editor (not QTP), the changes will take effect only after the component is reopened.
  • When more than one function with the same name exists in the function library, the last function will always be called. To avoid confusion, make sure that you verify that within the resources associated with an application area or component, each function has a unique name.
  • You can re-register the same method to use different user-defined functions without first unregistering the method. However, when you do unregister the method, it resets to its original QTP functionality (or is cleared completely if it was a new method), and not to the previous registration.
  • For example, suppose you enter the following statements:
  • RegisterUserFunc "Link", "Click", "MyClick"

    RegisterUserFunc "Link", "Click", "MyClick2"

    UnRegisterUserFunc "Link", "Click"

    After running the UnRegisterUserFunc statement, the Click method stops using the functionality defined in the MyClick2 function, and returns to the original QTP Click functionality, and not to the functionality defined in the MyClick function.

Run QTP Scripts at Scheduled Time

This article discusses how to run QTP scripts in the Scheduled Tasks item in Control Panel. By this method you can schedule individual script or multiple scripts and scripts will run automatically (even when you not at desk):

1. Create a sample QTP Test script. Save it as Testscript in the following location:

C:\Documents and Settings\skalra\Desktop\testscript

2. Create a .vbs file in notepad or in any other script editor to launch QTP with required settings, add-ins etc:
Here is a sample VB script code:

Set qt App = CreateObject("QuickTest.Application")

qtApp.Launch

qtApp.Visible = True

qtApp.Open "C:\Documents and Settings\skalra\Desktop\testscript" 'this is the location of test scripts
Set qtTest = qtApp.Test

Set objResultsOptions = CreateObject("QuickTest.RunResultsOptions")

objResultsOptions.ResultsLocation = strPathname & getTimestamp() 'Suppose you have a function that returns you the timestamp

qtTest.Save

qtTest.Run objResultsOptions

qtTest.Close

qtApp.Quit


Copy the code into notepad and save the file as QTPschedule1.vbs

3. Schedule the QTP:
– Go to Windows “Control Panel” -> “Scheduled Tasks”.
– Click on “Add Scheduled Task” in the “Scheduled Tasks”
– This will start the “Scheduled Tasks Wizard”.
– browse the .vbs file where u placed.
– after selecting, click on the proceed button & select the schedule as u want.

Opening scheduled tasks to modify them
To modify a scheduled task, click Start, click All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks. The Scheduled Tasks window opens so that you can modify the settings.

Stopping and pausing scheduled tasks

* To stop a running task, right-click the task in the Scheduled Tasks window, and then click End Task. It may take a moment or two for the task to stop. To restart the task, right-click the task and then click Run.
* To pause the task scheduler so that no tasks run until you want them to, click Pause Task Scheduler on the Advanced menu. To permit tasks to run again, click Continue Task Scheduler on the Advanced menu.

NOTE: If you click Pause, the task will run at its next scheduled time.