Can we prepare QTP scripts for GUI applications without actually adding the objects to Object Repository? or by adding objects at run time?
Can we prepare QTP scripts for GUI applications without actually adding the objects to Object Repository? or by adding objects at run time?
Hi Shwe30,
Yes we can prepare scripts without actually using objects present in the Object Repository.
We call this method as Descriptive Programming. We can list the set of Properties and values that describe the object as part of our coding syntax itself.
Example
Set myObj = Description.Create()
myObj("AttachedText").value:="agentName"
myObj("html Tag").value:="a".
Iin the first sentence we are trying to define the attached Text with the specific object and in the second since it is an HTML Object, we are defining its html Tag value. Based on these statements, QTP can identify the object and work with it.
For adding Objects at Runtime, we could create an Application Variable using which we open the QTP repository at runtime and we could add the object at runtime. But I would not advise that. Using Descriptive programming to handle Dynamic objects would be better.
Runtime properties can be retrieved using the GetRO Property method.
Cheers......
hmm....Thats a great solution...Thanks!!!!
yes we can prepare script without using objects present in the object repository
If you want to prepare QTP scripts for GUI applications & any application without actually adding the objects to Object Repository there is only one way likw DESCRIPTIVE Programming
Really fine ans.....
Hi Panish,
I am sorry but it seems you did not go through the question completely. Preparation of GUI scripts without objects in the repository is being discussed with respect to QTP tool alone.
QTP does provide you a concept called as Descriptive programming which enables you to work without actually having the object present in the Repository.
Please do read through the chain of mails incase you wish to know more about this.
Yes you are true in one sense..... Tools like Winrunner and Rational Robot do not allow you to create scripts without the object being present in the Repository. But they do enable Opening the GUI Map at runtime and adding objects dynamically.
Hope this clears things a bit.....
Cheers......
Thanks Ya i was bit confused with mercury tools You are right there is a method called DESCRIPTIVE PROGRAMMING
Hi,
does it mean that we are indirectly adding object data into repository.So every time u run the appln its creating a collapsing repository.., i mean repository for just 1 run.Is it true????
Hi panish,
No how Descriptive programming works is that instead of adding objects to repository, you code the object along with its mandatory properties as part of scripting syntax.
Thus these objects are not created as part of any collapsing repository. Hence they are still valid for any number of runs.
Yes had it been the concept of Collapsible repository, definitely it would not have exsited for more than 1 run.
But since we use the methods of creating objects and associating their description along with it, it works fine for all runs.
Set myObj = Description.Create()
myObj("AttachedText").value:="agentName"
myObj("html Tag").value:="a".
The sentence Description.create actually creates a Description Object to which you can associate your Object Properties.
Cheers....
hi
In QTP scripts by discription programming to avoid the adding objects to the object repository before and runtime.
Thanks.Good to know the correct answer.
Can any one suggest me where to get the
QTP guide for getting better understanding on the usage of QTP Scripts and functionalities.
Currently i went through the Tutorial for understanding. But i need more info on the QTP Scripts. Please guide me
we can go to the discreptive programing only when object repository could not find out the object propertirs.
we can add the properties at the Run time by using "SetTo Property("Property name ,Value")
Do you have any clarifictions ,let me know
Thanks&Regards,
Ravikumar
What you said is correct Mr. Ravikumar,
But how you can add the properties at runtime by using SetToProperty method.
I think it is not possible by using SetTOProperty method.
Yes.... you can add the properties to the objects by using SetTOProperty method, but not at runtime.
For adding properties at run time, we need SetROProperty method. But QTP doesn't have such kind of method.
I think you got an idea....