Summary of the invention
For this purpose, the present invention provides the automated testing method, device and mobile terminal of a kind of mobile terminal, to try hard to solve
Or at least alleviate at least one existing problem above.
According to an aspect of the invention, there is provided a kind of automated testing method of mobile terminal, this method includes step
It is rapid: to open the operation of monitoring in response to user, execute the first order, obtain the real time information of mobile terminal, wherein real time information
It is the CPU usage of the mobile terminal periodically obtained with preset frequency;The operation of test is opened in response to user, executes the second life
It enables, runs test script;At the end of test, output test result, test result includes the testing time and closes with the testing time
Join the CPU usage of storage;And CPU use state curve graph is drawn according to test result, in order to determine the CPU of the application
Using whether normal.
Optionally, it in mobile terminal automation testing method according to the present invention, further comprises the steps of: according to test assignment
Test script is write, wherein test assignment includes executing logic, executes logic by configuration parameter and indicates that test assignment is corresponding
Execute sequence.
Optionally, in mobile terminal automation testing method according to the present invention, configuration parameter includes testing time, surveys
Try time and testing procedure.
Optionally, in mobile terminal automation testing method according to the present invention, the second order, operation test foot are executed
This step of includes: the execution logic that test assignment is parsed after opening test;And the test is automatically carried out by logic is executed
The corresponding test script of task.
Optionally, in mobile terminal automation testing method according to the present invention, operation test script is further comprised the steps of:
When, corresponding testing procedure is executed by call configuration option.
According to another aspect of the present invention, a kind of mobile terminal automation testing device is provided, device includes: that monitoring is single
Member is adapted for the operation that user opens monitoring, executes the first order, the real-time of mobile terminal is periodically obtained with preset frequency
Information, real time information include CPU usage;Driving unit is adapted for the operation that user opens test, executes the second life
It enables, runs test script;Output interface is suitable for association output testing time and CPU usage at the end of test, as test
As a result;And Drawing of Curve unit, it is suitable for drawing CPU use state curve graph according to test result, in order to determine the application
CPU use it is whether normal.
Optionally, in mobile terminal automation testing device according to the present invention, driving unit further include: it is single to execute son
Member, suitable for writing test script according to test assignment, wherein test assignment includes executing logic, executes logic and passes through configuration parameter
It indicates that test assignment is corresponding and executes sequence.
Optionally, in mobile terminal automation testing device according to the present invention, configuration parameter includes testing time, surveys
Try time and testing procedure.
Optionally, in mobile terminal automation testing device according to the present invention, driving unit is further adapted for opening survey
The execution logic of test assignment is parsed after examination;And the corresponding test script of the test assignment is automatically carried out by logic is executed.
Optionally, in mobile terminal automation testing device according to the present invention, driving unit is further adapted for surveying in operation
This when of training, executes corresponding testing procedure by call configuration option.
According to another aspect of the present invention, a kind of mobile terminal is provided, there is automatic test device as described above.
Mobile terminal automation testing scheme according to the present invention makes according to the Functional Design test case of test target
Test has more specific aim.Meanwhile by way of automated execution without human intervention, efficiency can be improved, when greatly shortening
Between;And the CPU usage of real-time monitoring mobile terminal during the test, and then CPU use state change curve is obtained,
So that test result is very clear.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
It is fully disclosed to those skilled in the art.
Fig. 1 is 100 organigram of mobile terminal according to an embodiment of the invention.Referring to Fig.1, mobile terminal
100 include: memory interface 102, one or more data processor, image processor and/or central processing unit 104, with
And peripheral interface 106.Memory interface 102, one or more processors 104 and/or peripheral interface 106 are either discrete member
Part also can integrate in one or more integrated circuits.In the mobile terminal 100, various elements can pass through one or more
Communication bus or signal wire couple.Sensor, equipment and subsystem may be coupled to peripheral interface 106, to help reality
Existing multiple functions.For example, motion sensor 110, optical sensor 112 and range sensor 114 may be coupled to peripheral interface
106, to facilitate the functions such as orientation, illumination and ranging.Other sensors 116 can equally be connected with peripheral interface 106, such as fixed
Position system (such as GPS receiver), temperature sensor, biometric sensor or other sensor devices, it is possible thereby to help reality
Apply relevant function.
Camera sub-system 120 and optical sensor 122 can be used for the camera of convenient such as record photos and video clips
The realization of function, wherein the camera sub-system and optical sensor for example can be charge-coupled device (CCD) or complementary gold
Belong to oxide semiconductor (CMOS) optical sensor.It can help to realize by one or more radio communication subsystems 124
Communication function, wherein radio communication subsystem may include radio-frequency transmitter and transmitter and/or light (such as infrared) receiver
And transmitter.The particular design and embodiment of radio communication subsystem 124 can depend on mobile terminal 100 is supported one
A or multiple communication networks.For example, mobile terminal 100 may include being designed to support GSM network, GPRS network, EDGE net
The communication subsystem 124 of network, Wi-Fi or WiMax network and BlueboothTM network.Audio subsystem 126 can be with loudspeaking
Device 128 and microphone 130 are coupled, to help the function of implementing to enable voice, such as speech recognition, speech reproduction, number
Word record and telephony feature.
I/O subsystem 140 may include touch screen controller 142 and/or other one or more input controllers 144.
Touch screen controller 142 may be coupled to touch screen 146.For example, the touch screen 146 and touch screen controller 142 can be with
The contact carried out therewith and movement or pause are detected using any one of a variety of touch-sensing technologies, wherein sensing skill
Art includes but is not limited to capacitive character, resistive, infrared and surface acoustic wave technique.Other one or more input controllers 144
May be coupled to other input/control devicess 148, for example, one or more buttons, rocker switch, thumb wheel, infrared port,
The pointer device of USB port, and/or stylus etc.One or more of button (not shown)s may include for controlling
The up/down button of 130 volume of loudspeaker 128 and/or microphone.
Memory interface 102 can be coupled with memory 150.The memory 150 may include that high random access is deposited
Reservoir and/or nonvolatile memory, such as one or more disk storage equipments, one or more optical storage apparatus, and/
Or flash memories (such as NAND, NOR).Memory 150 can store an operating system 152, for example, Android, IOS or
The operating system of Windows Phone etc.The operating system 152 may include for handling basic system services and execution
The instruction of task dependent on hardware.Memory 150 can also be stored using 154.These applications in operation, can be from memory
150 are loaded on processor 104, and run on the operating system run via processor 104, and utilize operating system
And the interface that bottom hardware provides realizes the various desired functions of user, such as instant messaging, web page browsing, pictures management.
Using can be independently of operating system offer, it is also possible to what operating system carried.
According to one embodiment of present invention, a kind of mobile terminal 100 that can complete CPU automatic test is provided,
The function can be realized by arranging the client application of automatic test device 300, which is stored in using 154
In.
Fig. 2 shows the flow charts of mobile terminal automation testing method 200 according to an embodiment of the invention.The party
Method executes in the mobile terminal 100, and this method starts from step S210, and the operation of monitoring is opened in response to user, executes the first life
It enables, obtains the real time information of mobile terminal 100, wherein real time information refers to the mobile terminal 100 periodically obtained with preset frequency
CPU usage.User opens monitoring by clicking " cpu monitor " on interface, and as shown in Figure 5A, mobile terminal 100 is with pre-
Frequency coordination " adb shell dumpsys cpuinfo " order is determined, to obtain CPU real time information, that is, CPU usage.
Then in step S220, the operation of test is opened in response to user, is executed the second order, is run test script.
As shown in Figure 5 B, user selects application to be tested on interface, opens test, such as user selects " short message " application, mobile
Terminal 100 calls shell-command to bring into operation automatic test script, test short message application, and specific command format is as follows:
" adb shell uiautomator runtest automates packet name -- nohup-c packet name class name # method name ".
According to an embodiment of the invention, to write test script according to test assignment, wherein test assignment includes executing to patrol
Volume, the execution logic indicates that the test assignment is corresponding by configuration parameter and executes sequence.So including in test script
Multiple event-actions in 100 operation interface of mobile terminal are executed, for example, multiple event-actions may include in mobile terminal
100 incoming event movement clicks event-action, obtains event control movement, slip event movement.Mobile terminal 100 is being opened
After opening test, the execution logic of test assignment is first parsed, and automatically carry out the corresponding test of the test assignment by logic is executed
Script.
For example, when testing the basic function of short message application in mobile terminal 100, the corresponding execution of the test assignment
Logic can be such that
1. opening Information application program
2. newly-built information, saves as rough draft
3. information is checked in sliding
4. newly-built multimedia message (picture, video, audio, text), saves as rough draft
5. searching for information using Chinese, English, spcial character respectively
6. checking the short message searched
Any one information is deleted 7. returning
8. setting chat background
9. exiting information
10. sending short message
Wherein, configuration parameter includes testing time (runCounts), testing time (runTimes) and testing procedure.
Mobile terminal 100 can execute corresponding testing procedure when running test script by call configuration option.For example, needle
To the task of the application of test short message above, us can be specified to test certain steps therein by modifying configuration parameter, or
Person can be specified in step 7 by configuration parameter and delete a plurality of information.
Then in step S230, at the end of test, output test result.It according to one embodiment of present invention, can be with
It is testing after a certain period of time (for example, 12 hours), by selecting " stopping " on the interface of mobile terminal 100, as shown in Figure 5A,
Terminate test.Certainly, mobile terminal 100 also can be set after the automatic execution test some time in tester, terminates test.
The present invention is to this and with no restrictions.
Mobile terminal 100 can export the Excel table of a test result comprising all applications into SD card automatically.The survey
Test result includes the testing time (or perhaps test moment) of all applications and makes with the CPU of testing time associated storage
With rate, or it is CPU usage.For example, being exported such as in the form of Excel table for the task of above-mentioned test short message application
Lower test result (only partial results):
Then in step S240, CPU use state curve graph is drawn according to test result, in order to determine the application
Whether CPU use is normal.Such as according to table above, the CPU use state of short message application as shown in Figure 4 can be drawn out
Curve graph, and can finding out from the curve graph of Fig. 4, the utilization rate of CPU substantially remains between 10%~30%, compared with
The form of table observes test result, and curve graph is more clear.
Compare in addition, drawing curve graph and being conducive to the performance that mobile terminal is applied.According to a kind of implementation, can use upper
It states step and tests the cpu usage that short message is applied in another mobile terminal, it is same to export CPU use state curve graph.Test
Personnel can be intuitive to see that the utilization rate in which moment CPU is excessively high, be easier to examine by way of curve graph overlapping contrast
It measures mobile terminal and the reason of Caton, fever phenomenon occurs.
In addition, as described in step S220, tester can by CPU use state curve graph observe exist
The CPU of which or a certain moment mobile terminal 100 uses unreasonable (e.g., CPU usage is excessively high) period, and then modifies and survey
Configuration parameter in training sheet causes CPU using unreasonable specific steps further to test and confirm, and then to the application
Source code be modified.
Fig. 3 shows the schematic diagram of mobile terminal automation testing device 300 according to an embodiment of the invention.The dress
Setting 300 includes: monitoring unit 310, driving unit 320, output interface 330 and Drawing of Curve unit 340, wherein monitoring is single
Member 310 and output interface 330 are coupled with 320 phase of driving unit respectively, and Drawing of Curve unit 340 is coupled with 330 phase of output interface.
Monitoring unit 310 is adapted for the operation that user opens monitoring, executes the first order, that is, with preset frequency
Adb order is called, periodically to obtain the real time information of mobile terminal 100, wherein real time information includes the CPU of mobile terminal 100
Utilization rate.
Meanwhile driving unit 320 is adapted for the operation that user opens test, executes the second order, i.e. calling shell
Order runs test script.
According to a kind of implementation, driving unit 320 further includes executing subelement 322, suitable for being write according to test assignment
Test script, wherein test assignment includes executing logic, and execution logic indicates that the test assignment is corresponding by configuration parameter and holds
Row sequence.For example, configuration parameter may include testing time, testing time and testing procedure.Test assignment should be as more as possible
Cover the basic function of application to be measured in ground.According to test assignment design test case, test can be made to have more specific aim.
According to another embodiment of the present invention, driving unit 320 is further adapted for when running test script, is configured by calling
Parameter executes corresponding testing procedure.For example, for the task of test short message application me can be specified by modifying configuration parameter
Only test certain steps therein, alternatively, can be specified by configuration parameter the number tested in a certain step, time etc..
Output interface 330 is suitable for association output testing time and CPU usage at the end of test, as test result.
The test result is then sent to Drawing of Curve unit 340 coupled thereto.
Drawing of Curve unit 340 is suitable for drawing CPU use state curve graph according to test result, in order to determine the application
CPU use it is whether normal.
Compare in addition, drawing curve graph and being conducive to competing product.According to a kind of implementation, can test using the above scheme another
The cpu usage that short message is applied in mobile terminal, it is same to export CPU use state curve graph.Tester can pass through
The mode of curve graph overlapping contrast is intuitive to see that the utilization rate in which moment CPU is excessively high, is easier to detect that mobile terminal goes out
The reason of existing Caton, fever phenomenon.
According to a kind of implementation, observed in which period by CPU use state curve graph as tester or
When the CPU of a certain moment mobile terminal of person uses unreasonable (e.g., CPU usage is excessively high), matching in test script can be modified
Parameter is set, causes CPU using unreasonable specific steps further to test and confirm, and then carry out to the source code of the application
Amendment.
It should be appreciated that in order to simplify the disclosure and help to understand one or more of the various inventive aspects, it is right above
In the description of exemplary embodiment of the present invention, each feature of the invention be grouped together into sometimes single embodiment, figure or
In person's descriptions thereof.However, the disclosed method should not be interpreted as reflecting the following intention: i.e. claimed hair
Bright requirement is than feature more features expressly recited in each claim.More precisely, as the following claims
As book reflects, inventive aspect is all features less than single embodiment disclosed above.Therefore, it then follows specific real
Thus the claims for applying mode are expressly incorporated in the specific embodiment, wherein each claim itself is used as this hair
Bright separate embodiments.
Those skilled in the art should understand that the module of the equipment in example disclosed herein or unit or groups
Part can be arranged in equipment as depicted in this embodiment, or alternatively can be positioned at and the equipment in the example
In different one or more equipment.Module in aforementioned exemplary can be combined into a module or furthermore be segmented into multiple
Submodule.
Those skilled in the art will understand that can be carried out adaptively to the module in the equipment in embodiment
Change and they are arranged in one or more devices different from this embodiment.It can be the module or list in embodiment
Member or component are combined into a module or unit or component, and furthermore they can be divided into multiple submodule or subelement or
Sub-component.Other than such feature and/or at least some of process or unit exclude each other, it can use any
Combination is to all features disclosed in this specification (including adjoint claim, abstract and attached drawing) and so disclosed
All process or units of what method or apparatus are combined.Unless expressly stated otherwise, this specification is (including adjoint power
Benefit require, abstract and attached drawing) disclosed in each feature can carry out generation with an alternative feature that provides the same, equivalent, or similar purpose
It replaces.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments
In included certain features rather than other feature, but the combination of the feature of different embodiments mean it is of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed
Meaning one of can in any combination mode come using.
In addition, be described as herein can be by the processor of computer system or by executing by some in the embodiment
The combination of method or method element that other devices of the function are implemented.Therefore, have for implementing the method or method
The processor of the necessary instruction of element forms the device for implementing this method or method element.In addition, Installation practice
Element described in this is the example of following device: the device be used for implement as in order to implement the purpose of the invention element performed by
Function.
As used in this, unless specifically stated, come using ordinal number " first ", " second ", " third " etc.
Description plain objects, which are merely representative of, is related to the different instances of similar object, and is not intended to imply that the object being described in this way must
Must have the time it is upper, spatially, sequence aspect or given sequence in any other manner.
Although the embodiment according to limited quantity describes the present invention, above description, the art are benefited from
It is interior it is clear for the skilled person that in the scope of the present invention thus described, it can be envisaged that other embodiments.Additionally, it should be noted that
Language used in this specification primarily to readable and introduction purpose and select, rather than in order to explain or limit
Determine subject of the present invention and selects.Therefore, without departing from the scope and spirit of the appended claims, for this
Many modifications and changes are obvious for the those of ordinary skill of technical field.For the scope of the present invention, to this
Invent done disclosure be it is illustrative and not restrictive, it is intended that the scope of the present invention be defined by the claims appended hereto.