CN109960642B - Automatic test method and device - Google Patents

Automatic test method and device Download PDF

Info

Publication number
CN109960642B
CN109960642B CN201711403538.7A CN201711403538A CN109960642B CN 109960642 B CN109960642 B CN 109960642B CN 201711403538 A CN201711403538 A CN 201711403538A CN 109960642 B CN109960642 B CN 109960642B
Authority
CN
China
Prior art keywords
mobile terminal
information
test
http request
target control
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.)
Active
Application number
CN201711403538.7A
Other languages
Chinese (zh)
Other versions
CN109960642A (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.)
Baidu Online Network Technology Beijing Co Ltd
Original Assignee
Baidu Online Network Technology Beijing Co Ltd
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 Baidu Online Network Technology Beijing Co Ltd filed Critical Baidu Online Network Technology Beijing Co Ltd
Priority to CN201711403538.7A priority Critical patent/CN109960642B/en
Publication of CN109960642A publication Critical patent/CN109960642A/en
Application granted granted Critical
Publication of CN109960642B publication Critical patent/CN109960642B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/3664Environments for testing or debugging software
    • 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
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

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)
  • Debugging And Monitoring (AREA)
  • Telephone Function (AREA)

Abstract

The invention provides an automatic test method and an automatic test device, wherein the method comprises the following steps: intercepting a first operation sent by a user and simulating; the first operation is an operation executed by a user in the application program to be tested; determining indication information of a target control corresponding to the first operation; recording operation information by using the first operation and the indication information; and carrying the operation information in an HTTP request and sending the HTTP request to a slave mobile terminal so that the slave mobile terminal executes the operation information to test the application program. By the method, real-time operation control of multiple mobile terminals by one mobile terminal can be realized in the same local area network, and the mobile terminals can be various devices with different models, different Android versions and different languages, so that the purpose of compatibility test is achieved.

Description

Automatic test method and device
Technical Field
The invention relates to the technical field of automatic testing, in particular to an automatic testing method and device.
Background
The compatibility test of the APP occupies a large proportion in daily test work, and the conventional compatibility test mainly comprises the aspects of machine types, resolution, Android versions, ROM, supported languages and the like.
The existing APP compatibility testing method mainly includes a mode of carrying out monkey testing by means of a testing platform, or carrying out playback testing by controlling a mobile phone by a PC client, or embedding a Software Development Kit (SDK) in an Android Package (Android Package, APK) to monitor user operation, and then carrying out playback testing on the mobile phone.
However, due to the fact that fragmentation of the Android system is serious, when the existing testing method is used for testing, repeated workload is large, and testing efficiency is low. When the PC client controls the mobile phone to perform playback test, a script execution environment needs to be set up, and a plurality of mobile phones can be connected only by means of the USB concentrator, so that the test work needs to be performed in a place with the PC client, and the test place is limited.
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, a first object of the present invention is to provide an automatic testing method, which can implement real-time operation control on multiple mobile terminals by using one mobile terminal in the same local area network, where the mobile terminal can be multiple devices with different models, different Android versions and different languages, so as to achieve the purpose of compatibility testing. Through by mobile terminal control mobile terminal, need not test platform, need not repacking APP, also need not to install the PC customer end and build PC script execution environment, can realize installing promptly and use, the test cost is low. Because the PC client is not required to be installed, the test site can be selected at will, and the method can be used for field test and has higher applicability.
A second object of the invention is to propose another automatic test method.
The third purpose of the invention is to provide an automatic testing device.
A fourth object of the present invention is to provide another automatic test apparatus.
A fifth object of the invention is to propose a computer device.
A sixth object of the invention is to propose another computer device.
A seventh object of the invention is to propose a non-transitory computer-readable storage medium.
An eighth object of the present invention is to propose a non-transitory computer-readable storage medium.
To achieve the above object, an embodiment of a first aspect of the present invention provides an automatic testing method for testing an application program to be tested in a non-embedded manner on a mobile terminal, where the method includes:
intercepting a first operation sent by a user and simulating; the first operation is an operation executed by a user in the application program to be tested;
determining indication information of a target control corresponding to the first operation;
recording operation information by using the first operation and the indication information;
and carrying the operation information in an HTTP request and sending the HTTP request to a slave mobile terminal so that the slave mobile terminal executes the operation information to test the application program.
According to the automatic testing method, the first operation sent by the user is intercepted and simulated, the indication information of the target control corresponding to the first operation is determined, the first operation and the indication information are used for recording the operation information, the operation information is carried in the HTTP request and is sent to the slave mobile terminal, and therefore the slave mobile terminal executes the operation information to test the application program. The operation information is sent to the slave mobile terminal after the mobile terminal records the operation information, so that the slave mobile terminal performs playback test according to the operation information, real-time operation control on a plurality of mobile terminals by one mobile terminal under the same local area network can be realized, and the mobile terminal can be various devices with different models, different Android versions and different languages, so that the purpose of compatibility test is achieved. Through by mobile terminal control mobile terminal, need not test platform, need not repacking APP, also need not to install the PC customer end and build PC script execution environment, can realize installing promptly and use, the test cost is low. Because the PC client is not required to be installed, the test site can be selected at will, and the method can be used for field test and has higher applicability.
In order to achieve the above object, a second aspect of the present invention provides an automatic testing method for testing an application program to be tested in a non-embedded manner on a mobile terminal, where the method includes:
Receiving an HTTP request sent by a main mobile terminal;
analyzing and acquiring operation information from the HTTP request; the operation information is generated according to the operation of a user on the main mobile terminal;
and playing back the operation information for testing to obtain test data.
According to the automatic test method provided by the embodiment of the invention, the HTTP request sent by the main mobile terminal is received, the operation information is analyzed and obtained from the HTTP request, and the operation information is played back for testing to obtain the test data. The operation information of the main mobile terminal is received to carry out playback test, the mobile terminal is controlled by the mobile terminal, a test platform is not needed, APP packaging is not needed, a PC client side is not needed to be installed, a PC script execution environment is not needed to be built, instant use and instant use can be achieved, and the test cost is low. Because the PC client is not required to be installed, the test site can be selected at will, and the method can be used for field test and has higher applicability.
In order to achieve the above object, a third embodiment of the present invention provides an automatic testing apparatus for testing an application to be tested in a non-embedded manner on a mobile terminal, the apparatus including:
the intercepting module is used for intercepting and simulating a first operation sent by a user; the first operation is an operation executed by a user in the application program to be tested;
The determining module is used for determining the indication information of the target control corresponding to the first operation;
the recording module is used for recording operation information by utilizing the first operation and the indication information;
and the sending module is used for carrying the operation information in an HTTP request and sending the HTTP request to the slave mobile terminal so that the slave mobile terminal executes the operation information to test the application program.
The automatic testing device provided by the embodiment of the invention determines the indication information of the target control corresponding to the first operation by intercepting and simulating the first operation sent by the user, records the operation information by using the first operation and the indication information, carries the operation information in the HTTP request and sends the HTTP request to the slave mobile terminal, so that the slave mobile terminal executes the operation information to test the application program. The operation information is sent to the slave mobile terminal after the mobile terminal records the operation information, so that the slave mobile terminal performs playback test according to the operation information, real-time operation control on a plurality of mobile terminals by one mobile terminal under the same local area network can be realized, and the mobile terminal can be various devices with different models, different Android versions and different languages, so that the purpose of compatibility test is achieved. Through by mobile terminal control mobile terminal, need not test platform, need not repacking APP, also need not to install the PC customer end and build PC script execution environment, can realize installing promptly and use, the test cost is low. Because the PC client is not required to be installed, the test site can be selected at will, and the method can be used for field test and has higher applicability.
In order to achieve the above object, a fourth aspect of the present invention provides another automatic testing apparatus for testing an application to be tested in a non-embedded manner on a mobile terminal, the apparatus including:
the receiving module is used for receiving the HTTP request sent by the main mobile terminal;
the analysis module is used for analyzing and acquiring operation information from the HTTP request; the operation information is generated according to the operation of a user on the main mobile terminal;
and the test module is used for playing back the operation information for testing to obtain test data.
The automatic testing device of the embodiment of the invention receives the HTTP request sent by the main mobile terminal, analyzes and obtains the operation information from the HTTP request, plays back the operation information for testing and obtains the testing data. The operation information of the main mobile terminal is received to carry out playback test, the mobile terminal is controlled by the mobile terminal, a test platform is not needed, APP packaging is not needed, a PC client side is not needed to be installed, a PC script execution environment is not needed to be built, instant use and instant use can be achieved, and the test cost is low. Because the PC client is not required to be installed, the test site can be selected at will, and the method can be used for field test and has higher applicability.
To achieve the above object, a fifth embodiment of the present invention provides a computer device, including: a processor and a memory;
wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the automatic test method according to the embodiment of the first aspect.
To achieve the above object, a sixth aspect of the present invention provides another computer device, including: a processor and a memory;
wherein the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the automatic test method according to the embodiment of the second aspect.
To achieve the above object, a seventh embodiment of the present invention proposes a non-transitory computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the automatic testing method according to the first embodiment.
To achieve the above object, an eighth aspect of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the automatic testing method according to the second aspect.
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 schematic flow chart of an automatic testing method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of an automatic control method according to a second embodiment of the present invention;
fig. 3 is a schematic flow chart of an automatic testing method according to a third embodiment of the present invention;
FIG. 4 is a flowchart illustrating another automatic testing method according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating another automatic testing method according to a second embodiment of the present invention;
FIGS. 6 a-6 d are schematic diagrams of an application of automatic testing;
fig. 7 is a schematic structural diagram of an automatic test apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an automatic test apparatus according to a second embodiment of the present invention;
fig. 9 is a schematic structural diagram of an automatic test apparatus according to a third embodiment of the present invention;
FIG. 10 is a schematic diagram of another automatic test apparatus according to an embodiment of the present invention;
FIG. 11 is a schematic structural diagram of another automatic test apparatus according to a second embodiment of the present invention; and
FIG. 12 is a block diagram of an exemplary computer device suitable for use in implementing embodiments 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 drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
An automatic test method and apparatus of an embodiment of the present invention will be described below with reference to the accompanying drawings.
The existing APP compatibility test methods mainly comprise the following methods:
the method comprises the following steps: and uploading the test package to be tested to a cloud platform, and carrying out monkey test on the cloud platform. However, the monkey test has no test scene, and the service life of the commercial test platform resource is limited, so that the problem is difficult to find;
the second method comprises the following steps: and synchronously displaying the interface of the mobile phone on a PC client or a web page, recording user operation on the virtual mobile phone, and finally playing back the user operation on the mobile phone for testing. In the method, the PC client controls the mobile phone to perform playback test, a script execution environment needs to be established, and when a plurality of mobile phones need to be connected for test, a USB concentrator needs to be used;
The third method comprises the following steps: and embedding the SDK in the APK, monitoring the operation of a user by the SDK, recording the operation into a use case, and performing playback test on the mobile phone. By adopting the test mode, the APP needs to be packaged again, the access cost is higher, and the cross-APP operation cannot be carried out;
the method four comprises the following steps: and carrying out recording playback test based on the pictures. The test method only supports the test of one language, and cannot realize multi-language test.
Aiming at least one problem existing in the method, the embodiment of the invention provides an automatic testing method, which can realize playback test without a testing platform and a PC client, is ready to use when installed, supports multi-language test and can be matched with an international service testing scene.
Fig. 1 is a flowchart illustrating an automatic testing method according to an embodiment of the present invention, where the method is used in a mobile terminal to test an application to be tested in a non-embedded manner.
As shown in fig. 1, the automatic test method includes the steps of:
step 101, intercepting a first operation sent by a user and simulating the first operation; the first operation is an operation executed by a user in the application program to be tested.
In this embodiment, a test tool may be installed on a plurality of mobile terminals, and the test tool is used to execute the automatic test method provided in this embodiment.
When the application program needs to be tested, in order to test the compatibility of the application program, the application program to be tested can be installed in a plurality of mobile terminals, and the mobile terminals can be mobile phones of different manufacturers, different models, different Android versions and different languages. In the testing process, the plurality of mobile terminals may be divided into one group for testing, for example, each 10 mobile terminals are divided into one group, and one mobile terminal is randomly selected from each group as a master mobile terminal, the remaining mobile terminals in the group serve as slave mobile terminals, a user operates an application program to be tested on the master mobile terminal, and the slave mobile terminals implement the testing of the application program to be tested on the slave mobile terminals by replaying the operation performed by the user on the master mobile terminal.
In this embodiment, when a user selects a mobile terminal and operates an application program to be tested on the mobile terminal, the mobile terminal serves as a main mobile terminal, an operation, which is sent by the user and executed in the application program to be tested, is intercepted by a testing tool as a first operation, and then a simulator in the testing tool simulates a real first operation sent by the user. The operation executed by the user in the application program to be tested can be a single-click operation, a double-click operation, a sliding operation, a long-press operation and the like.
Specifically, different interception modes can be set for different controls. For the main key or the return key, a broadcast listener may be provided, and a first operation of trying to control a home key (home) or a soft keyboard (receiver) for returning to the desktop, which is simulated, is monitored through the broadcast listener in the mobile terminal; for other controls except the start key and the soft keyboard, a transparent floating layer can be embedded in a display interface of the mobile terminal, and first operation aiming at the other controls except the start key and the soft keyboard is intercepted through the transparent floating layer.
It should be noted that, according to the test requirements of the tester, the tester may only set the broadcast monitor to intercept the operation of the user on the main key or the return key, may also only set the transparent floating layer to intercept the operation of the user on other controls except the main key and the return key, and may also set the broadcast monitor and the transparent floating layer to intercept the operation of the user on all the controls. The type of intercepting tool to be set can be selected according to the testing requirement, which is not limited by the present invention. In this embodiment, in order to ensure the integrity of the test, a broadcast listener and a transparent floating layer are simultaneously provided to intercept the operations of the user on all the controls.
And 102, determining indication information of a target control corresponding to the first operation.
In this embodiment, after the first operation is simulated, the indication information of the target control may be further obtained for the target control corresponding to the first operation. The indication information is used for indicating the name of the target control and/or the position of the target control in the application program to be tested.
It should be noted that, a specific implementation process of determining the indication information of the target control corresponding to the first operation will be explained in the following, and in order to avoid redundancy, it is not described herein too much.
And 103, recording the operation information by using the first operation and the indication information.
In this embodiment, after the first operation is intercepted and the indication information of the target control corresponding to the first operation is determined, the first operation and the indication information may be recorded to obtain operation information, and according to the recorded information, the first operation performed on the target control by the user may be played back.
And step 104, carrying the operation information in the HTTP request and sending the HTTP request to the slave mobile terminal so that the slave mobile terminal executes the operation information to test the application program.
The master mobile terminal and the at least one slave mobile terminal may communicate with each other through a wireless network, or a local area network may be formed between the master mobile terminal and the slave mobile terminal such that the master mobile terminal and the slave mobile terminal communicate only within the local area network. After the master mobile terminal records the operation information, the operation information can be packaged in the HTTP request, and the HTTP request carrying the operation information is sent to the slave mobile terminal in wireless communication connection with the master mobile terminal through a wireless network, so that the slave mobile terminal executes the operation information to test the application program to be tested.
In this embodiment, each slave mobile terminal may be equipped with an HTTP server to monitor the HTTP request sent by the master mobile terminal in real time, and after receiving the HTTP request, analyze the HTTP request, and perform operations such as instruction distribution and parameter conversion, so that the slave mobile terminal can accurately playback operation information, thereby completing a test on the application to be tested.
According to the automatic testing method, the first operation sent by the user is intercepted and simulated, the indication information of the target control corresponding to the first operation is determined, the first operation and the indication information are used for recording the operation information, the operation information is carried in the HTTP request and is sent to the slave mobile terminal, and therefore the slave mobile terminal executes the operation information to test the application program. The operation information is sent to the slave mobile terminal after the mobile terminal records the operation information, so that the slave mobile terminal performs playback test according to the operation information, real-time operation control on a plurality of mobile terminals by one mobile terminal under the same local area network can be realized, and the mobile terminal can be various devices with different models, different Android versions and different languages, so that the purpose of compatibility test is achieved. Through by mobile terminal control mobile terminal, need not test platform, need not repacking APP, also need not to install the PC customer end and build PC script execution environment, can realize installing promptly and use, the test cost is low. Because the PC client is not required to be installed, the test site can be selected at will, and the method can be used for field test and has higher applicability.
In order to more clearly describe the determination of the indication information of the target control corresponding to the first operation in the foregoing embodiment, another automatic testing method is provided in the embodiment of the present invention, and fig. 2 is a flowchart of an automatic control method provided in the second embodiment of the present invention.
As shown in fig. 2, based on the embodiment shown in fig. 1, step 102 may include the following steps:
in step 201, an operation area of a first operation is obtained.
In this embodiment, after intercepting the first operation, an operation area corresponding to the first operation may be obtained according to a position where the first operation occurs.
For example, for a capacitive touch screen, because the capacitive touch screen works by using current induction of a human body, when a user touches the screen, a coupling capacitor is formed between a finger of the user and a working surface of the screen due to an electric field of the human body, because a high-frequency signal is connected to the working surface, when the finger absorbs a very small current, the current flows out of electrodes at four corners of the screen respectively, and the current flowing through the four electrodes is in a proportional relation with the distances from the finger to the four corners, and the controller can determine the position where the finger touches the screen by accurately calculating the proportion of the four currents. Therefore, in the embodiment, after the first operation of the user on the capacitive touch screen is monitored, the position where the first operation occurs is also determined. For example, when the first operation is a clicking operation, the controller of the main mobile terminal can determine an operation area corresponding to the clicking operation performed by the user by analyzing current values flowing out of four corners of the working surface of the touch screen.
Step 202, analyzing the interface information, and determining a target control corresponding to the first operation according to the operation area.
The interface information may be, for example, an interface layout file of a control, and position information of each control of the application program to be tested in the screen is stored. Therefore, in this embodiment, according to the acquired operation area of the first operation, by querying the interface information, the target control corresponding to the first operation may be determined.
It should be noted here that, in order to accurately identify a control corresponding to an operation, each control is often provided with a coverage area, and when an operation area falls within the coverage area of a certain control, it is stated that a target control which a user tries to operate is the control.
Step 203, traversing the interface control tree to obtain the indication information of the target control.
The indication information is at least one of a unique identifier, a name and/or path information traversing to the target control.
In this embodiment, after the target control corresponding to the first operation is determined, path information of the target control may be further obtained in a manner of traversing the interface control tree, and/or a name, a unique identifier, and the like of the target control are obtained, so that the target control can be uniquely determined during playback.
According to the automatic testing method, the operation area of the first operation is obtained, the interface information is analyzed, the target control corresponding to the first operation is determined according to the operation area, the interface control tree is traversed, and the indication information of the target control is obtained, so that the control identification accuracy can be improved, and the playback testing accuracy is improved.
When the transparent floating layer is arranged to intercept the first operation executed on other controls except the main key and the return key, the transparent floating layer is equivalent to a shielding layer arranged on an application program, when the transparent floating layer is opened, the transparent floating layer intercepts the first operation executed on the controls by a user, the first operation cannot be immediately executed in the application program, and the first operation is effective after the transparent floating layer is closed. It should be noted that the test tool and the application program to be tested are both application programs installed on the mobile terminal, the test tool does not need to be embedded into the application program to be tested, and the automatic test method provided by the test tool can realize cross-APP testing of the application program to be tested through the setting of the transparent floating layer.
In order to control the switch of the transparent floating layer to ensure that the first operation can be intercepted by the transparent floating layer and can also take effect in the application program, in a possible implementation manner of the embodiment of the present invention, the opening and closing of the transparent floating layer may be controlled by setting a floating window, and fig. 3 is a schematic flow chart of an automatic testing method provided by a third embodiment of the present invention.
As shown in fig. 3, the automatic test method may include the steps of:
step 301, a visual floating window is arranged on the display interface, and the transparent floating layer is controlled to be opened or closed through the floating window.
In this embodiment, in order to control the switch of the transparent floating layer, a visible floating window may be disposed on the display interface in advance, so as to control the opening or closing of the transparent floating layer through the floating window.
Further, a plurality of display colors can be preset for the visible floating window, and different colors show the state of the transparent floating layer. For example, when the visible floating window is displayed in red, the current state of the transparent floating layer is represented as the closed state, and when the visible floating window is displayed in green, the current state of the transparent floating layer is represented as the open state. In this embodiment, because transparent floating layer is the stratum lucidum, the user is invisible in the vision, shows the state of transparent floating layer through the colour of visual suspension window, and the user just can learn directly perceivedly that transparent floating layer is in closed state or is in the open mode.
Step 302, intercepting a first operation through a transparent floating layer embedded in a display interface of the mobile terminal, wherein the control which is attempted to be controlled by the first operation is a non-initial key or a soft keyboard.
When the first operation performed by the user is an attempt to operate a control other than the start key or the soft keyboard, a transparent floating layer embedded in the display interface of the mobile terminal can be used to intercept the first operation. The transparent floating layer is equivalent to a screen layer and is in an acquiescent opening state, when a user performs operation on other controls except a start key or a soft keyboard, the operation does not take effect immediately in the application program, the transparent floating layer intercepts the operation firstly, and the operation takes effect in the application program after the transparent floating layer is closed or disappears.
And 303, detecting the ending action of the first operation through the floating window, and controlling the transparent floating layer to be closed when the ending action is detected.
In this embodiment, the visible floating window monitors the execution process of the first operation, and when the floating window detects the ending action of the first operation, the transparent floating layer may be controlled to close or disappear. The ending action may be a lifting action of the first operation, is used to indicate that the first operation is completed, and may be determined according to the action of the finger of the user. For example, the sliding operation includes touching the screen, sliding on the screen and moving away from the screen, when the floating window detects the touch of a finger, the sliding process of the finger is continuously detected, when the floating window detects that the finger moves away from the screen, the sliding operation is considered to be finished, and at this moment, the floating window controls the transparent floating layer to be closed.
And step 304, determining indication information of the target control corresponding to the first operation.
And 305, recording the operation information by using the first operation and the indication information.
It should be noted that, in the present embodiment, the description of step 303 to step 304 may refer to the description of step 102 to step 103 in the foregoing embodiment, and is not repeated here.
And step 306, carrying the operation information in the HTTP request and sending the HTTP request to the slave mobile terminal so that the slave mobile terminal executes the operation information to test the application program.
In this embodiment, the master mobile terminal may encapsulate all the recorded operation information in the HTTP request, and send the HTTP request carrying the operation information to the slave mobile terminal through a wireless network connection established with the slave mobile terminal, so that the slave mobile terminal completes the test of the application program by executing the operation information.
And 307, playing back the first operation on the mobile terminal to acquire the test data.
After the floating window controls the transparent floating layer to be closed, the recorded operation information of the first operation can be played back on the mobile terminal, and test data of the mobile terminal when the mobile terminal executes the first operation on the target control is obtained. The test data may be response time of the first operation, execution result of the first operation, compatibility between the application program and other application programs installed in the mobile terminal, and the like.
And 308, monitoring whether the first operation is finished in the playback on the mobile terminal through the floating window.
Step 309, after it is monitored that the playback of the first operation on the mobile terminal is completed, controlling the transparent floating layer to be re-opened through the floating window so as to continue intercepting the next operation of the user.
In this embodiment, after the playback of the first operation on the mobile terminal is completed, the floating window may control the transparent floating layer to be re-opened or restored again, so as to continue recording the next operation through the transparent floating layer. And after each playback is finished, the floating window restarts the transparent floating layer to intercept the next operation until the recording is finished or the user exits the application program.
The automatic testing method of the embodiment includes the steps of controlling opening or closing of a transparent floating layer by setting a floating window, obtaining a first operation through the transparent floating layer embedded in a display interface of a mobile terminal, determining indication information of a target control corresponding to the first operation, recording the operation information by using the first operation and the indication information, controlling the transparent floating layer to be closed through the floating window after an ending action of the first operation is detected, playing back the operation information on the mobile terminal to execute user operation, obtaining test data, controlling the transparent floating layer to be re-opened through the floating window after the playback operation information is completed so as to continue intercepting next operation of a user, carrying the operation information in an HTTP request, and sending the operation information to a slave mobile terminal so that the slave mobile terminal executes the operation information to test an application program. The transparent floating layer is controlled to be opened or closed by setting the floating window, the first operation and the playback operation information can be intercepted and captured orderly, the application program can be tested on the main mobile terminal while the operation information is recorded, the real-time operation control of a plurality of mobile terminals by one mobile terminal under the same local area network is realized, the mobile terminals can be various devices with different models, different Android versions and different languages, and the purpose of compatibility test is achieved.
In order to ensure that the master mobile terminal accurately sends the HTTP request carrying the operation information to the slave mobile terminal, in a possible implementation manner of the embodiment of the present invention, before monitoring and acquiring the operation of the user and the identification information of the operated target control, the master mobile terminal may receive an authorization instruction, where the authorization instruction includes attribute information of a plurality of slave mobile terminals, and the authorization instruction may be sent to the master mobile terminal by each slave mobile terminal individually, or may be sent to the master mobile terminal by the server after generating the authorization instruction uniformly according to the attribute information of each slave mobile terminal. After receiving the authorization instruction, the master mobile terminal forms a list by using a plurality of slave mobile terminals, wherein each record in the list may include attribute information of one slave mobile terminal and address information corresponding to the attribute information. In this embodiment, when the master mobile terminal carries the operation information in the HTTP request and sends the operation information to the slave mobile terminal, the method may specifically include: for each slave mobile terminal, acquiring address information of the slave mobile terminal from the list, and generating an HTTP request of the slave mobile terminal according to the address information; and adding the operation information into the HTTP request and transmitting the HTTP request to the slave mobile terminal. Specifically, for each slave mobile terminal, according to the attribute information of the slave mobile terminal, the address information corresponding to the attribute information may be obtained through the query list, and then the HTTP request is generated according to the address information, and then the operation information is added, and the HTTP request with the operation information added is sent to the slave mobile terminal.
By receiving the authorization instruction, the HTTP request carrying the operation information can be ensured to be only sent to the authorized slave mobile terminal, the accuracy of sending the operation information can be ensured, the playback test can be only carried out on the authorized slave mobile terminal, and the playback test has pertinence.
In order to more clearly describe a specific implementation process of performing playback test on a slave mobile terminal, that is, a master control terminal, according to received operation information, another automatic test method is provided in the embodiment of the present invention, where the method is performed by a slave mobile terminal corresponding to the master mobile terminal, and fig. 4 is a schematic flow diagram of another automatic test method provided in the first embodiment of the present invention, where the method is used in a mobile terminal to test an application program to be tested in a non-embedded manner.
As shown in fig. 4, the automatic control method includes the steps of:
step 401, receiving an HTTP request sent by a host mobile terminal.
The main mobile terminal and at least one slave mobile terminal can mutually transmit data through establishing wireless connection, and after the main mobile terminal records operation information, the operation information is packaged in an HTTP request and is sent to the slave mobile terminal which is in wireless communication with the main mobile terminal through a wireless network. Each slave mobile terminal receives an HTTP request sent by the master mobile terminal.
Step 402, analyzing and acquiring operation information from the HTTP request; wherein, the operation information is generated according to the operation of the user on the main mobile terminal.
In this embodiment, after receiving the HTTP request sent by the master mobile terminal, the slave mobile terminal may parse the HTTP request to obtain the operation information. The method comprises the steps that a user operates an application program to be tested on a master mobile terminal, the master mobile terminal intercepts the operation of the user on a control, operation information is obtained according to the operation of the user and the recording of the corresponding control, and the operation information is packaged in an HTTP request and sent to a slave mobile terminal. After receiving the HTTP request from the mobile terminal, the HTTP request is analyzed, and the operation information can be extracted therefrom.
And step 403, playing back the operation information for testing, and acquiring test data.
After the operation information is extracted from the HTTP request from the mobile terminal, the operation information is played back from the mobile terminal for testing. The operation information is recorded according to the operation executed by the user on the control on the main mobile terminal, so that when the operation information is played back from the slave mobile terminal, the operation executed by the user on the application program to be tested on the main mobile terminal can be simulated, and the execution result is obtained as the test data.
In the automatic test method of this embodiment, the HTTP request sent by the main mobile terminal is received, the operation information is parsed from the HTTP request, and the operation information is played back for testing, so as to obtain the test data. The operation information of the main mobile terminal is received to carry out playback test, the mobile terminal is controlled by the mobile terminal, a test platform is not needed, APP packaging is not needed, a PC client side is not needed to be installed, a PC script execution environment is not needed to be built, instant use and instant use can be achieved, and the test cost is low. Because the PC client is not required to be installed, the test site can be selected at will, and the method can be used for field test and has higher applicability.
In order to more clearly describe a specific implementation process of the playback operation information for testing in the foregoing embodiment, another automatic testing method is provided in the embodiment of the present invention, and fig. 5 is a flowchart of another automatic testing method provided in the second embodiment of the present invention.
As shown in fig. 5, on the basis of the embodiment shown in fig. 1, step 403 may include the following steps:
step 501, extracting indication information of the target control from the operation information.
The indication information is used for positioning the target control, and may be at least one of a unique identifier, a name, and/or path information traversed to the target control.
Since the operation information is obtained by recording the first operation performed on the target control by the user and the indication information of the corresponding target control, the indication information of the target control can be extracted from the operation information by analyzing the operation information in this embodiment.
And 502, positioning the target control according to the indication information.
Specifically, when the main mobile terminal locates the target control according to the indication information, the model information and the system version information of the mobile terminal may be obtained first, and then coordinate conversion may be performed according to the model information and the system version information of the mobile terminal, so as to finally obtain the coordinate information of the target control in the converted coordinate system.
In order to accurately position the target control, in this embodiment, coordinate conversion may be performed according to differences between model information and system version information of the slave mobile terminal and the master mobile terminal, so that coordinate information of the target control in the converted coordinate system is the same as coordinate information of the target control in the coordinate system of the master mobile terminal, and the target control is accurately positioned in the slave mobile terminal.
And step 503, executing corresponding operation on the target control.
In this embodiment, after the target control is positioned, corresponding operations may be performed on the target control to simulate operations performed on the target control by a user in the main mobile terminal, so as to complete the same test as that of the application program to be tested in the main mobile terminal.
According to the automatic testing method, the indication information of the target control is extracted from the operation information, the target control is positioned according to the indication information, and then corresponding operation is performed on the target control, so that the accuracy of playback testing can be improved.
In a possible implementation manner of the embodiment of the present invention, the slave mobile terminal further sends an authorization instruction to the master mobile terminal, and reports the attribute information of the slave mobile terminal to the master mobile terminal, so that the master mobile terminal sends the operation information to the corresponding slave mobile terminal according to the attribute information of the slave mobile terminal, and ensures that the slave mobile terminal sending the authorization instruction can receive the operation information, and tests the application program to be tested by playing back the operation information.
Fig. 6a to 6d are schematic diagrams of an application of the automatic test. As shown in fig. 6a, a User operates an application program to be tested on a main mobile terminal 61, and the main mobile terminal 61 captures and records the operation of the User to obtain a User Interface (UI) traversal instruction. Uploading cache data generated when a user executes operation to a performance case model to obtain a performance case; and analyzing the cache data to obtain a scene use case. The performance use case, the scene use case, the UI traversal instruction, and various other instructions (installation, start, UI operation, setting) are transmitted to the slave mobile terminal 62 through the Wi-Fi network, and playback test is performed in the slave mobile terminal 62 to obtain test data. By controlling a plurality of slave mobile terminals by one master mobile terminal, the repeated work of single test can be avoided, the workload is reduced, and the test efficiency is improved.
As shown in fig. 6b, the mobile terminal is taken as a mobile phone for explanation, the master mobile terminal is a controlling mobile phone, and the slave mobile terminal is a controlled mobile phone. The control mobile phone is provided with a control module, the control module can control the simulated intercepted user operation, then the operation information is recorded by the recording module and sent to the slave mobile terminal. Still be provided with a socket service module (socket server) in the control cell-phone, can call socket server through adk instruction, can intercept the coordinate of first operation through socket server after, convert the coordinate into Extensible Markup Language (XML) that the interface can be discerned to the interface, then send and record the module and carry out the traversal of degree of depth priority (DOM), obtain the indicating information of target control, wherein, target control indicating information includes: xpath path, ID, text (or name) or coordinates, etc.
As shown in fig. 6b, a transparent floating layer is disposed on the display interface in the control handset, and interception of the first operation can be performed through the transparent floating layer, where the transparent floating layer is invisible to the user in practical application. The small person in the upper left corner of the transparent floating layer is a visible floating window, the opening or closing of the transparent floating layer is controlled through the visible floating window, and the state of the transparent floating layer can be shown to the user through the color of the visible floating window, for example, the visible floating window shows that the transparent floating layer is in a closed state when the visible floating window is red, and the visible floating window shows that the transparent floating layer is in an enabled state when the visible floating window is green. Further, a broadcast listener, not shown in fig. 6b, is also disposed in the control handset, and the operation of the home or the record key is monitored through the broadcast listener.
Further, after the indication information of the target control is determined, the recorded operation information can be sent to the controlled mobile phone through the control module through an HTTP request. The slave controlled mobile phone is required to be provided with an HTTP service module, a playback module and an execution module, wherein the HTTP service module receives an operation instruction, the playback module plays back the operation instruction, and the execution module executes the operation information.
As shown in fig. 6c, a plurality of mobile phones are automatically tested at the same time, one mobile phone is selected as a control mobile phone before testing, and the rest mobile phones are used as controlled mobile phones. The controlled mobile phone can report equipment information, such as an IP address, model information and the like, to the control mobile phone. The control mobile phone can receive the reported device information and form a list of the controlled mobile phones according to the received device information.
And during testing, the control mobile phone directly sends the recorded operation instruction to the HTTP service module in the controlled mobile phone through the HTTP request. The internal components of the controlling handset and the controlled handset can be seen in fig. 6 b. In the testing process, the control mobile phone and the controlled mobile phone are in one-way communication.
As shown in fig. 6d, the control mobile phone sends the recorded operation information to an HTTP service module in the controlled mobile phone through an HTTP request, then a playback module in the controlled mobile phone performs HTTP request parsing, coordinate conversion and coordinate calculation on the operation instruction, then wirelessly calls a socket service in an execution module through an adb instruction, parses the coordinate to obtain an XML-format coordinate that can be identified by an interface, then locates the control through traversal of the UI DOM, and then executes a first operation on the located control. In order to realize the embodiment, the invention further provides an automatic testing device.
Fig. 7 is a schematic structural diagram of an automatic test apparatus according to an embodiment of the present invention, which is used in a mobile terminal to test an application to be tested in a non-embedded manner.
As shown in fig. 7, the automatic test apparatus 70 includes: an intercept module 710, a determination module 720, a recording module 730, and a send module 740. Wherein the content of the first and second substances,
the intercepting module 710 is used for intercepting a first operation sent by a user and simulating the first operation; the first operation is an operation executed by a user in the application program to be tested.
Specifically, the intercepting module 710 is configured to intercept a first operation through a transparent floating layer embedded in a display interface of the mobile terminal, where a control that the first operation attempts to control is not used for returning to a start key or a soft keyboard of a desktop; and/or, monitoring the simulated first operation trying to control the start key or the soft keyboard through a broadcast monitor in the mobile terminal.
The determining module 720 is configured to determine indication information of a target control corresponding to the first operation.
And a recording module 730, configured to record the operation information by using the first operation and the indication information.
The sending module 740 is configured to carry the operation information in the HTTP request and send the HTTP request to the slave mobile terminal, so that the slave mobile terminal executes the operation information to test the application program.
Further, in a possible implementation manner of the embodiment of the present invention, as shown in fig. 8, on the basis of the embodiment shown in fig. 7, the determining module 720 includes:
an acquisition unit 721 acquires an operation region of the first operation.
And the analysis determining unit 722 is configured to analyze the interface information, and determine a target control corresponding to the first operation according to the operation area.
The traversing unit 723 is used for traversing the interface control tree to acquire the indication information of the target control; the indication information is at least one of a unique identifier, a name and/or path information traversing to the target control.
By acquiring the operation area of the first operation, analyzing the interface information, determining the target control corresponding to the first operation according to the operation area, traversing the interface control tree, and acquiring the indication information of the target control, the accuracy of control identification can be improved, and the accuracy of playback test is further improved.
When the automatic testing device 70 sets the transparent floating layer to intercept the first operation executed on the control except for the main key and the return key, the transparent floating layer is equivalent to a shielding layer set on the application program, when the transparent floating layer is opened, the transparent floating layer intercepts the first operation executed on the control by the user, the first operation cannot be immediately executed in the application program, and when the transparent floating layer is closed, the first operation is effective. In order to control the switch of the transparent floating layer to ensure that the first operation can be intercepted by the transparent floating layer and can be effective in the application program, in a possible implementation manner of the embodiment of the present invention, as shown in fig. 9, on the basis of the embodiment shown in fig. 7, the automatic test apparatus 70 further includes:
The control unit 700 is used for setting a visible floating window on the display interface and controlling the transparent floating layer to be opened or closed through the floating window; and after the playback of the operation information on the mobile terminal is finished, controlling the transparent floating layer to be reopened through the floating window so as to continue intercepting the next operation of the user.
At this time, the intercepting module 710 is specifically configured to intercept a first operation through a transparent floating layer embedded in a display interface of the mobile terminal, where a control that the first operation attempts to control is not a primary key or a return key.
And a detecting module 750, configured to detect an action of the first operation after the recording unit 730 records the operation information by using the first operation and the indication information, and control the transparent floating layer to close through the floating window when detecting an ending action of the first operation.
And the playback module 760 is configured to play back the operation information on the mobile terminal to execute the operation of the user, and acquire the test data.
The transparent floating layer is controlled to be opened or closed by setting the floating window, so that the first operation and the playback operation information can be ensured to be intercepted and captured in order, and the application program can be ensured to be tested on the main mobile terminal while the operation information is recorded.
In a possible implementation manner of the embodiment of the present invention, the automatic testing device 70 is further configured to receive an authorization instruction, where the authorization instruction includes attribute information of a plurality of slave mobile terminals, and form a list by using the plurality of slave mobile terminals, where each record in the list may include attribute information of one slave mobile terminal and address information corresponding to the attribute information. In this embodiment, the sending module 740 is specifically configured to, for each slave mobile terminal, obtain address information of the slave mobile terminal from the list, and generate an HTTP request of the slave mobile terminal according to the address information; and adding the operation information into the HTTP request and transmitting the HTTP request to the slave mobile terminal.
By receiving the authorization instruction, the HTTP request carrying the operation information can be ensured to be only sent to the authorized slave mobile terminal, the accuracy of sending the operation information can be ensured, the playback test can be only carried out on the authorized slave mobile terminal, and the playback test has pertinence.
It should be noted that the foregoing explanation of the embodiment of the automatic test method is also applicable to the automatic test apparatus of the embodiment, and the implementation principle thereof is similar and will not be described herein again.
The automatic testing device of the embodiment determines the indication information of the target control corresponding to the first operation by intercepting and simulating the first operation sent by the user, records the operation information by using the first operation and the indication information, carries the operation information in the HTTP request, and sends the HTTP request to the slave mobile terminal, so that the slave mobile terminal executes the operation information to test the application program. The operation information is sent to the slave mobile terminal after the mobile terminal records the operation information, so that the slave mobile terminal performs playback test according to the operation information, real-time operation control on a plurality of mobile terminals by one mobile terminal under the same local area network can be realized, and the mobile terminal can be various devices with different models, different Android versions and different languages, so that the purpose of compatibility test is achieved. Through by mobile terminal control mobile terminal, need not test platform, need not repacking APP, also need not to install the PC customer end and build PC script execution environment, can realize adorning promptly and use, the test cost is low. Because the PC client is not required to be installed, the test site can be selected at will, and the method can be used for field test and has higher applicability.
In order to realize the above embodiment, the invention further provides another automatic testing device.
Fig. 10 is a schematic structural diagram of another automatic test apparatus according to an embodiment of the present invention, which is used in a mobile terminal to test an application program to be tested in a non-embedded manner.
As shown in fig. 10, the automatic test apparatus 100 includes: a receiving module 110, a parsing module 120, and a testing module 130. Wherein, the first and the second end of the pipe are connected with each other,
a receiving module 110, configured to receive an HTTP request sent by a host mobile terminal.
The parsing module 120 is configured to parse the HTTP request to obtain operation information; wherein the operation information is generated according to the operation of the user at the main mobile terminal.
And the test module 130 is configured to play back the operation information for testing, and obtain test data.
Further, in a possible implementation manner of the embodiment of the present invention, as shown in fig. 11, on the basis of the embodiment shown in fig. 10, the test module 130 includes:
an extracting unit 131, configured to extract indication information of the target control from the operation information.
And a positioning unit 132, configured to position the target control according to the indication information.
Specifically, the positioning unit 132 is configured to obtain model information and system version information of the mobile terminal; performing coordinate conversion according to the model information and the system version information of the mobile terminal; and acquiring coordinate information of the target control in the converted coordinate system.
The execution unit 133 is configured to execute a corresponding operation on the target control.
By extracting the indication information of the target control from the operation information and positioning the target control according to the indication information, corresponding operation is performed on the target control, and the accuracy of playback test can be improved.
In a possible implementation manner of the embodiment of the present invention, the automatic testing device 110 may further send an authorization instruction to the master mobile terminal before receiving the HTTP request sent by the master mobile terminal, and report the attribute information of the mobile terminal to the master mobile terminal, so that the master mobile terminal sends the operation information to the corresponding slave mobile terminal according to the attribute information of the slave mobile terminal, and it is ensured that the slave mobile terminal that sends the authorization instruction can receive the operation information, and the application program to be tested is tested by playing back the operation information.
It should be noted that the foregoing explanation of the embodiment of the automatic test method is also applicable to the automatic test apparatus of the embodiment, and the implementation principle thereof is similar and will not be described herein again.
The automatic test device of this embodiment receives the HTTP request sent by the main mobile terminal, parses the acquired operation information from the HTTP request, and plays back the operation information to perform a test, thereby acquiring test data. The operation information of the main mobile terminal is received to carry out playback test, the mobile terminal is controlled by the mobile terminal, a test platform is not needed, APP packaging is not needed, a PC client side is not needed to be installed, a PC script execution environment is not needed to be built, instant use and instant use can be achieved, and the test cost is low. Because the PC client is not required to be installed, the test site can be selected at will, and the method can be used for field test and has higher applicability.
In order to implement the foregoing embodiment, the present invention further provides a computer device, including: a processor and a memory; wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, for implementing an automatic test method as described in the foregoing embodiments.
In order to implement the above embodiment, the present invention further provides another computer device, including: a processor and a memory; wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory for implementing another automatic test method as described in the foregoing embodiments.
In order to implement the above embodiments, the present invention also proposes a non-transitory computer-readable storage medium on which a computer program is stored, which when executed by a processor implements an automatic test method as described in the foregoing embodiments.
In order to implement the above embodiments, the present invention also proposes another non-transitory computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements another automatic testing method as described in the foregoing embodiments.
FIG. 12 illustrates a block diagram of an exemplary computer device suitable for use in implementing embodiments of the present invention. The computer device 10 shown in fig. 12 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in FIG. 12, computer device 12 is in the form of a general purpose computing device. The components of computer device 10 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 10 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer device 10 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 28 may include computer system readable media in the form of volatile Memory, such as Random Access Memory (RAM) 30 and/or cache Memory 32. The computer device 10 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 12, and commonly referred to as a "hard drive"). Although not shown in FIG. 12, a disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a Compact disk Read Only Memory (CD-ROM), a Digital versatile disk Read Only Memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the application.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally perform the functions and/or methodologies of the embodiments described herein.
Computer device 10 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with the computer system/server 12, and/or with any devices (e.g., network card, modem, etc.) that enable the computer system/server 10 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Furthermore, the computer device 10 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public Network such as the Internet) via the Network adapter 20. As shown in FIG. 12, network adapter 20 communicates with the other modules of computer device 10 via bus 18. It should be understood that although not shown in FIG. 12, other hardware and/or software modules may be used in conjunction with computer device 10, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, implementing the automatic test method mentioned in the foregoing embodiments.
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 are not necessarily intended to 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. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
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 steps of a custom logic function or 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.
The logic and/or steps represented in the flowcharts or otherwise described herein, such as an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
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, various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. 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 separate 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. 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 (15)

1. An automatic test method, which is used for a mobile terminal to test an application program to be tested in a non-embedded mode, the method comprising the following steps:
intercepting a first operation sent by a user and simulating; the first operation is an operation executed by a user in the application program to be tested;
determining indication information of a target control corresponding to the first operation;
recording operation information by using the first operation and the indication information;
carrying the operation information in an HTTP request and sending the HTTP request to a slave mobile terminal so that the slave mobile terminal executes the operation information to test the application program;
intercepting the simulated first operation, comprising:
intercepting the first operation through a transparent floating layer embedded in a display interface of the mobile terminal, wherein a control which is attempted to be controlled by the first operation is not used for returning to a start key or a soft keyboard of a desktop;
A visual floating window is arranged on the display interface, and the opening or closing of the transparent floating layer is controlled through the floating window;
after recording the operation information by using the first operation and the indication information, the method further includes:
detecting an ending action of the first operation through the floating window, and controlling the transparent floating layer to be closed when the ending action is detected;
and playing back the operation information on the mobile terminal to execute the first operation, and acquiring test data.
2. The method of claim 1, wherein intercepting the first operation issued by the user comprises:
monitoring, by a broadcast listener in the mobile terminal, the first operation that the user attempts to control a start key or a soft keyboard for returning to a desktop.
3. The method of claim 1, wherein the determining the indication information of the target control corresponding to the first operation comprises:
acquiring an operation area of the first operation;
analyzing interface information, and determining the target control corresponding to the first operation according to the operation area;
traversing an interface control tree to obtain indication information of the target control; wherein the indication information is at least one of a unique identifier, a name and/or path information traversing to the target control.
4. The method of claim 1, further comprising:
monitoring whether the first operation is finished in the playback on the mobile terminal through the floating window;
and when the first operation is monitored to be completed in the playback of the mobile terminal, controlling the transparent floating layer to be reopened through the floating window so as to continue intercepting the next operation of the user.
5. The method according to any one of claims 1-3, wherein before obtaining the user's operation and the identification information of the operated target control, the method further comprises:
receiving an authorization instruction, wherein the authorization instruction comprises attribute information of a plurality of slave mobile terminals;
forming a list using the plurality of slave mobile terminals.
6. The method of claim 5, wherein the step of carrying the operation information in an HTTP request to the slave mobile terminal comprises:
for each slave mobile terminal, acquiring address information of the slave mobile terminal from the list, and generating an HTTP request of the slave mobile terminal according to the address information;
and adding the operation information into the HTTP request and sending the HTTP request to the slave mobile terminal.
7. An automatic test method is used for a mobile terminal to test an application program to be tested in a non-embedded mode, and comprises the following steps:
receiving an HTTP request sent by a main mobile terminal;
analyzing and acquiring operation information from the HTTP request; the operation information is generated according to the operation of a user on the main mobile terminal;
replaying the operation information for testing to obtain test data;
the playing back the operation information for testing comprises the following steps:
extracting indication information of a target control from the operation information;
positioning the target control according to the indication information;
and executing corresponding operation on the target control.
8. The method of claim 7, wherein the positioning the target control according to the indication information comprises:
obtaining model information and system version information of a mobile terminal;
performing coordinate conversion according to the model information and the system version information of the mobile terminal;
and acquiring coordinate information of the target control in the converted coordinate system.
9. The method according to any one of claims 7-8, wherein before receiving the HTTP request sent by the host mobile terminal, the method further comprises:
And sending an authorization instruction, and reporting the attribute information of the mobile terminal to a main mobile terminal.
10. An automatic testing device, which is used on a mobile terminal to test an application program to be tested in a non-embedded manner, the device comprising:
the intercepting module is used for intercepting and simulating a first operation sent by a user; the first operation is an operation executed by a user in the application program to be tested;
the determining module is used for determining the indication information of the target control corresponding to the first operation;
the recording module is used for recording operation information by utilizing the first operation and the indication information;
the sending module is used for carrying the operation information in an HTTP request and sending the HTTP request to the slave mobile terminal so that the slave mobile terminal executes the operation information to test the application program;
the intercepting module is specifically used for intercepting the first operation through a transparent floating layer embedded in the display interface of the mobile terminal, wherein a control which is attempted to be controlled by the first operation is not used for returning to a start key or a soft keyboard of a desktop;
the control unit is used for setting a visible floating window on the display interface and controlling the transparent floating layer to be opened or closed through the floating window;
The detection module is used for detecting the ending action of the first operation through the floating window after recording the operation information by utilizing the first operation and the indication information, and controlling the transparent floating layer to be closed when the ending action is detected;
and the playback module is used for playing back the operation information on the mobile terminal to execute the first operation and obtain the test data.
11. An automatic test device, which is used in a mobile terminal to test an application program to be tested in a non-embedded manner, the device comprising:
the receiving module is used for receiving the HTTP request sent by the main mobile terminal;
the analysis module is used for analyzing and acquiring operation information from the HTTP request; the operation information is generated according to the operation of a user on the main mobile terminal;
the test module is used for playing back the operation information for testing to obtain test data;
the test module comprises:
the extracting unit is used for extracting indication information of the target control from the operation information;
the positioning unit is used for positioning the target control according to the indication information;
and the execution unit is used for executing corresponding operation on the target control.
12. A computer device comprising a processor and a memory;
wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory for implementing the automatic test method according to any one of claims 1 to 6.
13. A computer device comprising a processor and a memory;
wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory for implementing the automatic test method according to any one of claims 7 to 9.
14. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements an automatic test method according to any one of claims 1 to 6.
15. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements an automatic test method according to any one of claims 7 to 9.
CN201711403538.7A 2017-12-22 2017-12-22 Automatic test method and device Active CN109960642B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711403538.7A CN109960642B (en) 2017-12-22 2017-12-22 Automatic test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711403538.7A CN109960642B (en) 2017-12-22 2017-12-22 Automatic test method and device

Publications (2)

Publication Number Publication Date
CN109960642A CN109960642A (en) 2019-07-02
CN109960642B true CN109960642B (en) 2022-07-19

Family

ID=67019182

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711403538.7A Active CN109960642B (en) 2017-12-22 2017-12-22 Automatic test method and device

Country Status (1)

Country Link
CN (1) CN109960642B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110515854B (en) * 2019-08-30 2023-08-11 网易(杭州)网络有限公司 Application program abnormality reproduction method and device and electronic equipment
CN110928766A (en) * 2019-10-12 2020-03-27 平安银行股份有限公司 Application software testing method, device, equipment and computer readable storage medium
CN111090577B (en) * 2019-10-12 2024-04-09 平安壹钱包电子商务有限公司 Multi-terminal synchronous test method and device, computer equipment and storage medium
CN112416741A (en) * 2019-12-26 2021-02-26 上海哔哩哔哩科技有限公司 Application program compatibility testing method and device
CN112328492B (en) * 2020-11-19 2022-10-14 腾讯科技(深圳)有限公司 Interaction control method and device between anchor and electronic equipment
US20220269586A1 (en) * 2021-02-24 2022-08-25 Applause App Quality, Inc. Systems and methods for automating test and validity
CN112817866A (en) * 2021-02-25 2021-05-18 北京百家科技集团有限公司 Recording playback method, device, system, computer equipment and storage medium
CN115297110A (en) * 2021-04-15 2022-11-04 京东科技控股股份有限公司 Control method, device and equipment of terminal equipment and storage medium
CN113377664A (en) * 2021-06-25 2021-09-10 上海商汤科技开发有限公司 Model testing method and device, electronic device and storage medium
CN113760750B (en) * 2021-08-13 2024-04-02 深圳Tcl新技术有限公司 Intelligent device testing method and device, electronic device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62108344A (en) * 1985-11-07 1987-05-19 Mitsubishi Electric Corp Test processing system for terminal control system
CN104579822A (en) * 2014-12-10 2015-04-29 华南理工大学 Automatic performance test system and method of mobile application based on Http protocol
CN105335292A (en) * 2015-11-12 2016-02-17 广州华多网络科技有限公司 Application compatibility testing method and system
CN106598396A (en) * 2016-12-21 2017-04-26 北京金山安全软件有限公司 Display method and device based on floating window and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62108344A (en) * 1985-11-07 1987-05-19 Mitsubishi Electric Corp Test processing system for terminal control system
CN104579822A (en) * 2014-12-10 2015-04-29 华南理工大学 Automatic performance test system and method of mobile application based on Http protocol
CN105335292A (en) * 2015-11-12 2016-02-17 广州华多网络科技有限公司 Application compatibility testing method and system
CN106598396A (en) * 2016-12-21 2017-04-26 北京金山安全软件有限公司 Display method and device based on floating window and electronic equipment

Also Published As

Publication number Publication date
CN109960642A (en) 2019-07-02

Similar Documents

Publication Publication Date Title
CN109960642B (en) Automatic test method and device
CN107038112B (en) Application interface debugging method and device
CN108804302B (en) Remote testing method, system and related equipment
KR102058976B1 (en) Application method and device
US10657036B2 (en) Determining visual testing coverages
CN102841845B (en) Automatic testing method of Android device software
CN102904996B (en) The method and device of a kind of handset touch panel performance test, system
US9161238B2 (en) Mobile device monitoring and testing
CN110674025B (en) Interactive behavior monitoring method and device and computer equipment
CN104424089A (en) Terminal testing method and device
TW201518933A (en) Testing device and testing method thereof
US8752023B2 (en) System, method and program product for executing a debugger
US9804955B2 (en) Method and apparatus for creating reference images for an automated test of software with a graphical user interface
JP2008538642A5 (en)
Wang et al. Automatic Android GUI traversal with high coverage
CN105653438B (en) The striding course automated testing method and device of Android device
CN107102949B (en) Application program offline testing method and tool
CN104956339A (en) Generating software test script from video
WO2018201615A1 (en) Testing method and system for use with battery management unit
CN102981949A (en) Method for on-line automatic tests of server
CN103268289A (en) Method and system for transcribing and applying test script on mobile terminal
CN104915297A (en) APP electricity consumption automatic test method for android device
CN112416775A (en) Software automation testing method and device based on artificial intelligence and electronic equipment
CN106445810B (en) A kind of test method and system of interactive software and equipment compatibility
CN109032911B (en) Frame rate detection method and device for mobile device and electronic device

Legal Events

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