QTP Interview Questions – Part 4
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
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
By associating procedures to test objects.
With the help of WSH (It is a Windows administration tool), we can use Windows API functions for enhancing Tests.
Read 21st question and answer.
It’s a process of Automating the Quick test operations. To do this we can use java script, VC++ and .NET Apart from VBscript.
WSH is a windows administration tool, it provides hosting environment for running VBscript, Jscript scripts.
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.
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
Using loop statements and GetROProperty method
We can fetch test data directly from external files and databases by creating automation objects
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
For Passing values
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
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
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.
The object, which properties change dynamically (frequently). We can use Regular Expressions to handle dynamic objects.
The purpose of description object is to store multiple properties values of a test object.
By associating a procedure to a test object we can use this as a method on that test object.
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
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.
Test objects are basic and generic objects that QTP recognize. Run time object means the actual object to which a test object maps.
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.
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?