Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analyze the working principle of QuickTest from life examples

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Students who have just come into contact with QTP often do not know much about how QTP works, but in work and study, only when they really understand the working principle of QTP can they further learn QTP and use QTP. This lecture reveals the working principle of QTP through examples, hoping to help readers to further understand QTP.

1.1 how QuickTest learns objects and identifies objects

How does QTP10.0 learn about objects? It is illustrated by an example.

For example, Orlando needs Lee to help him pick up his two children at the station. Lee has a recent photo of the two children, each with their own characteristics. One of them is an 8-year-old with curly hair and blue eyes, and the other is a girl with ponytail and black-rimmed glasses, about 14 years old. Lee can completely distinguish and identify the two children by the features in the photo. Lee saw similar children at the station, and based on the characteristics he remembered, he was soon able to determine whether Orlando had asked him to pick up the two children.

QuickTest takes a very similar approach to memorizing objects during recording.

First, it "observes" the object to be recorded, and then stores it as a test object to determine which test object class the object conforms to. QuickTest also classifies test objects for checking items, such as standard Windows dialog boxes (Dialog), Web buttons (WebButton), or Visual Basic scroll bar objects (VbScrollBar).

For each test object class, QuickTest has a list of mandatory attributes to remember all the time, just as Lee remembers each child feature after seeing the photo. When recording an object, QuickTest always remembers these default property values and then checks the rest of the similar objects to see if the description is sufficient to uniquely identify the object. If it is not enough to uniquely identify the object, QuickTest adds auxiliary attributes to the object item by item until the attribute list can identify an object. Just like Lee identifies two children by a combination of features such as hair color and height. If no auxiliary properties are available, or if those available are still not enough to indicate the uniqueness of the object, QuickTest adds a special sequential identifier (such as the location of the object on the page or in the source code) to indicate the uniqueness of the object.

How do you identify objects during QuickTest playback of the script?

During the playback of the QuickTest script, just as Lee recognizes two children, the goal is quickly determined based on the unique combination of features recorded in Lee's mind. QuickTest uses the list of object attributes recorded during recording to find the corresponding object properties, determines the uniqueness of the object according to the attributes (or a combination of multiple attributes), and then carries out related operations on the object.

1.2 description of the test object

For each object class, QuickTest remembers a set of properties of the object when recording, and then uses the description property to identify and identify the object when running the test.

To record a script that logs into the plane booking system, click "Keyword View" in the QTP10.0 window, right-click "userName", and select "Object Properties" from the right menu as shown in figure 2.30.

If the three properties in the list of attributes in the diagram are not sufficient to uniquely identify the object, QuickTest will mark its uniqueness by adding some auxiliary attributes. When you run the test, QuickTest searches for objects that match the property descriptions it remembers. If a matching object is found, some action is performed on the object.

Where does QuickTest Professional store the list of properties of objects and their records?

As shown in the figure, you can see the objects and attributes recorded by QuickTest Professional in the QTP object library. Click "Resources"-"Object Repository" on the QuickTest Professional menu bar to enter the object library.

Object library

As shown in the figure, the object that is operated during recording is recorded in the object library, and the object is recognized during QuickTest playback and the relevant operation is assigned to the object.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report