Summary of the invention
In view of the above problems, it proposes on the present invention overcomes the above problem or at least be partially solved in order to provide one kind
State the method and device of problem tested mobile terminal.
According to one aspect of the present invention, the method that a kind of pair of mobile terminal is tested is provided, comprising: receive and pacify
Dress test installation kit;It wherein, include: multiple action type marks and the behaviour for executing various types operation in the test installation kit
Make logic, and/or, multiple operated object marks and the operation logic for positioning each operation object;It is received by ADB order entrance
Test instruction;Wherein, include action type mark and/or operated object mark in the test instruction;Pacified according to the test
Operation logic corresponding with action type mark and/or operated object mark is tested in dress packet.
Optionally, the quantity of the test instruction is a plurality of, and a plurality of test instruction is successively executed according to reception sequence.
Optionally, when it is mistake that test, which instructs corresponding test result, this method further comprises: passing through ADB order
Entrance receives modified test instruction, and re-starts test according to the modified test instruction.
Optionally, when it is correct that test, which instructs corresponding test result, this method further comprises: the test is referred to
Corresponding command content is enabled to be saved in preset test file, wherein the test file is used to save according to reception sequence
Each item test instructs corresponding command content to execute again.
Optionally, the action type includes: to double-click type, click type, sliding type, length by type and for mould
The action type of quasi- hardware button, wherein the hardware button includes one of the following or multiple: return key, Menu key, sound
Measure key and power key, and the operated object mark is operation object coordinate range on the screen and/or the operation object
It is identified as the ID value of operation object;
Also, the operation logic of each operation object of the positioning includes: the operation object by prestoring in user
The operation logic that coordinate ratio on interface is positioned;And/or the characteristic by identifying the operation object prestored carries out
The operation logic of positioning.
Another aspect according to the present invention provides the device that a kind of pair of mobile terminal is tested, comprising: installation mould
Block, suitable for receiving and installing test installation kit;It wherein, include: multiple action type marks and execution in the test installation kit
The operation logic of various types operation, and/or, multiple operated object marks and the operation logic for positioning each operation object;It connects
Module is received, is suitable for receiving test instruction by ADB order entrance;Wherein, in test instruction comprising action type mark and/
Or operated object mark;Test module, be suitable for according in the test installation kit with the action type mark and/or operation pair
It is tested as identifying corresponding operation logic.
Optionally, the quantity of the test instruction is a plurality of, and a plurality of test instruction is successively executed according to reception sequence.
Optionally, which further comprises: weight test module, and being suitable for instructing corresponding test result in test is mistake
When, modified test is received by ADB order entrance and is instructed, and survey is re-started according to the modified test instruction
Examination.
Optionally, which further comprises: memory module, and it is correct for being suitable for instructing corresponding test result in test
When, instruct corresponding command content to be saved in preset test file the test, wherein the test file is for pressing
The corresponding command content of each item test instruction is saved according to reception sequence to execute again.
Optionally, the action type includes: to double-click type, click type, sliding type, length by type and for mould
The action type of quasi- hardware button, wherein the hardware button includes one of the following or multiple: return key, Menu key, sound
Measure key and power key, and the operated object mark is operation object coordinate range on the screen and/or the operation object
It is identified as the ID value of operation object;
Also, the operation logic of each operation object of the positioning includes: the operation object by prestoring in user
The operation logic that coordinate ratio on interface is positioned;And/or the characteristic by identifying the operation object prestored carries out
The operation logic of positioning.
In the method and device provided by the invention tested mobile terminal, traditional APK file is replaced with
Test installation kit in the present invention, also, test in installation kit and do not define a series of coherent execution directly and can not be split
Testing process, but various individual operation logics needed for defining execution test process, for example, defining multiple operation classes
Type mark and the operation logic for executing various types operation, and/or, multiple operated object marks and each operation object of positioning
Operation logic.On this basis, each operation logic is completed according to the ADB test instruction received, to realize complete test
Process.It can be seen that in the present invention, operation logic and specific operating procedure being separated, therefore, walk out of existing mistake when a certain
When, it is not necessary to modify test installation kit, the corresponding ADB test instruction of the step need to be only received and executed again, can accomplish list
The effect of wrong single-step debug is walked out of, thus enormously simplifies debugging process.
The above description is only an overview of the technical scheme of the present invention, in order to better understand the technical means of the present invention,
And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage can
It is clearer and more comprehensible, the followings are specific embodiments of the present invention.
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.
The embodiment of the invention provides the method and devices that a kind of pair of mobile terminal is tested, and are at least able to solve tradition
Test mode the technical issues of complicated operation could complete test again is subjected to after error.
Fig. 1 shows the flow chart of the method provided by one embodiment of the present invention tested mobile terminal.Such as Fig. 1
It is shown, this method specifically includes the following steps:
Step S110: receiving and installs test installation kit;It wherein, include: multiple action types in the test installation kit
Mark and the operation logic for executing various types operation, and/or, multiple operated object marks and the behaviour for positioning each operation object
Make logic.
For example, action type includes: to double-click type, click type, sliding type, length by type and for analog hardware
The action type etc. of button, wherein the hardware button includes one of the following or multiple: return key, Menu key, volume key
With power key etc..The operation logic for executing various types operation usually passes through software code or interface function is realized, for automatic
Complete the operating process of respective type.Operation object is usually specific control, can be indicated by the coordinate or title of control,
Certainly, in addition to control, operation object can also be button or input frame etc..The operation logic of positioning operation object generally also by
Software code or interface function are realized, for determining the specific location of the operation object on the screen.
Step S120: test instruction is received by ADB order entrance;It wherein, include action type in the test instruction
Mark and/or operated object mark.
Wherein, test instruction may also be referred to as ADB order, and every ADB order is used to indicate what mobile terminal specifically executes
Kind operation, type and/or mark including operation.For example, single-click operation etc. can be executed to control A.
Step S130: it is patrolled according to operation corresponding with action type mark and/or operated object mark in test installation kit
It collects and is tested.
For example, needing to obtain execution single-click operation institute from test installation kit when needing to carry out single-click operation to control A
The operation logic of corresponding operation logic and orient control A, and tested accordingly.
It can be seen that in the present invention, operation logic and specific operating procedure are separated, therefore, walked out of now when a certain
When mistake, it is not necessary to modify test installation kit, the corresponding ADB test instruction of the step need to be only received and executed again, can be done
To the effect of single step error single-step debug, thus enormously simplify debugging process.
Fig. 2 shows the flow charts for the method tested mobile terminal that another embodiment of the present invention provides.This
Embodiment can be realized based on a variety of automated test frames, for example, can be surveyed based on Uiautomator and/or Robotium
Frame and Monkey Runner test frame etc. are tried, the present invention tests environment without limitation to specific.In addition, in this reality
It applies in example and is illustrated for based on Android platform, but it will be appreciated to those of skill in the art that in the embodiment of the present invention
Scheme can also be flexibly applied in the mobile terminal of other various platforms.As shown in Fig. 2, this method specifically includes following step
It is rapid:
Step S210: test installation kit is generated at the end PC, and the test installation kit is sent to mobile terminal.
Wherein, test installation kit can be realized by APK form, can also be realized by other various forms.It is testing
Various operation logics needed for defining test in installation kit.For example, multiple action type marks and execution various types operation
Operation logic, and/or, multiple operated object marks and the operation logic for positioning each operation object.Wherein, operation logic can
By by software code, function interface, hardware chip etc. it is all kinds of in a manner of realize.
Step S220: mobile terminal receives and installs above-mentioned test installation kit.
Wherein, mobile terminal can receive above-mentioned test installation kit in several ways, for example, can pass through data line
Test installation kit is copied on the hard disk of mobile terminal after being connect with PC.Alternatively, the various nothings such as wifi, bluetooth can also be passed through
Line transmission mode is transferred to mobile terminal for installation kit is tested.Alternatively, test peace can also be transmitted by ADB order entrance
Dress packet.The present invention to specific transmission mode without limitation.
By installing above-mentioned test installation kit, various operation logics needed for making mobile terminal that test be locally stored,
The operation logic of various types operation is identified and executed including multiple action types, and/or, multiple operated object marks and positioning
The operation logic etc. of each operation object.
Step S230: generating at the end PC and test instruction, and test instruction is sent to movement eventually by ADB order entrance
End.
Specifically, the command content of the test instruction of generation depends on the corresponding specific test content of this step.Test refers to
Order can be realized by the ADB order of following form: " adb shell am broadcast-a ADB_INTENT-e OPER
[value1]-e WIDGET [value2] ... " wherein, action type mark is transmitted by value1 (such as click, sliding, length
By etc.), the design parameter of operation is transmitted by value2, such as the attributes such as type, text, index of control object clicked.
For example, it is assumed that the method in the present embodiment needs to click " set " button in mobile terminal side and in the setting input frame of pop-up
It clicks " brightness regulation " button and is adjusted.Correspondingly, it in order to realize above-mentioned steps, at least needs to generate two tests and refers to
It enables.First test instruction includes single-click operation in test instruction for realizing the operating procedure for clicking " set " button
Corresponding action type mark (being indicated by above-mentioned value1), to indicate that this operation is to click the operation of type;
In addition, also comprising operated object mark (pass through above-mentioned value2 indicate) in test instruction, i.e. " set " button is pressed
Button ID or button name etc., to indicate that the object of this operation is " set " button.Article 2 test instruction is for realizing point
The operating procedure for hitting " brightness regulation " button is used comprising the mark of action type corresponding to single-click operation in test instruction
To indicate that this operation is to click the operation of type;In addition, also including operated object mark, i.e. " brightness in test instruction
Button ID or button name of adjusting " button etc., to indicate that the object of this operation is " brightness regulation " button.Specific implementation
When, above-mentioned two tests instruction can be sent to mobile terminal simultaneously, and comprising executing serial number in the test instruction of each item,
So that mobile terminal executes sequence according to execute that serial number determines the test instruction of each item;It can also will be above-mentioned according to execution sequence
Two tests instruction be successively sent to mobile terminal, for example, can wait until first test instruction execution finish and return to survey
Article 2 test instruction is retransmited after trying successful test result.
In specific implementation, the quantity for testing instruction is not limited to two, can be more a plurality of test instruction.In addition, test
The action type for including in instruction is also not necessarily limited to single-click operation, can also be the various possible operations such as double-click, sliding, long-pressing,
Moreover, it is also possible to be the operation for analog hardware button, wherein hardware button includes one of the following or multiple: returning
Key, Menu key, Home key, volume key and power key.It is other buttons that the operation object for including in test instruction, which is also possible to, defeated
Enter frame etc..In addition, test instruction can also only comprising action type or only include operation object, when test instruction is only comprising behaviour
When making type, such as it can be and judge whether the current state of mobile terminal networks, whether can generate flow etc.;When test instructs
When only including operation object, scheduled a type of operation can only be executed for the operation object, for example, when certain buttons
Single-click operation is executed, when not supporting the operation such as double-click, action type can be omitted in test instruction and identified.
Step S240: it after mobile terminal receives above-mentioned test instruction, is identified according in test installation kit with action type
And/or the corresponding operation logic of operated object mark is tested.
It specifically, can be in order to enable mobile terminal automatic capture to instruct and automatically process to from the test at the end PC
The trapping module that setting is instructed for capture the test from the end PC in test installation kit mentioned above, and to capturing
The processing module that is handled of test instruction, each module can be realized by preset function, can also using other it is various it is soft/
Hardware mode is realized.
In the present embodiment, above-mentioned trapping module can be realized by following function code sections:
The function be equivalent to one can receive, the radio receiver of filter message, can be realized automatically by the function
Capture the purpose of the test instruction at the end PC.
In addition, above-mentioned processing module can be realized by following function code sections:
public void oper(String oper,Intentintent){
IOperationoper;
if(oper.equals(“click”)){
Oper=new Clicker (intent);
}else if(oper.equals(“drag”)){
……
The information such as the action type for including in the test instruction captured can be judged automatically by above-mentioned function and are executed
Corresponding processing.For example, showing its action type when in test instruction comprising being worth the parameter for " click " to click;Work as survey
When in examination instruction comprising being worth the parameter for " drag ", show its action type to pull.
Specifically, it in upper example, is instructed for for realizing first test for clicking " set " button, firstly, it is necessary to
It is clicked corresponding to the operation of type from test installation kit according to the action type identifier lookup and acquisition of clicking type operations
Operation logic, the operation logic can realize that the function can execute the operation for clicking type automatically by scheduled function.So
Afterwards, need to position the operation logic of the button according to the button identifier lookup of " set " button and obtaining from test installation kit,
The operation logic can also realize that the function can be such that automatically cursor navigates at corresponding button by scheduled function.Tool
Body, it in the present embodiment, can be positioned according to the coordinate pair button of button on the screen, which is realized simply just
It is prompt;Furthermore it is also possible to which button is identified and positioned according to the attribute of button or feature, which is not changed by screen resolution
It is more flexible to be applicable in scene for the influence of change.Two kinds of above-mentioned positioning methods are introduced separately below:
In the first implementation, it is positioned by the coordinate ratio of the operation object that prestores on a user interface.
For example, it is assumed that establishing coordinate system by coordinate origin of the lower left corner of user interface, and set the upper right corner of complete user interface
Coordinate be (1,1), correspondingly, each position in user interface can be indicated by corresponding coordinate ratio, example
Such as, coordinate points are that the position of (1/3,2/3) is at the left side position on the upper side of entire user interface.It can benefit by this kind of mode
The position that operation object is determined with operation object coordinate ratio locating in entire user interface passes through merely with traditional
Specific coordinate value is higher compared to accuracy come the mode for determining position, is not influenced by screen resolution variation, and locating speed
Fastly.For example, cause the size of user interface to change even if the screen resolution size of terminal device is changed, but
Be, the relativeness between a certain operation object and entire user interface be it is fixed, therefore, can still be accurately located
The operation object.
In the second implementation, by identifying that the characteristic of the operation object prestored is positioned.Wherein, it prestores
Operation object characteristic for uniquely identifying corresponding operation object, specifically include: the exterior contour of operation object
Data and/or color data etc..For example, for by taking " set " button as an example, corresponding characteristic include the button shape,
Size, color, text and font etc..In short, the characteristic by the operation object prestored can be unique on a user interface
Ground identification and positioning operation object.When specific implementation, it can be realized in conjunction with related algorithms such as image recognitions.It can by this kind of mode
The position of operation object is searched and determined according to the resemblance of operation object, pass through specific coordinate value merely with traditional
The advantage not influenced by screen resolution variation is likewise supplied with to determine that the mode of position is compared.Moreover, working as the cloth of user interface
When office's variation (such as after product renewing), even if the position of operation object is changed, still can accurately it determine by this way
Bit manipulation object.
Wherein, above-mentioned step S230 and step S240 can be executed repeatedly, specific to execute what number depended on receiving
Test the item number of instruction.For example, when a test process needs three test sequentially executed instructions to be just able to achieve, it is above-mentioned
Step S230 and step S240 will be executed three times, be respectively used to for each time to handle corresponding test instruction.
It since test process is likely to occur mistake, is debugged when an error occurs, therefore, this method can also be into
One step includes the steps that following S250.Wherein, step S250 is an optional step.
Step S250: it when it is mistake that test, which instructs corresponding test result, is further repaired by the reception of ADB order entrance
Test instruction after changing, and test is re-started according to modified test instruction.
Test result is that the concrete condition of mistake includes a variety of, for example, it may be possible to be the parameter error tested in instruction, test
Hardware on environment error or mobile terminal such as does not support at a variety of causes.Either because mistake occurs in which kind of reason, require
It is debugged at the end PC, to be modified to test instruction, and revised test instruction is retransmitted to mobile terminal,
So that mobile terminal re-executes corresponding test process.
Specifically, when above-mentioned step S230 and step S240 execution is multiple, this step may also can be executed repeatedly, often
When there is a test instruction error in step S240, step S250 can be all triggered.Single step may be implemented by step S240
The purpose of error, single-step debug.For example, when entire test process includes 10 test instructions, if what the 9th article of test instructed
Corresponding result is mistake, then need to only receive modified 9th article of test again and instruct and execute, be successfully tested before
Preceding 8 tests instruction need not retest, and thus, it is possible to which the workload of debugging link is greatly reduced, improve testing efficiency.In addition,
In the present embodiment, since, only comprising the operation logic being separated from each other, concrete operation step is by subsequent survey in test installation kit
Examination instruction indicates that therefore, test installation kit need to only be transmitted and be installed once, even if followed by mistake, need not also give birth to again
At and test installation kit is installed, thereby further simplify operating process.
In addition, since test process may need to be performed a plurality of times, for example, after this test process successful execution,
The possible later period results in the need for testing again due to updating mobile terminal etc..Therefore, it is repeated in order to facilitate the later period complete
At test process, this method can further include following step S260.Wherein, step S260 is also one optional
Step.
Step S260: when it is correct that test, which instructs corresponding test result, corresponding command content is instructed to protect test
It is stored in preset test file.
When specific implementation, this step can be realized by following two ways.In the first way, whenever passing through step
As soon as step S260 is triggered when S240 successful execution test instruction, so as to by the corresponding command content of this test instruction
It is saved in test file.In the second way, after all tests are instructed successful execution by step S240,
Step S260 is triggered, just to instruct corresponding command content to be saved in test file all tests.
Wherein, above-mentioned test file is used to save the corresponding command content of each item test instruction according to reception sequence so as to again
Secondary execution.For example, when test instruction be ADB order when, corresponding command content be this order in include action type with
Operation object, the concrete form of command content depend on specific test environment, as long as capableing of the form of automatic trigger test
?.It can be seen that the instruction being successfully tested can be saved by step S260, so that the later period repeats, because
This, for needing the application scenarios of repeated multiple times test, through this embodiment in mode can significantly simplify later period survey
Workload when examination improves testing efficiency.
Fig. 3 shows the structure chart for the device of another embodiment of the present invention offer tested mobile terminal.Such as
Shown in Fig. 3, which includes: installation module 31, receiving module 32 and test module 33.
Installation module 31 is suitable for receiving and installs test installation kit.It wherein, include: multiple operations in the test installation kit
Type identification and the operation logic for executing various types operation, and/or, multiple operated object marks and each operation object of positioning
Operation logic.
Receiving module 32 is suitable for receiving test instruction by ADB order entrance.Wherein, include operation in the test instruction
Type identification and/or operated object mark.
Test module 33 be suitable for according in the test installation kit with the action type identify and/or operated object mark
Corresponding operation logic is tested.
Wherein, when the quantity of test instruction is a plurality of, a plurality of test instruction is successively executed according to reception sequence.It is optional
Ground, which further comprises: weight test module 34, is suitable for passing through ADB when it is mistake that test, which instructs corresponding test result,
Order entrance receives modified test instruction, and re-starts test according to the modified test instruction.
Optionally, which further comprises: memory module 35, and it is correct for being suitable for instructing corresponding test result in test
When, instruct corresponding command content to be saved in preset test file the test, wherein the test file is for pressing
The corresponding command content of each item test instruction is saved according to reception sequence to execute again.
Wherein, aforesaid operations type includes: to double-click type, click type, sliding type, length by type and for simulating
The action type of hardware button, wherein the hardware button includes one of the following or multiple: return key, Menu key, volume
Key and power key;Also, the operated object mark is operation object coordinate range on the screen and/or the operation pair
ID value as being identified as operation object.
Also, the operation logic of each operation object of the positioning includes: the operation object by prestoring in user
The operation logic that coordinate ratio on interface is positioned;And/or the characteristic by identifying the operation object prestored carries out
The operation logic of positioning.
The specific structure and working principle of above-mentioned modules can refer to the description of corresponding steps in embodiment of the method, herein
It repeats no more.
In conclusion in the method and device provided by the invention tested mobile terminal, by traditional APK text
Part replaces with the test installation kit in the present invention, also, tests in installation kit and do not define a series of coherent execution and not directly
Detachable testing process, but various individual operation logics needed for defining execution test process, for example, defining more
A action type mark and the operation logic for executing various types operation, and/or, multiple operated object marks and each behaviour of positioning
Make the operation logic of object.On this basis, each operation logic is completed according to the ADB test instruction received, to have realized
At test process.It can be seen that in the present invention, operation logic and specific operating procedure are separated, therefore, when a certain step
When the error occurs, it is not necessary to modify test installation kit, the corresponding ADB test instruction of the step need to be only received and executed again,
It can accomplish the effect of single step error single-step debug, thus enormously simplify debugging process.
Algorithm and display are not inherently related to any particular computer, virtual system, or other device provided herein.
Various general-purpose systems can also be used together with teachings based herein.As described above, it constructs required by this kind of system
Structure be obvious.In addition, the present invention is also not directed to any particular programming language.It should be understood that can use various
Programming language realizes summary of the invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In the instructions provided here, numerous specific details are set forth.It is to be appreciated, however, that implementation of the invention
Example can be practiced without these specific details.In some instances, well known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this specification.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of the various inventive aspects,
Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the disclosed method should not be interpreted as reflecting the following intention: i.e. required to protect
Shield the present invention claims features more more than feature expressly recited in each claim.More precisely, as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, wherein each claim itself
All as a separate embodiment of the present invention.
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 in this include institute in other embodiments
Including certain features rather than other feature, but the combination of the feature of different embodiment means in the scope of the present invention
Within and form different embodiments.For example, in the following claims, embodiment claimed it is any it
One can in any combination mode come using.
Various component embodiments of the invention can be implemented in hardware, or to run on one or more processors
Software module realize, or be implemented in a combination thereof.It will be understood by those of skill in the art that can be used in practice
Microprocessor or digital signal processor (DSP) realize some or all portions in device according to an embodiment of the present invention
The some or all functions of part.The present invention is also implemented as a part or complete for executing method as described herein
The device or device program (for example, computer program and computer program product) in portion.It is such to realize program of the invention
It can store on a computer-readable medium, or may be in the form of one or more signals.Such signal can be with
It downloads from internet website, is perhaps provided on the carrier signal or is provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and ability
Field technique personnel can be designed alternative embodiment without departing from the scope of the appended claims.In the claims,
Any reference symbol between parentheses should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not
Element or step listed in the claims.Word "a" or "an" located in front of the element does not exclude the presence of multiple such
Element.The present invention can be by means of including the hardware of several different elements and being come by means of properly programmed computer real
It is existing.In the unit claims listing several devices, several in these devices can be through the same hardware branch
To embody.The use of word first, second, and third does not indicate any sequence.These words can be explained and be run after fame
Claim.