CN105335288A - Positioning method and device of mobile application page object - Google Patents

Positioning method and device of mobile application page object Download PDF

Info

Publication number
CN105335288A
CN105335288A CN201510707772.3A CN201510707772A CN105335288A CN 105335288 A CN105335288 A CN 105335288A CN 201510707772 A CN201510707772 A CN 201510707772A CN 105335288 A CN105335288 A CN 105335288A
Authority
CN
China
Prior art keywords
application page
mobile application
text
page object
recorded
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510707772.3A
Other languages
Chinese (zh)
Other versions
CN105335288B (en
Inventor
殷坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Neusoft Corp
Original Assignee
Neusoft Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Neusoft Corp filed Critical Neusoft Corp
Priority to CN201510707772.3A priority Critical patent/CN105335288B/en
Publication of CN105335288A publication Critical patent/CN105335288A/en
Application granted granted Critical
Publication of CN105335288B publication Critical patent/CN105335288B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Processing Or Creating Images (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a positioning method and device of a mobile application page object. The positioning method of the mobile application page object comprises the steps that when an id and a text of the mobile application page object are a null value or do not exist, executing a first judgment process, when the id value is not exclusive and the text is a null value or does not exist, executing a second judgment process, when the text value is not exclusive and the id is a null value or does not exist, executing a third judgment process, wherein the first judgment process is that when a route does not exist and screens of a recording device and a playback mobile device are identical, the object is positioned by using a coordinate, the second judgment process is that when the screens of the recording and playback mobile devices are identical, the object is collectively positioned by the id and the coordinate, and the third judgment process is that when the screens of the recording and playback mobile devices are identical, the object is collectively positioned by the text and the coordinate. By adopting the method, an appropriate positioning strategy can be self-adaptively determined, and the positioning accuracy and compatibility of the mobile application page object when an automatic testing script is played back can be improved.

Description

Method and device for positioning mobile application page object
Technical Field
The invention relates to the technical field of software testing, in particular to a method and a device for positioning a mobile application page object.
Background
With the vigorous development of the mobile internet technology, the scale of mobile applications (Android/IOS applications) is larger and larger, and how to ensure the quality of the mobile applications through effective tests also becomes a difficult problem in front of all mobile application development teams. In the face of frequent version release and numerous equipment types, pure manual testing gradually cannot cope with the frequent version release and the demand of automatic testing is increasing. The automatic test simulates each step of operation of a user in an automatic mode, wherein each step consists of object positioning and object operation, and the primary task is object positioning.
In the traditional automatic test process, the positioning of the mobile application page object must use the data information specified in advance, the mobile application page object cannot be positioned in a self-adaptive manner according to various data information (id, text, path and coordinate) of the mobile application page object and the screen attribute resolution and pixel density of the mobile device (the mobile device used during recording and the mobile device used during playback), and the automatic test script is poor in compatibility.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the related art.
Therefore, an object of the present invention is to provide a method for positioning a mobile application page object, which can adaptively determine a suitable positioning policy, and improve the accuracy and compatibility of positioning the mobile application page object during playback of an automated test script.
Another object of the present invention is to provide a positioning apparatus for mobile application page objects.
In order to achieve the above object, an embodiment of the present invention provides a method for positioning a mobile application page object, including: acquiring data information of a mobile application page object, wherein the data information comprises id, text, a path and coordinates; acquiring the state of the id or acquiring the state of the text to obtain a state result, wherein the state result is any one of a null value, an absence value, a non-unique value and a unique value; if the status result is that the id and the text are null values or do not exist, executing a first judgment process, if the status result is that the id value is not unique and the text is null value or does not exist, executing a second judgment process, and if the status result is that the text value is not unique and the id is null value or does not exist, executing a third judgment process, wherein the first judgment process is to judge whether the path exists, judge whether the screens of the recorded and played back mobile devices are the same when the path does not exist, and position the mobile application page object by using the coordinates when the screens of the recorded and played back mobile devices are the same; the second judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and when the screens of the recorded and played back mobile devices are the same, the id and the coordinates are used for positioning the mobile application page object together; and the third judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and co-locate the mobile application page object by using the text and the coordinates when the screens of the recorded and played back mobile devices are the same.
According to the positioning method of the mobile application page object provided by the embodiment of the first aspect of the invention, when the id and the text of the mobile application page object are null values or nonexistence, the path does not exist, and the screens of the recorded and played mobile devices are the same, the mobile application page object is positioned by using the coordinates, when the id value is not unique, the text is null value or nonexistence, and the screens of the recorded and played mobile devices are the same, the mobile application page object is positioned by using the id and the coordinates together, and when the text value is not unique, the id is null value or nonexistence, and the screens of the recorded and played mobile devices are the same, the mobile application page object is positioned by using the text and the coordinates together, so that a proper positioning strategy can be determined in a self-adaptive manner, and the accuracy and compatibility of the positioning of the mobile application page object during.
In order to achieve the above object, an embodiment of a second aspect of the present invention provides a device for positioning a mobile application page object, including: the system comprises a data information acquisition module, a data information acquisition module and a data information processing module, wherein the data information acquisition module is used for acquiring data information of a mobile application page object, and the data information comprises an id, a text, a path and a coordinate; the state result acquisition module is used for acquiring the state of the id, or acquiring the state of the text, judging whether the path exists or not, and judging whether the screens of the recorded and played back mobile equipment are the same or not to obtain a state result; an execution module, configured to execute a first determination process when the state result is that the id and the text are null values or do not exist, execute a second determination process when the state result is that the id value is not unique and the text is null values or does not exist, and execute a third determination process when the state result is that the text value is not unique and the id is null values or does not exist, where the first determination process is to determine whether the path exists, determine whether a screen of a recorded and played-back mobile device is the same when the path does not exist, and position the mobile application page object with the coordinates when the screen of the recorded and played-back mobile device is the same; the second judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and when the screens of the recorded and played back mobile devices are the same, the id and the coordinates are used for positioning the mobile application page object together; and the third judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and co-locate the mobile application page object by using the text and the coordinates when the screens of the recorded and played back mobile devices are the same.
The positioning device for the mobile application page object provided by the embodiment of the second aspect of the invention positions the mobile application page object by using the coordinates when the id and the text of the mobile application page object are null values or nonexistent, the path does not exist, the screens of the recorded and played mobile devices are the same, positions the mobile application page object by using the id and the coordinates when the id is not unique and the text is null values or nonexistent, and the screens of the recorded and played mobile devices are the same, and positions the mobile application page object by using the text and the coordinates when the text is not unique and the id is null values or nonexistent, and the screens of the recorded and played mobile devices are the same, so that a proper positioning strategy can be determined in a self-adaptive manner, and the accuracy and the compatibility of the positioning of the mobile application page object during the playback of the automatic test script are improved.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a flowchart illustrating a method for positioning a mobile application page object according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating an object location method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of complete data information of a mobile application page object acquired in the embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method for positioning a mobile application page object according to another embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a positioning apparatus for a mobile application page object according to another embodiment of the present invention;
fig. 6 is a schematic structural diagram of a positioning apparatus for a mobile application page object according to another embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention. On the contrary, the embodiments of the invention include all changes, modifications and equivalents coming within the spirit and terms of the claims appended hereto.
Fig. 1 is a schematic flowchart of a method for positioning a mobile application page object according to an embodiment of the present invention, where the method includes:
s11: data information of a mobile application page object is obtained, wherein the data information comprises id, text, a path and coordinates.
Wherein the mobile application is an application on the mobile device.
A mobile device such as a smartphone, or a tablet computer, etc.
The application may refer to a software program running on an electronic device, such as a Personal Computer (PC), a cloud device, or a mobile device.
After a mobile application page, such as a user clicks on an application on a mobile device, a jump interface on the mobile device screen is displayed.
In the field of computer technology, an object refers to an instance of a class loaded in memory, with associated member variables and member functions.
Such as buttons, pictures, text, input boxes, etc.
id is an identification attribute of a page element.
Text is a type of document for computers that is used primarily to document and store textual information, rather than image, sound, and formatting data.
In the present invention, the path may be described in an XML path language (XPath) syntax, and the object of the path description may be, for example, an XML (extensible markup language) object or a HTML (hypertext markup language) object.
Coordinates are sets of data values that determine positional relationships.
In particular, data information of id, text, path, and coordinates of the mobile application page object may be obtained to locate the object of the mobile application page.
For example, as shown in fig. 2, which is a schematic diagram of an object location method in the embodiment of the present invention, taking a "national telephone rate recharge" object as an example, the location method includes four types:
1. positioning the mobile application page object by id: an object can be located by the developer's identification attribute id set for the object in the code, which is usually named "id", but sometimes also named "resource-id" or other name, as shown in FIG. 2 as label 21.
2. Locating a mobile application page object by text: an object can also be located by its visible text, as shown in fig. 2 as callout 22.
3. Locating a mobile application page object through a path: each object can be located on the page by a relative path or an absolute path, and the path corresponding to label 23 shown in fig. 2 is: // ScrollView [1]/LinearLayout [0]/ListView [1]/LinearLayout [0]/relativeLayout [0]/TextView [1 ].
4. Positioning the mobile application page object by coordinates: an object is located by coordinates (x-axis, y-axis) of the top left corner and the bottom right corner of the object, and coordinates of a center point are calculated according to the coordinates of the top left corner and the bottom right corner, which are the actual click positions on the screen of the mobile device, and are labeled 24 as shown in fig. 2.
Optionally, the data information further includes resolution and pixel density.
The resolution is the precision of the screen image and refers to the number of points that the screen can display. Since the dots, lines and surfaces on the screen are all made up of dots, the screen is finer with greater resolution, e.g., 1280 × 720.
The pixel density is the number of pixels owned by each inch, and the higher the pixel density is, the larger the screen image reality is.
Data information of resolution and pixel density can be completely and automatically acquired in the process of recording and replaying the automatic test script without additional supplement.
For example, refer to fig. 3, which is a schematic diagram of complete data information of a mobile application page object acquired in the embodiment of the present invention.
S12: and acquiring the state of the id or acquiring the state of the text to obtain a state result, wherein the state result is any one of a null value, an absence value, a non-unique value and a unique value.
Specifically, since most mobile application page objects do not need to set an id and a text during development, the id and the text do not have a value, and since objects of id and text attributes set manually cannot ensure uniqueness of the id value and the text value, when the id and the text are null values or do not exist, the mobile application page object cannot be positioned through the id and the text, or when the id and the text value are not unique, the mobile application page object cannot be accurately positioned, and therefore, a state of the id needs to be acquired, or a state of the text needs to be acquired to judge whether the id has a unique value, or whether the text has a unique value.
For example, the status result is that id has a unique value.
Optionally, obtaining the status of id or obtaining the status of text to obtain a status result includes: judging whether the id meets a first preset condition or not, and judging whether the text has a unique value or not when the id meets the first preset condition so as to obtain a state result; or judging whether the text meets a second preset condition, and judging whether the id has a unique value when the text meets the second preset condition so as to obtain a state result; the first preset condition is that id is any one of null value, non-existence and non-unique value, and the second preset condition is that text is any one of null value, non-existence and non-unique value.
S13: if the state result is id and the text is null value or not, executing a first judgment process, if the state result is that the id value is not unique and the text is null value or not, executing a second judgment process, and if the state result is that the text value is not unique and the id is null value or not, executing a third judgment process, wherein the first judgment process is used for judging whether a path exists or not, judging whether the screens of the recorded and played back mobile equipment are the same or not when the path does not exist, and positioning the mobile application page object by using coordinates when the screens of the recorded and played back mobile equipment are the same; the second judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and when the screens of the recorded and played back mobile devices are the same, the mobile application page objects are positioned by using the id and the coordinates; the third judging process is to judge whether the screens of the recorded and played back mobile devices are the same, and co-locate the mobile application page object by using the text and the coordinates when the screens of the recorded and played back mobile devices are the same.
And judging whether the screens of the recorded and played back mobile devices are the same or not according to the resolution and the pixel density.
The recording is to automatically record and operate steps, input data and other information through an automation tool in the process of manually operating the application to be tested based on a certain mobile device.
The playback is a manual operation process before different mobile devices are selected to be automatically restored based on the recorded test scripts, and is the playback of a use case.
For example, when the status result is that id and text are null values or do not exist, whether a path exists is further judged, when the path does not exist, whether the screens of the recorded and played back mobile devices are the same is judged, and when the screens of the recorded and played back mobile devices are the same, the mobile application page object is positioned by using the coordinates.
In the embodiment, when the id and the text of the mobile application page object are null values or nonexistent, the path does not exist, and the screens of the recorded and played back mobile devices are the same, the mobile application page object is positioned by using the coordinates, when the id value is not unique and the text is null values or nonexistent, and the screens of the recorded and played back mobile devices are the same, the mobile application page object is co-positioned by using the id and the coordinates, and when the text value is not unique and the id is null values or nonexistent, and the screens of the recorded and played back mobile devices are the same, the mobile application page object is co-positioned by using the text and the coordinates, a proper positioning strategy can be determined in a self-adaptive manner, and the accuracy and the compatibility of the positioning of the mobile application page object during the playback of the automatic.
Fig. 4 is a flowchart illustrating a method for positioning a mobile application page object according to another embodiment of the present invention, where the method includes:
s401: data information of id, text, path, coordinates, resolution, and pixel density of the mobile application page object is obtained.
In particular, data information of id, text, path, coordinates, resolution, and pixel density of the mobile application page object may be obtained to locate the object of the mobile application page.
When the automatic script is played back, firstly, the complete data information of the mobile application page object obtained when the script is recorded is obtained, and the id, the text, the path, the coordinates, the resolution and the pixel density information in the complete data information are analyzed.
S402: and judging whether the id is a null value or not, if so, executing the step S405 and the subsequent steps, and otherwise, executing the step S403.
For example, it is determined whether the id obtained during recording is null or not, and if the id is null or not, step S405 and subsequent steps are triggered to be executed.
S403: and judging whether the id has a unique value, if so, executing the step S404, and otherwise, executing the step S405 and the subsequent steps.
For example, it is determined whether an id value obtained during recording exists on the detected mobile application page and an object with the id as the value exists only, and when it is determined that the id has the unique value, the step S404 is triggered to be executed.
S404: the mobile application page object is located with the id.
Since the id value is unique, the mobile application page object can be located by using the id.
S405: and judging whether the text is a null value or not, if so, executing the steps S406-S411, otherwise, executing the steps S412-S417.
For example, whether a text value obtained by recording is empty or not is judged, or whether an object with a text value exists on the tested mobile application page, and if not, the execution of steps S406 to S411 is triggered.
S406: and judging whether the path exists, if so, executing step S407, otherwise, executing step S408.
For example, it is determined whether a corresponding object exists in the detected mobile application page of the path value obtained during recording, and if so, step S407 is triggered to be executed.
S407: the mobile application page object is located with the path.
S408: and judging whether the recorded and played back screens of the mobile equipment are the same, if so, executing step S409, otherwise, executing step S410.
Whether the screens of the recorded and played back mobile devices are the same is judged through the resolution and the pixel density, and if so, the step S409 is triggered to be executed.
S409: the mobile application page object is located with the coordinates.
S410: the coordinates are recalculated to obtain first recalculated coordinates.
In the invention, under the condition that the screen resolution and the pixel density of the mobile equipment adopted in recording and playback are different, the position deviation of the same mobile application page object is larger, and if the mobile application page object is positioned on another mobile equipment by directly using the coordinates in recording, the position deviation is very large, so that recalculation is required according to the screen attribute of the front-back moving equipment to improve the positioning accuracy of the mobile application page object.
S411: the mobile application page object is positioned with the first recalculated coordinates.
S412: and judging whether the text has a unique value, if so, executing the step S413, and otherwise, executing the step S414.
For example, it is determined whether the object corresponding to the text value obtained during recording on the detected mobile application page is unique, and if so, step S413 is triggered to be executed.
S413: the mobile application page object is located with text.
S414: and judging whether the screens of the recorded and played back mobile devices are the same, if so, executing step S415, otherwise, executing step S416.
Whether the screens of the recorded and played back mobile devices are the same is judged through the resolution and the pixel density, and if so, the step S415 is triggered to be executed.
S415: the mobile application page object is co-located with the text and coordinates.
Specifically, among a plurality of mobile application page objects with the same text value, an object with the actual center point coordinate closest to the center point coordinate recorded during case recording is selected.
S416: and recalculating the coordinates to obtain the third recalculated coordinates.
In the invention, under the condition that the screen resolution and the pixel density of the mobile equipment adopted in recording and playback are different, the position deviation of the same mobile application page object is larger, and if the mobile application page object is positioned on another mobile equipment by directly using the coordinates in recording, the position deviation is very large, so that recalculation is required according to the screen attribute of the front-back moving equipment to improve the positioning accuracy of the mobile application page object.
S417: co-locating the mobile application page object with the third re-computed coordinates and the text.
Specifically, among a plurality of mobile application page objects having the same text value, an object whose virtual center point coordinate is closest to the third recalculated coordinate is selected.
It should be noted that, in the present invention, after the data information of id, text, path, coordinate, resolution, and pixel density of the mobile application page object is obtained, it may also be determined whether the text is null or not, and whether the text has a unique value, and then the id is determined according to the state result, and the determination order of the id and the text is not limited.
In this embodiment, by locating the mobile application page object with the path when the path exists, locating the mobile application page object with the path when the path does not exist, locating the mobile application page object with the coordinates when the path does not exist and the screen of the recorded and played mobile device is the same, locating the mobile application page object with the first recalculated coordinates when the path does not exist and the screen of the recorded and played mobile device is different, locating the mobile application page object with the text when the text has a unique value, locating the mobile application page object with the text and the coordinates when the text value is not unique and the id is null or nonexistent and the screen of the recorded and played mobile device is the same, locating the mobile application page object with the text and the third recalculated coordinates when the text value is not unique and the id is null or nonexistent and the screen of the recorded and played mobile device is different, the method and the device can adaptively determine a proper positioning strategy, and improve the accuracy and compatibility of positioning of the mobile application page object during playback of the automatic test script.
Fig. 5 is a schematic structural diagram of a positioning apparatus for a mobile application page object according to another embodiment of the present invention, where the apparatus 50 includes a data information obtaining module 501, a status result obtaining module 502, and an executing module 503, where the data information obtaining module 501 is configured to obtain data information of the mobile application page object, where the data information includes id, text, path, and coordinate; a status result obtaining module 502, configured to obtain a status of the id, or a status of the text, determine whether a path exists, and determine whether a screen of the recorded and played back mobile device is the same, so as to obtain a status result; an executing module 503, configured to execute a first determining process when the status result is id and the text is null or absent, execute a second determining process when the status result is id is not unique and the text is null or absent, and execute a third determining process when the status result is text is not unique and id is null or absent, where the first determining process is to determine whether a path exists, determine whether the screens of the recorded and played back mobile devices are the same when the path does not exist, and position the mobile application page object by using coordinates when the screens of the recorded and played back mobile devices are the same; the second judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and when the screens of the recorded and played back mobile devices are the same, the mobile application page objects are positioned by using the id and the coordinates; the third judging process is to judge whether the screens of the recorded and played back mobile devices are the same, and co-locate the mobile application page object by using the text and the coordinates when the screens of the recorded and played back mobile devices are the same.
A data information obtaining module 501, configured to obtain data information of the mobile application page object, where the data information includes id, text, path, and coordinate.
Wherein the mobile application is an application on the mobile device.
A mobile device such as a smartphone, or a tablet computer, etc.
The application may refer to a software program running on an electronic device, such as a Personal Computer (PC), a cloud device, or a mobile device.
After a mobile application page, such as a user clicks on an application on a mobile device, a jump interface on the mobile device screen is displayed.
In the field of computer technology, an object refers to an instance of a class loaded in memory, with associated member variables and member functions.
Such as buttons, pictures, text, input boxes, etc.
id is an identification attribute of a page element.
Text is a type of document for computers that is used primarily to document and store textual information, rather than image, sound, and formatting data.
In the present invention, the path may be described in an XML path language (XPath) syntax, and the object of the path description may be, for example, an XML (extensible markup language) object or a HTML (hypertext markup language) object.
Coordinates are sets of data values that determine positional relationships.
In particular, data information of id, text, path, and coordinates of the mobile application page object may be obtained to locate the object of the mobile application page.
For example, as shown in fig. 2, which is a schematic diagram of an object location method in the embodiment of the present invention, taking a "national telephone rate recharge" object as an example, the location method includes four types:
1. positioning the mobile application page object by id: an object can be located by the developer's identification attribute id set for the object in the code, which is usually named "id", but sometimes also named "resource-id" or other name, as shown in FIG. 2 as label 21.
2. Locating a mobile application page object by text: an object can also be located by its visible text, as shown in fig. 2 as callout 22.
3. Locating a mobile application page object through a path: each object can be located on the page by a relative path or an absolute path, and the path corresponding to label 23 shown in fig. 2 is: // ScrollView [1]/LinearLayout [0]/ListView [1]/LinearLayout [0]/relativeLayout [0]/TextView [1 ].
4. Positioning the mobile application page object by coordinates: an object is located by coordinates (x-axis, y-axis) of the top left corner and the bottom right corner of the object, and coordinates of a center point are calculated according to the coordinates of the top left corner and the bottom right corner, which are the actual click positions on the screen of the mobile device, and are labeled 24 as shown in fig. 2.
Optionally, the data information further includes resolution and pixel density.
The resolution is the precision of the screen image and refers to the number of points that the screen can display. Since the dots, lines and surfaces on the screen are all made up of dots, the screen is finer with greater resolution, e.g., 1280 × 720.
The pixel density is the number of pixels owned by each inch, and the higher the pixel density is, the larger the screen image reality is.
Data information of resolution and pixel density can be completely and automatically acquired in the process of recording and replaying the automatic test script without additional supplement.
For example, refer to fig. 3, which is a schematic diagram of complete data information of a mobile application page object acquired in the embodiment of the present invention.
The status result obtaining module 502 is configured to obtain the status of the id or the status of the text, determine whether the path exists, and determine whether the recorded and played back screen of the mobile device is the same, so as to obtain a status result.
Optionally, the state result obtaining module 502 is specifically configured to determine whether the id meets a first preset condition, and when the id meets the first preset condition, determine whether the text has a unique value, so as to obtain a state result; or judging whether the text meets a second preset condition, and judging whether the id has a unique value when the text meets the second preset condition so as to obtain a state result; the first preset condition is that id is any one of null value, non-existence and non-unique value, and the second preset condition is that text is any one of null value, non-existence and non-unique value.
Specifically, since most mobile application page objects do not need to set an id and a text during development, the id and the text do not have a value, and since objects of id and text attributes set manually cannot ensure uniqueness of the id value and the text value, when the id and the text are null values or do not exist, the mobile application page object cannot be positioned through the id and the text, or when the id and the text value are not unique, the mobile application page object cannot be accurately positioned, and therefore, a state of the id needs to be acquired, or a state of the text needs to be acquired to judge whether the id has a unique value, or whether the text has a unique value.
For example, the status result is that id has a unique value.
An executing module 503, configured to execute a first determining process when the status result is id and the text is null or absent, execute a second determining process when the status result is id is not unique and the text is null or absent, and execute a third determining process when the status result is text is not unique and id is null or absent, where the first determining process is to determine whether a path exists, determine whether the screens of the recorded and played back mobile devices are the same when the path does not exist, and position the mobile application page object by using coordinates when the screens of the recorded and played back mobile devices are the same; the second judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and when the screens of the recorded and played back mobile devices are the same, the mobile application page objects are positioned by using the id and the coordinates; the third judging process is to judge whether the screens of the recorded and played back mobile devices are the same, and co-locate the mobile application page object by using the text and the coordinates when the screens of the recorded and played back mobile devices are the same.
And judging whether the screens of the recorded and played back mobile devices are the same or not according to the resolution and the pixel density.
The recording is to automatically record and operate steps, input data and other information through an automation tool in the process of manually operating the application to be tested based on a certain mobile device.
The playback is a manual operation process before different mobile devices are selected to be automatically restored based on the recorded test scripts, and is the playback of a use case.
For example, when the status result is that id and text are null values or do not exist, whether a path exists is further judged, when the path does not exist, whether the screens of the recorded and played back mobile devices are the same is judged, and when the screens of the recorded and played back mobile devices are the same, the mobile application page object is positioned by using the coordinates.
Optionally, the execution module 503 is further configured to locate the mobile application page object with the id when the status result is that the id has a unique value.
For example, whether an id value obtained during recording exists in a detected mobile application page or not is judged, and an object with the unique id as the value exists is judged, and when the id is judged to have the unique value, the mobile application page object is positioned by using the id.
Optionally, the execution module 503 is further configured to locate the mobile application page object with the text when the status result is that the text has a unique value.
For example, whether the object corresponding to the text value obtained during recording on the detected mobile application page is unique is judged, and if the object is unique, the mobile application page object is positioned by the text.
Optionally, the execution module 503 is further configured to locate the mobile application page object by using the path when determining that the path exists.
For example, whether a corresponding object exists in the detected mobile application page of the path value obtained during recording is judged, and if the corresponding object exists, the mobile application page object is positioned by using the path.
In another embodiment, as shown in fig. 6, the apparatus 50 further comprises a coordinate calculation module 504, wherein,
and the coordinate calculation module 504 is configured to recalculate the coordinates to obtain first recalculated coordinates when it is determined that the recorded and played back mobile device screens are different.
The execution module 503 is also for positioning the mobile application page object with the first recalculated coordinates.
In the invention, under the condition that the screen resolution and the pixel density of the mobile equipment adopted in recording and playback are different, the position deviation of the same mobile application page object is larger, and if the mobile application page object is positioned on another mobile equipment by directly using the coordinates in recording, the position deviation is very large, so that recalculation is required according to the screen attribute of the front-back moving equipment to improve the positioning accuracy of the mobile application page object.
The coordinate calculation module 504 is further configured to recalculate the coordinates to obtain second recalculated coordinates when the recorded and played back screens of the mobile devices are different.
The execution module 503 is also used to co-locate the mobile application page object with the second recalculated coordinates and id.
Specifically, among a plurality of mobile application page objects with the same id value, an object with the actual center point coordinate closest to the second recalculated coordinate is selected.
The coordinate calculation module 504 is further configured to recalculate the coordinates to obtain third recalculated coordinates when the recorded and played back mobile device screens are different.
The execution module 503 is also for co-locating the mobile application page object with the third re-computed coordinates and the text.
Specifically, among a plurality of mobile application page objects having the same text value, an object whose virtual center point coordinate is closest to the third recalculated coordinate is selected.
It should be noted that, in the present invention, after the data information of id, text, path, coordinate, resolution, and pixel density of the mobile application page object is obtained, it may also be determined whether the text is null or not, and whether the text has a unique value, and then the id is determined according to the state result, and the determination order of the id and the text is not limited.
In the embodiment, when the id and the text of the mobile application page object are null values or nonexistent, the path does not exist, and the screens of the recorded and played back mobile devices are the same, the mobile application page object is positioned by using the coordinates, when the id value is not unique and the text is null values or nonexistent, and the screens of the recorded and played back mobile devices are the same, the mobile application page object is co-positioned by using the id and the coordinates, and when the text value is not unique and the id is null values or nonexistent, and the screens of the recorded and played back mobile devices are the same, the mobile application page object is co-positioned by using the text and the coordinates, a proper positioning strategy can be determined in a self-adaptive manner, and the accuracy and the compatibility of the positioning of the mobile application page object during the playback of the automatic.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In addition, in the description of the present invention, "a plurality" means two or more unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (18)

1. A method for positioning a mobile application page object is characterized by comprising the following steps:
acquiring data information of a mobile application page object, wherein the data information comprises id, text, a path and coordinates;
acquiring the state of the id or acquiring the state of the text to obtain a state result, wherein the state result is any one of a null value, an absence value, a non-unique value and a unique value;
if the status result is that the id and the text are null values or do not exist, executing a first judgment process, if the status result is that the id value is not unique and the text is null value or does not exist, executing a second judgment process, and if the status result is that the text value is not unique and the id is null value or does not exist, executing a third judgment process, wherein the first judgment process is to judge whether the path exists, judge whether the screens of the recorded and played back mobile devices are the same when the path does not exist, and position the mobile application page object by using the coordinates when the screens of the recorded and played back mobile devices are the same; the second judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and when the screens of the recorded and played back mobile devices are the same, the id and the coordinates are used for positioning the mobile application page object together; and the third judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and co-locate the mobile application page object by using the text and the coordinates when the screens of the recorded and played back mobile devices are the same.
2. The method for locating a mobile application page object as recited in claim 1, wherein said obtaining a status of said id or a status of said text to obtain a status result further comprises:
and if the status result is that the id has a unique value, positioning the mobile application page object by using the id.
3. The method for locating a mobile application page object as recited in claim 2, wherein said obtaining a status of said id or a status of said text to obtain a status result further comprises:
and if the state result is that the text has a unique value, positioning the mobile application page object by using the text.
4. A method for locating a mobile application page object as defined in claim 1, wherein said obtaining a status of said id or a status of said text to obtain a status result comprises:
judging whether the id meets a first preset condition, and judging whether the text has a unique value when the id meets the first preset condition so as to obtain a state result; or,
judging whether the text meets a second preset condition or not, and judging whether the id has a unique value or not when the text meets the second preset condition so as to obtain a state result;
the first preset condition is that the id is any one of a null value, an absence value and a non-unique value, and the second preset condition is that the text is any one of a null value, an absence value and a non-unique value.
5. The method for positioning a mobile application page object according to claim 4, wherein said first determining step of determining whether said path exists further comprises:
and if the path exists, positioning the mobile application page object by using the path.
6. The method for positioning a mobile application page object according to claim 5, wherein after determining whether the recorded and played back screens of the mobile devices are the same in the first determining process, the method further comprises:
if the recorded and played back mobile equipment screens are judged to be different, recalculating the coordinates to obtain first recalculated coordinates, and positioning the mobile application page object by using the first recalculated coordinates.
7. The method for positioning a mobile application page object according to claim 6, wherein after determining whether the recorded and played back screens of the mobile devices are the same in the second determination process, the method further comprises:
when the recorded and played back mobile equipment screens are different, recalculating the coordinates to obtain second recalculated coordinates;
co-locating the mobile application page object with the second recalculated coordinate and the id.
8. The method for positioning a mobile application page object according to claim 7, wherein after determining whether the recorded and played back screens of the mobile devices are the same in the third determining process, the method further comprises:
when the recorded and played back mobile equipment screens are different, recalculating the coordinates to obtain a third recalculated coordinate;
co-locating the mobile application page object with the third re-computed coordinate and the text.
9. The method for locating an object on a mobile application page according to any one of claims 1, 7 and 8, wherein said data information further comprises a resolution and a pixel density by which it is determined whether the screen of said recording and playback mobile device is the same.
10. An apparatus for locating a mobile application page object, comprising:
the system comprises a data information acquisition module, a data information acquisition module and a data information processing module, wherein the data information acquisition module is used for acquiring data information of a mobile application page object, and the data information comprises an id, a text, a path and a coordinate;
the state result acquisition module is used for acquiring the state of the id, or acquiring the state of the text, judging whether the path exists or not, and judging whether the screens of the recorded and played back mobile equipment are the same or not to obtain a state result;
an execution module, configured to execute a first determination process when the state result is that the id and the text are null values or do not exist, execute a second determination process when the state result is that the id value is not unique and the text is null values or does not exist, and execute a third determination process when the state result is that the text value is not unique and the id is null values or does not exist, where the first determination process is to determine whether the path exists, determine whether a screen of a recorded and played-back mobile device is the same when the path does not exist, and position the mobile application page object with the coordinates when the screen of the recorded and played-back mobile device is the same; the second judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and when the screens of the recorded and played back mobile devices are the same, the id and the coordinates are used for positioning the mobile application page object together; and the third judgment process is to judge whether the screens of the recorded and played back mobile devices are the same, and co-locate the mobile application page object by using the text and the coordinates when the screens of the recorded and played back mobile devices are the same.
11. The apparatus for locating a mobile application page object of claim 10, wherein the execution module is further to:
and when the state result is that the id has a unique value, positioning the mobile application page object by using the id.
12. The apparatus for locating a mobile application page object of claim 11, wherein the execution module is further to:
and when the state result is that the text has the unique value, positioning the mobile application page object by using the text.
13. The apparatus for positioning a mobile application page object of claim 10, wherein the state result obtaining module is specifically configured to:
judging whether the id meets a first preset condition, and judging whether the text has a unique value when the id meets the first preset condition so as to obtain a state result; or,
judging whether the text meets a second preset condition or not, and judging whether the id has a unique value or not when the text meets the second preset condition so as to obtain a state result;
the first preset condition is that the id is any one of a null value, an absence value and a non-unique value, and the second preset condition is that the text is any one of a null value, an absence value and a non-unique value.
14. The apparatus for locating a mobile application page object of claim 13, wherein the execution module is further to:
and when the path exists, positioning the mobile application page object by using the path.
15. A positioning apparatus for a mobile application page object as defined in claim 14, further comprising:
the coordinate calculation module is used for recalculating the coordinates to obtain first recalculated coordinates when judging that the recorded and played back mobile equipment screens are different;
the execution module is further to locate the mobile application page object with the first recalculated coordinates.
16. A positioning apparatus for a mobile application page object as defined in claim 15, further comprising:
the coordinate calculation module is also used for recalculating the coordinates when the recorded and played back mobile equipment screens are different so as to obtain second recalculated coordinates;
the execution module is further to co-locate the mobile application page object with the second recalculated coordinate and the id.
17. A positioning device for a mobile application page object according to claim 16, comprising:
the coordinate calculation module is also used for recalculating the coordinates when the screens of the recorded and played back mobile devices are different so as to obtain the coordinates after the recalculation is carried out again;
the execution module is further to co-locate the mobile application page object with the third recalculated coordinate and the text.
18. The apparatus for locating a mobile application page object according to any one of claims 10, 16 and 17, wherein the data information further includes a resolution and a pixel density by which it is determined whether the screen of the recording and playback mobile device is the same.
CN201510707772.3A 2015-10-27 2015-10-27 The localization method and device of Mobile solution page object Active CN105335288B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510707772.3A CN105335288B (en) 2015-10-27 2015-10-27 The localization method and device of Mobile solution page object

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510707772.3A CN105335288B (en) 2015-10-27 2015-10-27 The localization method and device of Mobile solution page object

Publications (2)

Publication Number Publication Date
CN105335288A true CN105335288A (en) 2016-02-17
CN105335288B CN105335288B (en) 2017-12-05

Family

ID=55285841

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510707772.3A Active CN105335288B (en) 2015-10-27 2015-10-27 The localization method and device of Mobile solution page object

Country Status (1)

Country Link
CN (1) CN105335288B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095373A (en) * 2016-06-21 2016-11-09 东软集团股份有限公司 Realize striding equipment screen coordinate is adaptive, operate equipment method and the device of correspondence
CN107885661A (en) * 2017-11-08 2018-04-06 百度在线网络技术(北京)有限公司 The terminal transparency method of testing and system of Mobile solution, equipment, medium
CN109101412A (en) * 2017-06-21 2018-12-28 腾讯科技(深圳)有限公司 Test file generation, test method, device, storage medium and computer equipment
CN109445788A (en) * 2018-10-24 2019-03-08 北京赢销通软件技术有限公司 A kind of script execution and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060005039A1 (en) * 2004-05-26 2006-01-05 Benq Corporation Authentication control system and method thereof
CN102662559A (en) * 2012-03-13 2012-09-12 西安交通大学 Design method of virtual touch screen technology based on scene identification
CN104881478A (en) * 2015-06-02 2015-09-02 吴小宇 Web page positioning identification system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060005039A1 (en) * 2004-05-26 2006-01-05 Benq Corporation Authentication control system and method thereof
CN102662559A (en) * 2012-03-13 2012-09-12 西安交通大学 Design method of virtual touch screen technology based on scene identification
CN104881478A (en) * 2015-06-02 2015-09-02 吴小宇 Web page positioning identification system and method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095373A (en) * 2016-06-21 2016-11-09 东软集团股份有限公司 Realize striding equipment screen coordinate is adaptive, operate equipment method and the device of correspondence
CN106095373B (en) * 2016-06-21 2019-05-03 东软集团股份有限公司 Realize striding equipment screen coordinate adaptation, the method for operation equipment and corresponding device
CN109101412A (en) * 2017-06-21 2018-12-28 腾讯科技(深圳)有限公司 Test file generation, test method, device, storage medium and computer equipment
CN109101412B (en) * 2017-06-21 2021-05-11 腾讯科技(深圳)有限公司 Test file generation method, test file generation device, test file testing method, test file testing device, storage medium and computer equipment
CN107885661A (en) * 2017-11-08 2018-04-06 百度在线网络技术(北京)有限公司 The terminal transparency method of testing and system of Mobile solution, equipment, medium
CN109445788A (en) * 2018-10-24 2019-03-08 北京赢销通软件技术有限公司 A kind of script execution and device

Also Published As

Publication number Publication date
CN105335288B (en) 2017-12-05

Similar Documents

Publication Publication Date Title
TWI729331B (en) Image annotation information processing method, device, server and system
CN112424836B (en) Techniques for displaying shader tables associated with ray traced images
US9317400B2 (en) Code coverage rate determination method and system
US8676723B2 (en) Automated test system based on three-dimensional application software framework and a method thereof
US10147398B2 (en) Display control method and device
CN105335288B (en) The localization method and device of Mobile solution page object
US20090228838A1 (en) Content design tool
US8645912B2 (en) System and method for use in replaying software application events
US20130239090A1 (en) Visual Representations of Code in Application Development Environments
CN111190825A (en) Automatic test method, system and robot
CN109213668B (en) Operation recording method and device and terminal
CN104199767A (en) Test method and device
CN109491646B (en) Message entry method and device, electronic equipment and readable medium
US10152039B2 (en) Method and apparatus for the display of multiple errors on a human-machine interface
US9280627B1 (en) GUI based verification at multiple abstraction levels
US20140304686A1 (en) Responding to a problem during software testing
US8761515B2 (en) Electronic device and method for creating measurement codes
JP2011170697A (en) Software structure analyzing device
US20230060213A1 (en) System and method for generating automation test scripts dynamically for human machine interface testing
US10169216B2 (en) Simulating sensors
US20140074432A1 (en) Electronic device and method for measuring outline of object
CN111736748B (en) Data processing method and device based on map information and electronic equipment
US10255886B2 (en) Inspection record apparatus and inspection record method
US10379970B2 (en) Automatic design discrepancy reporting
CN107092485B (en) Tab label dynamic updating method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant