QTP New Feature Version 10.0

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 23

QTP Environment variable

The variables that are commonly used across the environment in many tests by different
resources are know as Environment Variables.

There are Two types of Environment variables

1. Built-in-variables

2. User Defined Variables

1.Built-in-variables :- These variables will be by default available in every test and can
be directly used in any test with help of following syntax.

Syntax: Environment.value(“Built-in-variables”)

Example :

var=environment.Value("OS") : to display the Operating System

msgbox var

2. User Defined Variables :- The variables which are required commonly in number of
test apart from the Built-in-variables need to be created by the user which are known as
User Defined Variables.

User Defined Variables are created in environment file, any body in that environment can
Associate this file and use the variables in it.

There are Two types of User Defined Variables

i. Internal User Defined Variables : These Variables are used in the same file. See
below example:

• Open the Cal application


• Put the tool under recording mode
• Capture the objects properties of Cal application to Object Repository
• Stop recording

Steps for Declaring the Environment Variables in QTP:

• Activate the menu item Test


• Go to Settings
• Select the Environment tab
• Select variable type as User-defined
• Click on New button
• Add new Environment window will appear
• Give the details of Name and value ( type will be Internal )
• Click on OK
• Again Click on New button to add one more variable
• Add new Environment window will appear
• Give the details of Name and value ( type will be Internal )
• Click on OK
• Click on Apply
• Click on OK
• If you want you can Export these data to a a file with .xml extension file in the
Environment folder

Associating the Environment Variables ( by parameterizing)

• Develop the script in test pane as below:

' Setting the declered environment value (a ) to value1 edit button

VbWindow("Form1").VbEdit("val1").Set environment.Value("a")

' Setting the declered environment value (b ) to value2 edit button

VbWindow("Form1").VbEdit("val2").Set environment.Value("b")

' clicking on ADD button

VbWindow("Form1").VbButton("ADD").Click

• Run the test


• Analyze the results

ii. External User Defined Variables :- which are Imported from other file. See below
example (Proceed step by step):

• Open the Cal application


• Put the tool under recording mode
• Capture the objects properties of Cal application to Object Repository
• Stop recording

Declaring the Environment Variables:

• Activate the menu item Test


• Go to Settings
• Select the Environment tab
• Select variable type as User-defined
• Select the check box of ‘load variables and values from an external file’

If you want you can make use of Exported data or you can create your own data in a file
with .xml extention file in the Environment folder

• Browse that file


• Click on Apply
• Click on OK

Associating the Environment Variables ( by parameterizing )

• Develop the script in test pane as below

' Setting the declered environment value (a ) to value1 edit button

VbWindow("Form1").VbEdit("val1").Set environment.Value("a")

' Setting the declered environment value (b ) to value2 edit button

VbWindow("Form1").VbEdit("val2").Set environment.Value("b")

' clicking on ADD button

VbWindow("Form1").VbButton("ADD").Click

• Run the test


• Analyze the results

Simple code to vadilate all the links of web page(DP and child object)

‘***********************************************************************

‘SCENARIO NAME :Check all links


‘DESCRIPTION :This code Check all links in any web page
‘PRECONDITIONS :This Assume that when click on Link the new page will open on
current window but not in new window
‘AUTHOR :Mohan kumar
‘***********************************************************************

Set oDesc = Description.Create()


‘ Retrieve HTML tag
oDesc(”html tag”).Value = “A”
Set rc = Browser(”title:=.*”).Page(”title:=.*”).ChildObjects(oDesc)
num = rc.Count() ’get the number of link in a page
For i=0 to num-1
Set rc = Browser(”title:=.*”).Page(”title:=.*”).ChildObjects(oDesc)
ref = rc(i).GetROProperty(”href”) ’get the “href”propety of the i th link
Browser(”title:=.*”).Page(”title:=.*”).link(”text:=.*”,”index:=”&i).click ’click on i th
link
Browser(”title:=.*”).sync
title1=Browser(”title:=.*”).getRoproperty(”title”) ’get the tile of the target page
MsgBox title1
Browser(”title:=.*”).navigate(ref)’Navigates to the url taken from “href” property
Browser(”title:=.*”).sync
title2=Browser(”title:=.*”).getRoproperty(”title”)’get the tile of the tNavigated page
MsgBox title2
If title1=title2 Then’condition to check for the targetted page and Navigated page
Reporter.ReportEvent 0, “Navigated To Correct Page”,”"&title1′Reports if correct
else
Reporter.ReportEvent 1,”"&title1,”"&title2
End If
Browser(”title:=.*”).back’Navigates back to main page
Browser(”title:=.*”).sync

Count number of links and objects in web page by child method objects

To count the number of links in a web page, We can use ChildObjects to get the link
collection, then retrieve the properties for example number of links or any other objects
on page.

Dim oDesc, oAllLinks, iNumberOfLinks


set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set oAllLinks = Browser("creationtime:=0").
Page("micclass:=Page").ChildObjects(oDesc)
iNumberOfLinks = aAllLinks.Count
msgbox iNumberOfLinks

QTP script to send Keyboard Input to an Application

Sending Keyboard Input to an Application

The example below uses the PressKey method to send keyboard input to an application.

'An example that presses a key using DeviceReplay.

Set obj = CreateObject("Mercury.DeviceReplay")


Window("Notepad").Activate

obj.PressKey 63

The PressKey method uses the ASCII value for the key.
63 is the ASCII value for F5.

ASCII values for other keys:


F1 - 59
F2 - 60
F3 - 61
F4 - 62
F5 - 63
F6 - 64
F7 - 65
F8 - 66
F9 - 67
F10 - 68
F11 - 87
F12 – 88

QTP script for Message Boxes That Close Automatically

Using Message Boxes That Close Automatically

The function below shows a message box that disappears after the specified timeout (in
seconds). The script execution then continues.

Public Sub MsgBoxTimeout (Text, Title, TimeOut)

Set WshShell = CreateObject("WScript.Shell")

WshShell.Popup Text, TimeOut, Title

End Sub

If TimeOut is 0, it behaves just like a normal message box. If TimeOut is greater than 0,
the dialog box disappears after the specified number of seconds.

Note: When you are using this code.


Don't use Msgbox separately and MsgBoxTimeout separately. It should be used only
once.
What ever you want in msgbox should be 'text' for MsgBoxTimeout.
E.g. MsgBoxTimeout variable name , ""(if title is blank), 2
QTP script Debugging using file operations

The following are some file operations which are useful for debugging scripts in QTP.
The following examples can be downloaded from here.

' Creates a specified file and returns a TextStream object that can be used to read from or
write to the file.

' Example of usage:

' Set f = CreateFile("d: emp\beenhere.txt", True)

' f.WriteLine Now

' f.Close

Function CreateFile(sFilename, bOverwrite)

Set fso = CreateObject("Scripting.FileSystemObject")

Set CreateFile = fso.CreateTextFile(sFilename, bOverwrite)

End Function

' Opens a specified file and returns a TextStream object that can be used to read from,
write to, or append to the file.

' iomode: 1 - ForReading, 2 - ForWriting, 8 - ForAppending

' Example of usage

' Set f = OpenFile("d: emp\beenhere.txt", 2, True)

' f.WriteLine Now

' f.Close

Function OpenFile(sFilename, iomode, create)

Set fso = CreateObject("Scripting.FileSystemObject")

Set OpenFile = fso.OpenTextFile(sFilename, iomode, create)

End Function
' Appends a line to a file.

' Example of usage:

' AppendToFile "d: emp\beenhere.txt", Now

Function AppendToFile(sFilename, sLine)

Const ForAppending = 8

If sFilename = "" Then

sFilename = Environment("SystemTempDir") & "\QTDebug.txt"

End If

Set f = OpenFile(sFilename, ForAppending, True)

f.WriteLine sLine

f.Close

End Function

' Writes a line to a file.

' Destroys the current content of the file .

' Example of usage:

' WriteToFile "d: emp\beenhere.txt", Now

Function WriteToFile(sFilename, sLine)

Const ForWriting = 2

If sFilename = "" Then

sFilename = Environment("SystemTempDir") & "\QTDebug.txt"

End If

Set f = OpenFile(sFilename, ForWriting, True)

f.WriteLine sLine
f.Close

End Function

QTP script Normalizing strings

The NormalizeString function receives a string and returns the equivalent string in a
regular expression.

Function NormalizeString(OrgStr)

Dim TempStr

TempStr = Replace(OrgStr, "\", "\\")

TempStr = Replace(TempStr, "*", "\*")

TempStr = Replace(TempStr, "+", "\+")

TempStr = Replace(TempStr, ".", "\.")

NormalizeString = Replace(TempStr, "?", "\?")

End function

msgbox NormalizeString ("a+b*c.d?e")

Considrations for debugging tests and function libraries in QTP

You must have the Microsoft Script Debugger installed to run tests in debug mode. If it is
not installed, you can use the QuickTest Additional Installation Requirements Utility to
install it. (Select Start > Programs > QuickTest Professional > Tools > Additional
Installation Requirements.)

While the test and function libraries are running in debug mode, they are read-only. You
can modify the content after you stop the debug session (not when you pause it). If
needed, you can enable the function library for editing (File > Enable Editing) after you
stop the session. For more information, see Editing a Read-Only Function Library. After
you implement your changes, you can continue debugging your test and function
libraries.

If you perform a file operation (for example, you open a different test or create a new
test), the debug session stops.
If a file is called using an ExecuteFile statement, you cannot debug the file or any of the
functions contained in the file. In addition, when debugging a test that contains an
ExecuteFile statement, the execution marker may not be displayed correctly.

In QuickTest, when you open a test, QuickTest creates a local copy of the external
resources that are saved to your Quality Center project. Therefore, any changes you apply
to any external resource that is saved in your Quality Center project, such as a function
library, will not be recognized in the test until the test is closed and reopened. (An
external resource is any resource that can be saved separately from the test, such as a
function library, a shared object repository, or a recovery scenario.)

In contrast with this, any changes you apply to external resources saved in the file
system, such as function libraries, are implemented immediately, as these files are
accessed directly and are not saved as local copies when you open your test.

Debugging QTP Tests and Function Libraries

About Debugging Tests and Function Libraries

After you create a test or function library (including registered user functions), you
should check that they run smoothly, without errors in syntax or logic. To debug a
function library, you must first associate it with a test and then debug it from that test.

QuickTest Professional provides different options that you can use to detect and isolate
defects in a test or function library. For example:

You can control the run session using the Pause command, breakpoints, and various step
commands that enable you to step into, over, and out of a specific step.

If QTP displays a run error message during a run session, you can click the Debug button
on the error message to suspend the run and debug the test or function library.

When a run session is paused (suspended), you can use the Debug Viewer to check and
modify the values of VBScript objects and variables and to manually run VBScript
commands.

You can use the Debug from Step command to begin (and pause) your debug session at a
specific point in your test. You can also use the Run to Step command to pause the run at
a specific point in your test. You can set breakpoints, and then enable and disable them as
you debug different parts of your test or function library.

You can also use the Run from Step command to run your test from a selected step. This
enables you to check a specific section of your application or to confirm that a certain
part of your test or function library runs smoothly.
Programming the Filesystemobject in QTP

To program with the FileSystemObject (FSO) object model:

Use the CreateObject method to create a FileSystemObject object.

Use the appropriate method on the newly created object.

Access the object's properties.

The FSO object model is contained in the Scripting type library, which is located in the
Scrrun.dll file. Therefore, you must have Scrrun.dll in the appropriate system directory on
your Web server to use the FSO object model.

Creating a FileSystemObject Object

First, create a FileSystemObject object by using the CreateObject method.

The following code displays how to create an instance of the FileSystemObject:

[VBScript]
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
[JScript]
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject");

In both of these examples, Scripting is the name of the type library and FileSystemObject
is the name of the object that you want to create. You can create only one instance of the
FileSystemObject object, regardless of how many times you try to create another.

Using the Appropriate Method

Second, use the appropriate method of the FileSystemObject object. For example, to
create a new object, use either CreateTextFile or CreateFolder (the FSO object model
doesn't support the creation or deletion of drives).

To delete objects, use the DeleteFile and DeleteFolder methods of the FileSystemObject
object, or the Delete method of the File and Folder objects. You can also copy and move
files and folders, by using the appropriate methods.

Accessing Existing Drives, Files, and Folders


To gain access to an existing drive, file, or folder, use the appropriate "get" method of the
FileSystemObject object:

GetDrive

GetFolder

GetFile

To gain access to an existing file:

[VBScript]
Dim fso, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.GetFile("c:\test.txt")
[JScript]
var fso, f1;
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fso.GetFile("c:\\test.txt");

Do not use the "get" methods for newly created objects, since the "create" functions
already return a handle to that object. For example, if you create a new folder using the
CreateFolder method, don't use the GetFolder method to access its properties, such as
Name, Path, Size, and so forth. Just set a variable to the CreateFolder function to gain a
handle to the newly created folder, then access its properties, methods, and events.

To set a variable to the CreateFolder function, use this syntax:

[VBScript]
Sub CreateFolder
Dim fso, fldr
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.CreateFolder("C:\MyTest")
Response.Write "Created folder: " & fldr.Name
End Sub
[JScript]
function CreateFolder()
{
var fso, fldr;
fso = new ActiveXObject("Scripting.FileSystemObject");
fldr = fso.CreateFolder("C:\\MyTest");
Response.Write("Created folder: " + fldr.Name);
}

Accessing the Object's Properties


Once you have a handle to an object, you can access its properties. For example, to get
the name of a particular folder, first create an instance of the object, then get a handle to it
with the appropriate method (in this case, the GetFolder method, since the folder already
exists).

Use this code to get a handle to the GetFolder method:

[VBScript]
Set fldr = fso.GetFolder("c:\")
[JScript]
var fldr = fso.GetFolder("c:\\");
Now that you have a handle to a Folder object, you can check its Name property.

[VBScript]
Response.Write "Folder name is: " & fldr.Name
[JScript]
Response.Write("Folder name is: " + fldr.Name);
To find out the last time a file was modified, use the following syntax:

[VBScript]
Dim fso, f1
Set fso = CreateObject("Scripting.FileSystemObject")
' Get a File object to query.
Set f1 = fso.GetFile("c:\detlog.txt")
' Print information.
Response.Write "File last modified: " & f1.DateLastModified
[JScript]
var fso, f1;
fso = new ActiveXObject("Scripting.FileSystemObject");
// Get a File object to query.
f1 = fso.GetFile("c:\\detlog.txt");
// Print information.
Response.Write("File last modified: " + f1.DateLastModified);

QTP & FSO Model

The FileSystemObject (FSO) object model allows you to use the familiar object.method
syntax with a rich set of properties, methods, and events to process folders and files.

Use this object-based tool with:

HTML to create Web pages

Windows Scripting Host to create batch files for Microsoft Windows


Script Control to provide a scripting capability to applications developed in other
languages

Because use of the FSO on the client side raises serious security issues about providing
potentially unwelcome access to a client's local file system, this documentation assumes
use of the FSO object model to create scripts executed by Internet Web pages on the
server side. Since the server side is used, the Internet Explorer default security settings do
not allow client-side use of the FileSystemObject object. Overriding those defaults could
subject a local computer to unwelcome access to the file system, which could result in
total destruction of the file system's integrity, causing loss of data, or worse.

The FSO object model gives your server-side applications the ability to create, alter,
move, and delete folders, or to detect if particular folders exist, and if so, where. You can
also find out information about folders, such as their names, the date they were created or
last modified, and so forth.

The FSO object model also makes it easy to process files. When processing files, the
primary goal is to store data in a space- and resource-efficient, easy-to-access format.
You need to be able to create files, insert and change the data, and output (read) the data.
Since storing data in a database, such as Access or SQL Server, adds a significant amount
of overhead to your application, storing your data in a binary or text file may be the most
efficient solution. You may prefer not to have this overhead, or your data access
requirements may not require all the extra features associated with a full-featured
database

The FSO object model, which is contained in the Scripting type library (Scrrun.dll),
supports text file creation and manipulation through the TextStream object. Although it
does not yet support the creation or manipulation of binary files, future support of binary
files is planned.

QTP tests using keyword-driven testing

Keyword-driven testing advantages include the following:

1. In QTP, 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.

2. 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.
3. 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.

4. 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.

5. 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.

6. 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.

7. 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

QTP tricky ques and ans

1. How will you automate a window which while spying is not returning any property
value ??

2. How do you find the color and font of all the links on the page???

3. what are the disadvantages of smart identification.??

4.what are the disadvantages of recovery scenario??

5.How can you execute javascript on qtp??

6.What are the basic prerequisites required in automating an infragistics controls based
application?
7.Can i record a web based application on Mozilla??

8.What is the difference between Repository Parameter and Repositories Collection ??

9.How to copy Virtual Object Manager from one computer to another computer??

10.Can we use GetRoProperty method to get index or location of link in web


application??

Answer 1: In QTP point of view we automation applications where there is proper


addin.There are few cases where we can use win32 API and shell programming to
acheive.

EX use win32 query to get the handle or processid of the app and use some api to act on
it...this will be a work around not a solution.

Answer 2: Ans: use DHTML properties ....uses object.attributes...u will get all DHTML
properties of that particular element in a collection.

Answer 3: Disadvantages of Smart Identification: There are many out of which is time
consuming it eats lot of time and some times it yields wrong results also in case of
dynamic environment.

If u enable smart identification when particular object description is mismatched it will


take much time to
recognize that object.And for identifying which object decryption is mismatched we have
to verify the qtp results.

If disable smart identification qtp will through error in that particular statement

Answer 4: I think Space and time may be the constraints, because i never used it. it is
pretty waste of time to use it.

Answer 5: HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest


Professional\Configuration_UI\ScriptMgr

Create a new String value with name AltProgID and value "Mercury.JSScriptMgr" and
change the value of "Create" to 1

Create a new child key inside the key


HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest
Professional\Configuration_UI\ScriptConstants
{0ECD5785-BE7D-11d4-8EAF-11135659EC56}

Repeat the same steps for the below key


HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest
Professional\Configuration

Open
C:\Program Files\Mercury Interactive\QuickTest Professional\bin\QTEditor.ini
Add the below parameter to [General options]
AllowJavaScript = 1
DisableVBScript = 1

Answer 7: U can record but not as a web application but a standard windows application

ex:
Window("Mozilla Firefox").WinObject("MozillaWindowClass").Type "naveen"

Answer 8: Repository parameters enable you to specify that certain property values
should be parameterized, but leave the actual parameterization to be defined in each test
that is associated with the object repository that contains the parameterized test object
property values.
Repository parameters are useful when you want to create and run tests on an object that
changes dynamically

repositoriescollection is a collection object that enables you to programmatically manage


the run-time collection of shared object repository files associated with the current action

for more details refere QTP Help file.

Answer 9: checkout for .VOT files in dat foler of the installation

Answer 10: NO

QTP Test Results Analysis with New Reporting Functionality

Test Results Analysis with New Reporting Functionality

QuickTest 10.00 includes a powerful set of new reporting options that help you analyze
and manage your run results more thoroughly and efficiently. These include:

Jump to step. When you want to know more about a particular node in the Test Results
window, right-click it and select Jump to Step in QuickTest. The QuickTest main
window comes into focus, and the cursor jumps to the relevant step. For more
information, see Jumping to a Step.

Export Test Results to Microsoft Word or PDF Formats. In addition to HTML


format, you can now select to save your QuickTest run results in Microsoft Word or PDF
formats. You can then share this information, together with any local system monitoring
data, with your developers and performance testing teams. For more information, see
Exporting Test Results.

New Image Reporting Options:

Add Images to the Test Results. When you use the Reporter.ReportEvent method to
add information to the run results, you can now specify an image file as the fourth
argument. When you view the results, the image is displayed in the Result Details tab of
the Test Results window. For example, you can include an image returned by a
CaptureBitmap step in the run results. For more information, see ReportEvent Method
in the Utility section .

View Bitmaps Differences in Bitmap Checkpoints. In addition to the expected and


actual bitmaps that are displayed in the Test Results window, you can also select to view
the differences between the two. The difference bitmap is a black-and-white image that
contains one black pixel for every pixel that is different between the two images. For
more information, see Analyzing Bitmap Checkpoint Results.

Include Images in Exported and Printed Test Results. When you choose the Detailed
option for printing or exporting, the document now includes all images. These include
screen captures of steps, expected, actual, and difference bitmaps for bitmap checkpoints,
and any images sent to the run results using the ReportEvent method. For more
information, see Printing Test Results.

Additional Quality Center Details. The run results for tests and components that are run
as part of a Quality Center test set now include the Quality Center server and project
name

NEW To Do pane

The new To Do pane that is now available in the QTP, enables you to create and manage
self-defined tasks, and to view a compiled set of the TODO comments from your tests,
components, and associated function libraries.

For example, you can use the Tasks tab to provide instructions to someone else during a
handover, or to create reminders for yourself. The Tasks tab provides check boxes in
which you can mark off each task as you complete it. In the Comments tab, you can
view and sort all your TODO comments. You can also jump directly to a selected TODO
comment in the testing document.
If you use the Maintenance Run Wizard to detect updates needed to your steps or object
repository, then you can use the To Do pane to track and manage the TODO comments
added during the maintenance run session.

You can also export your tasks and TODO comments from the To Do pane to an XLS
(Excel), CSV (comma separated), or XML file
Custom Bitmap checkpoint comparision algorithm in QTP 10

You (or a third party) can now develop custom comparers for bitmap checkpoints. A
custom comparer is a COM object that performs the bitmap comparison for the
checkpoint according to your testing requirements. For example, you could define a
custom comparer that allows a bitmap checkpoint to pass even if the image in the
application shifts by an amount specified when the checkpoint is defined.

After you install and register a custom comparer on the QTP computer, your comparer is
available for selection in the Bitmap Checkpoint Properties dialog box. The dialog box
provides space for specifying additional configuration preferences expected by your
comparer.

When QTP a bitmap checkpoint that uses a custom comparer, it supplies the expected
and actual bitmaps to the custom comparer object. It then receives and reports the results
that the custom compares returns

Load and run actions- Call Actions Dynamically During the Test Run

Call Actions Dynamically During the Test Run

Generally, when you insert a call to an external action, the action call becomes part of the
test, and the called action is loaded each time you open the test.

In some situations, you may want to take advantage of the new LoadAndRunAction
statement to load an action only when the step runs, and then run that action.

This is useful, for example, if you use many conditional statements that call external
actions, and you do not want to load all of these actions each time you open the test, since
these actions may not be necessary during the run session.

Save tests with resources in QTP 10

Improve Portability by Saving Copies of Tests Together with Their Resource Files

Tests and their resource files are often stored on a network drive or in Quality Center.
However, you may need to open or run a test when you do not have access to the network
drive or QC. For example, you may need to create a portable copy of a test for use when
traveling 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 a copy of your test, all associated resource files, and any
called actions.
local system monitoring in QTP

The new local system monitoring feature in QTP (File > Settings > Local System
Monitor) enables you to monitor the local (client-side) computer resources used by the
application instance you are testing during a run session.

You can monitor a number of different system counters to view the effects your
application has on the system. You can also define upper limits for the counters. If any of
the specified counters exceed these limits, the test run will fail.

Additionally, you can export the data from the System Monitor tab to a variety of file
types.

The results generated for the counters you monitor are displayed as a line chart in a
special System Monitor tab in the Test Results window.
The System Monitor tab in the Test Results window

The points in the chart are synchronized with the steps in the Run Results tree. When you
select a step in the tree, the (red) Current Step line jumps to the corresponding location
in the chart.

You can also export the data from the chart so it can be further analyzed in other
programs
New resources and dependencies of model of QC with QTP

The new Quality Center resources and dependencies model enables you to store your
tests, components, and resources such that you can manage the relationships between
them and you can analyze the impact on all your assets when one asset changes.

If you are working with a Premier edition Quality Center server, then you can also import
and share your resources across different projects. You can synchronize these assets in
both projects when changes are made. This functionality also enables you to reuse your
existing assets instead of creating new assets whenever you create a new project. For
example, you can create a set of template assets to use as a basis for new projects.

Using the Resources and Dependencies Model

In previous versions of QTP and Quality Center, a test's associated resource files (such as
shared object repositories, function libraries, recovery scenarios, and external data
tables), were stored in Quality Center as attachments, while files associated with an
application area were stored in a standalone Resources folder in the Business
Components module.

Quality Center 10.00 introduces a new Test Resources module. This module enables you
to store all of these resources as separate entities that are linked to their owners and
marked as dependencies. Tests or actions that call other tests are also linked as
dependencies.

When you select a QTP test, business process test, or individual component in the Quality
Center test or component tree, you can view these dependent resources and tests in a new
Dependencies tab. The Dependencies tab shows all Quality Center entities that are used
by your testing document as well as all entities that are using it. For example, if your
QTP test is associated with two function libraries, and the actions in your test are
associated with three object repositories, these entities will be displayed in the Using
table of the test's Dependencies tab. If one of the actions in your test is called by another
test, then that calling test will be displayed in the Used by table.

In QTP, you can also view the action-specific dependencies in the Used By tab of the
Action Properties dialog box.

Quality Center recognizes assets that are linked as owned by or owner dependencies and
ensures that these important relationships are maintained when you import or create
baselines, rename or move resources, select to delete resources, or perform other
operations that can impact these relationships.

Note: If required, you can continue using the previous attachments model for all or some
of your QTP assets. However, if you use the old model, you will not be able to take
advantage of many of the features associated with the resources and dependencies model.
Ques:How can we associate an excel file from QTP 10.0 to QC 10.0 - Where can i add it
in QC or QTP to make it dependent on the particular business component or particular
test.

Ans:To export testscript/Excel from QTP to QC, you first need to establish QTP-QC
connection

1) In QTP , Go to File > Quality Center Connection.

2) Enter QC URL project name/domain/username/password and click on Login. QTP is


now connected to QC.

Next you can select the save the QTP Script in QC.

3) In QTP, Select File Menu > Save As > Save in QC

4 ) Select the Folder in QC where you wan to save the QTP Script

6) Click OK to Save

You might also like