CN105320595A - Application test method and device - Google Patents

Application test method and device Download PDF

Info

Publication number
CN105320595A
CN105320595A CN201410374576.4A CN201410374576A CN105320595A CN 105320595 A CN105320595 A CN 105320595A CN 201410374576 A CN201410374576 A CN 201410374576A CN 105320595 A CN105320595 A CN 105320595A
Authority
CN
China
Prior art keywords
control element
application testing
application
described control
simulated action
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
Application number
CN201410374576.4A
Other languages
Chinese (zh)
Inventor
鲁万林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201410374576.4A priority Critical patent/CN105320595A/en
Publication of CN105320595A publication Critical patent/CN105320595A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses an application test method. The method comprises the steps of obtaining an application test command, wherein the application test command comprises a simulation action instruction and an element identity of a corresponding target application; searching a control element corresponding to the element identity in a current interface, and obtaining position information of the control element; according to the position information of the control element, transmitting a simulation action event to the control element through an injuectKeyEvent object or an input command. The embodiment of the invention further discloses an application test device. By adopting the application test method and device, cross-process application simulation tests can be realized.

Description

A kind of application testing method and device
Technical field
The present invention relates to field of computer technology, particularly relate to a kind of application testing method and device.
Background technology
Along with continuing to bring out of electric terminal new technology, based on the increase of service application aspect development& testing proportion, improving constantly and the rapid fusion of application service based on electric terminal of complexity, the application program that electric terminal runs also is got more and more, and the demand for the Application testing on electric terminal is also arisen at the historic moment.Exist in prior art multiple can automatically to the mode that the application program on electric terminal is tested, but while a certain application program is tested, can not realize calling other processes and participate in test, such as in use often need other processes such as invoking web page browser, terminal photograph album at instant interprocess communication, but the function that existing test mode all cannot be called this striding course carries out simulation test.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of application testing method and device, can realize the application simulation test of striding course.
In order to solve the problems of the technologies described above, embodiments provide a kind of application testing method, described method comprises:
Obtain application testing order, described application testing order comprises the component identification of simulated action instruction and corresponding intended application;
In current interface, search the control element that described component identification is corresponding, and obtain the positional information of described control element;
According to the positional information of described control element, send simulated action event by injectKeyEvent object or input order to described control element.
Correspondingly, the embodiment of the present invention additionally provides a kind of application testing device, and described application testing device comprises:
Test command acquisition module, for obtaining application testing order, described application testing order comprises the component identification of simulated action instruction and corresponding intended application;
Element position acquisition module, for searching control element corresponding to described component identification in current interface, and obtains the positional information of described control element;
Action simulation module, for the positional information according to described control element, sends simulated action event by injectKeyEvent object or input order to described control element.
Mobile terminal in the embodiment of the present invention can by the application testing order got, simulated action event is sent to described target widget element by injectKeyEvent object or input order, due to the event transfer characteristic of injectKeyEvent object or input order, make it possible to the application simulation test realizing striding course.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the schematic flow sheet of a kind of application testing method in the embodiment of the present invention;
Fig. 2 is the mode schematic flow sheet obtaining application testing order in the embodiment of the present invention;
Fig. 3 is the schematic flow sheet of a kind of application testing method in another embodiment of the present invention;
Fig. 4 is the schematic flow sheet of a kind of application testing method in another embodiment of the present invention;
Fig. 5 is the structural representation of a kind of application testing device in the embodiment of the present invention;
Fig. 6 is the structural representation of the test command acquisition module of application testing device in the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Fig. 1 is the schematic flow sheet of a kind of application testing method in the embodiment of the present invention, application testing method in the embodiment of the present invention can be implemented in as in the mobile terminals such as mobile phone, smart mobile phone, panel computer, electronic reader, car-mounted terminal or portable wearable device, realized by the application testing device in mobile terminal, the application testing method as shown in the figure in the present embodiment can comprise:
S101, obtains application testing order, and described application testing order comprises the component identification of simulated action instruction and corresponding intended application.
Concrete, described simulated action instruction can hit instruction for simulation points, simulation is long by instruction, the instruction of simulation sliding screen etc., the component identification of described intended application can for the click object of simulation click commands preset, title, the control ID (IDentity) of the appointment control of such as intended application or other are in order to identify the identification information of this control, described component identification can also comprise the application identities of intended application, in order to distinguish the control element corresponding to same application identities of different application.In an alternative embodiment, described application testing order can also comprise the application identities of enabled instruction and corresponding intended application, for performing startup intended application, checking command and corresponding verification object identity can also be comprised, for verifying application test execution result.
S102, searches the control element that described component identification is corresponding in current interface, and obtains the positional information of described control element.
Concrete, application testing device can according to described component identification, control element all in traversal current system interface, search and obtain control element corresponding to described component identification, menu control is obtained as searched according to component identification " menu ", according to component identification, " individual " center " is searched and is obtained individual center control, and then obtain the control information of the control element corresponding with described component identification, comprise the positional information of described control element, described positional information can be the display position coordinate of described control element on mobile terminal display interface, as can be represented the place interface location of corresponding control element with x-axis coordinate and y-axis coordinate.In an alternative embodiment, by using hierarchyviewer.bat instrument, the coordinate figure of each element control in current interface can be obtained.
S103, according to the positional information of described control element, simulated action event is sent to described control element by injectKeyEvent object or input order, after this control element receives this simulation click event, can respond according to this simulation click event, such as click menu control, then can popup menu option.
Concrete, injectKeyEvent (key entry event) object can the IWindowManager.injectKeyEvent that provides of such as IwindowManager, application testing device by injecting the positional information of simulated action instruction and described control element to injectKeyEvent object, can send simulated action event to make described injectKeyEvent object to described control element.In an alternative embodiment, the positional information of simulated action instruction and described control element by performing su order line, can be passed to default agent process Agent.jar by application testing device; Make described agent process Agent.jar inject the positional information of simulated action instruction and described control element to injectKeyEvent object, thus send simulated action event to described control element.
And send simulated action event by input order to described control element, such as can perform inputtapxy, wherein x and y is respectively and determines according to the positional information of described control element the interface coordinate that obtains, and the control element that can realize finding in S102 sends simulation click event.In an alternative embodiment, can also by inputtext<String> order in current interface can input area input text information, inputx can also be passed through, y, down, inputx, y, move and inputx, the compound command of y, up realizes simulating slip event.
And then in an alternative embodiment, application testing device can obtain the current operating system version information of mobile terminal, if operating system is the android system being not less than 4.0.3 version, then send simulated action event by input order to described control element; If operating system is the android system higher than 4.0.3 version, then send simulated action event by injectKeyEvent object to described control element.
In the present invention's application testing method embodiment described in conjunction with Figure 1, mobile terminal can by the application testing order got, simulated action event is sent to described target widget element by injectKeyEvent object or input order, due to the event transfer characteristic of injectKeyEvent object or input order, make it possible to the application simulation test realizing striding course.
In an alternative embodiment, mobile terminal perform S101 obtain the method for described application testing order can as shown in Figure 2, further comprising the steps:
S201, obtains application testing script.Described application testing script can obtain for tester writes in advance, comprises the multiple application testing order and correlation parameter, object etc. that arrange according to predetermined testing process.
S202, the keyword configuration information according to presetting searches test instruction keyword in described application testing script.Described keyword configuration information in order to identify described application testing order in described application testing script, can under pre-configured preservation assigned catalogue in the terminal, under leaving SD (SecureDigital, safe digital) card root directory in.
S203, according to the instruction keyword found in described application testing script, obtains described application testing order.
Such as, in keyword configuration information, the keyword that the application testing order of unlatching intended application is corresponding can be " opening ", obtain keyword " open " when searching in application testing script, then can get the application testing order of opening intended application, and for example clicking keyword corresponding to the application testing order of target widget can be " click ", obtain keyword " click " when searching in application testing script, then can get the application testing order clicking target widget.And then after finding keyword corresponding to application testing order, the tested object of application testing order can be obtained in the keyword successive character found, comprise application identities, component identification, screen position coordinate etc., tested object can carry out identifying to identify acquisition with <> symbol in an alternative embodiment, application testing order as obtained according to " clicking < menu > " can for clicking the control element that in current interface, component identification " menu " is corresponding, the application testing order and for example obtained according to " opening <Photoalbum> " can for opening photograph album application.
Fig. 3 is the schematic flow sheet of a kind of application testing method in another embodiment of the present invention, and the application testing method flow process as shown in the figure in the present embodiment can comprise:
S301, obtains the application identities of enabled instruction and corresponding intended application.
In an alternative embodiment, application testing device can obtain application testing order by flow process shown in Fig. 2, first search from described application testing script and obtain keyword corresponding to enabled instruction, thus get the application identities of the enabled instruction intended application corresponding with this enabled instruction, the script word comprising keyword corresponding to enabled instruction in described application testing script can such as: " opening <Photoalbum> " or " opening <QQ browser > ", content in <> is the application identities of described intended application.
S302, starts described intended application according to described enabled instruction.
Concrete, application testing device can according to the enabled instruction got and corresponding application identities, intended application corresponding to described application identities is started by trigger action system, as opened system photograph album, opening QQ browser etc., at this moment mobile terminal display interface shows the application interface of the intended application be activated.
S303, obtains the component identification of simulated action instruction and corresponding intended application.
In an alternative embodiment, application testing device can obtain application testing order by flow process shown in Fig. 2, after S301 searches and obtains keyword corresponding to enabled instruction, search from described application testing script further and obtain keyword corresponding to simulated action instruction, thus get the component identification of simulated action instruction and corresponding intended application.The script word comprising keyword corresponding to simulated action instruction in described application testing script can such as: " clicking < menu > ", " clicking < Ge Ren center > " or " long by < phonetic entry > " etc., the content in <> is described component identification.Described component identification can also comprise the application identities of intended application in an alternative embodiment, in order to distinguish the control element corresponding to same application identities of different application.
S304, searches the control element that described component identification is corresponding in current interface, and obtains the positional information of described control element.
Concrete, application testing device can according to described component identification, control element all in traversal current system interface, search and obtain control element corresponding to described component identification, menu control is obtained as searched according to component identification " menu ", according to component identification, " individual " center " is searched and is obtained individual center control, and then obtain the control information of the control element corresponding with described component identification, comprise the positional information of described control element, described positional information can be the display position coordinate of described control element on mobile terminal display interface, as can be represented the place interface location of corresponding control element with x-axis coordinate and y-axis coordinate.In an alternative embodiment, by using hierarchyviewer.bat instrument, the coordinate figure of each element control in current interface can be obtained.
S305, judges whether operating system is the android system being not less than 4.0.3 version, if then perform S306, otherwise performs S307.
S306, sends simulated action event by input order to described control element.
The simulated action instruction such as got is simulation click commands, inputtapxy can be performed, wherein x and y is respectively and determines according to the positional information of described control element the interface coordinate that obtains, and the control element that can realize finding in S304 sends simulation click event.In an alternative embodiment, if the simulated action instruction got is Text Input instruction, can by inputtext<String> order in current interface can input area input text information, if the simulated action instruction got is simulation slip instruction, inputx can also be passed through, y, down, inputx, y, move and inputx, the compound command of y, up realizes simulating slip event.
S307, sends simulated action event by injectKeyEvent object to control element.
Concrete, injectKeyEvent (key entry event) object can the IWindowManager.injectKeyEvent that provides of such as IwindowManager, application testing device by injecting the positional information of simulated action instruction and described control element to injectKeyEvent object, can send simulated action event to make described injectKeyEvent object to described control element.In an alternative embodiment, the positional information of simulated action instruction and described control element by performing su order line, can be passed to default agent process Agent.jar by application testing device; Make described agent process Agent.jar inject the positional information of simulated action instruction and described control element to injectKeyEvent object, thus send simulated action event to described control element.
In application testing method in the present embodiment, the application testing order of mobile terminal by getting, open intended application, and by injectKeyEvent object or the input order control element transmission simulated action event to described intended application, due to the event transfer characteristic of injectKeyEvent object or input order, make it possible to the application simulation test realizing striding course.
Fig. 4 is the schematic flow sheet of a kind of application testing method in another embodiment of the present invention, and the application testing method as shown in Figure 4 in the present embodiment can comprise:
S401, obtains the application identities of enabled instruction and corresponding intended application.
In an alternative embodiment, application testing device can obtain application testing order by flow process shown in Fig. 2, first search from described application testing script and obtain keyword corresponding to enabled instruction, thus get the application identities of the enabled instruction intended application corresponding with this enabled instruction, the script word comprising keyword corresponding to enabled instruction in described application testing script can such as: " opening <Photoalbum> " or " opening <QQ browser > ", content in <> is the application identities of described intended application.
S402, starts described intended application according to described enabled instruction.
Concrete, application testing device can according to the enabled instruction got and corresponding application identities, intended application corresponding to described application identities is started by trigger action system, as opened system photograph album, opening QQ browser etc., at this moment mobile terminal display interface shows the application interface of the intended application be activated.
S403, obtains the component identification of simulated action instruction and corresponding intended application
In an alternative embodiment, application testing device can obtain application testing order by flow process shown in Fig. 2, after S401 searches and obtains keyword corresponding to enabled instruction, search from described application testing script further and obtain keyword corresponding to simulated action instruction, thus get the component identification of simulated action instruction and corresponding intended application.The script word comprising keyword corresponding to simulated action instruction in described application testing script can such as: " clicking < menu > ", " clicking < Ge Ren center > " or " long by < phonetic entry > " etc., the content in <> is described component identification.Described component identification can also comprise the application identities of intended application in an alternative embodiment, in order to distinguish the control element corresponding to same application identities of different application.
S404, searches the control element that described component identification is corresponding in current interface, and obtains the positional information of described control element.
Concrete, application testing device can according to described component identification, control element all in traversal current system interface, search and obtain control element corresponding to described component identification, menu control is obtained as searched according to component identification " menu ", according to component identification, " individual " center " is searched and is obtained individual center control, and then obtain the control information of the control element corresponding with described component identification, comprise the positional information of described control element, described positional information can be the display position coordinate of described control element on mobile terminal display interface, as can be represented the place interface location of corresponding control element with x-axis coordinate and y-axis coordinate.In an alternative embodiment, by using hierarchyviewer.bat instrument, the coordinate figure of each element control in current interface can be obtained.
S405, judges that operating system is current and whether obtains root authority, if the determination result is YES, then perform S406, otherwise performs S407.
S406, judges whether operating system is the android system being not less than 4.0.3 version, if the determination result is YES, then performs S408, otherwise performs S409.
S407, sends simulated action event by Instrumentation object to control element.
Even current operation system does not obtain root authority, then application testing device can send corresponding simulated action event by Instrumentation object to described control element, described Instrumentation object can android.app.Instrumentation.sendPointerSync in the Instrumentation class of such as Android, it can send for coordinate x, the KEY_DOWN event of y and KEY_UP event, thus realize sending simulation click event to the control element of intended application, it can also send according to respective coordinates and comprise ACTION_DOWN, the event of ACTION_MOVE and ACTION_UP realizes simulation slip event.
S408, sends simulated action event by input order to described control element.
The simulated action instruction such as got is simulation click commands, inputtapxy can be performed, wherein x and y is respectively and determines according to the positional information of described control element the interface coordinate that obtains, and the control element that can realize finding in S404 sends simulation click event.In an alternative embodiment, if the plan action command got is Text Input instruction, can by inputtext<String> order in current interface can input area input text information, if the simulated action instruction got is simulation slip instruction, inputx can also be passed through, y, down, inputx, y, move and inputx, the compound command of y, up realizes simulating slip event.
S409, sends simulated action event by injectKeyEvent object to control element.
Concrete, injectKeyEvent (key entry event) object can the IWindowManager.injectKeyEvent that provides of such as IwindowManager, application testing device by injecting the positional information of simulated action instruction and described control element to injectKeyEvent object, can send simulated action event to make described injectKeyEvent object to described control element.In an alternative embodiment, the positional information of simulated action instruction and described control element by performing su order line, can be passed to default agent process Agent.jar by application testing device; Make described agent process Agent.jar inject the positional information of simulated action instruction and described control element to injectKeyEvent object, thus send simulated action event to described control element.
S410, obtains checking command and corresponding verification object identity.
In an alternative embodiment, application testing device can obtain application testing order by flow process shown in Fig. 2, after S403 searches and obtains keyword corresponding to simulated action instruction, search from described application testing script further and obtain keyword corresponding to checking command, thus get checking command and corresponding verification object identity.The script word comprising keyword corresponding to checking command in described application testing script can such as: " verification <test> ", " verification < helps > " or " the cabin > of verification <xxx " etc., the content in <> is described verification object identity.In specific implementation, response that can be corresponding after receiving simulated action event according to the tested control element of intended application, set described verification object identity, such as, after clicking the menu control of intended application, can eject and comprise the option such as " instrument " " help ", " exiting ", then can set described verification object identity as " help ".
S411, searches object elements corresponding to described verification object identity according to described checking command in current interface, and obtains testing check results according to lookup result.
Through menu control from step arbitrary in S407 ~ S409 to intended application send simulation click event after, application testing device can search object elements corresponding to verification object identity in current interface, if found the object elements that verification object identity is corresponding, namely there is verification object elements in current system interface, then show that simulation click event test successfully, otherwise think and simulate click event test crash.
Application testing device in the present embodiment can open intended application by the application testing order got, and send simulated action event to the control element of intended application in several ways according to different situations, can also obtain testing check results by searching corresponding object elements to the verification object identity preset, achieve the application simulation test of striding course, and automatically can generate test result feedback.
Fig. 5 is the structural representation of a kind of application testing device in the embodiment of the present invention, application testing device in the embodiment of the present invention can be implemented in as in the mobile terminals such as mobile phone, smart mobile phone, panel computer, electronic reader, car-mounted terminal or portable wearable device, and the application testing device as shown in the figure in the embodiment of the present invention at least can comprise:
Test command acquisition module 510, for obtaining application testing order, described application testing order comprises the component identification of simulated action instruction and corresponding intended application.
Concrete, described simulated action instruction can hit instruction for simulation points, simulation is long by instruction, the instruction of simulation sliding screen etc., the component identification of described intended application can for the click object of simulation click commands preset, title, the control ID (IDentity) of the appointment control of such as intended application or other are in order to identify the identification information of this control, described component identification can also comprise the application identities of intended application, in order to distinguish the control element corresponding to same application identities of different application.In an alternative embodiment, described application testing order can also comprise the application identities of enabled instruction and corresponding intended application, for performing startup intended application, checking command and corresponding verification object identity can also be comprised, for verifying application test execution result.
In an alternative embodiment, described test command acquisition module 510 can comprise as shown in Figure 6 further:
Test script acquiring unit 511, for obtaining application testing script.
Described application testing script can obtain for tester writes in advance, comprises the multiple application testing order and correlation parameter, object etc. that arrange according to predetermined testing process.
Keyword lookup unit 512, for searching test instruction keyword according to the keyword configuration information preset in described application testing script.
Described keyword configuration information in order to identify described application testing order in described application testing script, can under pre-configured preservation assigned catalogue in the terminal, under leaving SD (SecureDigital, safe digital) card root directory in.
Test command acquiring unit 513, for according to the instruction keyword found in described application testing script, obtains described application testing order.
Such as, in keyword configuration information, the keyword that the application testing order of unlatching intended application is corresponding can be " opening ", obtain keyword " open " when keyword lookup unit 512 is searched in application testing script, test command acquiring unit 513 can get the application testing order of opening intended application, and for example clicking keyword corresponding to the application testing order of target widget can be " click ", search in application testing script when keyword lookup unit 512 and obtain keyword " click ", test command acquiring unit 513 can get the application testing order clicking target widget.And then after finding keyword corresponding to application testing order, the tested object of application testing order can be obtained in the keyword successive character found, comprise application identities, component identification, screen position coordinate etc., tested object can carry out identifying to identify acquisition with <> symbol in an alternative embodiment, application testing order as obtained according to " clicking < menu > " can for clicking the control element that in current interface, component identification " menu " is corresponding, the application testing order and for example obtained according to " opening <Photoalbum> " can for opening photograph album application.
Element position acquisition module 520, for searching control element corresponding to described component identification in current interface, and obtains the positional information of described control element.
Concrete, element position acquisition module 520 can according to described component identification, control element all in traversal current system interface, search and obtain control element corresponding to described component identification, menu control is obtained as searched according to component identification " menu ", according to component identification, " individual " center " is searched and is obtained individual center control, and then obtain the control information of the control element corresponding with described component identification, comprise the positional information of described control element, described positional information can be the display position coordinate of described control element on mobile terminal display interface, as can be represented the place interface location of corresponding control element with x-axis coordinate and y-axis coordinate.In an alternative embodiment, element position acquisition module 520 by using hierarchyviewer.bat instrument, can obtain the coordinate figure of each element control in current interface.
Action simulation module 530, for the positional information according to described control element, sends simulated action event by injectKeyEvent object or input order to described control element.
Concrete, injectKeyEvent (key entry event) object can the IWindowManager.injectKeyEvent that provides of such as IwindowManager, action simulation module 530 by injecting the positional information of simulated action instruction and described control element to injectKeyEvent object, can send simulated action event to make described injectKeyEvent object to described control element.In an alternative embodiment, the positional information of simulated action instruction and described control element by performing su order line, can be passed to default agent process Agent.jar by action simulation module 530; Make described agent process Agent.jar inject the positional information of simulated action instruction and described control element to injectKeyEvent object, thus send simulated action event to described control element.
And action simulation module 530 sends simulated action event by input order to described control element, such as can perform inputtapxy, wherein x and y is respectively and determines according to the positional information of described control element the interface coordinate that obtains, and the control element that can realize finding to element position acquisition module 520 sends simulation click event.In an alternative embodiment, action simulation module 530 can also by inputtext<String> order in current interface can input area input text information, inputx can also be passed through, y, down, inputx, y, move and inputx, the compound command of y, up realizes simulating slip event.
In an alternative embodiment, described application testing device can also comprise further:
Intended application starts module 540, for starting described intended application according to described enabled instruction.
In this embodiment, first test command acquisition module 510 can be searched and obtain keyword corresponding to enabled instruction from described application testing script, thus get the application identities of the enabled instruction intended application corresponding with this enabled instruction, the script word comprising keyword corresponding to enabled instruction in described application testing script can such as: " opening <Photoalbum> " or " opening <QQ browser > ", content in <> is the application identities of described intended application.Intended application starts module 540 thus can according to the enabled instruction got and corresponding application identities, intended application corresponding to described application identities is started by trigger action system, as opened system photograph album, opening QQ browser etc., at this moment mobile terminal display interface shows the application interface of the intended application be activated.
In an alternative embodiment, described application testing device can also comprise further:
System version acquisition module 550, for obtaining operating system version information;
And then if operating system is the android system being not less than 4.0.3 version, then described action simulation module 530 can send simulated action event by input order to described control element; If operating system is the android system higher than 4.0.3 version, then action simulation module 530 can send simulated action event by injectKeyEvent object to described control element.
In an alternative embodiment, described application testing device can also comprise further:
Root authority judge module 560, whether root authority is obtained for judging that operating system is current, if determination operation system is current obtain root authority, then triggers described action simulation module 530 and send simulated action event by injectKeyEvent object or input order to described control element.
Further in another embodiment, described action simulation module 530 also for: when described root authority judge module 560 judges that operating system is current and do not obtain root authority, then send simulated action event by Instrumentation object to described control element.
Even current operation system does not obtain root authority, then action simulation module 530 can send corresponding simulated action event by Instrumentation object to described control element, described Instrumentation object can android.app.Instrumentation.sendPointerSync in the Instrumentation class of such as Android, it can send for coordinate x, the KEY_DOWN event of y and KEY_UP event, thus realize sending simulation click event to the control element of intended application, it can also send according to respective coordinates and comprise ACTION_DOWN, the event of ACTION_MOVE and ACTION_UP realizes simulation slip event.
In an alternative embodiment, described application testing device can also comprise further:
Test correction verification module 570, for searching object elements corresponding to described verification object identity in current interface according to described checking command, and obtains testing check results according to lookup result.
In an alternative embodiment, after test command acquisition module 510 can get keyword corresponding to simulated action instruction, search from described application testing script further and obtain keyword corresponding to checking command, thus get checking command and corresponding verification object identity.The script word comprising keyword corresponding to checking command in described application testing script can such as: " verification <test> ", " verification < helps > " or " the cabin > of verification <xxx " etc., the content in <> is described verification object identity.In specific implementation, response that can be corresponding after receiving simulated action event according to the tested control element of intended application, set described verification object identity, such as, after clicking the menu control of intended application, can eject and comprise the option such as " instrument " " help ", " exiting ", then can set described verification object identity as " help ".In action simulation module 530 after the menu control transmission simulation click event of intended application, test correction verification module 570 can search object elements corresponding to verification object identity in current interface, if found the object elements that verification object identity is corresponding, namely there is verification object elements in current system interface, then show that simulation click event test successfully, otherwise think and simulate click event test crash.
Application testing device in the embodiment of the present invention can open intended application by the application testing order got, and send simulated action event to the control element of intended application in several ways according to different situations, achieve the application simulation test of striding course, can also obtain testing check results by searching corresponding object elements to the verification object identity preset further, thus automatically can generate test result feedback.
One of ordinary skill in the art will appreciate that all or part of flow process realized in above-described embodiment method, that the hardware that can carry out instruction relevant by computer program has come, described program can be stored in a computer read/write memory medium, this program, when performing, can comprise the flow process of the embodiment as above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-OnlyMemory, ROM) or random store-memory body (RandomAccessMemory, RAM) etc.
Above disclosedly be only present pre-ferred embodiments, certainly can not limit the interest field of the present invention with this, therefore according to the equivalent variations that the claims in the present invention are done, still belong to the scope that the present invention is contained.

Claims (20)

1. an application testing method, is characterized in that, described method comprises:
Obtain application testing order, described application testing order comprises the component identification of simulated action instruction and corresponding intended application;
In current interface, search the control element that described component identification is corresponding, and obtain the positional information of described control element;
According to the positional information of described control element, send simulated action event by injectKeyEvent object or input order to described control element.
2. application testing method as claimed in claim 1, is characterized in that, described application testing order also comprises the application identities of enabled instruction and corresponding intended application;
Described method also comprises:
Described intended application is started according to described enabled instruction.
3. application testing method as claimed in claim 1, is characterized in that, describedly sends simulated action event by injectKeyEvent object to described control element and comprises:
Inject the positional information of simulated action instruction and described control element to injectKeyEvent object, send simulated action event to make described injectKeyEvent object to described control element.
4. application testing method as claimed in claim 3, is characterized in that, the described positional information to the injection simulated action instruction of injectKeyEvent object and described control element comprises:
By performing su order line, the positional information of simulated action instruction and described control element is passed to default agent process;
Described agent process injects the positional information of simulated action instruction and described control element to injectKeyEvent object.
5. application testing method as claimed in claim 1, is characterized in that, is describedly comprised to described control element transmission simulated action event by input order:
Perform inputtapxy, wherein x and y is respectively and determines according to the positional information of described control element the interface coordinate that obtains.
6. application testing method as claimed in claim 1, is characterized in that, is describedly comprised to described control element transmission simulated action event by injectKeyEvent object or input order:
If operating system is the android system being not less than 4.0.3 version, then send simulated action event by input order to described control element;
If operating system is the android system higher than 4.0.3 version, then send simulated action event by injectKeyEvent object to described control element.
7. application testing method as claimed in claim 1, is characterized in that, the described positional information according to described control element, is also comprised before described control element sends simulated action event by injectKeyEvent object or input order:
Determination operation system is current obtains root authority.
8. application testing method as claimed in claim 7, it is characterized in that, described method also comprises:
If operating system is current do not obtain root authority, then send simulated action event by Instrumentation object to described control element.
9. application testing method as claimed in claim 1, is characterized in that, described application testing order also comprises checking command and corresponding verification object identity;
Described method also comprises:
In current interface, search object elements corresponding to described verification object identity according to described checking command, and obtain testing check results according to lookup result.
10. the application testing method according to any one of claim 1 ~ 9, is characterized in that, the order of described acquisition application testing comprises:
Obtain application testing script;
Keyword configuration information according to presetting searches test instruction keyword in described application testing script;
According to the instruction keyword found in described application testing script, obtain described application testing order.
11. 1 kinds of application testing devices, is characterized in that, described application testing device comprises:
Test command acquisition module, for obtaining application testing order, described application testing order comprises the component identification of simulated action instruction and corresponding intended application;
Element position acquisition module, for searching control element corresponding to described component identification in current interface, and obtains the positional information of described control element;
Action simulation module, for the positional information according to described control element, sends simulated action event by injectKeyEvent object or input order to described control element.
12. application testing devices as claimed in claim 11, is characterized in that, described application testing order also comprises the application identities of enabled instruction and corresponding intended application;
Described application testing device also comprises:
Intended application starts module, for starting described intended application according to described enabled instruction.
13. application testing devices as claimed in claim 11, is characterized in that, described action simulation module sends simulated action event by injectKeyEvent object to described control element and comprises:
Action simulation module injects the positional information of simulated action instruction and described control element to injectKeyEvent object, sends simulated action event to make described injectKeyEvent object to described control element.
14. application testing devices as claimed in claim 13, is characterized in that, the positional information that described action simulation module injects simulated action instruction and described control element to injectKeyEvent object comprises:
By performing su order line, the positional information of simulated action instruction and described control element being passed to default agent process, injecting the positional information of simulated action instruction and described control element to make described agent process to injectKeyEvent object.
15. application testing devices as claimed in claim 11, is characterized in that, described action simulation module sends simulated action event by input order to described control element and comprises:
Action simulation module performs inputtapxy, and wherein x and y is respectively and determines according to the positional information of described control element the interface coordinate that obtains.
16. application testing devices as claimed in claim 11, is characterized in that, also comprise:
System version acquisition module, for obtaining operating system version information;
Described action simulation module sends simulated action event by injectKeyEvent object or input order to described control element and comprises:
If operating system is the android system being not less than 4.0.3 version, then action simulation module sends simulated action event by input order to described control element;
If operating system is the android system higher than 4.0.3 version, then action simulation module sends simulated action event by injectKeyEvent object to described control element.
17. application testing devices as claimed in claim 11, is characterized in that, also comprise:
Root authority judge module, whether root authority is obtained for judging that operating system is current, if determination operation system is current obtain root authority, then triggers described action simulation module and send simulated action event by injectKeyEvent object or input order to described control element.
18. application testing devices as claimed in claim 17, is characterized in that, described action simulation module also for:
When described root authority judge module judges that operating system is current and do not obtain root authority, then send simulated action event by Instrumentation object to described control element.
19. application testing devices as claimed in claim 11, is characterized in that, described application testing order also comprises checking command and corresponding verification object identity;
Described application testing device also comprises:
Test correction verification module, for searching object elements corresponding to described verification object identity in current interface according to described checking command, and obtains testing check results according to lookup result.
20. application testing devices according to any one of claim 11 ~ 19, it is characterized in that, described test command acquisition module comprises:
Test script acquiring unit, for obtaining application testing script;
Keyword lookup unit, for searching test instruction keyword according to the keyword configuration information preset in described application testing script;
Test command acquiring unit, for according to the instruction keyword found in described application testing script, obtains described application testing order.
CN201410374576.4A 2014-07-31 2014-07-31 Application test method and device Pending CN105320595A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410374576.4A CN105320595A (en) 2014-07-31 2014-07-31 Application test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410374576.4A CN105320595A (en) 2014-07-31 2014-07-31 Application test method and device

Publications (1)

Publication Number Publication Date
CN105320595A true CN105320595A (en) 2016-02-10

Family

ID=55248014

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410374576.4A Pending CN105320595A (en) 2014-07-31 2014-07-31 Application test method and device

Country Status (1)

Country Link
CN (1) CN105320595A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105824755A (en) * 2016-03-17 2016-08-03 厦门美图移动科技有限公司 Automation test method, automation test device and mobile terminal
CN105956438A (en) * 2016-04-19 2016-09-21 奇酷软件(深圳)有限公司 Rapid display method, rapid display device and terminal
CN106776277A (en) * 2016-11-18 2017-05-31 乐视控股(北京)有限公司 A kind of method of striding course test, device and electronic equipment
CN107590062A (en) * 2016-07-06 2018-01-16 阿里巴巴集团控股有限公司 A kind of method of testing and device of multi-client interaction
CN107783867A (en) * 2017-07-25 2018-03-09 上海壹账通金融科技有限公司 Gesture method of testing, device, computer equipment and storage medium
CN109214165A (en) * 2017-07-04 2019-01-15 武汉安天信息技术有限责任公司 A kind of judgment method of the rights statements legitimacy of pre-installed applications program and judge system
CN110704709A (en) * 2019-08-27 2020-01-17 北京金堤科技有限公司 Application data capturing method and device, storage medium and electronic equipment
CN111370053A (en) * 2018-12-25 2020-07-03 北京兆易创新科技股份有限公司 eMMC test method and device
CN108388513B (en) * 2018-02-09 2021-06-08 飞天诚信科技股份有限公司 Automatic testing method and device
CN114064447A (en) * 2020-08-05 2022-02-18 腾讯科技(深圳)有限公司 Interface test method and device, storage medium and terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101996131A (en) * 2009-08-19 2011-03-30 航天信息股份有限公司 Automatic test method and automatic test platform for graphic user interface (GUI) based on x extensive makeup language (XML) packaging key word
CN102053911A (en) * 2010-12-30 2011-05-11 东莞宇龙通信科技有限公司 Automated testing method and system based on Android and mobile terminal
US20120297341A1 (en) * 2010-02-16 2012-11-22 Screenovate Technologies Ltd. Modified Operating Systems Allowing Mobile Devices To Accommodate IO Devices More Convenient Than Their Own Inherent IO Devices And Methods For Generating Such Systems
CN102819492A (en) * 2012-08-02 2012-12-12 中山大学 Keyword driven automatic testing frame on basis of Android
CN102841845A (en) * 2012-07-30 2012-12-26 广东欧珀移动通信有限公司 Automatic testing method of Android device software

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101996131A (en) * 2009-08-19 2011-03-30 航天信息股份有限公司 Automatic test method and automatic test platform for graphic user interface (GUI) based on x extensive makeup language (XML) packaging key word
US20120297341A1 (en) * 2010-02-16 2012-11-22 Screenovate Technologies Ltd. Modified Operating Systems Allowing Mobile Devices To Accommodate IO Devices More Convenient Than Their Own Inherent IO Devices And Methods For Generating Such Systems
CN102053911A (en) * 2010-12-30 2011-05-11 东莞宇龙通信科技有限公司 Automated testing method and system based on Android and mobile terminal
CN102841845A (en) * 2012-07-30 2012-12-26 广东欧珀移动通信有限公司 Automatic testing method of Android device software
CN102819492A (en) * 2012-08-02 2012-12-12 中山大学 Keyword driven automatic testing frame on basis of Android

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105824755A (en) * 2016-03-17 2016-08-03 厦门美图移动科技有限公司 Automation test method, automation test device and mobile terminal
CN105956438A (en) * 2016-04-19 2016-09-21 奇酷软件(深圳)有限公司 Rapid display method, rapid display device and terminal
CN107590062A (en) * 2016-07-06 2018-01-16 阿里巴巴集团控股有限公司 A kind of method of testing and device of multi-client interaction
CN107590062B (en) * 2016-07-06 2021-11-30 阿里巴巴集团控股有限公司 Multi-client interaction testing method and device
CN106776277A (en) * 2016-11-18 2017-05-31 乐视控股(北京)有限公司 A kind of method of striding course test, device and electronic equipment
CN109214165B (en) * 2017-07-04 2021-02-05 武汉安天信息技术有限责任公司 Judgment method and judgment system for validity of permission declaration of pre-installed application program
CN109214165A (en) * 2017-07-04 2019-01-15 武汉安天信息技术有限责任公司 A kind of judgment method of the rights statements legitimacy of pre-installed applications program and judge system
CN107783867B (en) * 2017-07-25 2020-02-14 深圳壹账通智能科技有限公司 Gesture testing method and device, computer equipment and storage medium
CN107783867A (en) * 2017-07-25 2018-03-09 上海壹账通金融科技有限公司 Gesture method of testing, device, computer equipment and storage medium
CN108388513B (en) * 2018-02-09 2021-06-08 飞天诚信科技股份有限公司 Automatic testing method and device
CN111370053A (en) * 2018-12-25 2020-07-03 北京兆易创新科技股份有限公司 eMMC test method and device
CN110704709A (en) * 2019-08-27 2020-01-17 北京金堤科技有限公司 Application data capturing method and device, storage medium and electronic equipment
CN114064447A (en) * 2020-08-05 2022-02-18 腾讯科技(深圳)有限公司 Interface test method and device, storage medium and terminal
CN114064447B (en) * 2020-08-05 2024-05-31 腾讯科技(深圳)有限公司 Interface testing method and device, storage medium and terminal

Similar Documents

Publication Publication Date Title
CN105320595A (en) Application test method and device
CN103312850B (en) A kind of mobile phone automatized test macro and method of work
CN104598380A (en) Method and system for automatic testing based on control
CN104035867A (en) Android-based application function traverse test method
CN106776319B (en) Automatic test method and device
CN103118031A (en) Method and electronic device for logging in application account
CN109063504B (en) Private file access method, mobile terminal and storage medium
CN111414309B (en) Automatic test method of application program, computer equipment and storage medium
CN111427803A (en) Automated random test method, apparatus, computer device and medium
CN110162453B (en) Test method, test device, computer readable storage medium and computer equipment
CN106209757A (en) Automatically detection and convenient login method, device and the system of filling entry field
CN109783355A (en) Page elements acquisition methods, system, computer equipment and readable storage medium storing program for executing
CN104156305A (en) Application program testing method and device
CN110889116B (en) Advertisement interception method and device and electronic equipment
CN110855642A (en) Application vulnerability detection method and device, electronic equipment and storage medium
CN102982217A (en) Processing method and device of screen print
CN107102937B (en) User interface testing method and device
CN104899140A (en) Test method for mobile terminal assembly
CN109657453B (en) Authority setting method and device, mobile terminal and computer readable storage medium
CN106557411B (en) Method and system for testing Hybrid application in Android system
CN109933479B (en) Fault simulation and emulation method and related equipment
CN107783867B (en) Gesture testing method and device, computer equipment and storage medium
CN104424098A (en) Application test method and application testing device
CN106844186B (en) Offline test method of application and terminal equipment
CN113672826B (en) Page jump method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160210