Wednesday, July 2, 2008

Quick Test Professional FAQ’s

Quick Test Professional FAQ’s
1. How QTP scripts are advantageous when need to re-work the same business scenarios?

A. To record the Quick Test Professional Script on one instance and be able to execute it on any other instance. The assumption is there are no major GUI changes between the recorded and the execution instances.

2. How can you make the scripts generic and what architecture needs to be followed?

A. In order to achieve the above objective, we need to plan the Quick Test Professional script. It should have two parts:
1. Script – that is generic Quick test script.
2. Data – from the parameter file that is customer instance specific.

Eg. Imagine a business flow has a scenario
- Login to the web page
- Check mail
- Logout
1. Create data/parameter file (can be flat file [.txt] or an excel file) is instance specific.
2. Create (record/program) the QTP initialization
3. The initialization script which calls the Object repository, common function library and all QTP actions/scripts

3. How to create an individual script?

A. Record the Quick Test Professional script and modify it to make it a generic script using the following steps:

a. Set the testing options in the Test Settings Dialog box.
b. Record the script
c. Modify the script to make it generic:
i. Parameterize the hard coded values.
ii. Modify the Object Repository file with regular expressions.
iii. Add unique properties to items in the Object Repository to make recognition simpler.
iv. Insert synchronization points as required.
v. Insert checkpoints for pass/fail validation.
vi. Insert additional programming logic.
vii. Use the Common Functions.

4. What is the testing process in QTP?

A. The testing process consists of 3 main phases:

1. Gather relevant test information – Input data should be gathered.

2. Create the basic test – Record/Program the scripts in actions

3. Enhance the basic test
Use Data Driven scripts to use the script to test with different sets of data
Reusable Actions- Identify the common scenarios and make the scripts generic and reuse the scripts across different business scenarios.

5. What are different types of recording modes in QTP?

A. There are two recording modes
1. Low-level
2. Analog

Low – Level Recording:

Use Low-Level Recording when you need to record the exact location of the object on your application screen.
To record in Low-Level Recording, select “Low-Level Recording” from the “Test” menu while recording


Use Analog Recording for applications in which the actual movement of the mouse is what you want to record.
To record in Analog mode, select “Analog Recording” from the “Test” menu while recording.

6. What is Object repository?

A. The Object Repository dialog box displays a test tree of all objects in the current action or the entire test (depending on the object repository mode you choose when you create your test). You can use the Object Repository dialog box to view or modify the properties of any test object in the repository or to add new objects to your repository.

Object Repository Modes

Per – Action Object Repository:
This is the default setting, and all tests created in QuickTest 5.6 or earlier use this mode. In this mode, QuickTest automatically creates an object repository file for each action in your test so that you can record and run tests without creating, choosing, or modifying object repository files.
Shared Object Repository:
In this mode, you can use one object repository file for multiple tests if the tests include the same objects. Object information that applies to many tests is kept in one central location. When the objects in your application change, you can update them in one location for multiple tests

7. How to select the Object repository mode?

A. To select the object repository mode
Goto Test Settings > Resource Tab to change the Object Repository Mode

The default object repository file name is default.tsr
You can change object repository mode when the Test contain no actions.

8. What is Active screen? What are the advantages of Active screen?

A. Active screen captures all the properties of the application and makes available even when offline/ when you are not connected to the application.
The main advantage is checkpoints can be added without connecting to the application

9. What are different Screen capture options available for Active screen?

A. Complete—Captures all properties of all objects in the application’s active window/dialog box/Web page in the Active Screen of each step. This level saves Web pages after any dynamic changes and saves Active Screen files in a compressed format.

Partial—(Default). Captures all properties of all objects in the application’s active window/dialog box/Web page 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 level saves Web pages after any dynamic changes and saves Active Screen files in a compressed format.

Minimum—Captures properties only for the recorded object and its parent in the Active Screen of each step. This level saves the original source HTML of all Web pages (prior to dynamic changes) and saves Active Screen files in a compressed format.

None—Disables capturing of Active Screen files for all applications and Web pages.

10. How QTP identifies the objects in the application during runtime?

A. QTP uses different properties to identify the objects in the applications. They are:
a. Mandatory Properties
b. Assistive Properties
c. Object Identifies
d. Smart Identification

11. Explain all Object identification properties.

A. Mandatory and Assistive Properties:
During the test run, QuickTest looks for objects that match all properties in the test object description - it does not distinguish between properties that were learned as mandatory properties and those that were learned as assistive properties

Smart Identification: QuickTest uses a very similar process of elimination with its 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.

12. What are Ordinal identifies. Explain in detail.

A. Ordinal Identifiers are
Indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description.

Indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description. Values are assigned from top to bottom, and then left to right.

The Web Browser object has a third ordinal identifier type:

Creation Time:
Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description.

13. What is Smart Identification?

A. Smart Identification:
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.

14. What are the properties available in Smart identification?

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

15. What is Object Spy? How is it used in QTP?

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

16. What are Run-Time Object Properties / Run-Time Object Methods?

A. Run-Time Object Properties / Run-Time Object Methods:
You can use the Object property to access the native properties of any run-time object. For example, you can retrieve the current value of the ActiveX calendar’s internal Day property as follows:

Eg. Sample code
Dim MyDay
Set MyDay = Browser('index').Page('Untitled').ActiveX('MSCAL.Calendar.7').Object.Day

17. What are Test Object Properties / Test Object Methods?

A. Test Object Properties / Test Object Methods:
You can use the GetTOProperty and SetTOProperty methods to retrieve and set the value of test object properties for test objects in your test.

You can use the GetROProperty to retrieve the current property value of objects in your application during the test run.

18.What are User-Defined Test Object Classes. How are they mapped?

A User-Defined Test Object Classes:
The Object Mapping dialog box enables you to map an object of an unidentified or custom class to a Standard Windows class. For example, if your application has a button that cannot be identified, this button is recorded as a generic WinObject. You can teach QuickTest to identify your object as if it belonged to a standard Windows button class. Then, when you click the button while recording a test, QuickTest records the operation in the same way as a click on a standard Windows button. When you map an unidentified or custom object to a standard object, your object is added to the list of Standard Windows test object classes as a user-defined test object. You can configure the object identification settings for a user defined object class just as you would any other object class

19. What are checkpoints?

A. A checkpoint is a verification point that compares a current value for a specified property with the expected value for that property. This enables you to identify whether your Web site or application is functioning correctly.

When you add a checkpoint, Quick Test adds a checkpoint with an icon in the test tree and adds a Check Point statement in the Expert View. When you run the test, Quick Test compares the expected results of the checkpoint to the current results. If the results do not match, the checkpoint fails. You can view the results of the checkpoint in the Test Results window.

20. What is a standard checkpoint?

A. You can check that a specified object in your application or on your Web page has the property values you expect, by adding a standard checkpoint to your test. To set the options for a standard checkpoint, you use the Checkpoint Properties dialog box.

21. What is Text or Text Area Checkpoint?

A. Text or Text Area Checkpoint Results
By adding text or text area checkpoints to your tests, you can check that a text string is displayed in the appropriate place in your application or on your Web page. When you run your test, Quick Test compares the expected results of the checkpoint to the actual results of the test run. If the results do not match, the checkpoint fails.

23. What is Bitmap Checkpoint?

A. Bitmap Checkpoints:
You can check an area of a Web page or application as a bitmap. While creating a test, you specify the area you want to check by selecting an object. You can check an entire object or any area within an object. Quick Test captures the specified object as a bitmap, and inserts a checkpoint in the test. You can also choose to save only the selected area of the object with your test in order to save disk space.

24. What is Table and Database Checkpoint?

A. Table and Database Checkpoints:
By adding table checkpoints to your tests, you can check that a specified value is displayed in a cell in a table on your Web page or in your application. By adding database checkpoints to your tests, you can check the contents of databases accessed by your Web page or application. The results displayed for table and database checkpoints are similar. When you run your test, Quick Test compares the expected results of the checkpoint to the actual results of the test run. If the results do not match, the checkpoint fails.

25. What is Accessibility Checkpoint?

A. Accessibility Checkpoints:
You can add accessibility checkpoints to help you quickly identify areas of your Web site that may not conform to the W3C (World Wide Web Consortium) Web Content Accessibility Guidelines. You can add automatic accessibility checkpoints to each page in your test, or you can add individual accessibility checkpoints to individual pages or frames.

26. What is XML Checkpoint?

A. XML Checkpoint:
The XML Checkpoint Properties dialog box displays the element hierarchy and values (character data) of the selected XML file.

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.

27. What is Synchronization?

A. When you run tests, 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 to ensure that Quick Test waits until your application is ready before performing a certain step.

28. What are different functions available for Synchronization?

A. There are several options that you can use to synchronize your test:

You can insert a synchronization point, which instructs Quick Test to pause the test until an object property achieves the value you specify. When you insert a synchronization point into your test, Quick Test generates a WaitProperty statement in the Expert View.

29. What is the difference in Exists/wait statements?

A. Exist ()/ Wait()

You can insert Exist or Wait statements that instruct QuickTest to wait until an object exists or to wait a specified amount of time before continuing the test.

Eg. Browser('Yahoo”).Page('CheckMail”).Button(“CheckMail”).Exists(10)

QTP waits for 10 seconds till the button exists in the page. The script proceeds if the button even exits before 10 seconds unlike wait() statement – it waits for 10 seconds no matter the button exits before 10 seconds.

30. What is Default Time Out?

A. Default Time Out:
You can also increase the default timeout settings in the Test Settings and Options dialog boxes in order to instruct Quick Test to allow more time for certain events to occur

31. What is Parameterization (Data Table Wizard)?

A. You can supply the list of possible values for a parameter by creating a Data Table parameter. 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, Quick Test substitutes the constant value with a different value from the Data Table.

32. What are Method Arguments?

A. Using Method arguments you parameterize method arguments in the Method Arguments dialog box. to open the Method Arguments dialog box, right-click a step containing a method in the test tree and choose Method Arguments. The Method Arguments dialog box opens and displays the method arguments in the step.

33. Well, I would like to run my test with different sets of data, How can I make it with the options available in QTP?

A. Listed are the different Data Table Iterations
Run one iteration only:
Runs the test only once, using only the first row in the global Data Table.

Run on all rows:
Runs the test with iterations using all rows in the global Data Table.
Run from row __ to row __ :
Runs the test with iterations using the values in the global Data Table for the specified row range.

34. What are different data tables available?

A. 1. Global Sheet
The Global sheet contains the data that replaces parameters in each iteration of the test.
2. Action Sheets
Each time you add a new action to the test, a new action sheet is added to the Data Table. Action sheets are automatically labeled with the exact name of the corresponding action. The data contained in an action sheet is relevant for the corresponding action only.

35. What is an Action?

A. An Quick test script contains different actions. An action contains the script ie. A piece of business scenario like, login to application, logout etc.

Well again It depends on how you create your framework ( If you would like to know more about frame work check out this link. Good one. for testing the applications.
I would suggest every action has a piece of business scenario which would help to re-use the script in a better way. Before deciding what are re-usable scripts. Firstly, identify all the common scenarios that occur in different business flows across different modules.
Then prepare the scripts and make generic. You can call all these functions by making this common function library available at Test options > Resourses.

36. What is Copy of action?

A. Copy of Action:
When you insert a copy of an action into a test, the action is copied in its entirety, including checkpoints, parameterization, and the corresponding action tab in the Data Table. If the test you are copying into uses per-action repository mode, the copied action’s action object repository will also be copied along with the action.

37. What are re-usable actions?

A. Reusable Actions:
Determines whether the action is a reusable action. A reusable action can be called multiple times within a test and can be called from other tests. Non-reusable actions can be copied and inserted as independent actions, but cannot be inserted as calls to the original action.

38. what about Call of Action?

A. You can insert a call (link) to a reusable action that resides in your current test (local action), or in any other test (external action).

39. When to Insert transactions?

A. Inserting Transactions:

During the test run, the Start Transaction signals the beginning of the time measurement. You define the beginning of a transaction in the Start Transaction dialog box

 The End Transaction signals the end of the time measurement

40. What are reular expressions?

A. Regular Expressions:
Regular expressions enable QuickTest to identify objects and text strings with varying values. You can use regular expressions when:
• Defining the property values of an object
• Parameterizing a step
• Creating checkpoints with varying values
A regular expression is a string that specifies a complex search phrase. By using special characters such as a period (.), asterisk (*), caret (^), and brackets ([ ]), you can define the conditions of a search. When one of these special characters is preceded by a backslash (\), QuickTest searches for the literal character.

Here is an example:
The actual pattern for the regular expression search is set using the Pattern property of the RegExp object. The RegExp.Global property has no effect on the Test method.
The Test method returns True if a pattern match is found; False if no match is found.
The following code illustrates the use of the Test method.
Function RegExpTest(patrn, strng)
Dim regEx, retVal ' Create variable.
Set regEx = New RegExp ' Create regular expression.
regEx.Pattern = patrn ' Set pattern.
regEx.IgnoreCase = False ' Set case sensitivity.
retVal = regEx.Test(strng) ' Execute the search test.
If retVal Then
RegExpTest = 'One or more matches were found.'
RegExpTest = 'No match was found.'
End If
End Function
MsgBox(RegExpTest('is.', 'IS1 is2 IS3 is4'))

41. Create a script to print the message

Dim MyVar
MyVar = MsgBox ('Hello World!', 65, 'MsgBox Example')
' MyVar contains either 1 or 2, depending on which button is clicked.

42. List all the run time errors in VB script.
A. VBScript run-time errors are errors that result when your VBScript script attempts to perform an action that the system cannot execute. VBScript run-time errors occur while your script is being executed; when variable expressions are being evaluated, and memory is being dynamic allocated.
Error Number Description
429 ActiveX component can't create object

507 An exception occurred

449 Argument not optional

17 Can't perform requested operation

430 Class doesn't support Automation

506 Class not defined

11 Division by zero

48 Error in loading DLL

5020 Expected ')' in regular expression

5019 Expected ']' in regular expression

432 File name or class name not found during Automation operation

92 For loop not initialized

5008 Illegal assignment

51 Internal error

505 Invalid or unqualified reference

481 Invalid picture

5 Invalid procedure call or argument

5021 Invalid range in character set

94 Invalid use of Null

448 Named argument not found

447 Object doesn't support current locale setting

445 Object doesn't support this action

438 Object doesn't support this property or method

451 Object not a collection

504 Object not safe for creating

503 Object not safe for initializing

502 Object not safe for scripting

424 Object required

91 Object variable not set

7 Out of Memory

28 Out of stack space

14 Out of string space

6 Overflow

35 Sub or function not defined

9 Subscript out of range

5017 Syntax error in regular expression

462 The remote server machine does not exist or is unavailable

10 This array is fixed or temporarily locked

13 Type mismatch

5018 Unexpected quantifier

500 Variable is undefined

458 Variable uses an Automation type not supported in VBScript

450 Wrong number of arguments or invalid property assignment

No comments: