As I described earlier that how QTP identifies test objects during execution.
The answer is simple that during run time it recognize the test object by referring to its object repository ,where we already have stored test object earlier(before creating any test we must make QTP to learn all the test required test object and store it in object repository).
Now the Question is the application is not ready then there is no test object available, then how QTP will learn the test objects and what will we store in the object repository??
Now answer may be the one of the following or all
1) It is impossible to automate any application which is not ready.
2) QTP cannot work without Object repository.
3) What QTP will learn and where will it store.
But all of the above answers are totally wrong J
There is concept/technique which is known as Descriptive Programming is the solution for those.
If we are using object repository then during the run session, QTP finds the object in the object repository based on its name and parent objects, and uses the stored test object description for that test object to identify the object in the application.
We can also instruct QTP to perform operations on objects without referring to the object repository or to the object's name. To do this, we provide QTP with a list of properties and values that QTP can use to identify the object or objects on which we want to perform an operation. This technique is known as Descriptive Programming (inserting programming descriptions).
There are two types of programmatic descriptions:
<!
Static. List the set of properties and values that describe the object directly in a VBScript statement Synatx: Testobj(“Propname1:=PropVal1” , “Propname2:=PropVal2”)
TestObject. The test object class.
PropertyName:=PropertyValue. The identification property and its value. Each property:=value pair should be separated by commas and quotation marks
Example :
Browser("Title:=Mercury Tours").Page("Title:=Mercury Tours").WebEdit("Name:=Author", "Index:=3").Set "Alok"
2) Dynamic. Add a collection of properties and values to a Description object, and then enter the Description object name in the statement.
The Dynamic type provides more power, efficiency, and flexibility. We can use the Description object to return a Properties collection object containing a set of Property objects. A Property object consists of a property name and value. We can then specify the returned Properties collection in place of an object name in a statement. (Each property object contains a property name and value pair.)
To create the Properties collection, you enter a Description. Create statement using the following syntax:
Set MyDescription = Description.Create() Example:
Set Objbtn = Description.Create()
Objbtn(“value”).Value = “Google Search”
Objbtn(“type”).Value = “submit”
Browser(“Google”).Page(“Google”).WebButton(Objbtn).Click