CN115757014A - Power consumption testing method and device - Google Patents
Power consumption testing method and device Download PDFInfo
- Publication number
- CN115757014A CN115757014A CN202211274409.3A CN202211274409A CN115757014A CN 115757014 A CN115757014 A CN 115757014A CN 202211274409 A CN202211274409 A CN 202211274409A CN 115757014 A CN115757014 A CN 115757014A
- Authority
- CN
- China
- Prior art keywords
- power consumption
- test
- consumption test
- software
- value
- 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.)
- Pending
Links
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Power Sources (AREA)
Abstract
The invention discloses a power consumption testing method and device, and relates to the field of computer application. The method comprises the following steps: acquiring an installation file and an instruction file of software to be tested; sending an installation file of the software to be tested to a power consumption testing resource pool; respectively generating a power consumption test script of each software function according to the description file; acquiring a first power consumption test value and a second power consumption value; obtaining a power consumption test value of the software function by using the first power consumption test value and the second power consumption test value; repeatedly executing the process of obtaining the power consumption test value of the software function until the power consumption test value of each software function is obtained; and generating a power consumption test file of the software to be tested according to the obtained power consumption test value of each software function. The invention realizes the automatic generation of a standardized power consumption test scheme in the test process, improves the power consumption test efficiency, saves the test resources, and also reduces the test code amount and the test complexity.
Description
Technical Field
The invention relates to the field of computer application, in particular to a power consumption testing method and device.
Background
At present, in the software testing industry, the power consumption of software is usually tested to realize the discrimination of software performance. The power consumption test of the software mainly aims at the overall power consumption test of the software. For the power consumption test of a specific function of software, the automatic power consumption test of the specific function can be realized only by simulating manual operation in advance or presetting standard conditions and the like.
The pre-simulation of manual operations is similar to the manual completion of power consumption testing of a particular function of software by a manager (or user). For example, the administrator clicks the test button 1, button 2, button 3, etc. according to the test flow, and at the same time, the test flow is recorded by using a tool, and then the test process is completed by the automatic simulation of the device.
The preset standard condition means that before the power consumption test of a specific function is executed, the test condition and the parameter value are set, and after the setting is finished, the power consumption test of the specific function is executed. For example, a power consumption test of a picture editing function requires that a fixed picture is input first. Then, the option to be edited and a fixed value of the option are set, such as a picture size option and a fixed value, a degree option and a fixed value of picture gaussian processing, and the like. And finally, testing the power consumption of the picture editing function after the preset condition is finished.
However, the above test for the power consumption of a specific function of software is limited in the testable range for software, and cannot completely cover the whole functional range of software; moreover, the test process is complex, and the test efficiency is low. Furthermore, the difference of different software is considered. If different software and specific function power consumption are tested, different test schemes need to be determined for each software. Therefore, the human resources and the software and hardware resources are continuously input for testing; meanwhile, in the testing process, the code amount and complexity are also continuously improved.
Disclosure of Invention
In view of this, embodiments of the present invention provide a power consumption testing method and apparatus, which implement testing of overall and specific functional power consumption of different software; in the test process, a standard power consumption test scheme is automatically generated, so that the power consumption test efficiency is improved, the test resources are saved, and the test code amount and the test complexity are reduced.
In a first aspect, an embodiment of the present invention provides a power consumption testing method, where the method includes:
acquiring an installation file and an instruction file of software to be tested;
sending an installation file of the software to be tested to a power consumption testing resource pool, so that the power consumption testing resource pool installs and starts the software to be tested according to the installation file after receiving an installation operation instruction;
respectively generating a power consumption test script of each software function included in the software to be tested according to the description file;
acquiring a first power consumption test value and a second power consumption value, wherein the first power consumption test value is an actual power consumption value obtained after a test device performs power consumption test on a power consumption test resource pool when any power consumption test script is not executed and the to-be-tested software is started, and the second power consumption test value is an actual power consumption value obtained after the test device performs power consumption test on the power consumption test resource pool when one power consumption test script is executed;
obtaining a power consumption test value of the software function by using the first power consumption test value and the second power consumption test value;
repeatedly executing the process of obtaining the first power consumption test value and the second power consumption test value and obtaining the power consumption test values of the software functions by using the first power consumption test value and the second power consumption test value until the power consumption test value of each software function is obtained;
and generating a power consumption test file of the software to be tested according to the obtained power consumption test value of each software function.
In a second aspect, an embodiment of the present invention provides a power consumption testing apparatus, where the apparatus includes:
the first acquisition unit is used for acquiring an installation file and an instruction file of the software to be tested;
the sending unit is used for sending the installation file of the software to be tested to a power consumption testing resource pool, so that the power consumption testing resource pool installs and starts the software to be tested according to the installation file after receiving an installation operation instruction;
the first generating unit is used for respectively generating a power consumption test script of each software function included in the software to be tested according to the description file;
the second obtaining unit is used for obtaining a first power consumption test value and a second power consumption value, wherein the first power consumption test value is an actual power consumption value obtained after a test device performs power consumption test on a power consumption test resource pool when any power consumption test script is not executed and the to-be-tested software is started, and the second power consumption test value is an actual power consumption value obtained after the test device performs power consumption test on the power consumption test resource pool when one power consumption test script is executed;
the computing unit is used for obtaining a power consumption test value of the software function by using the first power consumption test value and the second power consumption test value;
the second acquiring unit, the calculating unit repeatedly execute the acquiring of the first power consumption test value, the second power consumption test value and the using of the first power consumption test value and the second power consumption test value, obtaining the power consumption test value of the software function until the power consumption test value of each software function is obtained;
and the second generating unit is used for generating a power consumption test file of the software to be tested according to the acquired power consumption test value of each software function.
In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing the power consumption testing method described in the foregoing first aspect method.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement the power consumption testing method according to the first aspect.
According to the power consumption testing method and device provided by the embodiment of the invention, the electronic equipment acquires the installation file and the instruction file of the software to be tested; the electronic equipment sends an installation file of the software to be tested to the power consumption testing resource pool, so that the power consumption testing resource pool installs and starts the software to be tested according to the installation file after receiving an installation operation instruction; according to the instruction file, the electronic equipment respectively generates a power consumption test script of each software function included in the software to be tested; the electronic equipment obtains a first power consumption test value and a second power consumption value, wherein the first power consumption test value is an actual power consumption value obtained after the test equipment performs power consumption test on a power consumption test resource pool when any one power consumption test script is not executed and the to-be-tested software is started, and the second power consumption test value is an actual power consumption value obtained after the test equipment performs power consumption test on the power consumption test resource pool when one power consumption test script is executed; obtaining a power consumption test value of the software function by using the first power consumption test value and the second power consumption test value; repeatedly executing the process of obtaining the first power consumption test value and the second power consumption test value and obtaining the power consumption test values of the software functions by using the first power consumption test value and the second power consumption test value until the power consumption test value of each software function is obtained; and according to the obtained power consumption test value of each software function, the electronic equipment generates a power consumption test file of the software to be tested.
The scheme realizes the test of the whole and specific functional power consumption of different software; in the test process, a standard power consumption test scheme is automatically generated, so that the power consumption test efficiency is improved, the test resources are saved, and the test code amount and the test complexity are reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention 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 invention, 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 a power consumption testing method according to an embodiment of the present invention;
fig. 2 is a schematic networking diagram of an application power consumption testing method according to an embodiment of the present invention;
fig. 3 is a signaling diagram of an application power consumption testing method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a power consumption testing method apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The following describes a scheme provided by an embodiment of the present invention in detail with reference to fig. 1, and fig. 1 is a flowchart of a power consumption testing method provided by an embodiment of the present invention. In the embodiment of the present invention, the implementation subject is a power consumption test platform included in the electronic device. The electronic equipment can be a computer or a cluster, and the power consumption test platform runs in the computer or the cluster. As shown in fig. 1, the method of this embodiment specifically includes the following steps: as shown in fig. 1, the method of this embodiment specifically includes the following steps:
In this step, the administrator wants to perform a power consumption test on a certain software (hereinafter referred to as a software to be tested). The manager can input the download link address of the software to be tested to the power consumption testing platform in a command line mode.
After receiving the download link address, the power consumption testing platform can perform communication interaction with the third-party storage device, and acquire an installation file (or called an installation package) and an instruction file (or called an instruction document) of the software to be tested from the third-party storage device.
In the following embodiments, details of obtaining the installation file and the description file will be described, and are not described herein again.
And 120, sending the installation file of the software to be tested to a power consumption testing resource pool, so that the power consumption testing resource pool installs and starts the software to be tested according to the installation file after receiving an installation operation instruction.
In this step, after the power consumption testing platform obtains the installation file of the software to be tested, the power consumption testing platform sends the installation file of the software to be tested to the power consumption testing resource pool.
And after receiving the installation file of the software to be tested, the power consumption testing resource pool stores the installation file locally. And the power consumption testing resource pool waits for an installation operation instruction issued by the power consumption testing platform. And after receiving an installation operation instruction, installing and starting the to-be-tested software according to the installation file by the power consumption testing resource pool.
Optionally, after the power consumption testing resource pool receives and locally stores the installation file of the software to be tested, the power consumption testing resource pool sends a reception feedback to the power consumption testing platform, so that the power consumption testing platform determines that the power consumption testing resource pool has received the installation file.
Optionally, after the power consumption testing resource pool locally installs and starts the software to be tested, the power consumption testing resource pool may further send installation operation feedback to the power consumption testing platform, so that the power consumption testing platform determines that the power consumption testing resource pool has been installed and starts the software to be tested.
Certainly, in practical application, the power consumption testing platform may also carry the installation file of the software to be tested in the installation operation instruction and send the installation file to the power consumption testing resource pool. And after receiving the installation and operation instruction, the power consumption testing resource pool acquires an installation file of the software to be tested. And according to the installation file, the power consumption testing resource pool locally installs and starts the software to be tested. The power consumption testing resource pool sends installation and operation feedback to the power consumption testing platform, so that the power consumption testing platform determines that the power consumption testing resource pool is installed and starts the software to be tested.
Optionally, the power consumption testing resource pool and the power consumption testing platform are in different devices. The power consumption testing resource pool can also be called a software list, and is used for carrying at least one installation file of software to be tested. In practical applications, the power consumption testing resource pool may be embodied as a terminal device, and the terminal device may be embodied as a personal computer, a desktop computer, or the like. An operating system is configured in the terminal equipment to ensure the running environment of the software to be tested. And after the terminal equipment receives the installation operation instruction, the terminal equipment installs and starts the software to be tested.
It should be noted that, in the software function testing process, a piece of software to be tested is currently installed and started in the terminal device. After the test is finished, the terminal equipment clears all resources occupied by the software, such as processes, threads, CPU (central processing unit), memory and the like occupied by the software, and avoids influencing the test of other software to be tested.
And step 130, respectively generating a power consumption test script of each software function included in the software to be tested according to the description file.
In this step, after the power consumption test platform obtains the description file of the software to be tested, the power consumption test platform respectively generates a power consumption test script of each software function included in the software to be tested according to the description file.
For example, the software to be tested includes a picture editing function and a document editing function, and the power consumption test platform generates two power consumption test scripts respectively corresponding to the different functions.
In the following embodiments, the generated consumption test script will be described in detail, and will not be described herein.
After the power consumption test platform generates the power consumption test script of each software function or before the power consumption test platform requires the power consumption test resource pool to execute the script, the power consumption test script can be sent to the power consumption test resource pool. The test resource pool stores the power consumption test script locally.
It can be understood that the power consumption test platform may first send the power consumption test script of one software function to the power consumption test resource pool, and after the power consumption test of the software function is completed, send the power consumption test script of another software function to the power consumption test resource pool.
In this step, the power consumption testing platform may first request the testing device to perform a power consumption test on the power consumption testing resource pool in which the to-be-tested software is started and any one power consumption testing script is not executed, so as to obtain an actual power consumption value. The actual power consumption value is a first power consumption test value. And after the test equipment tests, sending a first power consumption test value to the power consumption test platform.
Then, the power consumption testing platform requires the power consumption testing resource pool to execute a power consumption testing script of the software function.
And finally, the power consumption test platform requests the test equipment to perform power consumption test on the power consumption test resource pool of the power consumption test script for executing a software function, so as to obtain an actual power consumption value. The actual power consumption value is a second power consumption test value. And after the test equipment tests, sending a second power consumption test value to the power consumption test platform.
In the following embodiments, the obtaining of the first power consumption test value and the second power consumption test value will be described in detail, and details are not repeated here.
And 150, obtaining a power consumption test value of the software function by using the first power consumption test value and the second power consumption test value.
In this step, after the power consumption test platform obtains the first power consumption test value and the second power consumption test value, the power consumption test value of a power consumption test script currently executed by the power consumption test resource pool is calculated. The power consumption test value is also the power consumption test value of the software function corresponding to the power consumption test script.
In the following embodiments, the calculation of the power consumption test value will be described in detail, and will not be described herein again.
In this step, since the specification file of the software to be tested may include a plurality of software functions, the power consumption testing platform repeatedly executes steps 140 to 150. And finally, the power consumption test platform acquires the power consumption test value of each software function.
And 170, generating a power consumption test file of the software to be tested according to the acquired power consumption test value of each software function.
In this step, after the power consumption test platform obtains the power consumption test value of each software function, a power consumption test file of the software to be tested is generated by using the power consumption test value of each software function.
Alternatively, the power consumption test file may specifically include a name of each software function and a power consumption test value of each software function. Wherein the name of the software function can be extracted from the description file.
In one example, the power consumption test file includes a picture editing function-power consumption 1.5W/hour; document editing function-power consumption 2W/hour.
Optionally, the power consumption test file may further include software and hardware information of the software resource pool.
In one example, the hardware information is specifically a CPU model i5/i7; the software information is specifically system version win10/win11.
The scheme realizes the test of the whole and specific functional power consumption of different software; in the test process, a standard power consumption test scheme is automatically generated, so that the power consumption test efficiency is improved, the test resources are saved, and the test code amount and the test complexity are reduced.
The following describes a scheme provided by an embodiment of the present invention in detail with reference to fig. 2 and fig. 3, and fig. 2 is a schematic networking diagram of an application power consumption testing method provided by an embodiment of the present invention. Fig. 3 is a signaling diagram of an application power consumption testing method according to an embodiment of the present invention.
In fig. 2, a network to which the power consumption test method is applied includes a power consumption test platform, a test device, a power consumption test resource pool, and a third-party storage device. The power consumption test platform, the test equipment and the power consumption test resource pool are in a network range. The power consumption test platform can realize the following functions: downloading software and tools, generating test scripts, managing power consumption tests and generating test reports. The test equipment can be arranged independently or integrated with the power consumption test resource pool in the terminal equipment. The power consumption testing resource pool stores a plurality of downloaded installation files of the software to be tested. Each third-party storage device stores an installation file and a description file of software to be tested.
In fig. 3, the software a includes two software functions, namely a document editing function and a picture editing function. The third-party storage device 1 stores the installation files and the description files of the software a, and now the manager wants to perform the power consumption test on the software a, the process is as follows:
step 300, the power consumption test platform receives a download link address of the software to be tested, which is input by a user.
In this step, the administrator inputs the download link address of the software a, i.e., the download URL of the software a, to the power consumption test platform in a command line manner.
And the power consumption test platform receives the download URL of the software A.
Step 301, according to the download link address, the power consumption test platform sends a first acquisition request to the third-party storage device.
In the embodiment of the present invention, the third party storage device may be specifically a target resource server.
In this step, according to the download URL of the software a, the power consumption test platform generates and sends a first acquisition request to the target resource server 1, so as to request the installation file and the description file of the software a from the target resource server 1.
It should be noted that the download URL can be used to locate the target resource server. The power consumption test platform can determine that the installation file and the instruction file of the software A are stored in the target resource server 1 according to the download URL of the software A.
After receiving the first acquisition request, the target resource server 1 determines an installation file and an instruction file of the power consumption test platform request software a. The target resource server 1 acquires the installation file and the description file of the software a from the local. The target resource server 1 generates and sends a first acquisition response to the power consumption test platform. The first acquisition response includes the installation file and the description file of the software a.
Step 302, the power consumption test platform receives a first acquisition response sent by the target resource server.
In this step, after receiving the first obtaining response, the power consumption test platform obtains the installation file and the description file of the software a from the first obtaining response.
Step 303, the power consumption testing platform sends an installation file of the software to be tested to the power consumption testing resource pool.
In this step, after receiving the installation file of the software a, the power consumption test resource pool stores the installation file of the software a locally. And generating a power consumption test resource pool and sending receiving feedback to the power consumption test platform.
And step 304, the power consumption testing resource pool sends receiving feedback to the power consumption testing platform.
And 305, the power consumption test platform sends an installation operation instruction to the power consumption test resource pool.
In this step, after receiving the receiving feedback, the power consumption testing platform determines that the power consumption testing resource pool has received the installation file of the software a. Power consumption test platform generation and power consumption test and the resource pool sends an installation operation instruction.
And step 306, the power consumption testing resource pool sends installation operation feedback to the power consumption testing platform.
In this step, after the power consumption testing resource pool receives the installation operation instruction, the power consumption testing resource pool installs and starts the software a in the terminal device according to the installation operation instruction. And generating a power consumption test resource pool and sending installation operation feedback to the power consumption test platform.
It should be noted that, at this time, the power consumption test resource pool does not run the document editing function and the picture editing function included in the software a.
And 307, according to the instruction file, the power consumption test platform respectively generates a power consumption test script of each software function included in the software to be tested, and sends the power consumption test script of one software function to the power consumption test resource pool.
In this step, after receiving the installation operation feedback, the power consumption test platform determines that the power consumption test resource pool has completed the installation and the start of the software A. And the power consumption test platform carries out natural language processing and analysis on the description file, and respectively extracts the function points corresponding to each software function and the structured data of the function points from the description file. And converting the execution process of each piece of structured data into a power consumption test script corresponding to each software function by using a standard programming language through the power consumption test platform.
The picture editing function will be described as an example.
The instruction file is recorded with a ' file ' button in the process of clicking the picture edition ', an ' opening ' option is selected from the sub-options, and if the picture in the path is selected, the picture is opened and displayed in the picture edition; in an edit button in picture editing, a Gaussian option is selected, the Gaussian degree, such as 100%, is input, and after the Gaussian degree is determined, the Gaussian processing of the picture can be finished. "
The power consumption test platform analyzes the instruction file by using natural language, and extracts a function point as 'picture editing'; the structured data of the function point is' 1 object: a picture; 2. the actions are as follows: gaussian processing; 3. action Process (action pass): a. file-open-picture; b. edit-gauss-gaussian degree input ".
Of course, in the process of parsing the description file in the natural language, the description file may not fully record the execution details of the software function, that is, the execution details may be missing. In one example, a "click file" button in picture editing is recorded in the description file, an "open" option is selected from the sub-options, and if a picture in the path is selected, the picture is opened and displayed in the picture editing; and inputting a Gaussian degree, such as 100% ", and finishing the Gaussian processing of the picture after the determination. "
In the above example, the specification file does not bear the content of "select gaussian option" or the like, resulting in loss of execution details. At this time, the power consumption test platform can search the relevant content of the picture editing function in the network through a crawler technology (existing high-speed search technology), compare the content, and supplement the execution details missing in the description file by itself.
And the power consumption test platform converts the structured data into a power consumption test script by using a standard programming language. The following examples:
the power consumption test script specifically comprises the following contents:
the power consumption test platform retrieves a picture in the network and records a download link address of the picture, namely a download URL of the picture, in the background. The URL may also be used to obtain pictures when performing homogeneous testing in other software tools. And the power consumption testing platform downloads the picture and transmits the picture to a specific path of the power consumption testing resource pool. And the power consumption testing resource pool runs the picture editing function of the software A, and a file button is matched in the picture editing function according to the extracted structured data. The power consumption testing resource pool simulates click in sequence: file-open (select specific path) -select picture ", the picture editing function opens the picture. The power consumption testing resource pool sequentially simulates clicking: editing-gaussian processing, inputting gaussian proportion and clicking a confirmation button. And at this moment, the power consumption testing resource pool completes the Gaussian processing of the picture.
After the power consumption test platform generates the power consumption test script of each software function, the power consumption test script of one software function, for example, the power consumption test script of the picture editing function, is sent to the power consumption test resource pool. And the test resource pool stores the power consumption test script of the picture editing function in local.
It can be understood that, after the power consumption test platform generates the power consumption test script of the document editing function, the power consumption test script is not sent to the power consumption test resource pool temporarily, and the power consumption test script is sent after the power consumption test of the picture editing function is completed.
Step 308, the power consumption test platform sends a first test request to the test equipment.
In this step, the power consumption test platform generates and sends a first test request to the test equipment to request the test equipment to perform power consumption test on the power consumption test resource pool of the power consumption test script which starts the software a and does not execute the picture editing function.
In the embodiment of the present invention, the test device may be specifically a power consumption tester.
Step 309, the test device performs power consumption test on the power consumption test resource pool when any power consumption test script is not executed and the to-be-tested software is started.
In this step, the power consumption test script of the software a is run in the power consumption test resource pool without executing the picture editing function. And the test equipment performs power consumption test on the power consumption test resource pool at the moment to obtain an actual power consumption value P.
Further, the test device itself generates power consumption when performing the power consumption test. The power consumption value of the test equipment is a constant value, i.e. P0. If the test equipment is set independently, the first power consumption test value P1 is the actual power consumption value P. If the test device and the power consumption test resource pool are integrated in the terminal device, the first power consumption test value P1 further includes P0, that is, P1= P + P0.
Step 310, the test equipment sends a first test response to the power consumption test platform.
In this step, the test device generates and sends a first test response to the power consumption test platform, where the first test response includes a first power consumption test value.
And 311, the power consumption test platform sends an execution script operation instruction to the power consumption test resource pool.
In this step, the power consumption test platform generates and sends a script operation instruction for executing the picture editing function to the power consumption test resource pool.
Step 312, the power consumption testing platform sends a second testing request to the testing device.
In this step, the power consumption test platform generates and sends a second test request to the test equipment to request the test equipment to perform power consumption test on the power consumption test resource pool running the picture editing function.
Step 313, the power consumption test resource pool executes a power consumption test script of the software function.
In this step, the power consumption test resource pool executes the power consumption test script of the picture editing function.
Step 314, the test device performs power consumption test on the power consumption test resource pool when executing the power consumption test script of the software function.
In this step, a power consumption test script with a picture editing function is run in the power consumption test resource pool. The test equipment carries out power consumption test on the power consumption test resource pool with the picture editing function to obtain an actual power consumption value P'.
Further, if the test device is set separately, the second power consumption test value P2 is the second actual power consumption value P'. If the test device is integrated with the power consumption test resource pool in the terminal device, the second power consumption test value P2 further includes P0, i.e. P2= P' + P0.
It should be noted that step 313 and step 314 are executed in parallel.
Step 315, the power consumption testing resource pool sends script operation feedback to the power consumption testing platform.
Step 316, the test equipment sends a second test response to the power consumption test platform.
In this step, the test device generates and sends a second test response to the power consumption test platform, where the second test response includes a second power consumption test value.
And 317, obtaining the power consumption test value of the software function by the power consumption test platform by using the first power consumption test value and the second power consumption test value.
In this step, the power consumption test platform uses the difference value between the second power consumption test value and the first power consumption test value as the power consumption test value of the picture editing function.
Further, the power consumption test value of the picture editing function is P2-P1; or, (P' + P0) - (P + P0).
And step 318, repeatedly executing the steps 308 to 317 until the power consumption test value of each software function is obtained.
In this step, the power consumption test platform repeatedly executes steps 308 to 317 to obtain a power consumption test value of the document editing function.
Step 319, the power consumption testing platform generates a power consumption testing file of the software to be tested.
In this step, after the power consumption test platform obtains the power consumption test value of each software function, and generating a power consumption test file of the software to be tested by using the power consumption test value of each software function.
Further, the power consumption test file may specifically include a name of each software function and a power consumption test value of each software function. Wherein the name of the software function can be extracted from the description file.
In one example, the power consumption test file includes a picture editing function-power consumption 1.5W/hour; document editing function-power consumption 2W/hour.
Further, the power consumption test file may further include software and hardware information of the terminal device where the software resource pool is located.
In one example, the hardware information is specifically a CPU model i5/i7; the software information is specifically system version win10/win11.
Fig. 4 is a schematic structural diagram of a power consumption testing apparatus according to an embodiment of the present invention, and as shown in fig. 4, the power consumption testing apparatus according to the embodiment may include: a first acquiring unit 410, a transmitting unit 420, a first generating unit 430, a second acquiring unit 440, a calculating unit 450, and a second generating unit 460.
The first obtaining unit 410 is configured to obtain an installation file and a description file of software to be tested;
the sending unit 420 is configured to send the installation file of the software to be tested to a power consumption testing resource pool, so that after receiving an installation operation instruction, the power consumption testing resource pool installs and starts the software to be tested according to the installation file;
the first generating unit 430 is configured to generate a power consumption test script of each software function included in the software to be tested according to the description file;
the second obtaining unit 440 is configured to obtain a first power consumption test value and a second power consumption value, where the first power consumption test value is an actual power consumption value obtained after a test device performs power consumption test on a power consumption test resource pool when a test script is not executed and the software to be tested is started, and the second power consumption test value is an actual power consumption value obtained after the test device performs power consumption test on the power consumption test resource pool when a power consumption test script is executed;
the calculating unit 450 is configured to obtain a power consumption test value of the software function by using the first power consumption test value and the second power consumption test value;
the second obtaining unit 440 and the calculating unit repeatedly execute the process of obtaining the first power consumption test value and the second power consumption test value and obtaining the power consumption test value of the software function by using the first power consumption test value and the second power consumption test value until obtaining the power consumption test value of each software function;
the second generating unit 460 is configured to generate a power consumption test file of the software to be tested according to the obtained power consumption test value of each software function.
Optionally, the first obtaining unit 410 is specifically configured to receive a download link address of the software to be tested, which is input by a user;
sending a first acquisition request to a target resource server according to the download link address;
and receiving a first acquisition response sent by the target resource server, wherein the first acquisition response comprises an installation file and an instruction file of the software to be tested.
Optionally, the first generating unit 430 is specifically configured to perform natural language processing and parsing on the description document, and extract, from the description file, a function point corresponding to each software function and structured data of the function point;
each structured data is converted into a power consumption test script corresponding to each software function using a standard programming language.
Optionally, the second obtaining unit 440 is specifically configured to send a first test request to the test device, so that the test device performs power consumption testing on a power consumption testing resource pool when any one power consumption testing script is not executed and the software to be tested is started;
and receiving a first test response sent by the test equipment, wherein the first test response comprises the first power consumption test value.
Optionally, the sending unit 420 is further configured to send a power consumption test script of a software function to the power consumption test resource pool, so that the power consumption test resource pool stores the power consumption test script of the software function.
Optionally, the second obtaining unit 440 is specifically configured to send an execution script operation instruction to the power consumption test resource pool, so that the power consumption test resource pool executes the power consumption test script;
sending a second test request to the test equipment so that the test equipment can perform power consumption test on a power consumption test resource pool when executing one power consumption test script;
and receiving a second test response sent by the test equipment, wherein the second test response comprises the second power consumption test value.
Optionally, the calculating unit 450 is specifically configured to, the obtaining a power consumption test value of the software function by using the first power consumption test value and the second power consumption test value specifically includes:
and taking the difference value of the second power consumption test value and the first power consumption test value as the power consumption test value of the software function.
Optionally, the test device is a power consumption tester, and the power consumption tester is independent of the power consumption test resource pool; alternatively, the test device is integrated with the power consumption test resource pool.
Optionally, when the test device is integrated with the power consumption test resource pool, the first power consumption test value further includes a test power consumption of the test device; the second power consumption value further comprises a test power consumption of the test device.
The apparatus of this embodiment may be used to implement the technical solutions of the method embodiments shown in fig. 1 to fig. 3, and the implementation principles and technical effects are similar, which are not described herein again.
Correspondingly, the power consumption testing device provided by the embodiment of the invention can also be realized by another structure. Fig. 5 is a schematic structural diagram of an embodiment of an electronic device provided by the present invention, which can implement the flows of the embodiments shown in fig. 1 to fig. 3 of the present invention, and as shown in fig. 5, the electronic device may include: the device comprises a shell 51, a processor 52, a memory 53, a circuit board 54 and a power circuit 55, wherein the circuit board 54 is arranged inside a space enclosed by the shell 51, and the processor 52 and the memory 53 are arranged on the circuit board 54; a power supply circuit 55 for supplying power to each circuit or device of the electronic apparatus; the memory 53 is used to store executable program code; the processor 52 runs a program corresponding to the executable program code by reading the executable program code stored in the memory 53 for executing the method described in the foregoing embodiment.
The specific execution process of the above steps by the processor 52 and the steps further executed by the processor 52 by running the executable program code may refer to the description of the embodiment shown in fig. 1 to fig. 3 of the present invention, and are not described herein again.
The electronic device: the device for providing computing services, the electronic device comprises a processor, a hard disk, a memory, a system bus and the like, the electronic device is similar to a general computer architecture, but the device has high requirements on processing capability, stability, reliability, safety, expandability, manageability and the like because high-reliability services need to be provided.
It should be noted that, in this document, terms such as "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on differences from other embodiments.
In particular, for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., 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, 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.
For convenience of description, the above devices are described as being respectively described in terms of functional division into various units/modules. Of course, the functionality of the units/modules may be implemented in one or more software and/or hardware implementations of the invention.
From the above description of the embodiments, it is clear to those skilled in the art that the present invention can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
Claims (10)
1. A method for power consumption testing, the method comprising:
acquiring an installation file and an instruction file of software to be tested;
sending an installation file of the software to be tested to a power consumption testing resource pool, so that the power consumption testing resource pool installs and starts the software to be tested according to the installation file after receiving an installation operation instruction;
respectively generating a power consumption test script of each software function included in the software to be tested according to the description file;
acquiring a first power consumption test value and a second power consumption value, wherein the first power consumption test value is an actual power consumption value obtained after a test device performs power consumption test on a power consumption test resource pool when any power consumption test script is not executed and the to-be-tested software is started, and the second power consumption test value is an actual power consumption value obtained after the test device performs power consumption test on the power consumption test resource pool when one power consumption test script is executed;
obtaining a power consumption test value of the software function by using the first power consumption test value and the second power consumption test value;
repeatedly executing the process of obtaining the first power consumption test value and the second power consumption test value and obtaining the power consumption test values of the software functions by using the first power consumption test value and the second power consumption test value until the power consumption test value of each software function is obtained;
and generating a power consumption test file of the software to be tested according to the obtained power consumption test value of each software function.
2. The method according to claim 1, wherein the obtaining of the installation file and the description file of the software to be tested specifically comprises:
receiving a download link address of the software to be tested, which is input by a user;
sending a first acquisition request to a target resource server according to the download link address;
and receiving a first acquisition response sent by the target resource server, wherein the first acquisition response comprises an installation file and an instruction file of the software to be tested.
3. The method according to claim 1, wherein the generating a power consumption test script for each software function included in the software to be tested according to the description file includes:
performing natural language processing analysis on the description document, and respectively extracting a function point corresponding to each software function and the structured data of the function point from the description document;
each structured data is converted into a power consumption test script corresponding to each software function using a standard programming language.
4. The method according to claim 1, wherein the obtaining the first power consumption test value specifically includes:
sending a first test request to the test equipment so that the test equipment performs power consumption test on a power consumption test resource pool when any one power consumption test script is not executed and the to-be-tested software is started;
and receiving a first test response sent by the test equipment, wherein the first test response comprises the first power consumption test value.
5. The method of claim 1, wherein prior to obtaining the first power consumption test value and the second power consumption value, the method further comprises:
and sending a power consumption test script of a software function to the power consumption test resource pool so that the power consumption test resource pool stores the power consumption test script of the software function.
6. The method according to claim 5, wherein the obtaining the second power consumption test value specifically comprises:
sending an execution script operation instruction to the power consumption testing resource pool so that the power consumption testing resource pool executes the power consumption testing script;
sending a second test request to the test equipment so that the test equipment performs power consumption test on a power consumption test resource pool when executing one power consumption test script;
and receiving a second test response sent by the test equipment, wherein the second test response comprises the second power consumption test value.
7. The method according to claim 1, wherein the obtaining the power consumption test value of the software function by using the first power consumption test value and the second power consumption test value specifically comprises:
and taking the difference value of the second power consumption test value and the first power consumption test value as the power consumption test value of the software function.
8. The method of claim 7, wherein the test device is a power consumption tester that is independent of the power consumption test resource pool; alternatively, the test device is integrated with the power consumption test resource pool.
9. The method of claim 8, wherein the first power consumption test value further comprises a test power consumption of the test device when the test device is integrated with the power consumption test resource pool; the second power consumption value further comprises a test power consumption of the test device.
10. A power consumption testing apparatus, the apparatus comprising:
the first acquisition unit is used for acquiring an installation file and an instruction file of the software to be tested;
the sending unit is used for sending the installation file of the software to be tested to a power consumption testing resource pool, so that the power consumption testing resource pool installs and starts the software to be tested according to the installation file after receiving an installation operation instruction;
the first generating unit is used for respectively generating a power consumption test script of each software function included in the software to be tested according to the description file;
the second obtaining unit is used for obtaining a first power consumption test value and a second power consumption value, wherein the first power consumption test value is an actual power consumption value obtained after a test device performs power consumption test on a power consumption test resource pool when any power consumption test script is not executed and the to-be-tested software is started, and the second power consumption test value is an actual power consumption value obtained after the test device performs power consumption test on the power consumption test resource pool when one power consumption test script is executed;
the computing unit is used for obtaining a power consumption test value of the software function by using the first power consumption test value and the second power consumption test value;
the second obtaining unit and the calculating unit repeatedly execute the process of obtaining the first power consumption test value and the second power consumption test value and obtaining the power consumption test value of the software function by using the first power consumption test value and the second power consumption test value until the power consumption test value of each software function is obtained;
and the second generating unit is used for generating a power consumption test file of the software to be tested according to the acquired power consumption test value of each software function.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211274409.3A CN115757014A (en) | 2022-10-18 | 2022-10-18 | Power consumption testing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211274409.3A CN115757014A (en) | 2022-10-18 | 2022-10-18 | Power consumption testing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115757014A true CN115757014A (en) | 2023-03-07 |
Family
ID=85352254
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211274409.3A Pending CN115757014A (en) | 2022-10-18 | 2022-10-18 | Power consumption testing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115757014A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117632650A (en) * | 2023-11-30 | 2024-03-01 | 摩尔线程智能科技(北京)有限责任公司 | Power consumption analysis method, device, electronic equipment and storage medium |
CN117707986A (en) * | 2024-02-05 | 2024-03-15 | 钦原科技有限公司 | Software power consumption testing method and system for mobile terminal |
-
2022
- 2022-10-18 CN CN202211274409.3A patent/CN115757014A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117632650A (en) * | 2023-11-30 | 2024-03-01 | 摩尔线程智能科技(北京)有限责任公司 | Power consumption analysis method, device, electronic equipment and storage medium |
CN117707986A (en) * | 2024-02-05 | 2024-03-15 | 钦原科技有限公司 | Software power consumption testing method and system for mobile terminal |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107516510B (en) | Automatic voice testing method and device for intelligent equipment | |
CN115757014A (en) | Power consumption testing method and device | |
CN110955409B (en) | Method and device for creating resources on cloud platform | |
CN108923997B (en) | Cloud service node automatic testing method and device based on python | |
CN113505082B (en) | Application program testing method and device | |
CN112732587A (en) | Method and device for acquiring automatic test log, electronic equipment and storage medium | |
CN115658529A (en) | Automatic testing method for user page and related equipment | |
US20220214963A1 (en) | Analysis apparatus, analysis method and program | |
CN111078529B (en) | Client writing module testing method and device and electronic equipment | |
CN112988589A (en) | Interface testing method, device and system | |
CN112346981A (en) | Joint debugging test coverage rate detection method and system | |
CN111581051A (en) | System operation log processing method, device, equipment and medium based on web front end | |
CN115827457A (en) | Browser compatibility testing method and related equipment | |
CN112306639B (en) | Virtual desktop testing method and device | |
CN114385493A (en) | Performance test method and device, electronic equipment and storage medium | |
CN114610446A (en) | Method, device and system for automatically injecting probe | |
CN112433946A (en) | Interface test management method, device, equipment and storage medium | |
CN113918206A (en) | Application program processing method and device, electronic equipment and readable storage medium | |
CN113377648A (en) | Software system diagnosis method and device, electronic equipment and computer readable medium | |
CN113761402A (en) | Link debugging method, device, equipment and storage medium | |
US20240095153A1 (en) | Test code generator, test code generation method, and, test code generaration program | |
CN113608996B (en) | Mirror image compiling test method, system, device and readable storage medium | |
CN113505073B (en) | Performance test method, device, equipment and medium of database | |
CN113836037B (en) | Interface interaction testing method, device, equipment and storage medium | |
CN116841778A (en) | Information acquisition method, information acquisition device, electronic equipment and computer readable storage medium |
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 |