APP power consumption testing method
1. The method for testing the power consumption of the APP is characterized by being applied to an APP power consumption testing system, wherein the APP power consumption testing system comprises testing equipment and a plurality of mobile devices which are respectively connected with the testing equipment; the method comprises the following steps:
after the connection with the mobile equipment is detected, acquiring equipment information of each piece of mobile equipment, and judging the connection mode with each piece of mobile equipment; the connection mode comprises wireless connection and wired connection;
if the connection mode is wireless connection, acquiring initial information of the mobile equipment; the initial information comprises first electric quantity information;
controlling each mobile device to execute corresponding operation based on preset running data of a target APP, and acquiring second electric quantity information and monitoring information of each mobile device after the operation is finished;
determining power consumption information of each mobile device according to the first power consumption information and the second power consumption information of each mobile device;
and based on the equipment information, performing aggregation operation on the power consumption information and the monitoring information of each mobile equipment to generate a power consumption test report of the target APP.
2. The method for APP power consumption testing as defined in claim 1, further comprising:
if the connection mode is wired connection, controlling each mobile device to execute corresponding operation based on the operation data, and acquiring the monitoring information of each mobile device after the operation is finished;
and based on the equipment information, carrying out aggregation operation on the monitoring information of each mobile equipment to generate a power consumption test report of the target APP.
3. The APP power consumption test method of claim 1, wherein determining power consumption information of each of the mobile devices according to the first power information and the second power information of each of the mobile devices comprises:
comparing the first electric quantity information with the second electric quantity information of each mobile device to obtain electric quantity difference value information;
and using the power difference information of each mobile device as the power consumption information.
4. The method of APP power consumption testing as defined in claim 1, further comprising:
receiving a recording instruction input by a user, and determining the target APP according to the recording instruction;
and receiving operation information input by a user based on the target APP, and recording the running data of the target APP according to the operation information.
5. The method for APP power consumption testing as defined in claim 1, wherein the monitoring information comprises: memory information, CPU information, uplink traffic information, and downlink traffic information.
Background
With the rapid advance of the mobile terminal technology, the number of APP applications in the market is large, and the importance of APP testing is self-evident to test engineers. At the present stage, when a tester carries out automatic test of a mobile terminal, not only functional test and compatibility test need to be carried out, but also power consumption test of APP needs to be carried out.
In the related technology, testing tools such as Tencent GT and Bug Insight are generally adopted to access into corresponding SDKs to realize power consumption testing of APP, however, the testing method can only realize one-to-one power consumption testing, a plurality of mobile terminals cannot be operated simultaneously, when the number of models to be tested is large, a great amount of time and manpower of testing personnel are consumed to finish the testing one by one, and the testing efficiency is low.
Disclosure of Invention
In view of this, the present application aims to overcome the technical problem in the prior art that the test efficiency is low when performing power consumption test on a mobile terminal APP, and provides a method for testing APP power consumption.
In order to achieve the purpose, the following technical scheme is adopted in the application:
the application provides a method for testing APP power consumption, which is applied to an APP power consumption testing system, wherein the APP power consumption testing system comprises testing equipment and a plurality of mobile equipment which are respectively connected with the testing equipment; the method comprises the following steps:
after the connection with the mobile equipment is detected, acquiring equipment information of each piece of mobile equipment, and judging the connection mode with each piece of mobile equipment; the connection mode comprises wireless connection and wired connection;
if the connection mode is wireless connection, acquiring initial information of the mobile equipment; the initial information comprises first electric quantity information;
controlling each mobile device to execute corresponding operation based on preset running data of a target APP, and acquiring second electric quantity information and monitoring information of each mobile device after the operation is finished;
determining power consumption information of each mobile device according to the first power consumption information and the second power consumption information of each mobile device;
and based on the equipment information, performing aggregation operation on the power consumption information and the monitoring information of each mobile equipment to generate a power consumption test report of the target APP.
Optionally, the method further includes:
if the connection mode is wired connection, controlling each mobile device to execute corresponding operation based on the operation data, and acquiring the monitoring information of each mobile device after the operation is finished;
and based on the equipment information, carrying out aggregation operation on the monitoring information of each mobile equipment to generate a power consumption test report of the target APP.
Optionally, the determining power consumption information of each mobile device according to the first power consumption information and the second power consumption information of each mobile device includes:
comparing the first electric quantity information with the second electric quantity information of each mobile device to obtain electric quantity difference value information;
and using the power difference information of each mobile device as the power consumption information.
Optionally, the method further includes:
receiving a recording instruction input by a user, and determining the target APP according to the recording instruction;
and receiving operation information input by a user based on the target APP, and recording the running data of the target APP according to the operation information.
Optionally, the monitoring information includes: memory information, CPU information, uplink traffic information, and downlink traffic information.
The technical scheme provided by the application can comprise the following beneficial effects:
according to the scheme, the test equipment can be used for establishing connection with the mobile equipment, after the test equipment detects that the test equipment is connected with the mobile equipment, the equipment information of each piece of mobile equipment can be obtained, the connection mode with the mobile equipment is judged, if the connection mode is wireless connection, the initial information of the mobile equipment can be obtained, and the initial information comprises the first electric quantity information. And then, controlling each mobile device to execute corresponding operation based on preset running data of the target APP, and acquiring second electric quantity information and monitoring information of each mobile device after the operation is finished. And determining the power consumption information of each mobile device according to the first power consumption information and the second power consumption information of each mobile device. Based on the device information, aggregation operation can be performed on the power consumption information and the monitoring information of each mobile device, and finally a power consumption test report of the target APP is generated. Therefore, the labor force for one-to-one APP power consumption test is broken, not only is the simultaneous power consumption test of multiple mobile devices APP realized, but also the APP power consumption test can be carried out in the functional test, the SDK is not required to be integrated, the development time is effectively saved, and the test efficiency is greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of an APP power consumption test method according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail below. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a flowchart of a method for testing APP power consumption according to an embodiment of the present application. The embodiment of the application provides a method for testing APP power consumption, which can be applied to an APP power consumption testing system, wherein the APP power consumption testing system can comprise a testing device and a plurality of mobile devices respectively connected with the testing device. As shown in the figure, taking the execution of the test device side as an example, the method for testing APP power consumption may include at least the following implementation steps:
step 11, after detecting that the connection is established with the mobile equipment, acquiring equipment information of each mobile equipment, and judging a connection mode with each mobile equipment; the connection mode comprises wireless connection and wired connection.
In particular, the interface of the testing device may be connected to the ADB to ensure that the mobile device and the testing device are in a connected state. The ADB is used as a general command line tool and can be connected and communicated with the mobile equipment to realize the functions of controlling the mobile equipment, transmitting files with the mobile equipment, checking logs at the mobile equipment end, simulating the operation of the mobile equipment and the like. After the test equipment starts to perform the APP power consumption test, firstly, whether the connection is established with the mobile equipment is detected, and after the connection with the mobile equipment is determined, the step 12 is continuously executed; after determining that the connection with the mobile device is not established, the connection can be tried to be reestablished, or prompt information is sent to the user to prompt the user that the connection is not established currently, so that the user can respond in time.
Step 12, if the connection mode is wireless connection, acquiring initial information of the mobile equipment; the initial information includes first power information.
And step 13, controlling each mobile device to execute corresponding operation based on preset running data of the target APP, and acquiring second electric quantity information and monitoring information of each mobile device after the operation is finished.
Wherein, the monitoring information may include: the memory information, the CPU information, the uplink traffic information, and the downlink traffic information are main contents of the power consumption test.
And step 14, determining power consumption information of each mobile device according to the first power consumption information and the second power consumption information of each mobile device.
And step 15, performing aggregation operation on the power consumption information and the monitoring information of each mobile device based on the device information, and generating a power consumption test report of the target APP.
The specific implementation manner of performing aggregation operation by using the power consumption information and the monitoring information based on the device information may refer to the related art, and is not described herein again.
In this embodiment, a connection may be established between the test device and the plurality of mobile devices, after the test device detects that the connection is established between the test device and the mobile devices, the test device may acquire device information of each mobile device, and determine a connection mode with the mobile device, and if the connection mode is a wireless connection, may acquire initial information of the mobile device, where the initial information includes the first electric quantity information. And then, controlling each mobile device to execute corresponding operation based on preset running data of the target APP, and acquiring second electric quantity information and monitoring information of each mobile device after the operation is finished. And determining the power consumption information of each mobile device according to the first power consumption information and the second power consumption information of each mobile device. Based on the device information, aggregation operation can be performed on the power consumption information and the monitoring information of each mobile device, and finally a power consumption test report of the target APP is generated. Therefore, the labor force for one-to-one APP power consumption test is broken, not only is the simultaneous power consumption test of multiple mobile devices APP realized, but also the APP power consumption test can be carried out in the functional test, the SDK is not required to be integrated, the development time is effectively saved, and the test efficiency is greatly improved.
In practice, the mobile device may include, but is not limited to, a cell phone, a tablet computer, and the like.
When the test device is connected to the mobile device through the ADB, since the ADB supports both wired connection and wireless connection, after step 11, the method for testing the APP power consumption may further include: if the connection mode is wired connection, controlling each mobile device to execute corresponding operation based on the operation data, and acquiring monitoring information of each mobile device after the operation is finished; and based on the equipment information, performing aggregation operation on the monitoring information of each mobile equipment to generate a power consumption test report of the target APP.
In practical application, the main test contents of the power consumption test are electric quantity, memory, CPU, uplink flow and downlink flow. When the connection mode is wired connection, the wired connection part can provide electric quantity for the mobile equipment, so that the electric quantity test is not standard, and therefore, under the condition of wired connection, the related information of the electric quantity is not recorded, namely, the electric quantity is not tested. When the connection mode is wireless connection, the related information of the electric quantity can be recorded, namely the electric quantity needs to be tested. Therefore, when the connection mode is wired connection, the operation data is directly called without recording electric quantity information so as to complete the preset operation of the preset time of the mobile equipment, and meanwhile, the monitoring data of the mobile equipment, namely the memory information, the CPU information, the uplink flow information, the downlink flow information and the like of the mobile equipment are obtained after the operation is finished. And then, carrying out aggregation operation on the monitoring information of each mobile device to finally obtain a power consumption test report of the target APP.
In some embodiments, when the power consumption information of each mobile device is determined according to the first power information and the second power information of each mobile device, the first power information and the second power information of each mobile device may be compared to obtain power difference information; and then the power difference information of each mobile device is used as the power consumption information. Therefore, the power consumption information of each mobile device can be acquired, and the comprehensiveness of the APP power consumption test is ensured.
In step 13, when the operation data of the target APP is preset, the following may be specifically executed: receiving a recording instruction input by a user, and determining a target APP according to the recording instruction; and receiving operation information input by a user based on the target APP, and recording the running data of the target APP according to the operation information. Based on this, the tester can set up the operational data of target APP in advance after receiving the test task to use in the follow-up test procedure of being convenient for, saved test time, bring a lot of facilities for the tester.
In some embodiments, after determining the connection mode with the mobile device, the test device may further receive test data input by the user, that is, the user performs a certain time of operation on the mobile device in a manual simulation mode to obtain the monitoring data. When the monitoring data is acquired through manual operation, the test equipment is considered to be finished when detecting that the test data is not received within the first preset time, and the monitoring data is acquired.
The first preset time may be set according to actual needs, and is not limited herein.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that, in the description of the present application, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present application, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and the scope of the preferred embodiments of the present application includes other implementations 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 application.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means 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 application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.