Friday, July 18, 2008

What is the difference between Wait and Synchronization point?

There are 2 types of Synchronization.
Local and Global.
For an object there is a Global synch time (20 seconds by default)(Available under File->Settings->Run in QTP 9.0) and additionally we can set individually the synch time for a particular object.

Hence total synch time is = Local + Global synch time.

In wait there is no Global concept and it is local to that object only.

Another key difference is: Suppose we have put a wait for 10 seconds then the application would wait for 10 seconds unconditionally. But say if we put a synch point of 10 secs say for an object to appear(local) and default Global synch time is 20 seconds, then total synch time for that object is 20 + 10 =30 seconds, but in case the object would appear in 15 seconds itself, even though the total synch time was 30 seconds, the script would proceed to the next task.

What property we use to get the tooltip of a link or an Image?

We use “alt” Run-time property of an object
Ex : var1=browser("MSN.com").Page("MSN.com").Image("NFL Sunday: Week 10 //LaDainia").GetROProperty("alt")

How to programmatically load a Shared Object Repository

Use the Automation Object Model to specify the path to a Shared Object Repository: Dim App 'As Application Set App = CreateObject("QuickTest.Application")App.Test.Settings.Resources.ObjectRepositoryPath = ""

How can you load External Library files in QTP?

We can load the external Library files by using 2 ways:
Choose Test > Settings > Choose Resources tab > Choose + button so select the library file > browse and select the library file > click Ok.
We can load the library files using Scripting:
Use executefile function to load library files.
Example:
executefile "C:\Documents and Settings\ukumar\Desktop\Sample.vbs"
x=10
y=5
result=SumOfTwoNumbers(x,y)
msgbox(result)

'Code in External Library file.
'Public function SumOfTwoNumbers(a,b)
'Dim sum
'sum=a+b
'SumOfTwoNumbers=sum
'End Function

How to check number of items in a WebList at run time.

Browser("browser name").Page("page name").WebList("list1").GetROProperty("items count")

How to "Turn Off" QTP results after running a Script?

Choose Tools > Options > Run Tab > Deselect View results when run session ends check box. But this suppresses only the result window, but log will be created and can viewed manually which cannot be restricted from getting created.

Is it possible to use the new text recognition mechanism to capture text that is in another language such as French or Japanese?

QTP 9.2 introduced a new text recognition mechanism. The information provided here applies to QTP 9.2 or higher. This solution is not available for earlier versions of QTP.
To indicate which language dictionaries QTP's text recognition mechanism should use, update the supported language list in the registry.
1. Open the registry editor.
2. Navigate to HKEY_CURRENT_USER\SOFTWARE\Mercury Interactive\QTP\MicTest\OcrEngine.
3. Right-click on the supportedLanguages value, and select "Modify."
4. Set the value data to the language or languages to be supported. Use a comma to separate the languages.
Example:English,German,Spanish,French
Note:Combined hieroglyphic languages (CJK - Chinese, Japanese, or Korean) and non-hieroglyphic languages are not supported. For example: English,Japanese

5. Click .
6. Restart QTP.

Is there a way to change the method QTP 9.2 uses for text recognition

By default, QTP (QTP) 9.2 uses Windows API first, then OCR, for text recognition operations.
QTP 9.2 introduced a new text recognition mechanism. The information provided here applies to QTP 9.2 or higher. This solution is not available for earlier versions of QTP.
1. Open the registry editor. (Windows + Run -> regedit)
2. Navigate to HKEY_CURRENT_USER\SOFTWARE\Mercury Interactive\QTP\MicTest\OcrEngine.
3. Right-click on the mode value, and select "Modify."
4. Set the value data for the mode you want to use:

0 - No OCR. Instructs QTP to use only the Windows API-based mechanism (and not the OCR mechanism) to retrieve text from the object.
1 - Windows API/OCR. Instructs QTP to first try to retrieve text directly from the object using the Windows API-based mechanism. If no text can be retrieved, QTP tries to retrieve text using the OCR mechanism. (Default) (Highly recommended when working with CJK languages.)
2 - OCR/Windows API. Instructs QTP to first try to retrieve text from the object using the OCR mechanism. If no text can be retrieved, then QTP uses its Windows API-based mechanism to retrieve text from the object.
3 - OCR only. Instructs QTP to use only the OCR mechanism (and not the Windows API-based mechanism) to retrieve text from the object. (Required when working with Windows Vista.)

5. Click .
6. Restart QTP.

Which add-ins can be used with QTP 9.2

You can use all version 9.1 add-ins with QTP (QTP) 9.2. In addition, you can use the following specific add-in versions with QTP 9.2:
· QTP Java Add-in 9.1
· QTP .NET Add-in 9.2
· QTP Oracle Add-in 8.2
· QTP PeopleSoft Add-in 8.2*
· QTP Add-in 8.2 for SAP Solutions
· QTP Siebel Add-in 8.0*
· QTP Stingray Add-in 8.2
· QTP Terminal Emulator Add-in 8.0*
· QTP VisualAge Smalltalk Add-in 8.2
· QTP Web Services Add-in 9.2

Note:You cannot use any other add-ins or add-in version with QTP 9.2, except for those listed above. The PeopleSoft, Siebel, and Terminal Emulator add-ins require an Add-in Upgrade patch before you can use them with QTP 9.2. You can install Add-in Upgrade patches by running the relevant patch executable from the \AddinsUpgrade folder.

Does QTP support Macintosh operating systems?

QTP does not support Macintosh operating systems. QTP is not expected to install or operate in this environment.

How to change the default directory that appears when saving a test

1. Open the registry editor (Start -> Run -> type "regedit".)
2. igate to the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QTP\MicTest
3. Find the TestsDirectory value. The value contains the path to the directory you want to be the default test script directory.
4. Edit this value to have your desired path.
a. Right click on TestsDirectory.
b. Choose Modify from the menu.
c. Enter the path into the Value data field.
d. Click OK.
Note:You should not place a "\" at the end of the path.

5. Repeat steps 2 through 4 for the following key: HKEY_CURRENT_USER\Software\Mercury Interactive\QTP\MicTest Note:If the specified directory path does not exist, QTP will open the "My Documents" directory by default.

How to programmatically set the object timeout value

The DefaultTimeOut property of the Setting object sets or retrieves the delay for finding objects. DefaultTimeOut is a per-test setting.
Setting("DefaultTimeout") = Milliseconds
Setting("DefaultTimeout") = 4000
Milliseconds: Maximum time in milliseconds to wait before it is determined that an object cannot be found.
To retrieve the setting:
CurrentSetting = Setting("DefaultTimeout")

We can use the browser navigation time-out by:
Setting("WebTimeout") = Milliseconds
To retrieve the setting:
currentsetting = Setting("WebTimeout")

Tuesday, July 15, 2008

How will you customize the Active Screen settings in QTP?


The Active Screen tab enables you to specify which information QuickTest saves and displays in the Active Screen while recording and running tests.

The more information saved in the Active Screen, the easier it is to edit the test or component after it is recorded. However, more information saved in the Active Screen adds to the recording time and disk space required. This is especially critical in Visual Basic, ActiveX, and .NET Windows Forms environments.

We can customize the Active Screen setting, by using “Custom Active Screen Capture Settings”.

To do this follow below navigation:

Tools > Options > Active Screen Tab > Click on custom level button > configure as per your needs and click Ok.



General Options:

You can specify the type of compression QuickTest uses for storing captured Active Screen information.

  • Simple—Instructs QuickTest to save Active Screen captures in standard uncompressed file formats (for example, .html and .png).
  • Compressed—Instructs QuickTest to save Active Screen captures in a compressed (zipped) file format. Using this option saves disk space, but it may affect the time it takes to load images in the Active Screen. This is the default option.

Windows Applications Options:

You can specify which properties are captured for each object in a Windows application when it is captured for the Active Screen.

  • Complete—Instructs QuickTest to save all properties of all objects in the application's open window/dialog box in the Active Screen of each step. This option makes it possible for you to insert checkpoints and perform other operations on any object in the window/dialog box, from the Active Screen for any step.
  • Partial—(Default). Instructs QuickTest to save all properties of all objects in the application's open window/dialog box in the Active Screen of the first step performed in an application's window, plus all properties of the recorded object in subsequent steps in the same window.

This option makes it possible for you to insert checkpoints and perform other operations on any object displayed in the Active Screen, while conserving recording time and disk space. Note that with this option the Active Screen information may not be fully updated for subsequent steps.

  • Minimum—Instructs QuickTest to save properties only for the recorded object and its parent in the Active Screen of each step.

This option enables speedy recording and requires relatively little disk space. However, you can insert checkpoints and perform other operations only on the recorded object and on the window/dialog box itself. You cannot perform operations on the other objects displayed in the Active Screen.

  • None—Disables capture of Active Screen files for Windows applications.

This option allows extremely fast recording and requires only a minimum of disk space. However, you cannot perform post-recording test editing from the Active Screen.

Web Options

You can specify whether QuickTest captures Web pages for the Active Screen.

  • Disable Active Screen capture—Disables the screen capture of all steps in the Active Screen. If you do not select this option, you can also delete Active Screen information after you have finished editing your test by selecting Save As, and clearing the Save Active Screen files check box.
Capture original HTML source—Captures the HTML source of Web pages as they appear originally, before any scripts are run. Deselecting this option instructs QuickTest to capture the HTML source of Web pages after any dynamic changes have been made to the HTML source (for example, by scripts running automatically when the page is loaded).

How will you do batch testing in QTP?

You can use Test Batch Runner to run several tests in succession. The results for each test are stored in their default location. Using Test Batch Runner, you can set up a list of tests and save the list as an .mtb file, so that you can easily run the same batch of tests again, at another time. You can also choose to include or exclude a test in your batch list from running during a batch run.

To enable Test Batch Runner to run tests, you must select Allow other Mercury products to run tests and components in the Run tab of the Options dialog box.

To set up and run a test batch:

Choose Programs > QuickTest Professional > Tools > Test Batch Runner from the Start menu. The Test Batch Runner dialog box opens. > Click the Add button or choose Batch > Add. The Open Test dialog box opens. Select a test you want to include in the test batch list and click Open. The test is added to the list.



To remove a test from the list, select it and click the Remove button or choose Batch > Remove.

When you are ready to run your test batch, click the Run button or choose Batch > Run. If QuickTest is not already open, it opens and the tests run sequence begins. Once the batch run is complete, you can view the results for each test in its default test results folder (\res#\report).

What are the file extensions for the following?


QTP Script file extension : .mts

Recovery scenario file extension : .qrs

Shared Object repository file : .tsr

Per Action Object repository file : .mtr

Batch file extension : .mtb

Outline the benefits of using GetROProperty instead creating an Output checkpoint


If you wish to create an Output value from the form controls in the Active Screen after recording a test, GetROProperty is a better choice than configuring an Output value. When configuring an output value for say a text control on your form in the Active Screen, QTP captures the co-ordinates of the control relative to the main application window. While running the test if the location of the form in the application window is different from when the test was recorded, the output value is obtained from the co-ordinate location of the control when the test was recorded and not from the current location of the control and the test may fail, so prefer to use GetROProperty instead of Output values.

What is Database Output value?


You can use database output values to output the value of the contents of database cells, based on the results of a query (result set) that you define on a database. You can create output values from the entire contents of the result set, or from a part of it. During the run session, QuickTest retrieves the current data from the database and outputs the values according to the settings that you specified.

What is Text and Text-area output values?


You can create a text output value from a text string displayed in a screen. You can define the output value as part of the displayed text, and you can specify the text before and/or after the output text.

You can also output text values from defined text areas.

When you create a text or text area output value, the text-recognition mechanism may not always retrieve the expected text. For this reason, when possible, you should retrieve text from your application window by using a standard output value for the object containing the text you require, using its text (or similar) property.

You can create a text output value while recording or editing your test .

To create a text output value while recording:

Insert > Output Value > Text Output Value > click the text string for which you want to specify a text output value > select the object for which you want to specify a text output value, and click Ok. > Text Output Value Properties dialog box opens > When you have finished defining the text output value details, click Ok.

What are standard output values?


You can use standard output values to output the property values of most objects. You can use standard output values to output text strings by specifying the text property of the object as an output value.

You can also use standard output values to output the contents of table cells.

You can create standard output values while recording or editing your test .

To create standard output values while recording:

choose Insert > Output Value > Select Standard Output Value > click the object for which you want to specify an output value > If the location you clicked is associated with more than one object, select the object for which you want to specify an output value > Click Ok > Specify the property values to output and their settings > Click Ok.

What are the different types of categories in “Output Values”


We can create the following categories of output values:

  1. Standard Output values
  2. Text and Text-area output values
  3. Database output values
XML Output values.

What is “Output Value”


An output value is a step in which one or more values are captured at a specific point in your test and stored for the duration of the run session.

You can output the property values of any object. You can also output values from text strings, table cells, databases, and XML documents.

If you select to output a value to an existing parameter, Data Table column, or environment variable, the existing value is overwritten when the output value step runs. When the run session ends, the original value is restored.

When you insert an output value step in your test, it is displayed in the Expert view as:

Object.Output CheckPoint(Name)

How you will add Recovery Scenarios to your test?


After you have created recovery scenarios, you can associate one or more scenarios with a test in order to instruct QuickTest to perform the recovery scenario(s) during the run session if a trigger event occurs.

To add a recovery scenario to a test:

Choose Test > Settings > Select Recovery tab > Select the Recovery scenario file > It will list out all the recovery scenarios in the recovery file > select the scenario file and click Add scenario button.

Can we prioritize the recovery scenarios?


You can prioritize the scenarios associated with your test to ensure that trigger events are recognized and handled in the required order.

Where recovery scenarios are saved?


Recovery scenarios are saved in recovery scenario files. A recovery scenario file is a logical collection of recovery scenarios, grouped according to your own specific requirements.

The recovery file is saved in the specified location with the file extension .qrs.

What is Application crash error trigger event in recovery scenario?


QuickTest detects an application crash and identifies it according to a predefined list of applications. For example, a secondary application may crash when a certain step is performed in the run session. You want to be sure that the run session does not fail because of this crash, which may indicate a different problem with your application. QuickTest can detect this application crash and activate a defined recovery scenario to continue the run session.

What is Test-run error trigger event in recovery scenario?


QuickTest detects a run error and identifies it by a failed return value from a method. For example, QuickTest may not be able to identify a menu item specified in the method argument, due to the fact that the menu item is not available at a specific point during the run session. QuickTest can detect this run error and activate a defined recovery scenario in order to continue the run session.

What is Object state trigger event in recovery scenario?


QuickTest detects a specific test object state and identifies it according to its property values and the property values of all its ancestors. Note that an object is identified only by its property values, and not by its class.

For example, a specific button in a dialog box may be disabled when a specific process is open. QuickTest can detect the object property state of the button that occurs when this problematic process is open and activate a defined recovery scenario to close the process and continue the run session.

What is pop-up trigger event in recovery scenario?


QuickTest detects a pop-up window and identifies it according to the window title and textual content. For example, a message box may open during a run session, indicating that the printer is out of paper. QuickTest can detect this window and activate a defined recovery scenario in order to continue the run session.

What are the different trigger types in Recovery Scenario?


QTP have 4 types of triggers in Recovery scenario:

  1. Pop-Up window
  2. Object State
  3. Test Run error
Application crash

What is the process of creating a recovery scenario?


The Recovery Scenario Wizard contains five main steps:

  • defining the trigger event that interrupts the run session
  • specifying the recovery operation(s) required to continue
  • choosing a post-recovery test run operation
  • specifying a name and description for the recovery scenario
specifying whether to associate the recovery scenario to the current test and/or to all new tests

How can you create Recovery Scenario?


The Recovery Scenario Manager dialog box enables you to create recovery scenarios and save them in recovery files. You create recovery scenarios using the Recovery Scenario Wizard, which leads you through the process of defining each of the stages of the recovery scenario. You then save the recovery scenarios in a recovery file, and associate them with specific tests.

How the recovery scenarios will work?


When you run a test for which you have defined recovery scenarios and an error occurs, QuickTest looks for the defined trigger event(s) that caused the error. If a trigger event has occurred, QuickTest performs the corresponding recovery and post-recovery operations.

The set of recovery operations is performed for each occurrence of the trigger event criteria. For example, suppose you define a specific object state, and two objects match this state, the set of replay operations is performed two times, once for each object that matches the specified state.

The recovery mechanism does not handle triggers that occur in the last step of a test. If you need to recover from an unexpected event or error that may occur in the last step of a test, you can do this by adding an extra step to the end of your test.

What a recovery scenario consists of?


A recovery scenario consists of:

  • Trigger Event—The event that interrupts your run session. For example, a window that may pop up on screen, or a QuickTest run error.
  • Recovery Operation(s)—The operation(s) that need to be performed in order to continue running the test. For example, clicking an OK button in a pop-up window, or restarting Microsoft Windows.
Post-Recovery Test Run Option—The instructions on how QuickTest should proceed once the recovery operations have been performed, and from which point in the test QuickTest should continue, if at all.

What is recovery Scenario?


Unexpected events, errors, and application crashes during a run session can disrupt your run session and distort results. This is a problem particularly when running tests unattended—the test is suspended until you perform the operation needed to recover.

Tuesday, July 8, 2008

What is entire parent hierarchy option in Virtual Object Wizard?


If you want QuickTest to identify the virtual object in one occurrence only, select entire parent hierarchy. QuickTest identifies the virtual object only if it has the exact parent hierarchy. For example, if the virtual object was defined using Browser("A").Page("B").Image("C"), QuickTest will not recognize it if the hierarchy changes to Browser("X").Page("B").Image("C").

What is parent-only option in Virtual Object Wizard?


We can select how you want QuickTest to identify and map the virtual object.

In the Identify object using box, we have two options:

  1. Parent-only option
  2. entire parent hierarchy
If you want QuickTest to identify all occurrences of the virtual object, select parent only. QuickTest identifies the virtual object using its direct parent only, regardless of the entire parent hierarchy. For example, if the virtual object was defined using Browser("A").Page("B").Image("C"), QuickTest will recognize the virtual object even if the hierarchy changes to Browser("A").Page("Y").Image("C").

Where does these Virtual Objects will be saved?


The virtual object collections displayed in the Virtual Object Manager are stored on your computer and not with the tests s that contain virtual object steps. This means that if you use a virtual object in a test step, the object will be recognized during the run session only if it is run on a computer containing the appropriate virtual object definition. To copy your virtual object collection definitions to another computer, copy the contents of your \dat\VoTemplate folder (or individual .vot collection files within this folder) to the same folder on the destination computer.

What is Virtual Object Manager?


The Virtual Object Manager contains all the virtual object collections defined on your computer.

What is Virtual Object collection?


A virtual object collection is a group of virtual objects that is stored in the Virtual Object Manager under a descriptive name.

What are the steps you follow to identify a virtual object?


We can define a virtual object by:

  1. Mapping it to a standard class
  2. Marking its boundaries
  3. Assigning a parent object
  4. Specifying a name and collection

How you identify Virtual Objects in your application?


You define a virtual object by using the Virtual Object Wizard.

What is Virtual Objects in QTP?


Your application may contain objects that behave like standard objects but are not recognized by QuickTest. You can define these objects as virtual objects and map them to standard classes, such as a button or a check box.

QuickTest does not support virtual objects for analog or low-level recording.

  1. The Web page or application window must be the same size and in the same position when recording and running tests s as it was when you defined the virtual object.
  2. You cannot insert any type of checkpoint on a virtual object.
  3. The virtual object should not overlap other virtual objects in your application or Web page.
  4. You can define virtual objects only for objects on which you can click or double-click and which record a Click or DblClick step. Otherwise, the virtual object is ignored.

How will you create Synchronization points in QTP?


To insert a synchronization point:

  1. Begin recording your test or component.
  2. Display the screen or page in your application that contains the object for which you want to insert a synchronization point.
  3. Choose Insert > Step > Synchronization Point.
  4. Click the object in your application for which you want to insert a synchronization point. >Click OK.
  5. The Add Synchronization Point dialog box opens.


6. The Property name list contains the test object properties associated with the object. Select the property name you want to use for the synchronization point.
7. Enter the property value for which QuickTest should wait before continuing to the next step in the test or component.
8. Enter the synchronization point timeout (in milliseconds) after which QuickTest should continue to the next step, even if the specified property value was not achieved.
9. Click OK. A WaitProperty step is added to your test or component.

Ex: Window("Flight Reservation").WinObject("Update Done").WaitProperty "visible", 1, 10000

You can enter Exist and/or Wait statements to instruct QuickTest to wait for a window to open or an object to appear. Exist statements return a boolean value indicating whether or not an object currently exists. Wait statements instruct QuickTest to wait a specified amount of time before proceeding to the next step. You can combine these statements within a loop to instruct QuickTest to wait until the object exists before continuing with the test or component.

In general, the amount of time QuickTest waits for objects to appear or for a browser to navigate to a specified page is insufficient, you can increase the default object synchronization timeout values for your test, by changing the Object Synchronization Timeout in the Test > Settings > Run tab.

To modify the amount of time that QuickTest waits for a Web page to load, change the Browser Navigation Timeout in the Test > Settings > Web tab.

What is synchronization point?


When you run a test or component, your application may not always respond with the same speed. For example, it might take a few seconds:

  • for a progress bar to reach 100%
  • for a status message to appear
  • for a button to become enabled
  • for a window or pop-up message to open
You can handle these anticipated timing problems by synchronizing your test or component to ensure that QuickTest waits until your application is ready before performing a certain step.

What is Object Spy?


Using the Object Spy, you can view the run-time or test object properties and methods of any object in an open application. You use the Object Spy pointer to point to an object. The Object Spy displays the selected object's hierarchy tree. It displays the run-time or test object properties and values of the selected object in the Properties tab. It displays the run-time or test object methods associated with the selected object in the Methods tab.

To use Object Spy:

  1. Choose Tools > Object Spy.
  2. Alternatively, click the Object Spy button from the Object Repository dialog box.

How to use user defined environmental variables?


Environmental variable is useful to carryon the variable values through diff actions in a single script.

  1. Choose Test > Settings > Click on Environment Tab.
  2. Select in the variable type drop down.
  3. Create a new variable and initialize it with a value. This variable will be the Global variable.
You could refer this variable across the Test as follows:
Environment("variable_name").

What is parameterization in QTP?


A parameter is a variable that is assigned a value from an external data source or generator. You can use the parameter feature in QuickTest to enhance your test by parameterizing the values that it uses.

You can parameterize values in steps, checkpoints in your test and values of action parameters.

If you wish to parameterize the same value in several steps in your test , you may want to consider using the Data Driver rather than adding parameters manually.

There are four types of parameters:

Test, action parameters: enable you to use values passed from your test , or values from other actions in your test.

In order to use a value within a specific action, you must pass the value down through the action hierarchy of your test to the required action. You can then use that parameter value to parameterize a step in your test .

Data Table parameters: enable you to create a data-driven test (or action) that runs several times using the data you supply. In each repetition, or iteration, QuickTest uses a different value from the Data Table.

Environment variable parameters: enable you to use variable values from other sources during the run session. These may be values you supply, or values that QuickTest generates for you based on conditions and options you choose.

Random number parameters: enable you to insert random numbers as values in your test.

What is run-time data table?


During the run session, QuickTest creates a run-time Data Table—a live version of the Data Table associated with your test.

During the run session, QuickTest displays the run-time data in the Data Table pane so that you can see any changes to the Data Table as they occur. When the run session ends, the run-time Data Table closes, and the Data Table pane again displays the stored design-time Data Table. Data entered in the run-time Data Table during the run session is not saved with the test . The final data from the run-time Data Table is displayed in the Run-Time Data Table in the Test Results window.

What is design-time data table?


The data your test uses is stored in the design-time Data Table, which is displayed in the Data Table pane at the bottom of the screen while you insert and edit steps.

Can we create test scripts in QTP without using object repository or objects?


Whenever QTP records any action on any object of an application, it adds some description on how to recognize that object to a repository of objects called object repository. QTP cannot take action on an object until unless its object description is in the Object Repository. But descriptive programming provides a way to perform action on objects which are not in Object repository.

Below are some of the situations when Descriptive Programming can be considered useful:

1. The objects in the application are dynamic in nature and need special handling to identify the object. The best example would be of clicking a link which changes according to the user of the application, Ex. “Logout <>”.

2. When object repository is getting huge due to the no. of objects being added. If the size of Object repository increases too much then it decreases the performance of QTP while recognizing a object.

3. When you don’t want to use object repository at all.

4. Modification to a test case is needed but the Object repository for the same is Read only or in shared mode i.e. changes may affect other scripts as well.

5. When you want to take action on similar type of object i.e. suppose we have 20 textboxes on the page and there names are in the form txt_1, txt_2, txt_3 and so on. Now adding all 20 the Object repository would not be a good programming approach.

There are two ways in which descriptive programming can be used

By creating properties collection object for the description.

Dim obj_Desc ‘Not necessary to declare

Set obj_Desc = Description.Create

obj_Desc(“html tag”).value= “INPUT”

obj_Desc(“name”).value= “txt.*”

obj_Desc(“name”).regularexpression= “txt.*”

Browser(“Browser”).Page(“Page”).WebEdit(obj_Desc).set “Test”

By giving the description in form of the string arguments.

Browser(“Browser”).Page(“Page”).WebElement(“Name:=txt_Name”,”html tag:=INPUT”,”Index:=0”).set “Test”

What will happen if you split an action and using shared object repository mode?


When using the shared object repository mode, splitting an action has no effect on the object repository file.

Monday, July 7, 2008

What will happen to the tests if you rename a shared object repository?


If you rename objects in a shared object repository in one test and save the changes, when you open another test using the same shared object repository, that test updates the object name in all steps of the test . This process may take a few moments. If you save the changes to the second test , the renamed steps are saved. However, if you close the second test without saving, then the next time you open the same test , it will again take a few moments to update the object names in the test steps.

What are the limitations for parameterizing test objects in shared object repository?


When parameterizing using a Data Table parameter:

  1. You must use the global data sheet. The Current action sheet (local) option in the Data Table Parameter Options dialog box is disabled.
  2. Your change to the object is saved in the shared object repository, but the corresponding Data Table is saved only with the test in which you are currently working.
  3. The column name in the global Data Table related to the parameterized object must be the same for every test using the same shared object repository.
The data within the global Data Table column can be different for each test .

What is shared object repository type in QTP?


When you use the shared object repository mode, QuickTest uses the object repository file you specify for all the actions in your test.

If you do not specify a file extension when creating a new object repository file, then QuickTest automatically appends the default extension name for shared object repositories: .tsr

When working in shared object repository mode:

  1. QuickTest adds new objects to the object repository as you record steps on the object.
  2. QuickTest uses the existing information and does not add the object to the object repository if you record operations on an object that already exists in the shared object repository (i.e. the object has the same test object description).
  3. QuickTest uses the same test object from the shared object repository file when you record on the same object in two different actions or in different tests
  4. QuickTest saves changes to the shared object repository file when you save your open test or when you click Save in the Object Repository dialog box if the shared object repository is not locked and/or opened in read-only mode.

What will happen if you insert a call to action into a test and using per-action object repository mode?


  1. Only the action itself is copied and not its corresponding object repository.
  2. The copied action will use the same shared object repository as the test into which it is being copied.
  3. When you insert copies of actions from tests using a different shared object repository or per-action repository mode, you must ensure that all the objects contained in the action are in the test's shared object repository. If the action uses objects that are not in the shared object repository, the test may fail.

What will happen if you insert a copy of an action and using per-action object repository mode?


When you insert a copy of an action into your test:

  1. The copied action's action object repository is copied along with the action steps.
  2. You can edit the object repository of the copied action as you would any other object repository in the test.
You cannot insert a copy of an action that uses a shared object repository file into a test that is using action object repositories.

What will happen if you split an action and using per-action object repository mode?


When you split an action:

  1. QuickTest makes a copy of the action object repository.
  2. The two actions have identical object repositories containing all of the objects that were in the original object repository.
If you add objects to one of the split actions, the new objects are added only to the corresponding action object repository.

What is per-action object repository type in QTP?


When working in object repository per-action mode:

  1. QuickTest creates a new (blank) object repository for each action. As you record operations on objects in your application, QuickTest automatically stores the information about those objects in the appropriate action object repository.
  2. When you create a new action, QuickTest creates another new object repository and again begins adding test objects to the repository as you record.
  3. When you record on the same object in your application in two different actions, the object is stored as a separate test object in each object repository.
When you save your test, all of the action object repositories are automatically saved with the test as part of each action within the test. The action object repository is not accessible as a separate file (as is the shared object repository).

What are the different types of object repositories in QTP?


There are two types of object repositories

  1. Per-action object repository (default)
  2. Shared Object repository

We can set the default object repository mode, by selecting Test > Settings > Resources tab > choose Object repository types as “Shared” > click on Set as default button > Click apply and click ok.

Note: You can change the object repository type for the test only if the test does not include any steps or any objects and the test does not call any external actions.

How QuickTest Identifies Objects During the Run Session


During a run session, QuickTest searches for a run-time object that exactly matches the description of the test object it learned while recording. It expects to find a perfect match for both the mandatory and any assistive properties it used to create a unique description while recording. As long as the object in the application does not change significantly, the description learned during recording is almost always sufficient for QuickTest to uniquely identify the object. This is true for most objects, but your application could include objects that are more difficult to identify during subsequent run sessions.

QuickTest uses a Smart Identification mechanism to identify an object, even when the recorded description is no longer accurate. Even if the values of your test object properties change, QuickTest's TestGuard technology maintains your test’s reusability by identifying the object using Smart Identification.

How QuickTest Identifies Objects During the Run Session


During a run session, QuickTest searches for a run-time object that exactly matches the description of the test object it learned while recording. It expects to find a perfect match for both the mandatory and any assistive properties it used to create a unique description while recording. As long as the object in the application does not change significantly, the description learned during recording is almost always sufficient for QuickTest to uniquely identify the object. This is true for most objects, but your application could include objects that are more difficult to identify during subsequent run sessions.

QuickTest uses a Smart Identification mechanism to identify an object, even when the recorded description is no longer accurate. Even if the values of your test object properties change, QuickTest's TestGuard technology maintains your test’s reusability by identifying the object using Smart Identification.

How QuickTest Learns Objects While Recording


QuickTest uses the below method when it learns objects during the recording process.

  1. First, it "looks" at the object on which you are recording and stores it as a test object,
  2. Determines the test object class that best fits it.
  3. Then, for each test object class, QuickTest has a list of mandatory properties that it always learns; When you record on an object, QuickTest always learns these default property values, and then "looks" at the rest of the objects on the page, dialog box, or other parent object to check whether this description is enough to uniquely identify the object. If it is not, QuickTest adds assistive properties, one by one, to the description, until it has compiled a unique description; If no assistive properties are available, or if those available are not sufficient to create a unique description, QuickTest adds a special ordinal identifier, such as the object's location on the page or in the source code, to create a unique description.
  4. Reads the current value of the object's properties in your application and stores the list of properties and values with the test object
  5. Chooses a unique name for the object, generally using the value of one of its prominent properties.
Records the operation that you performed on the object using the appropriate QuickTest test object method

What is Run Object in QTP?


A run-time object is the actual object in your Web site or application on which methods are performed during the run session.

What is Test Object in QTP?


A test object is an object that QuickTest creates in the test to represent the actual object in your application. QuickTest stores information about the object that will help it identify and check the object during the run session.

What is call to an existing action?


You can insert a call to a reusable action that is stored in your current test (local action), or in any other test (external action). Inserting a call to an existing action is like linking to it. You can view the steps of the action in the action view, but you cannot modify them. If you call an external action, you can choose, however, whether you want the data from the action's data sheet to be imported as a local, editable copy, or whether you want to use the (read-only) data from the original action.

If the test calling an action uses per-action repository mode, the called action's object repository is read-only.

If the test calling an action uses a shared object repository, the called action uses the same shared object repository as the calling test.

If you are working in a test that uses per-action object repository mode, you cannot call an external action from a test using a shared object repository.

What is call to copy of actions?


When you insert a call to a copy of an action into a test, the original action is copied in its entirety, including checkpoints, parameterization, the corresponding action tab in the Data Table, plus any defined action parameters.

If the test you are copying uses per-action repository mode, the copied action's object repository is also copied together with the action.

If the test into which you are copying uses a shared object repository, the copied action will use the same shared object repository as the calling test.

If you are working in a test that uses per-action object repository mode, you cannot copy an action from a test using a shared object repository.

The action is inserted into the test as an independent, non-reusable action (even if the original action was reusable).

Any changes you make to this action after you insert it affect only this action, and changes you make to the original action do not affect the copied action.

What are the restrictions to split an action?


You cannot split an action and the option is disabled when:

  1. an external action is selected
  2. the first step of an action is selected
  3. recording a test
  4. running a test
  5. you are working with a read-only test

How can you split actions in a test, what is the use of splitting the test?


You can split an action that is stored with your test into two sibling actions or into parent-child nested actions. When you split an action, the second action starts with the step that is selected when you perform the split action operation.

We can split the action in two ways:

Independent of each other—Splits the selected action into two sibling actions.

Nested (the second action is called by the first)—Splits the selected action into a parent action whose last step calls the second, child action.

To split an action:

  1. Select the step before which you want the new (second) action to begin.
  2. Choose Step > Split Action. (In QTP 9.2, Edit -> Action -> Split Action)
  3. Choose one of the following options:
    1. Independent of each other
    2. Nested
  4. If you wish, modify the name and description of the two actions in the Name and Description boxes.

What is nesting of actions?


Sometimes you may want to call an action from within an action. This is called nesting of actions.

Can two or more tests call the same action at a time?


Yes, two or more tests can call the same action.

Can we use steps in a non-reusable action?


You can store a copy of a non-reusable action with your test and then insert a call to the copy, but you cannot directly insert a call to a non-reusable action saved with another test.

What are the different types of actions?

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. By default, new actions are non-reusable.
  • 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.

What is an action?


  1. A logical unit of a test is called action. Actions divide your test into logical sections. When you create a new test, it contains a call to one action. By dividing your tests into calls to multiple actions, you can design more modular and efficient tests.
  2. An action consists of its own test script and its own object repository if the test is in per-action repository mode.
  3. Each action is stored together with the test in which you created it. You can insert a call to an action that is stored with the test and, depending on the properties of the action, you may also be able to call an action stored with another test.
  4. For every action called in your test, QuickTest creates a corresponding action sheet in the Data Table so that you can enter Data Table parameters that are specific to that action only.
  5. You can specify input parameters for actions, so that steps in an action can use values supplied from elsewhere in the test. You can also output values from actions to be used in steps later in the test, or to be passed back to the application that ran the test.
When you run a test with multiple actions, the test results are divided by actions within each test iteration so that you can see the outcome of each action, and you can view the detailed results for each action individually.

How do you create XML File checkpoint?


You create XML file checkpoints in order to directly access and verify specified XML files in your system.

To create an XML file checkpoint:

Choose Insert > Checkpoint > XML Checkpoint (File). The XML Checkpoint from File dialog box opens.



In the XML file box, enter the file path or Internet address of the XML file. > Click OK. The XML Checkpoint Properties dialog box opens.


Select the element(s), attribute(s), and/or value(s) that you want to check. > Click OK to add the XML checkpoint.

How to create XML checkpoint in QTP?


To create a XML (Web Page/Frame) checkpoint:

Choose Insert > Checkpoint > XML Checkpoint (Web Page/Frame) > Click a Web page or frame to check the XML documents associated with the page. XML Checkpoint Properties dialog box opens.



Select the XML document you want to check, and click OK.

The XML Checkpoint Properties dialog box opens.


Select the element(s), attribute(s), and/or value(s) that you want to check. For each element you want to check, select the checks you want to perform. For each attribute or value you want to check, select the checks you want to perform, or the parameterization options you want to set. If you want to check that the XML structure adheres to a specific XML schema, click Activate Schema Validation and set the required options. > Click OK to add the XML checkpoint.

What is Database checkpoint in QTP?

You create a database checkpoint based on the results of the query (result set) you defined on a database.

Database checkpoint is displayed in the Expert View as a DbTable.Check CheckPoint statement.

When you run the test or component, the database checkpoint compares the current data in the database to the expected data defined in the Database Checkpoint Properties dialog box. If the expected data and the current results do not match, the database checkpoint fails. The results of the checkpoint can be viewed in the Test Results window.

To create a database checkpoint:

Choose Insert > Checkpoint > Database Checkpoint, The Database Query Wizard opens





Select your database selection preferences and click Next. If you chose Specify SQL statement in the previous step, the Specify SQL statement screen opens. Specify the connection string and the SQL statement, and click Finish.



The Checkpoint Properties dialog box opens. Select the checks to perform on the result set and click OK.

What is text checkpoint in QTP?


Enables you to check that the text is displayed in a screen, window, or Web page, according to specified criteria. It is supported for all environments.

Text (or text area) checkpoints may behave differently in different run sessions depending on the operating system version you are using, service packs you have installed, other installed toolkits, the APIs used in your application, and so on.

Therefore, when possible, it is highly recommended to check text from your application window by inserting a standard checkpoint for the object containing the desired text, using its text (or similar) property.

To add a text checkpoint while recording:

Choose Insert > Checkpoint > Text Checkpoint > Click the text string for which you want to create the checkpoint. The Text Checkpoint Properties dialog box opens.






Specify the checkpoint settings. > Click OK to close the dialog box.

What is bitmap checkpoint in QTP?

You can check an area of a Web page or application as a bitmap. While creating a test or component, you specify the area you want to check by selecting an object. You can check an entire object or any area within an object. QuickTest captures the specified object as a bitmap, and inserts a checkpoint in the test or component.

You can create bitmap checkpoints for all supported testing environments (as long as the appropriate add-ins are loaded).

The results of bitmap checkpoints may be affected by factors such as operating system, screen resolution, and color settings.

To create a bitmap checkpoint while recording:

Choose Insert > Checkpoint > Bitmap Checkpoint > Click an object to check in your Web page or application. > Select an object from the tree on which to create a bitmap checkpoint. > Click OK. The Bitmap Checkpoint Properties dialog box opens.

If you want to check a specific area of the object, click the Select Area button.

If you want to save only the selected area of the object with your test or component (to save disk space), select the Save only selected area check box.

Specify the Checkpoint Timeout, and click OK.




When you run the test or component, QuickTest compares the object or selected area of the object currently displayed on the Web page or application with the bitmap stored when the test or component was recorded. If there are differences, QuickTest captures a bitmap of the actual object and displays it with the expected bitmap in the details portion of the Test Results window.


Sunday, July 6, 2008

What is page checkpoint in QTP?


You can check statistical information about your Web pages by adding page checkpoints to your test or component. These checkpoints check the links and the sources of the images on a Web page. You can also instruct page checkpoints to include a check for broken links.

To add a page checkpoint while recording:

Choose Insert > Checkpoint > Standard Checkpoint > Select the Page item and click OK




The Page Checkpoint Properties dialog box opens.



Modify the settings for the checkpoint in the Page Checkpoint Properties dialog box.

Click OK to close the dialog box. A checkpoint step is added in the Keyword View and expert view.

Note: You cannot select the HTML Verification options while creating a page checkpoint from the Keyword View or Active Screen. You can select these options only when creating a Page checkpoint while recording.