1. What are the advantages in Test Automation?
a) Fast: Test Tool runs tests significantly faster than human users.
b) Reliable: Automation tool can perform the same operation each time, if we repeated multiple times, so that we can eliminate human errors.
c) Repeatable: We can check how application or website reacts after repeated the same operation with multiple times.
d) Reusable: Automation scripts are reusable on different version of the application of websites even if the user interfaces changes.
e) Comprehensive: In automation testing we can build a suit of tests that covers every feature in the application or website.
f) Programmable: We can program sophisticated Tests that bring out hidden information from the application
2. What are the drawbacks in Test Automation?
a) It is expensive
b) We cannot automate all areas.
c) Lack of Skill
d) It has some limitations (It cannot test every thing)
3. What type of test tools available in the industry?
We can segregate Test tools in 2 categories
a) Business Classification
1) Vendor Tools
2) Open Source Tools
3) In-house Tools
b) Technical Classification
1) Functional and Regression Test Tools
2) Load/Stress/Performance Test Tools
3) Security Test Tools
5) Test Management Tools
6) Unit Test Tools
7) Requirement Management Tools Etc...
4. What are the important factors in test tool selection?
a. Technical factors:
i. Nature of the AUT (Application Under Test)
ii. Tool Features (Facilities available)
iii. Availability of Skilled professionals
iv. Organizations experience
v. Technical support from vendor
b. Business factors:
i. Budget
ii. Vendor’s Reputation
iii. Client’s Interest
5. What test cases can be automated?
Test cases that we want to execute on number of versions of the software
Ex: Regression test cases
Test cases that we want to execute with multiple sets of data
Ex: Data driven test cases
Test cases having complex functionality
6. What test cases cannot be automated?
Dynamically changing functionality
Test cases that require more Human interaction CUI (command user interface) based test cases.
7. Explain about the Testing process in QTP?
Planning:
1. Analyzing the Application
2. Automation Framework Implementation
3. Selecting/Generating Test cases for Automation
4. Collecting Test Data
5. Configuring Tool Settings
6. Generating the basic tests
Using Object Repository method or using Descriptive Programming, we can generate Tests
Enhancing Tests:
With respect to our project requirements, we have to enhance our tests. For enhancing tests QTP is providing various features like:
Inserting Transaction points
1. Synchronization
2. Parameterization
3. Inserting VB script Flow Control statements
4. Adding comments
5. Calling Functions/ calling Actions
6. Using Environment variables
7. Entering Regular Expressions
8. Inserting Checkpoints
9. Inserting Output values
Etc..
Note: For any Test all enhancement methods not required.
Debugging Tests (if required)
1. It is optional; basically scripting languages are Light weight languages, no need to compile them separately. During execution Scripts can be compiled and Run.
2. If we have any doubts about some scripts, then we can execute them step by step with the support of VBScript Debug commands and Break points
Running tests:
1. Generally, many companies are using Framework feature for Running Tests.
2. QTP Supports Individual Test execution, Batch execution, Tests execution through AOM Scripting, and Scheduled execution with the support of Windows Operating system.
Analyzing Results:
1. It is not the Responsibility of QTP; Test engineer has to do this manually.
2. QTP is providing Result window in XML format.
3. QTP is providing Result deletion tool also.
4. QTP is providing Test results exporting facility. It supports HTML, Word document and PDF (portable document format) formats.
Reporting defects:
Reporting defects also not a QTP responsibility that we have to do manually after analyzing the results, but if we are using Quality Center, from QTP result window we can send defects directly.
8. What types of License available for QTP?
a) Seat License or Node locked
Fixed for one System (Machine), we can use from that System only
b) Concurrent License or Floating License
This License, we can use from different Systems but one at a time
9. What are the QTP supported environments?
QTP Supports Software Applications based on Add-ins only
Add-in means Technology supporting files
QTP Add ins available for following technologies:
a) Default Add ins
1) Activex
2) Visual Basic
3) Web
b) Other Add-ins
1) Delphi
2) Java
3) .NET Web forms
4) .NET Windows forms
5) WPF (Windows Presentation Foundation)
6) Oracle
7) People Soft
8) Power Builder
9) SAP for Web
10) SAP GUI for windows environment
11) Siebel Environment
12) Standard Windows
13) Terminal Emulator (TE)
14) Visual Age Smalltalk Environment
15) Web Services Environment
10. Does QTP Support UNIX Environment?
No, QTP doesn’t support UNIX/Linux Environment, Supports Windows Operating Environment only, but LoadRunner and Quality Center have support both Windows and UNIX Operating Environments.
11. What is the scripting language that used in QTP for applying programming logic?
Micro Soft Visual Basic Scripting edition (VBScript) engine embedded with QTP.
12. Does QTP Support Database Testing and Data driven Testing?
Yes, SQL Engine embedded with QTP Tool, so we use SQL Statements directly in QTP Test Pane as well as in Function Library.
QTP has an integrated Spread sheet(Excel like) for Performing Data Driven Testing, otherwise we can fetch test data directly from external files and databases using VB Script.
Creating Tests (Recording & Running, Object Repository and Object Identification Configuration)
13. What is Recording in QTP?
It is process of creating the main body of a test by recording the typical processes that users perform.
QuickTest records the operations we perform, displays them as steps in the Keyword View, and generates them in a script (in the Expert View).
14. How many Recording Modes available in QTP? What are they?
There are 3 Recording modes available in QTP.
1) Normal Recording
2) Analog Recording
3) Low Level Recording
15. What is Analog Recording modes
It Records exact mouse and keyboard operations, we can use this mode for recording continues mouse operations like digital signatures, paints etc..
This mode doesn't generate statements for each and every operation, generates all operations in a Track file.
By default this mode is disabled, after selecting Normal Recording mode only it enables.
16. What is Low Level Recording?
It Records some operations on Non-supported environments apart from Normal operations.
17. What are object and Software Objects?
Object: Object is something, which has structure and properties.
Software Object: an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure.
Example:
GUI (Windows) Environment: Window, Dialog box, Edit Box, Button, Check Box, Radio Button, List Box and Combo Box etc...
Web Environment: Browser, Page, Link, Image, edit Box, Button, Grid, Frame Etc..
18. What type of Objects available in QTP?
There are 4 types of Objects available in QTP.
1) Run-time Objects
2) Test Objects
3) Utility Objects
4) Automation / User Defined Objects
19. What are Utility Objects?
These are QTP reserved objects, used for Testing and Result reporting.
Example
a) SystemUtil
b) Reporter
c) DataTable
d) Services
e) environment etc...
20. What is Automation Object?
An object that is exposed to other applications or programming tools through Automation interfaces.
21. Explain about Object, Property and value?
Object: It is something which has structure and properties
Property: an attribute of an Object.
Value: Value of the Property
22. What is Object Repository?
It is a Storage place for Storing Objects, QTP has 2 types of Repositories.
a) Local Repository
b) Shared Repository
23. What are the differences between Local and Shared Repositories?
Local Repository:
QTP Creates a Local Repository for every Action during Recording automatically and also QTP maintenance Local Repositories, but user can edit these repositories.
It is a QTP Internal file, extension is .mtr
Shared Repository:
User Creates Shared Repositories by adding objects in Object Repository Manager.This can be shared among nuber of tests.
User has to maintain shared repository files
Shared Repository files are External files, extension is .tsr
24. How to Start Test Automation Process, before the Application is ready?
QTP is providing a feature called "Define New Test Object" for creating new objects without Application. This feature available in Local Repository and Object Repository Manager.
25. How to Combine Repositories?
We Can combine Repositories using Object Repository Merge Tool. It is available in Object Repository Manager
26. Explain about Statement, Action, Test and Data table in QTP?
a) Statement: an Instruction or a minimal executable unit
b) Action: Set of Statements
c) Test: One or more Actions
Design Time Data Table:
1. It is viewed in the QTP Main Test
2. It is created prior to the test execution
3. It represents data from external Sources
Run-Time Data Table:
1. It is viewed in the QTP Test Result Window
2. It is created in Test Results after test execution.
3. It represents a live version of design Time Data table.
27. What are the differences between Actions and Functions and which are better?
Actions:
1. It’s a QTP feature and Local feature (not a global feature)
2. We can use check points in Actions
3. As it is QTP feature it may corrupt
4. Actions are slow execution
Functions:
1. It’s a VB script feature and global concept
2. We can’t use checkpoints in functions, instead of checkpoints we can use validation points (Loops and Conditional statements)
3. It doesn’t corrupt
4. Functions are faster in execution than Actions
28. How create methods in QTP?
By associating procedures to test objects.
29. How to enhance tests with windows API functions?
With the help of WSH (It is a Windows administration tool), we can use Windows API functions for enhancing Tests.
30. What are the major differences between functions and actions in QTP? What advantages there in functions than actions?
Read 21st question and answer.
31. What is Automation Object Model?
It’s a process of Automating the Quick test operations. To do this we can use java script, VC++ and .NET Apart from VBscript.
32. What is Windows Script Host?
WSH is a windows administration tool, it provides hosting environment for running VBscript, Jscript scripts.
33. What is exception handling?
Handling expected and unexpected errors during execution
34. What is the difference between constants and variables in VB Script?
We use constants for replacing literal values and constants never change.
We use variables for storing values that returned by the program, functions, etc.
Variable values may vary through out the script.
35. How test engineer identifies when programmatic descriptions are useful?
If application is not ready (using screenshots and documents we can prepare descriptive programming)
If we want to make our scripts global
If lengthy tests are there and that we want to execute fast
36. How to retrieve data from application objects?
Using loop statements and GetROProperty method
37. How to build scripts that access data from external resources?
We can fetch test data directly from external files and databases by creating automation objects
Ex:ADODB, Filesystem object
38. What is object spy used for?
It is a feature of QTP, used for getting the object’s information (all properties and values) .It is available in QTP tool main window, in Local repository and in object Repository Manager
39. What is the purpose of input parameters?
For Passing values
40. What is an Action? How many types of Actions are there in QTP?
Set of statements to perform a task or tasks is called an Action.
Three types of actions are there.
1. non reusable actions
2. reusable actions
3. External actions
In QTP 9.2 default action is: Non reusable
form QTP 10.0 default action is: Reusable
Example:
Let there are two tests : test:1 and test:2
In test:1 let there are two actions
a.login (reusable)and b. insert order(nonreusable)
in test:2 let there are two actions
a.open order(reusable) and b. fax order(non reusable)
If we call login action from test:1 in test :2 then login action is called External action.
In test :2 login is reusable but calling point of view its external action
41. What is a virtual object? How to configure virtual objects?
Whenever QTP is not recognizing an area or user defined object as an object that we can make as a virtual object.
For making virtual objects QTP is providing a feature called Virtual object manager. Through this we can configure virtual objects.
42. What are dynamic objects?
The object, which properties change dynamically (frequently). We can use Regular Expressions to handle dynamic objects.
43. What is the purpose of description object?
The purpose of description object is to store multiple properties values of a test object.
44. What is the advantage of associating a procedure to a test object?
By associating a procedure to a test object we can use this as a method on that test object.
45. How to create a Library File?
Open an Editor (Ex: Notepad),
Generate some script statements and save with .vbs extension.
In a library file we can put more than one function also
46. What are the disadvantages of using actions?
Action is a QTP tool feature that occupies QTP’s more memory space.
It may be corrupted.
It is not a global feature. Test engineer may not have the control on action.
47. What is the difference between Test Objects and Run Time Objects ?
Test objects are basic and generic objects that QTP recognize. Run time object means the actual object to which a test object maps.
48. Can i change properties of a test object?
Yes. You can use SetTOProperty to change the test object properties. It is recommended that you switch off the Smart Identification for the
object on which you use SetTOProperty function.
Can i change properties of a run time object?
No (but Yes also). You can use GetROProperty("outerText") to get the outerText of a object but there is no function like SetROProperty to change this property. But you can use WebElement().object.outerText="Something" to change the property.
49. When and Why to use Descriptive programming?
Below are some of the situations when Descriptive Programming can be considered useful:
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 <>”.
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.
When you don’t want to use object repository at all. Well the first question would be why not Object repository? Consider the following scenario which would help understand why not Object repository
Scenario 1: Suppose we have a web application that has not been developed yet. Now QTP for recording the script and adding the objects to repository needs the application to be up, that would mean waiting for the application to be deployed before we can start of with making QTP scripts. But if we know the descriptions of the objects that will be created then we can still start off with the script writing for testing
Scenario 2: Suppose an application has 3 navigation buttons on each and every page. Let the buttons be “Cancel”, “Back” and “Next”. Now recording action on these buttons would add 3 objects per page in the repository. For a 10 page flow this would mean 30 objects which could have been represented just by using 3 objects. So instead of adding these 30 objects to the repository we can just write 3 descriptions for the object and use it on any page.
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.
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.
50. How to use Descriptive programming?
There are two ways in which descriptive programming can be used:
a) Static Programming: By giving the description in form of the string arguments.
b) dynamic Programming: By creating properties collection object for the description.
51. What are the extensions of QTP files?
1. QTP Test / Test Script(.mts){.mts=module/mercury test script}
2. Local Repository file (.mtr){.mtr=module/mercury test repository}
3. Shared repository files(.tsr){Test shared repository}
4. Library files (.vbs)
5. Environmental files (.xml)
6. Test batch file (.mtb){module test batch}
7. QTP result file (xml) optional: pdf, doc, xml-for reporting
8. Recovery scenario file (.qrs){quick recovery scenario}
52. How to handle dynamic objects?
By using Regular expressions we can handle dynamic objects.
54. What are the differences between checkpoint and output value?
Both are same in insertion but different in purpose.
Checkpoint is a verification point, it takes expected results from the user and compare with the actual results during execution and provides test results.
Output value captures object properties values, database content and xml elements values and stores in run time data table.
Checkpoints compare actual results with expected results, output values captures values and stores.
55. How to handle Repositories dynamically?
With Repositoriescollection utility object, we can handle shared object repositories dynamically.
Note: on Repositoriescollection object, we can use Add, Find, Remove, and Removeall like methods.
56. What is the use of environment variables?
Environment variables are global variables that we can use from number of tests commonly.
Whenever we want to use some variables from number of tests, instead of declaring as local variables, if we use environment variables concept then maintenance will be easy.
57. What is a Regular Expression, where we use this feature in QTP?
Regular expression is nothing but matching patterns.
In QTP, we use this feature for identifying dynamic objects
58. What is the advantage of Dynamic Descriptive Programming than Static?
Incase of dynamic programming Tests generation is easy and maintenance also very easy.
59. What are the limitations of QuickTest?
a. It supports MS Windows operating environment only
b. It doesn’t support CLI Applications (Command line interface)
c. It supports IE only for generating scripts but it does not support Mozilla and other browsers. For executing tests it supports Mozilla like other browsers.
d. It has limited support for web services testing.
60. How to capture a moving image in QTP?
61. What is Smart Identification in QTP and explain it?
62. How many folders are created in one Test creation in QTP?
Two folders and six files.
63. What is Description object in QTP?
64. What are the Properties you use for identifying a Browser, a Page when using descriptive programming?
title property for Browser
title property for Page
65. How do you measure Transaction Time in QTP other than Using of Start and End Transaction Points?
By using ‘Timer’ function we can measure transaction times.
66. what is the Deference between Recovery Scenario and "On Error Resume Next"?
1) Both are for handling Error events, Recovery Scenario is a QTP Tool feature, whereas "On Error Resume Next" is a VB Script feature
2) "On Error Resume Next" is used when we are sure about the step where the error can occur. Recovery Scenario can be used to handle unexpected event or error.
********************************************************
On Error Statement (Visual Basic)
1. Enables an error-handling routine and specifies the location of the routine within a procedure; can also be used to disable an error-handling routine.
2. Without an On Error statement, any run-time error that occurs is fatal: an error message is displayed, and execution stops.
3. Whenever possible, we suggest you use structured exception handling in your code, rather than resorting to unstructured exception handling and the On Error statement.
67. Explain in brief about the QTP Automation Object Model.
QTP Automation Object model deals with Automation of QTP itself. Almost all configuration and functionality provided by QTP is represented by QTP's Automation Object Model . Almost all dialog boxes in QTP have a corresponding automation object which can set or retrieved using the corresponding properties or methods in the Automation Object Model.QTP Automation Objects can be used along with standard VB programming elements like iterative loops or conditional statements to help you design a script of choice
68. What is Test Fusion Report ?
Test Fusion Report , displays all aspects of a test run and is organized in a Tree format.
It gives details of each step executed for all iterations.
It also gives Run-time data table, Screen shots and movie of the test run if opted.
69. How can you handle exceptions in QTP?
In QTP Exceptional handling is done by using
a. Recovery Scenarios.
b. Using “On Error” statement
In Recovery scenario you have to define.
1. Triggered Events.
2. Recovery steps.
3. Post Recovery Test-Run.
At Script Level you can use the On Error Resume Next and On Error Go to 0 statement.
70. What is the Difference between Bitmap Check point & Image Check point?
Bitmap checkpoint does a pixel to pixel comparison of an image or part of an image.
Image checkpoint does do a pixel to pixel comparison but instead compare imageproperties like alt text , destination url etc.
71. How would you export a Script from one PC to another in QTP ?
We can make use of the "Generate Script" function available in Object Identification, Test Settings and Tools/Options tab to create a zip of the script at the source computer. These zip files then can be imported into QTP at the destination computer.
72. Can launch two instances of QTP on the same machine ?
No. You can work with only single instance of QTP on the same machine. But QTP itself can work on multiple instances of the Application Under Test (AUT). Ex: QTP can handlemultiple IE browser windows.
73. What is SetToProperty ?
SetToProperty changes property of an object stored in the Object Repository. However these changes are not permanent.
74. What is Accessibility Checkpoint?
World Wide Web Consortium (W3C) came up with some instructions and guidelines for Web-based technology and information systems to make it easy for the disabled to access the web. For example the standards make it mandatory to have an 'alt text' for an image. So a blind person who is accessing the website, will use text - to -speech converters and atleast understand what the image is about if not see it. All these standards are checked by Accessibility Checkpoints.
75. What is the difference between Properties and methods?
A property is a named attribute of an object. Properties define the characteristics of an object such as Size, Color etc. or sometimes the way in which it behaves.
A method is an action that can be performed on objects.
For example, a dog is an object. Its properties might include long white hair, blue eyes, 3 pounds weight etc. Its methods might be move, jump, play, breath etc
76. . Explain about the frame that you have used in your project?
77. What are the different types of Test Automation Frameworks ?
The types of Automation Frameworks are -
1) Linear Scripting - Record & Playback
2) The Test Library Architecture Framework.
3)The Data-Driven Testing Framework.
4)The Keyword-Driven or Table-Driven Testing Framework.
78. How many types of recording modes in QTP? Which will be used when ?
QTP supports 3 types of recording modes
1. Normal mode also called Contextual
2. Low-level recording mode
3.Analog mode
Normal Mode: It is the default recording mode and takes full advantage of QTP's Test Object Model. It recognizes objects regardless of their position on -screen. This is the preferred mode of recoding and is used for most of the automation activities.
Low-level recording mode: This mode records the exact x,y co-ordinates of your mouse operations. It is helpful in testing hashmaps. It is useful for recording objects not identified by normal mode of QTP.
Analog mode: This mode records exact mouse and keyboard "movements" you perform in relation to the screen / application window. This mode is useful for the operation such as drawing a picture, recording signature., drag and drop operations.
79. What are the types object Repositories in QTP.
QTP Supports 2 types of Object Repository
1) Shared Object Repository (also called Global)
2) Per-Action Object Repository, (also called Local)
Per-Action Object Repository is used by default. The extension for Per-Action repository is ".mtr" .
Shared Object Repository is preferable while dealing with dynamic objects which are called in multiple tests. The extension is ".tsr"
80. What is action split and the purpose of using this in QTP?
Action split is to divide an existing action into two parts.The purpose is to divide actions based on their functionality to improve code re-use.
81. Explain how QTP identifies object ?
QTP identifies any GUI Object based on its corresponding properties. While recording, QTP will identify and store peculiar properties (as defined in the Object Identification settings) in the object repository of the GUI object . At run-time, QTP will compare the stored property values with the on-screen properties, to uniquely identify the GUI object.
82. Can we call QTP test from another test using scripting. Suppose there are 4 tests and I want to call these tests in a main script. Is this possible in QTP?
Yes. You can call 4 or even more scripts in your tests.For this, first you will need to make the Actions in the corresponding scripts re-usable.Then from the destination script you can make calls to these re-usable actions.
83. What are the properties you would use for identifying a browser & page when using descriptive programming ?
You can use the name property
ex: Browser("name:="xxx"").page("name:="xxxx"").....
OR
We can also use the property "micClass".
ex: Browser("micClass:=browser").page("micClass:=page")....
84. Can we record an application running on a remote machine using QTP ?
Yes .you can record remote application provided you are accessing application through the local browser not via remoter like citrix.
If you are still unable to record it is advisable install QTP and application, on the same machine
85. Can you switch between Per-Action and Shared Object Repository ? If yes how ?
Yes .We can switch. Go to Test--->Settings--->Resources. Here you have an option to choose repositories.
86. What is Step Generator?
Step Generator enables use to Add Test Steps in your script. Using step generator you can add steps to your script without actually recording it.
87. What is an Optional Step ?
A step when declared optional is not mandatory to be executed. If the corresponding GUI object is present, QTP performs the operation on it. If the GUI object is not present, QTP bypasses the optional step and proceeds to execute the next step.
88. How would you export a Script from one PC to another in QTP ?
We can make use of the "Generate Script" function available in Object Identification, Test Settings and Tools/Options tab to create a zip of the script at the source computer. These zip files then can be imported into QTP at the destination computer.
89. How can you handle exceptions in QTP?
In QTP Exceptional handling is done by using
a. Recovery Scenarios.
b. Using “On Error” statement
In Recovery scenario you have to define.
1. Triggered Events.
2. Recovery steps.
3. Post Recovery Test-Run.
At Script Level you can use the On Error Resume Next and On Error Go to 0 statement.
90. What is the difference between functions and actions in QTP?
Actions have their own Object Repository & Data Table. Actions help make your Test modular and increase reuse. Example: You can divide your script into Actions based on functionality like Login, Logout etc.
Functions is a VB Script programming concept and do not have their own Object Repository or Data Table. Functions help in re-use of your code. Ex: You can create a Function in your script to concatenate two strings.
a) Fast: Test Tool runs tests significantly faster than human users.
b) Reliable: Automation tool can perform the same operation each time, if we repeated multiple times, so that we can eliminate human errors.
c) Repeatable: We can check how application or website reacts after repeated the same operation with multiple times.
d) Reusable: Automation scripts are reusable on different version of the application of websites even if the user interfaces changes.
e) Comprehensive: In automation testing we can build a suit of tests that covers every feature in the application or website.
f) Programmable: We can program sophisticated Tests that bring out hidden information from the application
2. What are the drawbacks in Test Automation?
a) It is expensive
b) We cannot automate all areas.
c) Lack of Skill
d) It has some limitations (It cannot test every thing)
3. What type of test tools available in the industry?
We can segregate Test tools in 2 categories
a) Business Classification
1) Vendor Tools
2) Open Source Tools
3) In-house Tools
b) Technical Classification
1) Functional and Regression Test Tools
2) Load/Stress/Performance Test Tools
3) Security Test Tools
5) Test Management Tools
6) Unit Test Tools
7) Requirement Management Tools Etc...
4. What are the important factors in test tool selection?
a. Technical factors:
i. Nature of the AUT (Application Under Test)
ii. Tool Features (Facilities available)
iii. Availability of Skilled professionals
iv. Organizations experience
v. Technical support from vendor
b. Business factors:
i. Budget
ii. Vendor’s Reputation
iii. Client’s Interest
5. What test cases can be automated?
Test cases that we want to execute on number of versions of the software
Ex: Regression test cases
Test cases that we want to execute with multiple sets of data
Ex: Data driven test cases
Test cases having complex functionality
6. What test cases cannot be automated?
Dynamically changing functionality
Test cases that require more Human interaction CUI (command user interface) based test cases.
7. Explain about the Testing process in QTP?
Planning:
1. Analyzing the Application
2. Automation Framework Implementation
3. Selecting/Generating Test cases for Automation
4. Collecting Test Data
5. Configuring Tool Settings
6. Generating the basic tests
Using Object Repository method or using Descriptive Programming, we can generate Tests
Enhancing Tests:
With respect to our project requirements, we have to enhance our tests. For enhancing tests QTP is providing various features like:
Inserting Transaction points
1. Synchronization
2. Parameterization
3. Inserting VB script Flow Control statements
4. Adding comments
5. Calling Functions/ calling Actions
6. Using Environment variables
7. Entering Regular Expressions
8. Inserting Checkpoints
9. Inserting Output values
Etc..
Note: For any Test all enhancement methods not required.
Debugging Tests (if required)
1. It is optional; basically scripting languages are Light weight languages, no need to compile them separately. During execution Scripts can be compiled and Run.
2. If we have any doubts about some scripts, then we can execute them step by step with the support of VBScript Debug commands and Break points
Running tests:
1. Generally, many companies are using Framework feature for Running Tests.
2. QTP Supports Individual Test execution, Batch execution, Tests execution through AOM Scripting, and Scheduled execution with the support of Windows Operating system.
Analyzing Results:
1. It is not the Responsibility of QTP; Test engineer has to do this manually.
2. QTP is providing Result window in XML format.
3. QTP is providing Result deletion tool also.
4. QTP is providing Test results exporting facility. It supports HTML, Word document and PDF (portable document format) formats.
Reporting defects:
Reporting defects also not a QTP responsibility that we have to do manually after analyzing the results, but if we are using Quality Center, from QTP result window we can send defects directly.
8. What types of License available for QTP?
a) Seat License or Node locked
Fixed for one System (Machine), we can use from that System only
b) Concurrent License or Floating License
This License, we can use from different Systems but one at a time
9. What are the QTP supported environments?
QTP Supports Software Applications based on Add-ins only
Add-in means Technology supporting files
QTP Add ins available for following technologies:
a) Default Add ins
1) Activex
2) Visual Basic
3) Web
b) Other Add-ins
1) Delphi
2) Java
3) .NET Web forms
4) .NET Windows forms
5) WPF (Windows Presentation Foundation)
6) Oracle
7) People Soft
8) Power Builder
9) SAP for Web
10) SAP GUI for windows environment
11) Siebel Environment
12) Standard Windows
13) Terminal Emulator (TE)
14) Visual Age Smalltalk Environment
15) Web Services Environment
10. Does QTP Support UNIX Environment?
No, QTP doesn’t support UNIX/Linux Environment, Supports Windows Operating Environment only, but LoadRunner and Quality Center have support both Windows and UNIX Operating Environments.
11. What is the scripting language that used in QTP for applying programming logic?
Micro Soft Visual Basic Scripting edition (VBScript) engine embedded with QTP.
12. Does QTP Support Database Testing and Data driven Testing?
Yes, SQL Engine embedded with QTP Tool, so we use SQL Statements directly in QTP Test Pane as well as in Function Library.
QTP has an integrated Spread sheet(Excel like) for Performing Data Driven Testing, otherwise we can fetch test data directly from external files and databases using VB Script.
Creating Tests (Recording & Running, Object Repository and Object Identification Configuration)
13. What is Recording in QTP?
It is process of creating the main body of a test by recording the typical processes that users perform.
QuickTest records the operations we perform, displays them as steps in the Keyword View, and generates them in a script (in the Expert View).
14. How many Recording Modes available in QTP? What are they?
There are 3 Recording modes available in QTP.
1) Normal Recording
2) Analog Recording
3) Low Level Recording
15. What is Analog Recording modes
It Records exact mouse and keyboard operations, we can use this mode for recording continues mouse operations like digital signatures, paints etc..
This mode doesn't generate statements for each and every operation, generates all operations in a Track file.
By default this mode is disabled, after selecting Normal Recording mode only it enables.
16. What is Low Level Recording?
It Records some operations on Non-supported environments apart from Normal operations.
17. What are object and Software Objects?
Object: Object is something, which has structure and properties.
Software Object: an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure.
Example:
GUI (Windows) Environment: Window, Dialog box, Edit Box, Button, Check Box, Radio Button, List Box and Combo Box etc...
Web Environment: Browser, Page, Link, Image, edit Box, Button, Grid, Frame Etc..
18. What type of Objects available in QTP?
There are 4 types of Objects available in QTP.
1) Run-time Objects
2) Test Objects
3) Utility Objects
4) Automation / User Defined Objects
19. What are Utility Objects?
These are QTP reserved objects, used for Testing and Result reporting.
Example
a) SystemUtil
b) Reporter
c) DataTable
d) Services
e) environment etc...
20. What is Automation Object?
An object that is exposed to other applications or programming tools through Automation interfaces.
21. Explain about Object, Property and value?
Object: It is something which has structure and properties
Property: an attribute of an Object.
Value: Value of the Property
22. What is Object Repository?
It is a Storage place for Storing Objects, QTP has 2 types of Repositories.
a) Local Repository
b) Shared Repository
23. What are the differences between Local and Shared Repositories?
Local Repository:
QTP Creates a Local Repository for every Action during Recording automatically and also QTP maintenance Local Repositories, but user can edit these repositories.
It is a QTP Internal file, extension is .mtr
Shared Repository:
User Creates Shared Repositories by adding objects in Object Repository Manager.This can be shared among nuber of tests.
User has to maintain shared repository files
Shared Repository files are External files, extension is .tsr
24. How to Start Test Automation Process, before the Application is ready?
QTP is providing a feature called "Define New Test Object" for creating new objects without Application. This feature available in Local Repository and Object Repository Manager.
25. How to Combine Repositories?
We Can combine Repositories using Object Repository Merge Tool. It is available in Object Repository Manager
26. Explain about Statement, Action, Test and Data table in QTP?
a) Statement: an Instruction or a minimal executable unit
b) Action: Set of Statements
c) Test: One or more Actions
Design Time Data Table:
1. It is viewed in the QTP Main Test
2. It is created prior to the test execution
3. It represents data from external Sources
Run-Time Data Table:
1. It is viewed in the QTP Test Result Window
2. It is created in Test Results after test execution.
3. It represents a live version of design Time Data table.
27. What are the differences between Actions and Functions and which are better?
Actions:
1. It’s a QTP feature and Local feature (not a global feature)
2. We can use check points in Actions
3. As it is QTP feature it may corrupt
4. Actions are slow execution
Functions:
1. It’s a VB script feature and global concept
2. We can’t use checkpoints in functions, instead of checkpoints we can use validation points (Loops and Conditional statements)
3. It doesn’t corrupt
4. Functions are faster in execution than Actions
28. How create methods in QTP?
By associating procedures to test objects.
29. How to enhance tests with windows API functions?
With the help of WSH (It is a Windows administration tool), we can use Windows API functions for enhancing Tests.
30. What are the major differences between functions and actions in QTP? What advantages there in functions than actions?
Read 21st question and answer.
31. What is Automation Object Model?
It’s a process of Automating the Quick test operations. To do this we can use java script, VC++ and .NET Apart from VBscript.
32. What is Windows Script Host?
WSH is a windows administration tool, it provides hosting environment for running VBscript, Jscript scripts.
33. What is exception handling?
Handling expected and unexpected errors during execution
34. What is the difference between constants and variables in VB Script?
We use constants for replacing literal values and constants never change.
We use variables for storing values that returned by the program, functions, etc.
Variable values may vary through out the script.
35. How test engineer identifies when programmatic descriptions are useful?
If application is not ready (using screenshots and documents we can prepare descriptive programming)
If we want to make our scripts global
If lengthy tests are there and that we want to execute fast
36. How to retrieve data from application objects?
Using loop statements and GetROProperty method
37. How to build scripts that access data from external resources?
We can fetch test data directly from external files and databases by creating automation objects
Ex:ADODB, Filesystem object
38. What is object spy used for?
It is a feature of QTP, used for getting the object’s information (all properties and values) .It is available in QTP tool main window, in Local repository and in object Repository Manager
39. What is the purpose of input parameters?
For Passing values
40. What is an Action? How many types of Actions are there in QTP?
Set of statements to perform a task or tasks is called an Action.
Three types of actions are there.
1. non reusable actions
2. reusable actions
3. External actions
In QTP 9.2 default action is: Non reusable
form QTP 10.0 default action is: Reusable
Example:
Let there are two tests : test:1 and test:2
In test:1 let there are two actions
a.login (reusable)and b. insert order(nonreusable)
in test:2 let there are two actions
a.open order(reusable) and b. fax order(non reusable)
If we call login action from test:1 in test :2 then login action is called External action.
In test :2 login is reusable but calling point of view its external action
41. What is a virtual object? How to configure virtual objects?
Whenever QTP is not recognizing an area or user defined object as an object that we can make as a virtual object.
For making virtual objects QTP is providing a feature called Virtual object manager. Through this we can configure virtual objects.
42. What are dynamic objects?
The object, which properties change dynamically (frequently). We can use Regular Expressions to handle dynamic objects.
43. What is the purpose of description object?
The purpose of description object is to store multiple properties values of a test object.
44. What is the advantage of associating a procedure to a test object?
By associating a procedure to a test object we can use this as a method on that test object.
45. How to create a Library File?
Open an Editor (Ex: Notepad),
Generate some script statements and save with .vbs extension.
In a library file we can put more than one function also
46. What are the disadvantages of using actions?
Action is a QTP tool feature that occupies QTP’s more memory space.
It may be corrupted.
It is not a global feature. Test engineer may not have the control on action.
47. What is the difference between Test Objects and Run Time Objects ?
Test objects are basic and generic objects that QTP recognize. Run time object means the actual object to which a test object maps.
48. Can i change properties of a test object?
Yes. You can use SetTOProperty to change the test object properties. It is recommended that you switch off the Smart Identification for the
object on which you use SetTOProperty function.
Can i change properties of a run time object?
No (but Yes also). You can use GetROProperty("outerText") to get the outerText of a object but there is no function like SetROProperty to change this property. But you can use WebElement().object.outerText="Something" to change the property.
49. When and Why to use Descriptive programming?
Below are some of the situations when Descriptive Programming can be considered useful:
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 <
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.
When you don’t want to use object repository at all. Well the first question would be why not Object repository? Consider the following scenario which would help understand why not Object repository
Scenario 1: Suppose we have a web application that has not been developed yet. Now QTP for recording the script and adding the objects to repository needs the application to be up, that would mean waiting for the application to be deployed before we can start of with making QTP scripts. But if we know the descriptions of the objects that will be created then we can still start off with the script writing for testing
Scenario 2: Suppose an application has 3 navigation buttons on each and every page. Let the buttons be “Cancel”, “Back” and “Next”. Now recording action on these buttons would add 3 objects per page in the repository. For a 10 page flow this would mean 30 objects which could have been represented just by using 3 objects. So instead of adding these 30 objects to the repository we can just write 3 descriptions for the object and use it on any page.
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.
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.
50. How to use Descriptive programming?
There are two ways in which descriptive programming can be used:
a) Static Programming: By giving the description in form of the string arguments.
b) dynamic Programming: By creating properties collection object for the description.
51. What are the extensions of QTP files?
1. QTP Test / Test Script(.mts){.mts=module/mercury test script}
2. Local Repository file (.mtr){.mtr=module/mercury test repository}
3. Shared repository files(.tsr){Test shared repository}
4. Library files (.vbs)
5. Environmental files (.xml)
6. Test batch file (.mtb){module test batch}
7. QTP result file (xml) optional: pdf, doc, xml-for reporting
8. Recovery scenario file (.qrs){quick recovery scenario}
52. How to handle dynamic objects?
By using Regular expressions we can handle dynamic objects.
54. What are the differences between checkpoint and output value?
Both are same in insertion but different in purpose.
Checkpoint is a verification point, it takes expected results from the user and compare with the actual results during execution and provides test results.
Output value captures object properties values, database content and xml elements values and stores in run time data table.
Checkpoints compare actual results with expected results, output values captures values and stores.
55. How to handle Repositories dynamically?
With Repositoriescollection utility object, we can handle shared object repositories dynamically.
Note: on Repositoriescollection object, we can use Add, Find, Remove, and Removeall like methods.
56. What is the use of environment variables?
Environment variables are global variables that we can use from number of tests commonly.
Whenever we want to use some variables from number of tests, instead of declaring as local variables, if we use environment variables concept then maintenance will be easy.
57. What is a Regular Expression, where we use this feature in QTP?
Regular expression is nothing but matching patterns.
In QTP, we use this feature for identifying dynamic objects
58. What is the advantage of Dynamic Descriptive Programming than Static?
Incase of dynamic programming Tests generation is easy and maintenance also very easy.
59. What are the limitations of QuickTest?
a. It supports MS Windows operating environment only
b. It doesn’t support CLI Applications (Command line interface)
c. It supports IE only for generating scripts but it does not support Mozilla and other browsers. For executing tests it supports Mozilla like other browsers.
d. It has limited support for web services testing.
60. How to capture a moving image in QTP?
61. What is Smart Identification in QTP and explain it?
62. How many folders are created in one Test creation in QTP?
Two folders and six files.
63. What is Description object in QTP?
64. What are the Properties you use for identifying a Browser, a Page when using descriptive programming?
title property for Browser
title property for Page
65. How do you measure Transaction Time in QTP other than Using of Start and End Transaction Points?
By using ‘Timer’ function we can measure transaction times.
66. what is the Deference between Recovery Scenario and "On Error Resume Next"?
1) Both are for handling Error events, Recovery Scenario is a QTP Tool feature, whereas "On Error Resume Next" is a VB Script feature
2) "On Error Resume Next" is used when we are sure about the step where the error can occur. Recovery Scenario can be used to handle unexpected event or error.
********************************************************
On Error Statement (Visual Basic)
1. Enables an error-handling routine and specifies the location of the routine within a procedure; can also be used to disable an error-handling routine.
2. Without an On Error statement, any run-time error that occurs is fatal: an error message is displayed, and execution stops.
3. Whenever possible, we suggest you use structured exception handling in your code, rather than resorting to unstructured exception handling and the On Error statement.
67. Explain in brief about the QTP Automation Object Model.
QTP Automation Object model deals with Automation of QTP itself. Almost all configuration and functionality provided by QTP is represented by QTP's Automation Object Model . Almost all dialog boxes in QTP have a corresponding automation object which can set or retrieved using the corresponding properties or methods in the Automation Object Model.QTP Automation Objects can be used along with standard VB programming elements like iterative loops or conditional statements to help you design a script of choice
68. What is Test Fusion Report ?
Test Fusion Report , displays all aspects of a test run and is organized in a Tree format.
It gives details of each step executed for all iterations.
It also gives Run-time data table, Screen shots and movie of the test run if opted.
69. How can you handle exceptions in QTP?
In QTP Exceptional handling is done by using
a. Recovery Scenarios.
b. Using “On Error” statement
In Recovery scenario you have to define.
1. Triggered Events.
2. Recovery steps.
3. Post Recovery Test-Run.
At Script Level you can use the On Error Resume Next and On Error Go to 0 statement.
70. What is the Difference between Bitmap Check point & Image Check point?
Bitmap checkpoint does a pixel to pixel comparison of an image or part of an image.
Image checkpoint does do a pixel to pixel comparison but instead compare imageproperties like alt text , destination url etc.
71. How would you export a Script from one PC to another in QTP ?
We can make use of the "Generate Script" function available in Object Identification, Test Settings and Tools/Options tab to create a zip of the script at the source computer. These zip files then can be imported into QTP at the destination computer.
72. Can launch two instances of QTP on the same machine ?
No. You can work with only single instance of QTP on the same machine. But QTP itself can work on multiple instances of the Application Under Test (AUT). Ex: QTP can handlemultiple IE browser windows.
73. What is SetToProperty ?
SetToProperty changes property of an object stored in the Object Repository. However these changes are not permanent.
74. What is Accessibility Checkpoint?
World Wide Web Consortium (W3C) came up with some instructions and guidelines for Web-based technology and information systems to make it easy for the disabled to access the web. For example the standards make it mandatory to have an 'alt text' for an image. So a blind person who is accessing the website, will use text - to -speech converters and atleast understand what the image is about if not see it. All these standards are checked by Accessibility Checkpoints.
75. What is the difference between Properties and methods?
A property is a named attribute of an object. Properties define the characteristics of an object such as Size, Color etc. or sometimes the way in which it behaves.
A method is an action that can be performed on objects.
For example, a dog is an object. Its properties might include long white hair, blue eyes, 3 pounds weight etc. Its methods might be move, jump, play, breath etc
76. . Explain about the frame that you have used in your project?
77. What are the different types of Test Automation Frameworks ?
The types of Automation Frameworks are -
1) Linear Scripting - Record & Playback
2) The Test Library Architecture Framework.
3)The Data-Driven Testing Framework.
4)The Keyword-Driven or Table-Driven Testing Framework.
78. How many types of recording modes in QTP? Which will be used when ?
QTP supports 3 types of recording modes
1. Normal mode also called Contextual
2. Low-level recording mode
3.Analog mode
Normal Mode: It is the default recording mode and takes full advantage of QTP's Test Object Model. It recognizes objects regardless of their position on -screen. This is the preferred mode of recoding and is used for most of the automation activities.
Low-level recording mode: This mode records the exact x,y co-ordinates of your mouse operations. It is helpful in testing hashmaps. It is useful for recording objects not identified by normal mode of QTP.
Analog mode: This mode records exact mouse and keyboard "movements" you perform in relation to the screen / application window. This mode is useful for the operation such as drawing a picture, recording signature., drag and drop operations.
79. What are the types object Repositories in QTP.
QTP Supports 2 types of Object Repository
1) Shared Object Repository (also called Global)
2) Per-Action Object Repository, (also called Local)
Per-Action Object Repository is used by default. The extension for Per-Action repository is ".mtr" .
Shared Object Repository is preferable while dealing with dynamic objects which are called in multiple tests. The extension is ".tsr"
80. What is action split and the purpose of using this in QTP?
Action split is to divide an existing action into two parts.The purpose is to divide actions based on their functionality to improve code re-use.
81. Explain how QTP identifies object ?
QTP identifies any GUI Object based on its corresponding properties. While recording, QTP will identify and store peculiar properties (as defined in the Object Identification settings) in the object repository of the GUI object . At run-time, QTP will compare the stored property values with the on-screen properties, to uniquely identify the GUI object.
82. Can we call QTP test from another test using scripting. Suppose there are 4 tests and I want to call these tests in a main script. Is this possible in QTP?
Yes. You can call 4 or even more scripts in your tests.For this, first you will need to make the Actions in the corresponding scripts re-usable.Then from the destination script you can make calls to these re-usable actions.
83. What are the properties you would use for identifying a browser & page when using descriptive programming ?
You can use the name property
ex: Browser("name:="xxx"").page("name:="xxxx"").....
OR
We can also use the property "micClass".
ex: Browser("micClass:=browser").page("micClass:=page")....
84. Can we record an application running on a remote machine using QTP ?
Yes .you can record remote application provided you are accessing application through the local browser not via remoter like citrix.
If you are still unable to record it is advisable install QTP and application, on the same machine
85. Can you switch between Per-Action and Shared Object Repository ? If yes how ?
Yes .We can switch. Go to Test--->Settings--->Resources. Here you have an option to choose repositories.
86. What is Step Generator?
Step Generator enables use to Add Test Steps in your script. Using step generator you can add steps to your script without actually recording it.
87. What is an Optional Step ?
A step when declared optional is not mandatory to be executed. If the corresponding GUI object is present, QTP performs the operation on it. If the GUI object is not present, QTP bypasses the optional step and proceeds to execute the next step.
88. How would you export a Script from one PC to another in QTP ?
We can make use of the "Generate Script" function available in Object Identification, Test Settings and Tools/Options tab to create a zip of the script at the source computer. These zip files then can be imported into QTP at the destination computer.
89. How can you handle exceptions in QTP?
In QTP Exceptional handling is done by using
a. Recovery Scenarios.
b. Using “On Error” statement
In Recovery scenario you have to define.
1. Triggered Events.
2. Recovery steps.
3. Post Recovery Test-Run.
At Script Level you can use the On Error Resume Next and On Error Go to 0 statement.
90. What is the difference between functions and actions in QTP?
Actions have their own Object Repository & Data Table. Actions help make your Test modular and increase reuse. Example: You can divide your script into Actions based on functionality like Login, Logout etc.
Functions is a VB Script programming concept and do not have their own Object Repository or Data Table. Functions help in re-use of your code. Ex: You can create a Function in your script to concatenate two strings.
91. What are the advantages of Automation?
Repeatable:-If we have to run a set of tests repeatedly, automation is preferable.
It gives you the ability to run automation against code that frequently changes to catch regressions in a timely manner
Repeatable:-If we have to run a set of tests repeatedly, automation is preferable.
It gives you the ability to run automation against code that frequently changes to catch regressions in a timely manner
It gives you the ability to run automation in mainstream scenarios to catch regressions in a timely manner
- Compatable: - Automated tests can be run on different machines with , whereas the manual tests would have to be run sequentially.(different languages on different OS platforms).
- Reliable:-
- Reusable:-Automated scripts can be reusable in different environments and different applications on similar functionalities.
92. When do you opt Automation?
- If application is complex.
- When there are frequent changes in the requirements or enhancements in the application.
- When there is lot of Retesting to be done.
- When we are verifying Compatibility.
93. What are the recording modes in QTP?
A. QTP provides three types of recording methods to record operations:
Standard Recording (Normal) mode:-It is the default mode, which records all operations on application.
Analog Recording Mode: -Records all operations of mouse and keyboard based on screen coordinates or application coordinates.
Low Level Recording: -We use low level recording to record the operations of mouse and keyboard operations based on its coordinates.
94. When do you use Low Level recording?
Quickest pro. May not indentify all objects when quickest fails to identify an object during standard recording and to record operations where exact coordinates are required. This mode records at the object level and records all run-time objects as Window or Win Object test objects.
95. What do you mean by standard and custom objects?
Standard objects are the objects, which are belonging to all types of applications where as Custom objects are user-defined objects, which exist in an application.
96. What the different checkpoints in QTP?
There are different checkpoints in QTP like
a. Standard Checkpoint
b. Text Checkpoint
c. Text Area Checkpoint
d. Database Checkpoint
e. Bitmap checkpoint
f. Accessibility checkpoint
g. XML Checkpoint
h. Page Checkpoint
i. Table Checkpoint
j. Image Checkpoint
97. Do you use checkpoints in your project?
Yes, I use checkpoints at the data validations of input domains present in the application using regular expressions. As a checkpoint verifies that expected information is displayed in an Application while the executing the test.
98. How do you validate any property of a Runtime Object?
A. Using standard checkpoint or Using GETRO property method we can validate properties of every object on the apllicaton during Runtime
Syntax:
variable=Object Type(“Object Name”).getroproperty(“property name”)
variable=Object Type(“Object Name”).getroproperty(“property name”)
Note: The above will fetch the property value of an object and will be stored in the variable and if we have to validate that then we need to write a conditional statement (IF..)
Ex: If you want to check the enabled property of an object during runtime.
X=Browser(“Yahoo”).page(“Yahoo”).frame(“Login”).image(“Login”).getroproperty(“enabled”)
If X=”True” then
Reporter.reportevent micpass “Login Image”,”Is Enabled”
Else
Reporter.reportevent micfail, “Login Image”, “Is Disabled”
99. How do you fetch a property of a test object from the script during runtime?
A. Using GETTOPROPERTY
Synatx:
variable=object type(“object name”).gettoproperty(“property name”)
A. Using GETTOPROPERTY
Synatx:
variable=object type(“object name”).gettoproperty(“property name”)
EX: To fetch the window id property of Agent Name which is captured in Object Repository
X=dialog(“Login”).winedit(“Agent Name:”).gettoproperty(“window id”)
100. How do you fetch all the properties of a test object from the script during runtime?
A. Using GETTOPROPERTIES
Synatx:
set variable=object type(“object name”).gettoproperties()
set variable=object type(“object name”).gettoproperties()
EX: To fetch all the properties of Agent Name which is captured in Object Repository
- set X=dialog(“Login”).winedit(“Agent Name:”).gettoproperties()
Note:
1. While fetching all the properties of a test object, they should be assigned to an array using a keyword called set and if you want to access all the properties we need to specify the index value and the index starts from zero.
2. Both getoproperty and gettoproperties will work only on the test objects and will or can fetch only the properties associated with the test objects in object repository, where as gettoproperty can fetch any property value associated with a runtime object (i.e. the object on the application during runtime)
101. When a property of an object is changed on the modified build or what if more than object have more than one objects have similar properties due to which the script is failing, how do you handle this situation during runtime without changing the configuration of object identification.
A. Using SETTOPROPERTY
Syntax:
Object Type(“Object Name”).settoproperty “Property name”, “property value”
Object Type(“Object Name”).settoproperty “Property name”, “property value”
Ex: Dialog(“Login”).winedit(“Agent Name:”).settoproperty “attached text”, “Agent Name:”
102. How do you check the availability of an object on the application during runtime?
A. Using “Exist” method.
Syntax: variable=object type (“object name”).exist
Ex: x=dialog (“Login”). Winedit (“Agent Name:”). exist
Note: It will return true if the object exists on the application, if not it returns false
103. How do you maximize a window or screen or page
A. Maximize or fullscreen
Syntax: 1. Object Type(“Object Name”).maximize
2. Object Type(“Object Name”).maximize
104. How do you minimize a window or screen or page
A. Minimize
Syntax: Object Type(“Object Name”).minimize
105. How do you open a window or screen or page, which is minimized in the launch bar?
A. Restore
Syntax: Object Type(“Object Name”).restore
106. How do you move a window or screen or page?
A. Move, by providing the x and y coordinates
Syntax: Object Type(“Object Name”).move x,y
107. How do we get the count of items in a List or a Combobox?
A. Using Getitemscount method
Syntax: variable=Object type(“Object name”).getitemscount
Ex: Verifying no.of items, in "Fly From" Combo Box in Flight Reservation window
z = Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
108. How do we fetch a specific item from a List or a Combobox?
A. Using Getitem()
Syntax: variable=Object type(“Object name”).getitem(index number)
Ex: Fetching a specific item, from a "Fly From" Combo Box in Flight Reservation window
z = Window("Flight Reservation").WinComboBox("Fly From:").GetItem(5)
Note: the index value starts from zero
109. How do we fetch the complete list of items from a List or a Combobox?
A. Using Getcontent
Syntax: variable=Object type(“Object name”).getcontent
Ex: Fetching all the items, from a "Fly From" Combo Box in Flight Reservation window
z = Window("Flight Reservation").WinComboBox("Fly From:").Getcontent
110. How do we the text displayed on the runtime object
A. Getvisibletext()
Syntax: variable=Object Name(“Object type”).getvisibletext()
Ex: x=window(“Flight Reservation”).winedit(“Name:”).getvisibletext()
111. What are Test objects and run time objects?
Test objects are stored representations of the actual objects on an application. QuickTest creates test objects by learning a set of the properties and values of the objects on an application.
Run-time objects are the objects that are available on Application Under Test.
112. How do you add objects to object repository?
A. We can add objects to object repository in two ways:
i) From Object Repository:
Navigation: Resources -> Object Repository -> Object -> Add objects to local
ii) From Active Screens:
Navigation: Right click on the object in activescreens and select view/add object.
113. How do you add objects to object repository when the application is not available?
A. By creating a new test object
Navigation: Resources->Object Repository->Object ->Define New Test Object
114. How do you convert the local objects as reusable objects?
A. By exporting the local objects from object repository and storing them in shared repository file.
Navigation: Resources->Object Repository->File->Export Local Objects
115. What is the file extension of shared Repository file?
A. .tsr -> Test shared repository
116. How do you associate shared object repository to an action?
Navigation: Edit -> Action -> Action Properties -> Associate Repositories
117. How do you assosiate shared object repository for multiple actions in a test?
A. Navigation: Resources -> Object Repository -> Tools -> assosiate Repositories
118. How many actions you can create in a test?
A. There can be any number of actions created in a single test.
119. What are the action properties and test properties?
A. Action properties are the properties for the current action only, where as test properties belonging to total action properties in the current test.
120. What are the methods associated with actions in reusing the actions
A.
1) Call to Copy of Action
1) Call to Copy of Action
2) Call to Existing Action
121. What is difference between subroutine and function?
A. Subroutine doesn’t return any value where as function returns a value.
122. What is difference between passing parameters to functions as ByVal and ByRef?
A. Using ‘Call by Val’ values can be passed directly to variables where as ‘Call ByRef’ values can be passed based on the reference.
123. What is Option Explicit?
A. When used, makes mandatory to declare the variables in the script using a DIM (Dimension) statement.
124. How do you perform exception handling in QTP?
A. I) By using recovery Scenarios
II) On error resume next, it is to skip the line and goto next line in the script and On error goto 0,it is to disable the exception handling process.
When an error is occurred during the test execution the error details can be captured, by using err. Description and we can capture the error number by usingerr.Number
125. What are the run modes in QTP?
In QTP9.5 we have 3 run modes
- Normal Run Mode
- Update mode Run Mode
- Maintainence Run Mode
126. When you use for example wait (10); & default time in QTP is 20 seconds; if object is not found then how many seconds the script will wait?
A. It waits for 10 seconds at wait statement and waits for 20 seconds if the object is not available and then throughs an error.
127. What is the meaning of below statement?
Browser("brname"). page("Pgname").sync
128. What is the syntax for the wait property?
A. Object type(“object name”).waitproperty “Property name”, “Property value”, “time in seconds”
129. What is the file extension of a bitmap checkpoint?
A. .png or .bmp
130. What do you mean by call to copy of action and call to existing action?
(i) We can call both normal and reusable actions using call to copy an action and the called action canbe edited.
(ii) We can call only the reusable actions using call to existing actions and these are considered as external actions, which are non editable.
131. How do you convert a normal action into reusable action?
A. Edit menuàActionàAction PropertiesàGeneralàReusable Action
(Or)
In Test Pane Right clickàAction Propertiesà General à Reusable Action
132. How do you edit objects in shared object repository?
A. Slecect Object Repository Manager from Resources Menuà Open the Shared repository file à Select Enable editing option à then we can edit objects asper requirements.
133. What is debug viewer?
A. To view the variable values during execution of the script, change variable values during runtime. Etc
134. How do you use watch expression?
A. It is to monitor the specific variables declared under Watch during runtime. In Watch the value that is passed to a variable in the script will be captured.
135. During running the program, there is an uninterrupted expectation from the application, which stopped QTP script execution, how do you handle?
A. Before the start execution of a test batch I raise test run error trigger event and select the recovery scenario as ‘restart the testrun’ so that the testscript sart execution again.
136. What is step generator?
A. We can insert functions in the script from step generator, insert menu-à step à step generator à select the categoryà select the function à specify the parameters à ok
137. What is the extension of QTP Script file?
A. .mts(mercury test script)
138. Suppose there are 5 actions in a test, if you want to run only 3,5 actions how do you do?
A. Save the testàopen the saved test folderàopen the Action0 folderàopen(click on edit) the script fileàthen Commentize the Action1,2,4à Save the fileàopen the test file on QTP& Run the test.
139. What is the extension of Local object repository?
A. .mtr(mercury test repository)
140. What is the extension of shared object Repository?
A. .tsr(test shared repository)
141. What is the extension of library file?
A. When we creates & saves a library file it saves with the extension “.vbs(vbscript file)”
142. How do you return a value from a function?
A. By selecting call by return value in function definition generator in insert menu.
143. What is the syntax to define a function?
A. Public function function name(parameters)
----
---
End Function
144. Can you write script to login; suppose browser name is b1, page nameis p1, userid, password, login button ?
A. browser(“b1”).page(“p1”).webedit(“userid”).set “test”
browser(“b1”).page(“p1”).webedit(“password”).set “test123”
browser(“b1”).page(“p1”).image(“login”).click
145. Few datatable methods
A)
i. Addsheet
i. Addsheet
ii. Deletesheet
iii. Import
iv. Export
v. Importsheet
vi. Exportsheet
vii. Getsheet
viii. Getrowcount
ix. Getsheetcount
x. Setcurrentrow
xi. Setnextrow
xii. Setprevrow
146. How to assosiate a shared repository to the test through script?
A. Using the utility object called Repositoriescolletion
Synatx: RepositoriesCollection.add “path”
147. What is the method to count number of rows in datatable?
A. x=Datatable.getsheetcount(sheet id).getrowcount
msgbox x
148. How to add a parameter id to a specific sheet in datatable during runtime along with the value.
A. Syntax: variable=datatable.getsheet(“sheet id”).addparameter(“parameter id”,”value”).name
149. How do you import data from excel sheet to datatable?
A.Right Clickon DataTableà Click on SheetàImportàFrom fileàBrowse the Path
Or
Use Import method of datatable
Syntax: datatable.import “Path”
150. How to fetch the value from 6 row and 6 column in a specific sheet during runtime
A. datatable.getsheet(“sheetid”).setcurrentrow(6)
Variable=Datatable.value(6, “sheetid”)
151. Suppose there are 10 rows of values in datatable, the script is running for 10 times, if you want to run only for first 2 rows how do you do?
64. How to fetch data from a specific sheet in excel to a specific sheet in datatable during runtime?
A. Use Improtsheet method
Syntax: Datatable.importsheet (“path of file”, source sheet, destination sheet)
Note: source sheet is the sheet in excel and destination sheet is the sheet in datatable.
65. How to export data from a specific datasheet in datatable to a specific sheet in excel during runtime?
A. Use Exportsheet method
Syntax: Datatable.Exportsheet (“path of file”, source sheet,)
Note: Destination sheet is not required while exporting the data from datatable; if the file is not available in the specified location then quick test will create a file and dump the sheet. Always the sheet is
appended at the end of the excel file.
66. How do you fetch values in a reverse order from last row to first row from the datatble during runtime?
A. By seeting the focus to previous row before fetching the value
Syntax: datatable.setpreviousrow
67. What is accessibility checkpoint?
A. An Accessibiliy checkpoint checks the Web page for Section 508 compliance.
68. What is the use of recoveries in Quick Test Pfrofessional?
A. Unexpected events, errors, and application crashes during a run session can disrupt your run session and distort results. This is a problem particularly when tests run unattended the test pauses until you perform the operation needed to recover. To handle situations such as these, QuickTest enables you to create recovery scenarios and associate them with specific tests. Recovery scenarios activate specific recovery operations when trigger events occur.
69. How do you merge objects in 2 Repository files?
A. In Object Repository Manager àTools àObject Repository Merge toolàNew MergeTool, browse and select two Shared Rpository filesand click OK
70. How do you associate library file to the test?
A. A library file can be assosiate in 2 ways:
i) Through File à Settings à Resources
ii) Executefile “File Path”
71. What is the use of User Defined Environment Variables?
A. These variables are made specific to test which are available to all the actions in that test and also we can associate them to an external .XMl file so that they can be accessable from any test.
72. How do you assosiate external environment variables file to the test?
A. File à settings à Environment à User Defined à Load variables and values from external file à click ok.
To access the variable in the script:
Environment ("variable name")
73. Where is the data stored when we write data to datatable during runtime?
A. Runtime Table in Test Results.
74. What is the syntax for Reporter Event?
A. Reporter.ReportEvent event status,"report step name", "Details"
75. What is the use of Description class?
A. It is used to create an object by describing one or more properties of an object.
Syntax: set objectname=description.create
Objectname(“propertyname”).value=”property value”
76. Can you write syntax to connect to database?
A. Dim objectname
Set objectname=createobject ("ADODB.Connection")
For MS Access:
Con.open "provider=Microsoft.jet.oledb.4.0; data source=database path"
For SQL Server:
Con.open "provider=sqloledb.1;server=server name;uid=user name;pwd=password;database=database name"
Or
Con.open "driver=sqlserver;server=server name;uid=user name;pwd=password;database=database name"
77. Can you write script to read data from employee table in db1 database in SQL server (S1).
A. Dim con
Set con=createobject ("ADODB.Connection")
Con.open "provider=sqloledb.1;server=S1 name;uid=user name;pwd=password;database=db1
Or
Con.open "driver=sql server;server=S1 name;uid=user name;pwd=password;database=db1
Set rs=createobject(”adodb.recordset”)
rs.open “select * from employee”,con
78. Which are the Databases supported by Quick Test Professional?
A. Oracle, MS Access, SQL Server, and Mysql
79. What is parameterization and in how many scenarios we use parameterization?
A. Parameterization is the process of replacing a constant value with a parameter variable. That can be parameterized in following ways in Quick Test:
- While performing Data Driven Testing
- Through Action Parameters
- Random Numbers
- Environment Variables
80. How do we retrieve data from an Excel File?
A. Import data from excel to datatable
Datatable.importsheet "pathofexcelfile", sourcesheet, destinationsheet
In the script replace the value with the datatable parameter:
Datatable (“ParameterId”, “sheetId”)
81. What is Scripting.FileSystem Object?
A. With the FileSystemObject object model, we can process the drives, folders and files in the file system.
82.What is Active Screen in QTP?
A. It is QTP tool feature in which it captures the snap shots of the application screens during the recording process,we can use this screen to perform various script enhancements in absence of application.
83. What are the different types of licenses in QTP?
A. There are 2 types of licenses in Quick Test:
i) Seat License: It is single user license, which can be installed in one work workstation.
ii) Concurrent License: It is otherwise called as Site License, it is multi pack, which comes in bulk (4 or 5 or more license as a single pack)
84. What type of lincese you have used for QTP in your project?
A. We use concurrent user licence for 5 users at time
85. Who provided license for QTP?
A. Hp- (Mercury Interactive)
86. What is synchorinzation?
To instruct QuickTest to pause the test or component until a particular object property achieves the value you specify.
Quick Test supports different synchronization methods like:
A. Synchronization point (Waitproperty): It is a dynamic wait time, which is used to make sync between the Quick Test and the application under test. When you insert a synchronization point into your test or component, QuickTest generates a WaitProperty statement in the Expert View.
Syntax: Object ("objectname"). Waitproperty "property name", "property value", “wait time”
B. Wait: Wait statements to instruct QuickTest to wait for a window to open or an object to appear. Wait statements instruct QuickTest to wait a specified amount of time before proceeding to the next step
Syntax: Wait(time in sec)
C. For tests, you can set the maximum interval (in milliseconds) that QuickTest waits before running each test step. You do this by setting the Object Synchronization Timeout in the Run tab of the Test Settings dialog box (File > Settings > Run).
D. Browser ("browsername"). Page("pagename"). Sync
87. What is difference between text and text area checkpoint?
A. Text checkpoint captures the complete text displayed on the object but textarea checkpoint captures the text in the specified specified area on an object.
88. What use of “On Error Resume Next”?
A. On Error Resume Next causes execution to continue with the statement immediately following the statement that caused the run-time error, or with the statement immediately following the most recent call out of the procedure containing the On Error Resume Next statement. This allows execution to continue despite a run-time error. You can then build the error-handling routine inline within the procedure.
89. What are the different scripting languages QTP supports?
A. You can write your QTP automation programs in any Languages and development environment that supports automation. For example: you can use: VBScript, javaScript, Visual Basic, Visual C++, or Visual Studio.
90. What are the Technologies supportedby Quick Test?
A. Java, MS.Net, SAP, People Soft, Siebel, PoweBuilder, Flash ….Etc
91. How do you set permissions for executing the Quick Test scripts from Quality center?
A. In Quick Test; Goto Tools à Options à Run à selects other Mercury/Hp products to run tests and components.
92. What is the purpose of Terminal emulator add-in in QTP?
A. To test mainframe environment application objects.
93. What is the syntax to open any windows based application from QTP?
A. Invokeapllication(“path of application”)
Or
SystemUtil.Run(“path of application”)
94. When i started recording the program / adding the objects, the tool is not able to recognize any of the objects in the web application, what could be the reason?
A.Corresponding object class may be userdefined class by development team
95. What is difference between Reusable action and function?
A. Even though both can call from whenever we from the other test or other action function execute as external library where as reusable action calls the same action with separate datatable.
96. How do you debug the program?
A.Using Step commands(Step out ,Step Into,Step Over) and Debud Viewer, we can debug the test script.
97. What is difference between step into and step out?
A.During debugging the script we can use these options
Step into will execute the script line by line in main test & also in subtests where as Step over will execute line by line in the main test and executes all the statements at single instance in called function or sub test.
98. How do you comment the script or statements in QTP?
A.Using single quote (‘) at the start of the statement, we can comment a statement.
For commenting multiple lines or a block of code, select the block and press “Ctrl+M”
For uncommenting multiple lines or a block of code, select the block and press “Ctrl+Shift+M”
99.How do you execute a single action in Quick Test?
A. Select the current action; goto Automation à and select Run Current Action.
100.How do you execute the script from a selected location in the Action block?
A. Place the cursor focus in the specified location in the script; goto Automation à and select Run from Step
Or
Ctrl+F5
101.What is the syntax for creating an object using VBScript in Quick Test?
A. Set Objetvariable=CreateObject (“server name”,”type name”)
102. Can you write a function to accept 2 numbers and return the product?
A. Dim a, b, r
Public function fn_mul (a, b)
Fn_mul=a*b
End function
r =fn_mul(5,7)
Msgbox r
103. Which Framework was implemented in your project?
A. Keyword driven framework, by implemnting User Defined Functions
104. What is the extension of Recovery Scenario File?
A.When we create a recovery scenario and save in the system the scenario is created with file extension as “.qrs”(QuickTest recovery scenario)
105. What is smart identification?
A.Usually QTP tool will recognize the objects On the applicaiton based on Mandatory Properties, configured in Object Identification, if there is any conflict in identifying the object then Quick Test will try to identify the object based on the Assistive Properties, still if there is a conflict in identifying the object, then Auick Test will invoke the Smart Identification mechanism in identifying the object based on the Base Filter and Optional Fileter Properties configured.
106. What is Ordinal Identifier?
A. The ordinal identifier assigns the object a numerical value that indicates its order relative to other objects with an otherwise identical description (objects that have the same values for all properties specified in the mandatory and assistive property lists). This ordered value enables QuickTest to create a unique description when the mandatory and assistive properties are not sufficient to do so.
QuickTest can use the following types of ordinal identifiers to identify an object:
Index: Indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description
Location: 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
CreationTime: (Browser object only.) Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description
107. What are mandatory properties and Assistive properties?
A.These are the properties of an object configured in object identification, by default when the tool learn an object, it will learn the Mandatory Properties, if tool identify any 2 similar objects then Assistive Properties are also learned.
108. What is the function to extract a part/portion of a string?
A.We can use mid function:
Syntax: variable=mid (string, starting position, length)
Ex: For instance if you want to fetch “Systems” from the below string
Str="mindqSystems"
X=mid(str,6,7)
Msgbox X
or
If you want to fetch the complete string from 6 position
X=mid(str,6)
Msgbox X
109. What are the views under Test Pane in Quick Test?
A. QTP displays the test script in 2 views
- Keyword view: The Keyword View enables you to create and view the steps of your component in a keyword-driven, modular, table format. The Keyword View is comprised of a table-like view, in which each step is a separate row in the table, and each column represents different parts of the steps. You can modify the columns displayed to suit your requirements.
- Expert View: A test or component consists of statements coded in Microsoft VBScript. These statements are composed of objects, methods, and/or properties that instruct QuickTest to perform operations or retrieve information
110. Suppose there are 4 actions in my Test, How do we change the Sequence of Execution of these actions
A. In Keyword viewà Click action and drag to the required position or order
Or
In QTP when we save the script with multiple actions, in the test a folder with “Action0” will be created, in the “Action0” folder open the “script.mts” file and change the sequence of actions to be executed.
111. How do you configure an object as virtual object?
A. Using virtual object manager we can configure as follows:
Tools menuàVirtual Object ManageràClick on NewàSelect the Class Name to assignàpoint the object using hand symbolàselect Object Name, Collection name to storeàselect Finish.
112. What is the difference between independent action and nested actions?
A.In nested action if parent action properties are changed will affect the child actions, & if parent action is called automatically all the child actions are also called. In independent actions, each action acts as independent & will not depend on another action
113. How do you reduce the size of QTP script file?
A.While saving the file, unselect the option to save active screen, i.e. without active screen if we save the script, the size of the script file is decreased.
114. How do you reduce the size of Active Screen file?
A.By selecting Customize option in Tools menuàActive screenàSelect customizeàedit optionsàclick on OK.
115. Can you tell why do you use QTP and why not the other tools?
A. Apart from so many no.of GUI options QTP supports all latest technologies including Struts (in J2EE), NET Framework, MainFrames etc., it provides alternative method for Record and playback called Descriptive Programming (DP). We can also create an object for working with the applications using “createobject” function.
116. Can you write script to count the number of links in a web page?
A. set decobj=descripton.create()
Decobj(“micclass”)=”link”
Set objcoll=Browser(“Browser name”).page(“page name”).childobjects(Decobj)
Objcount=objcoll.count
Msgbox objcount
117. Can you write script to get the value from a text box?
A. Using “GetvisibleText” method, Using Text output value, Text area Output value we can retrieve the value from a text box.
Ex: x=Window(“sample”).winedit(“edit1”).getvisibletext()
Msgbox x
118. Can you write script to display numbers from 1 to 10?
A. For i=1 to 10
Msgbox i
next
119. Can you write script to check whether the window is exist or not?
A. z = Window(“window name”).Exist
if(z=true)then
reporter.ReportEvent 0,"existance of window","window is exists"
else
reporter.ReportEvent 1,"existance of window","window doesn't exists"
end if
120. Can you write script to set data in text box, using descriptive programming?
A. Ex: Dialog ("name: =Login"). Activate
Dialog ("name: =Login"). WinEdit ("x: =20","y: =59"). Set "mindq"
Or
By describing the object:
Set lgn=description.create
Lgn(“name”).value=”Login”
Set uname=description.create
Uname(“x”).value=”20”
Uname(“y”).value=”59”
Dialog(lgn).winedit(uname).set “Mindq”
121. What is Descriptive Programming?
A. Identifying the objects based on its properties in the script without storing the object descriptions in object repository. We can use or implement this mechanism when the repository is growing huge which might reduce the performance of Quick Test
We can achieve Descriptive Programming in two ways:
i) Static: You list the set of properties and values that describe the object directly in a VBScript statement.
Ex: Browser("name:=MercuryTours").Page("title:=MercuryTours").WebEdit("html id:=username").set “Mindq”
ii) Dynamic: You add a collection of properties and values to a Description object, and then enter the Description object name in the statement.
Ex: set br=description.create
Br(“name”).value=”MercuryTours”
set pge=description.create
pge(“title”).value=”MercuryTours”
set lun=description.create
lun(“html id”).value=”username”
browser(br).page(pge).webedit(lun).set “Mindq”
122. How does QTP tool will recognize the object in the application?
A. When script is recorded in Quick Test, the tool learns the object details & these details will be stored in object repository, during execution the tool will identify the runtime object on the application based on the description properties of the object in the object repository
123. How do you find the available properties of any object in the application?
A. Using Object Spy
Navigation: Tools àObject Spy
124. Suppose you have learned the properties of an object to object repository from the application, now the object properties have changed, how will you update the properties in the object repository?
A. “Update From Application”option from Resource menu so that updated propertie will be added to repository.
125. What is the difference between Test datatable and Runtime datatable?
A. The datatable associated with every test before or after test execution where as the Runtime datatable is the datatable present during test execution, we can accept values to script from runtime datatable and we can also write output to runtime datatable from script. The runtime datatable will be present in the results page after the test execution.
126. What is difference between while and do. while loop?
A. A While...Wend statement instructs QuickTest to perform a statement or series of statements while a condition is true
Syntax: while condition
Statements.
Wend
127. Can you do performance testing in QTP / how do you do performance testing in QTP? We can conduct performance testing using Begin transaction & End transaction statements in the script
A. Ex: Services.StartTransaction "Tran1"
Dialog ("Login"). Activate
Dialog ("Login"). WinEdit ("Agent Name:"). Set "mindq"
Dialog ("Login"). WinEdit ("Password:"). Set "mercury"
Dialog ("Login"). WinButton ("OK"). Click
Services.EndTransaction "Tran1"
The above script can show the performance time to login into Flight application
128. How to run win runner program from QTP?
A. Insert àcall to Winrunner testà Browse the path of the testàselect options àclick on OK
129. How to connect to QC /TD from QTP?
A. FileàQuality Center ConnectionàSpecify the Server NameàClick Connect.
130. Can you give any example how to use Regular Expression?
A. As Quick Test cannot recognize sequetional windows(Fax order No.1 No.2 etc) we can make Quick Test to recongnize the object using regular expressions. As follows
Resource àObject Repository à Select “Fax order No.” from the list àselect physical descriptionàedit text property as follows
“Fax Order No.*”àclick on OK
131. In how many ways we can create test script in QTP?
A. We can create a test script in 3 ways:
i) Through recording.
ii) Through Step generator
iii) Through DP(Descriptive Programming)
132. What is objective of Dim?
A. It is used to declare multiple variables in a single statement as dimension, so that the variable accepts of int, long, float etc.
133. What is the objective of split action?
A. Split action divides the existing action into no.of independent or nested actions. So that separate memory will be allocated, datasheet in datatable will be created.
133.What is missing resources? How can we identify missing resources?
A. If a test has resources that cannot be found, such as missing shared object repositories or calls to missing actions, or if it uses a repository parameter that does not have a defined value, QuickTest indicates this in the Missing Resources pane.
134.what is the advantage of ‘With’ in Quick Test?
A. The With statement allows you to perform a series of statements on a specified object without requalifying the name of the object
Ex: With MyLabel
.Height = 2000
.Width = 2000
.Caption = "This is MyLabel"
End With
135 What is the extension of QTP Script file?
A. .mts (mercury test script)
136.What is dictionary object?
A. A Dictionary object is the equivalent of a PERL associative array. Items can be any form of data, and are stored in the array. Each item is associated with a unique key. The key is used to retrieve an individual item and is usually an integer or a string, but can be anything except an array.
Ex: Dim d ' Create a variable.
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens" ' Add some keys and items.
d.Add "b", "Belgrade"
d.Add "c", "Cairo"
137.What is the use of Update Run mode?
A. QuickTest updates the set of properties for each object class in your associated object repositories according to the properties currently defined in the Object Identification dialog box. You can use this option to modify the set of properties used to identify an object of a certain type.
Update Run mode updates expected vales with latest values automatically.
138. What are the technologies supported by Quick Test 9.5?
A. a) NET Framework 1.1, 2.0, 3.0, and 3.5.
b) Java toolkits - AWT and JFC (Swing),SWT
c) Java run-time environments- Sun JDK, JRE, and Plug-in versions 1.4.2, 1.5.0, and 1.6.0 Sun Java Web Start 1.4.x, 1.5.x, and 1.6.x, JDK, JRE, and Plug-in, versions 1.3.0 and 1.4.2
d) Oracle Forms 6i, 9i, and 10g (Releases 1 and 2)
e) SAP Gui for Windows 7.1
f) PeopleSoft applications 8.X (8.0, 8.4, 8.8, 8.9, 9.0)
139. How to increase the speed of QTP execution?
A. By runnig in fast mode we can increase the speed of execution.
140. What is the diff between language and scripting language?
A. In Language compilation and execution are of different process where as Scripting Language Interpretation exists(no compilation and execution).
141.What is default data type of QTP?
A. Default datatype in Vbscript is ‘variant’.
142.How to create an User Defined Function?
A. 1) Create An UDF in notepad & save with .vbs extension.
2) File MenuàSettingsàresourcesàBrowse the vbscript fileàclick on “set as default” to apply for all tests.
3) call UDF using function name in the test.
143. How can i check if a environment variable exist or not?
A. When we use Environment("Param1").value then QTP expects the environment variable to be already defined. But when we use
Environment.value("Param1") then QTP will create a new internal environment variable if it does not exists. So to be sure that variable exist
in the environment try using Environment("Param1").value.
Environment.value("Param1") then QTP will create a new internal environment variable if it does not exists. So to be sure that variable exist
in the environment try using Environment("Param1").value.
When we use Environment ("Param1").value then QTP expects the environment variable to be already defined. But when we use
Environment.value ("Param1") then QTP will create a new internal environment variable if it does not exists already. So to be sure that variable exist
in the environment try using Environment ("Param1"). Value.
Environment.value ("Param1") then QTP will create a new internal environment variable if it does not exists already. So to be sure that variable exist
in the environment try using Environment ("Param1"). Value.
144.What are the features of Global sheet?
A. i) Parameters in Global sheet are global, they can be used in all the actions in the test.
ii) The test iterations are based on number of rows of data present in the Global sheet.
145. What is the use of datepart function?
A. Returns the specified part of a given date.
GetQuarter = DatePart ("q", TheDate)
146. What is test object?
A. It’s an object that is stored in object repository with which Qucik Test uses to recognize an object on the application. Each test object has one or more properties and methods that can be used to perform operations on that object. Each object also has a number of identification properties that can describe the object.
147. How to execute QTP from Command prompt?
A. From DOS prompt give the below command
C:\\ qtpro.exe
148. What are the different scripting languages you could use when working with QTP ?
A. VBScript, Java Script
149. How do we know the name of associated environment file to the current test?
A. Using a method called “environment.externalfilename” we can retrieve the name of associated environment file to the current test.
x=environment.ExternalFileName
Msgbox x
150.What is difference between Internal and External environmental variables?
A. Scope of Internal environmental variables is limited to current test so that we can use in all actions in the test where as external environmental variables are global, hence we can use in any action of any test.
151.Write script to delete a file from file system?
A. Using file System Object “Delete Method” we can delete a file.
Ex: set fso=createobject(“scripting.filesystemobject”)
Fso.deletefile “D:\demo.xml”
152.How do you execute scripts in a batch mode in Quick Test?
A. Using Test Batch Runner. The file extension of a batch file is .mtb (mercury test batch)
Navigation: start à programs à QTPà Tools à Test Batch Runner
153. What is the file extension of the script file & object repository file in Quick Test?
A. Extension of script file is - .mts(mercury test script) Local Object Repository is - .mtr(mercury test repository) Shared Object Repository Extension is - .tsr(test shared repository)
154. How can we merge two shared repositories in Quick Test?
A. Using Object Repository Merge Tool
Navigation: Resourcesà Object Repository manager à Tools à Object repository Merger Tool
155.What is the diff between public and private?
A. If we declare a function as public then we can call the function from any test or action, but private function can be created and used within that action of a test.
156.What is the diff between GET TOProperty and SETTOProperty?
A. Using GET TOProperty we can retrieve a single property of a test object, using SETToProperty we can set property(s) of n test object during runtime.
157.What is Function definition generator?
A. Using function definition generator we can create user defined functions.
Navigation: Insert menuàFunction Defnition generator
158. Explain advantages of Active screen?
A. We can perform the following operations using Active Screens:
i) Insert Standard, Text and Bitmap checkpoints
ii) Insert Standard Output value
iii) View and Add Object to object repository
iv) Generate script for an object using Step generator.
159. Explain Active screen Modes?
Windows application:(capture level)
a. Complete
b. Partial
c. Minimum
d. None
For web application:
Disable Active Screen Capture
Capture Original HTML Source
160. During Normal or Context Sensitive recording, what will happen in QTP?
A. Script is generated for the objects, on which the user performs the operations, snapshots are captured in active screen and the objects are captured in Object Repository.
In Normal recording quick test will generate a script based on the window or screen area coordinates.
161. Explain how QTP recognizes Run time object during execution time?
A. By comparing the Description Properties of every Test Object with the Runtime Object
162. Explain Object Repository?
A. It is a common or central place where quick test will capture all the properties on an object, which will make use of identifying the objects during runtime
163. Explain how we can associate shared repository through script?
A. Using Repositories collection method.
Synatx: Repositoriescollection.add(“shredrepositoryfilename”)
164. What is checkpoint? Explain how it will work?
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 application is functioning correctly.
165. When we insert a checkpoint, how QTP saves that information?
A. When we insert a checkpoint and saved it internally system creates a .dat file and stores the information of the checkpoint in the file. We can’t edit the file directly, we can edit only from QTP.
166. How to know checkpoint pass of fail during execution time? How to get return status of checkpoint?
A. Var=<object hierarchy>. Check (checkpoint (“object”))
It returns “True” value if check point pass, other wise it returns “False” value
167. How to suppress warning messages in test result window?
A. Reporter.Filter=<filter value>
Filter value can be 0, 1,2,3
0-Default. All reported events are displayed in the Test Results
1-Only event with a warning or fail status are displayed in the Test Results.
2-Only events with a fail status are displayed in the Test Results.
3-no events are displayed in test result window
168. How to find text is occurred in the given string or not?
A. InStr function
169. If the object does not support GetItemsCount method then how to find no of items in a combo box?
A. A web list box doesn’t support the method GetItemsCount instead it supports a property called “ItemsCount”. So we have to use GetROProperty (“ItemsCount”)
170. Write the script to print all properties available in the object Repository?
A. Set props=window (“Sample”). GetTOProperties
Propscount=Props.Count
For I=0 to Props.Count-1
Propsname=Props(I).Name
Propsval=props(i).Value
msgbox propsname&space(5)&propsval
171. Write script to change Global Synchronization value?
A. Dim App
Set App = CreateObject("QuickTest.Application")
App.Test.Settings.Run.ObjectSyncTimeOut = 20000
172. If I am not interest to use Transaction points how to find some portion of script execution time?
A. Starting time=now
<Portion of test script>
End time=now
Timetaken=(DateDiff(“s”,starttime,endtime)
173. How to associate external environmental variable file to current test/action Script?
A. Environment.LoadFromFile “Path of .xml file”
Var=Environment.Value(“env. Variable name”)
174. Write the script to find folder path where the current test results are saved?
A. Msgbox(Environment.Value(“ResultDir”))
175. Write the script to find path of the folder in which the test is located?
A. Msgbox(Environment.Value(“TestDir”))
176. Write the script to find which action is currently running?
A. Msgbox(Environment.Value(“ActionName”))
177. Write the script to find Local Host name?
A. Msgbox(Environment.Value(“LocalHostName”))
178. Write script for to invoke multiple web applications from a single instance?
A. Set IE1=Createobject(“Internet Explorer.Application”)
IE1.Visible=True
IE1.Navigate “http://www.mindqsystems.com”
IE1.Navigate http://Rediffmail.com
180. Explain Absolute path and Relative path?
A. The actual path of file as it resides on the hard drive is called absolute path.
The path of file relative to a given folder is called the relative path.
181. Write script to find number of rows filled in local sheet of Action1?
A. Var=DataTable.GetSheet(“Action1).GetRowCount
182. Syntax for setting the parameter id in runtime datatable?
A. variable=datatable.getsheet(“sheet id”).addparameter(“parameter id”,”parameter value”).name
183. Explain DATE and TIME functions?
A. These are default b functions, Date is to fetch the system current date and Time to fetche the system current time.
184. How to compare two strings?
A. Strcomp(string1,string2)
Returns a value indicating the result of a string comparison.
String1 is less than string2à -1
String1 is greater than string2à 1
String1 is equal to string2à 0
185. Write the function to return a string in which the characters order of a specified string is reversed?
A. Dim string
String=”Mindq”
String1(StrReverse(“string”))
Msgbox string1
186.Write the script to read values from Text file?
A. Dim fso,f
Set fso=createobject(“scripting.filesystemobject”)
Set f=fso.opentextfile(“path of .txt file”,1)
While f.atendofline<>true
S=f.readline()
Msgbox s
Wend
F.close()
187.Write script to create a .txt file and to write “mindqsystems” message?
A. Set fso=createobject(“scripting.filesystemobject”)
Set f=fso.createtextfile(“path of .txt file”,8)
f.writeline(“mindqsystems”)
f.close()
188.Write script to create .doc file and to write “mindqsystems” message?
A. Set fso=createobject("scripting.filesystemobject")
Set f=fso.createtextfile("E:\abc.doc")
f.writeline("mindqsystems")
f.close()
189. Write script to work on excel sheets?
A. Set excelapp=createobject("Excel.Application")
excelapp.workbooks.Add
excelApp.visible=true
Set excelsheet=ExcelApp.Activesheet
Set getsheet=excelapp.worksheets
'to get sheet count
msgbox(getsheet.count)
'to enter data
excelsheet.cells(1,1)="Madhu"
excelsheet.cells(2,1)="mindqsystems"
'to add sheet
getsheet.add
to delete sheet
setworksheet=excelbooksheet(4)
worksheet.delete
to read the value
var1=excelsheet.cells(1,1)
var2=excelsheet.cells(2,1)
msgbox(var1&vblf&var2)
to save worksheet
excelbook.saveas “path of location”
excelapp.quit
set excelapp=nothing
190. Write script to retrieve all similar objects located inside a parent object?
A. set obj1=description.create
obj1(“Class Name”).value=”WebEdit”
set objcoll=browser(“Yahoo”).page(“Yahoo..Mail”).childobjects(obj1)
objcnt=objcoll.count
“objcnt” will have the count of the webedits on the given page.
191. Where can I find a web pages cookie?
A. The cookie used by the browser can be accessed through the browsers document object model (DOM).
Ex: browser (“browser name”). Page (“pagename”).object.cookie
192. Does QTP recognize two diff browsers at a time..?If possible how..? Is it possible run scripts on Mozilla which are recorded on IE..?..How..?
A. QTP will recognize two browsers at a time with the help of Creation Time. We can not run the scripts on Mozilla which is recorded on IE. We will face few issues. In that case its better if we use DP(Descriptive Programming)
193. How can you capture (Read) the values from a Table?
If the given table is web table then we can capture the values from web table by using this method
Browser ("Browser").Page ("PageName").WebTable("TableName").
GetCellData(rowindex,columnindex)
194.Why you are Using Descriptive programming instead of Object Repository?
A. Descriptive Programming is an advanced concept in QTP.we can handle the Application by implementing the DP instead of OR.
Advantages of DP:- If there are two web objects with the same properties then how a specific object can be Identified?
- We can handle this situation several ways like
- through Smart Identification Process
- Through Index Property
- Through Dynamic handling through Descriptive Programming.
- We can handle this situation several ways like
- What function can be used to find the number of occurrences of sub strings within a string?
Function Body
Function Call Statement:- What is the concept of hooking in QTP?
- How to load vbs file to qtp through scripting?
- ExecuteFile "Path of file .vbs "
- What is absolute path and relative path in QTP..? How to access them and what are the differences between them...?
- How do we Access, retrieve and edit the runtime objects in Automation Testing using QTP?
- In how many ways we can use checkpoints to an application using QTP?
- How can we call an external library file in QTP apart from using the Executefile statement..? Is there any other way we can call the external library file in QTP?
- How to load an object repository file in to QTP during runtime?
- We can use RepositoriesCollection method ,
Syntax: RepositoriesCollection.Add(shared Object repository file path)
We can also associate this file with AOM concept
- Is QTP a compiler or interpreter, Can we execute a QTP Script file in a system which does not have QTP installed?
- QTP is an Interpreter. We cannot execute QTP script in another system which does not have QTP installed.
- What is the default ordinal identifier in QTP?
- What are the send keys in QTP?
- Send keys are used for sends one or more keystrokes to the active window.
- Suppose there are 100 links in a web page and the number of links will be changing dynamically from time to time. Write a code such that every time it will click on the last Link of the web page?
A.
obj.Click
- Difference between Dim and Redim Statement?
ReDim Customers (100)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.