Sunday, June 12, 2011

QTP Interview Question and Answers-3

1) What are the differences between Actions and Functions and which are better?

Actions:
o It’s a QTP feature and Local feature (not a global feature)
o We can use check points in Actions
o As it is QTP feature it may corrupt
o Actions are slow execution
Functions:
o It’s a VB script feature and global concept
o We can’t use checkpoints in functions, instead of checkpoints we can use validation points (Loops and Conditional statements)
o It doesn’t corrupt
o Functions are faster in execution than Actions
2) How create methods in QTP?
By associating procedures to test objects.
3) 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.
4) What are the major differences between functions and actions in QTP? What advantages there in functions than actions?
Read 21st question and answer.
5) 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.
6) What is Windows Script Host?
WSH is a windows administration tool, it provides hosting environment for running VBscript, Jscript scripts.
7) What is exception handling?
Handling expected and unexpected errors during execution
8) 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.
9) How test engineer identifies when programmatic descriptions are useful?
o If application is not ready (using screenshots and documents we can prepare descriptive programming)
o If we want to make our scripts global
o If lengthy tests are there and that we want to execute fast
10) How to retrieve data from application objects?
Using loop statements and GetROProperty method
11) 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, Filesystemobject
12) 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
13) What is the purpose of input parameters?
For Passing values
14) 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
In 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
15) 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.
16) What are dynamic objects?
The object, which properties change dynamically (frequently). We can use Regular Expressions to handle dynamic objects.
17) What is the purpose of description object?
The purpose of description object is to store multiple properties values of a test object.
18) 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.
19) 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
20) What are the disadvantages of using actions?
o Action is a QTP tool feature that occupies QTP’s more memory space.
o It may be corrupted.
o It is not a global feature. Test engineer may not have the control on action.
21) 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.
22) 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.
23) 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 <<UserName>>”.
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.

24) 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

No comments:

Post a Comment