Summary of the invention
The present invention is just based on the problems referred to above, propose a kind of new application testing technology, on existing application testing mode basis, the application testing that simple object type completes complex object type can be made full use of, set up general, the unified test thinking of the application testing that multi-object type participates in.
In view of this, the present invention proposes a kind of Mobile solution automatic test device, comprising: terminal connection unit, for installing application program to be measured at PC end, mobile phone connects PC end by USB line, recognizes mobile phone and connect under USB debugging mode; Test script recording elements, for when having recognized mobile phone and having connected, has utilized Android system to record application program to be measured, has translated and playback process, and/or, utilize iOS system to record and playback process application program to be measured; Task test cell, for based on the result to application program to be measured, adds corresponding check post, verifies, and export the result to application program to be measured in automatized script.In this technical scheme, automatized script can be generated easily, the input of tester in compile script is reduced greatly.
In technique scheme, preferably, described test script recording elements, specifically comprises: recording engine processing module, for when having recognized mobile phone and having connected, has utilized Android system to record application program to be measured, translates and playback process; And/or robotization engine processing module, for when having recognized mobile phone and having connected, has utilized iOS system to record and playback process application program to be measured.In this technical scheme, can be called by continuous integrating, automatic compiling, coil after carry out Black-box Testing, test result again continuous integration system read represent, make exploitation whole process realize closed loop.
In technique scheme, preferably, the operation that described recording engine processing module utilizes Android system to record application program to be measured, comprise further: use the adb order getevent that Android system carries, user is at hand hands-operation, action is sent on PC end in the mode of flow of event, resolves lid flow of event and obtains the click location of user on mobile phone screen; And/or use adb order sectional drawing function, be sent to by mobile phone screen sectional drawing in the interface of instrument PC end, user clicks the mobile phone sectional drawing in interface with mouse, obtains the click location on mobile phone screen; Send instructions to mobile phone with the use of sendkey order, mobile phone screen can hold the sectional drawing screen in interface to be consistent with PC simultaneously; After obtaining the behavior act of user on mobile phone and/or coordinate information, use uiautomator to obtain in current screen and comprise the coordinate of all objects, the information of shared screen area; And/or, the operation that described recording engine processing module utilizes Android system to translate application program to be measured, comprise further: use the Robotium framework of increasing income as playback engine, use java language to read the script xml file recorded, its content is translated and becomes Robotium framework test case used; And/or, described recording engine processing module utilizes Android system to carry out the operation of playback to application program to be measured, comprise further: preset playback environment, unpack heavily to sign to the apk bag of application program to be measured and pack again, reinstall on mobile phone, make the action that translated use-case can be recorded before playback on mobile phone; And/or, the operation that described robotization engine processing module utilizes iOS system to record application program to be measured, comprise further: the application program utilizing UI Automation to sign to Developer or the application program operated in simulator are recorded, obtain the behavior act of user, preserve with object form; And/or, described robotization engine processing module utilizes iOS system to carry out the operation of playback to application program to be measured, comprise further: after application program to be measured is carried out Developer signature, the certificate of upper developer is configured after taking source code, directly be installed in real equipment by Xcode compiling, the automatic test script of playback UI Automation.In this technical scheme, can testing efficiency be improved, make tester more be absorbed in foundation and the exploitation of new test module, thus improve test coverage.
In technique scheme, preferably, described task test cell, specifically comprise: test assignment authentication module, for based on the result to application program to be measured, in automatized script, add corresponding check post, check post is translated into the checking statement that can be played, application program to be measured is verified; The result output module, after having verified, has checked corresponding playback result, and configuration email address, gives corresponding personnel by daily record timed sending.In this technical scheme, can, so that the digital management of test assets, make test assets can obtain multiplexing in whole software test lifecycle.
In technique scheme, preferably, the operation that described test assignment authentication module is verified application program to be measured, comprises further: to the checking of the expectation function of application program to be measured, normal condition and exception condition; And/or the playback result that described the result output module is checked, comprises and performs use-case sum, by counting, unsuccessfully counting, skip number, failed error stack information, failed sectional drawing.In this technical scheme, the test activity of mechanism can be made to carry out more proceduring, meet the thought that CMMI process is improved.
According to a further aspect of the invention, also proposed a kind of Mobile solution automated testing method, comprising: step 202: install application program to be measured at PC end, mobile phone connects PC end by USB line, recognizes mobile phone and connect under USB debugging mode; Step 204: when having recognized mobile phone and having connected, utilized Android system to record application program to be measured, translate and playback process, and/or, utilize iOS system to record and playback process application program to be measured; Step 206: based on the result to application program to be measured, adds corresponding check post in automatized script, verifies, and export the result to application program to be measured.In this technical scheme, automatized script can be generated easily, the input of tester in compile script is reduced greatly.
In technique scheme, preferably, described step 204, specifically comprises: step 302: when having recognized mobile phone and having connected, utilized Android system to record application program to be measured, translate and playback process; And/or, step 304: when having recognized mobile phone and having connected, utilize iOS system to record and playback process application program to be measured.In this technical scheme, can be called by continuous integrating, automatic compiling, coil after carry out Black-box Testing, test result again continuous integration system read represent, make exploitation whole process realize closed loop.
In technique scheme, preferably, the operation that described step 302 utilizes Android system to record application program to be measured, comprise further: use the adb order getevent that Android system carries, user is at hand hands-operation, action is sent on PC end in the mode of flow of event, resolves lid flow of event and obtains the click location of user on mobile phone screen; And/or use adb order sectional drawing function, be sent to by mobile phone screen sectional drawing in the interface of instrument PC end, user clicks the mobile phone sectional drawing in interface with mouse, obtains the click location on mobile phone screen; Send instructions to mobile phone with the use of sendkey order, mobile phone screen can hold the sectional drawing screen in interface to be consistent with PC simultaneously; After obtaining the behavior act of user on mobile phone and/or coordinate information, use uiautomator to obtain in current screen and comprise the coordinate of all objects, the information of shared screen area; And/or, the operation that described step 302 utilizes Android system to translate application program to be measured, comprise further: use the Robotium framework of increasing income as playback engine, use java language to read the script xml file recorded, its content is translated and becomes Robotium framework test case used; And/or, described step 302 utilizes Android system to carry out the operation of playback to application program to be measured, comprise further: preset playback environment, unpack heavily to sign to the apk bag of application program to be measured and pack again, reinstall on mobile phone, make the action that translated use-case can be recorded before playback on mobile phone; And/or, the operation that described step 304 utilizes iOS system to record application program to be measured, comprise further: the application program utilizing UI Automation to sign to Developer or the application program operated in simulator are recorded, obtain the behavior act of user, preserve with object form; And/or, described step 304 utilizes iOS system to carry out the operation of playback to application program to be measured, comprise further: after application program to be measured is carried out Developer signature, the certificate of upper developer is configured after taking source code, directly be installed in real equipment by Xcode compiling, the automatic test script of playback UI Automation.In this technical scheme, can testing efficiency be improved, make tester more be absorbed in foundation and the exploitation of new test module, thus improve test coverage.
In technique scheme, preferably, described step 206, specifically comprise: step 402 is based on the result to application program to be measured, in automatized script, add corresponding check post, check post is translated into the checking statement that can be played, application program to be measured is verified; After step 404 has been verified, check corresponding playback result, configuration email address, gives corresponding personnel by daily record timed sending.In this technical scheme, can, so that the digital management of test assets, make test assets can obtain multiplexing in whole software test lifecycle.
In technique scheme, preferably, the operation that described step 402 is verified application program to be measured, comprises further: to the checking of the expectation function of application program to be measured, normal condition and exception condition; And/or the playback result that described step 404 is checked, comprises and performs use-case sum, by counting, unsuccessfully counting, skip number, failed error stack information, failed sectional drawing.In this technical scheme, the test activity of mechanism can be made to carry out more proceduring, meet the thought that CMMI process is improved.
By above technical scheme, on existing application testing mode basis, the application testing that simple object type completes complex object type can be made full use of, set up general, the unified test thinking of the application testing that multi-object type participates in.
Embodiment
In order to more clearly understand above-mentioned purpose of the present invention, feature and advantage, below in conjunction with the drawings and specific embodiments, the present invention is further described in detail.It should be noted that, when not conflicting, the feature in the embodiment of the application and embodiment can combine mutually.
Set forth a lot of detail in the following description so that fully understand the present invention; but; the present invention can also adopt other to be different from other modes described here and implement, and therefore, protection scope of the present invention is not by the restriction of following public specific embodiment.
Fig. 1 shows the block diagram of Mobile solution automatic test device according to an embodiment of the invention.
As shown in Figure 1, Mobile solution automatic test device 100 according to an embodiment of the invention, comprising: terminal connection unit 102, and for installing application program to be measured at PC end, mobile phone connects PC end by USB line, recognizes mobile phone and connect under USB debugging mode; Test script recording elements 104, for when having recognized mobile phone and having connected, has utilized Android system to record application program to be measured, has translated and playback process, and/or, utilize iOS system to record and playback process application program to be measured; Task test cell 106, for based on the result to application program to be measured, adds corresponding check post, verifies, and export the result to application program to be measured in automatized script.In this technical scheme, automatized script can be generated easily, the input of tester in compile script is reduced greatly.
In technique scheme, preferably, test script recording elements 104, specifically comprises: recording engine processing module 1042, for when having recognized mobile phone and having connected, has utilized Android system to record application program to be measured, translates and playback process; And/or robotization engine processing module 1044, for when having recognized mobile phone and having connected, has utilized iOS system to record and playback process application program to be measured.In this technical scheme, can be called by continuous integrating, automatic compiling, coil after carry out Black-box Testing, test result again continuous integration system read represent, make exploitation whole process realize closed loop.
In technique scheme, preferably, the operation that recording engine processing module 1042 utilizes Android system to record application program to be measured, comprise further: use the adb order getevent that Android system carries, user is at hand hands-operation, action is sent on PC end in the mode of flow of event, resolves lid flow of event and obtains the click location of user on mobile phone screen; And/or use adb order sectional drawing function, be sent to by mobile phone screen sectional drawing in the interface of instrument PC end, user clicks the mobile phone sectional drawing in interface with mouse, obtains the click location on mobile phone screen; Send instructions to mobile phone with the use of sendkey order, mobile phone screen can hold the sectional drawing screen in interface to be consistent with PC simultaneously; After obtaining the behavior act of user on mobile phone and/or coordinate information, use uiautomator to obtain in current screen and comprise the coordinate of all objects, the information of shared screen area; And/or, the operation that recording engine processing module 1042 utilizes Android system to translate application program to be measured, comprise further: use the Robotium framework of increasing income as playback engine, use java language to read the script xml file recorded, its content is translated and becomes Robotium framework test case used; And/or, recording engine processing module 1042 utilizes Android system to carry out the operation of playback to application program to be measured, comprise further: preset playback environment, unpack heavily to sign to the apk bag of application program to be measured and pack again, reinstall on mobile phone, make the action that translated use-case can be recorded before playback on mobile phone; And/or, the operation that robotization engine processing module 1044 utilizes iOS system to record application program to be measured, comprise further: the application program utilizing UI Automation to sign to Developer or the application program operated in simulator are recorded, obtain the behavior act of user, preserve with object form; And/or, robotization engine processing module 1044 utilizes iOS system to carry out the operation of playback to application program to be measured, comprise further: after application program to be measured is carried out Developer signature, the certificate of upper developer is configured after taking source code, directly be installed in real equipment by Xcode compiling, the automatic test script of playback UI Automation.In this technical scheme, can testing efficiency be improved, make tester more be absorbed in foundation and the exploitation of new test module, thus improve test coverage.
In technique scheme, preferably, task test cell 106, specifically comprise: test assignment authentication module 1062, for based on the result to application program to be measured, in automatized script, add corresponding check post, check post is translated into the checking statement that can be played, application program to be measured is verified; The result output module 1064, after having verified, has checked corresponding playback result, and configuration email address, gives corresponding personnel by daily record timed sending.In this technical scheme, can, so that the digital management of test assets, make test assets can obtain multiplexing in whole software test lifecycle.
In technique scheme, preferably, the operation that test assignment authentication module 1062 is verified application program to be measured, comprises further: to the checking of the expectation function of application program to be measured, normal condition and exception condition; And/or the playback result that the result output module 1064 is checked, comprises and performs use-case sum, by counting, unsuccessfully counting, skip number, failed error stack information, failed sectional drawing.In this technical scheme, the test activity of mechanism can be made to carry out more proceduring, meet the thought that CMMI process is improved.
Fig. 2 shows the process flow diagram of Mobile solution automated testing method according to an embodiment of the invention.
As shown in Figure 2, Mobile solution automated testing method according to an embodiment of the invention, comprising: step 202: install application program to be measured at PC end, and mobile phone connects PC end by USB line, recognizes mobile phone and connect under USB debugging mode; Step 204: when having recognized mobile phone and having connected, utilized Android system to record application program to be measured, translate and playback process, and/or, utilize iOS system to record and playback process application program to be measured; Step 206: based on the result to application program to be measured, adds corresponding check post in automatized script, verifies, and export the result to application program to be measured.In this technical scheme, automatized script can be generated easily, the input of tester in compile script is reduced greatly.
In technique scheme, preferably, as shown in Figure 3, step 204, specifically comprises: step 302: when having recognized mobile phone and having connected, utilized Android system to record application program to be measured, translate and playback process; And/or, step 304: when having recognized mobile phone and having connected, utilize iOS system to record and playback process application program to be measured.In this technical scheme, can be called by continuous integrating, automatic compiling, coil after carry out Black-box Testing, test result again continuous integration system read represent, make exploitation whole process realize closed loop.
In technique scheme, preferably, the operation that step 302 utilizes Android system to record application program to be measured, comprise further: use the adb order getevent that Android system carries, user is at hand hands-operation, action is sent on PC end in the mode of flow of event, resolves lid flow of event and obtains the click location of user on mobile phone screen; And/or use adb order sectional drawing function, be sent to by mobile phone screen sectional drawing in the interface of instrument PC end, user clicks the mobile phone sectional drawing in interface with mouse, obtains the click location on mobile phone screen; Send instructions to mobile phone with the use of sendkey order, mobile phone screen can hold the sectional drawing screen in interface to be consistent with PC simultaneously; After obtaining the behavior act of user on mobile phone and/or coordinate information, use uiautomator to obtain in current screen and comprise the coordinate of all objects, the information of shared screen area; And/or, the operation that step 302 utilizes Android system to translate application program to be measured, comprise further: use the Robotium framework of increasing income as playback engine, use java language to read the script xml file recorded, its content is translated and becomes Robotium framework test case used; And/or, step 302 utilizes Android system to carry out the operation of playback to application program to be measured, comprise further: preset playback environment, unpack heavily to sign to the apk bag of application program to be measured and pack again, reinstall on mobile phone, make the action that translated use-case can be recorded before playback on mobile phone; And/or, the operation that step 304 utilizes iOS system to record application program to be measured, comprise further: the application program utilizing UI Automation to sign to Developer or the application program operated in simulator are recorded, and obtain the behavior act of user, preserve with object form; And/or, step 304 utilizes iOS system to carry out the operation of playback to application program to be measured, comprise further: after application program to be measured is carried out Developer signature, the certificate of upper developer is configured after taking source code, directly be installed in real equipment by Xcode compiling, the automatic test script of playback UI Automation.In this technical scheme, can testing efficiency be improved, make tester more be absorbed in foundation and the exploitation of new test module, thus improve test coverage.
In technique scheme, preferably, as shown in Figure 4, step 206, specifically comprises: step 402, based on the result to application program to be measured, adds corresponding check post in automatized script, check post is translated into the checking statement that can be played, application program to be measured is verified; After step 404 has been verified, check corresponding playback result, configuration email address, gives corresponding personnel by daily record timed sending.In this technical scheme, can, so that the digital management of test assets, make test assets can obtain multiplexing in whole software test lifecycle.
In technique scheme, preferably, the operation that step 402 is verified application program to be measured, comprises further: to the checking of the expectation function of application program to be measured, normal condition and exception condition; And/or the playback result that step 404 is checked, comprises and performs use-case sum, by counting, unsuccessfully counting, skip number, failed error stack information, failed sectional drawing.In this technical scheme, the test activity of mechanism can be made to carry out more proceduring, meet the thought that CMMI process is improved.
Technical scheme of the present invention, just in order to solve the instrument of application program automatic test problem on main flow smart mobile phone in prior art; In view of the operation system of smart phone overwhelming majority is occupied by android and iOS, technical scheme of the present invention provides support to android and iOS two systems.
Technical scheme of the present invention, provides a kind of Mobile solution automated test tool, and android, iOS main flow operation system of smart phone realizes the automatic test to its application.The technical scheme technical issues that need to address of the present invention are as follows:
1, automatized script generates.With the mode generation script recorded, replace the mode of manual compiling script in the past.
2, script portability and reusability.The automatized script that instrument is recorded out is preserved with static text, and file itself does not rely on instrument.
3, script is to the support of playback environment.Behavior act is preserved with the form of object in automatic test script.As long as object exists in tested program, and need not consider playback apparatus resolution, the factor such as to arrange can playback checking.
4, playback script combines with playback framework.Select the playback framework of excellent performance to carry out playback to script, save system resource.
solve the technical scheme of the technology of the present invention problem:
(i) instrument schematic diagram.See Fig. 5.
(ii) the UI of instrument and operation.
This instrument uses java language compilation, and interface is generated by swt, succinctly understandable.Its operating process is, install at PC end and open instrument, mobile phone connects computer USB debugging mode of performing fighting by USB line, and at this moment instrument can identify that mobile phone connects (needing PC end to be also the operating system of apple when iOS system mobile phone connects).Open tested application program again, undertaken by the step recording use-case-translation use-case-playback use-case.
(iii) use-case is recorded
1.android system records use-case:
In Android system, there are two kinds of modes gathering user behavior action, the adb order getevent that first kind of way uses Android system to carry, user is at hand hands-operation, action can be sent on computer in the mode of flow of event, resolves this flow of event and can obtain the click location of user on mobile phone screen.The second way uses adb order sectional drawing function, and be sent to by mobile phone screen sectional drawing in the interface of instrument PC end, user clicks the mobile phone sectional drawing in interface with mouse, and instrument can obtain the click location on mobile phone screen.Send instructions to mobile phone with the use of sendkey order, mobile phone screen just can hold the sectional drawing screen in interface to be consistent with PC simultaneously.
Obtain the behavior act of user on mobile phone, namely some coordinate informations now.The combination of action as such in click (200,105), slip (100,600,230,100) and coordinate, but the playback on the mobile phone of different resolution of such information has problem.Use uiautomator can obtain the information such as the coordinate of all objects in current screen, shared screen area, so just click (200,105) can be converted into click (objectName).
2.iOS system records use-case:
UI Automation can record the application program of Developer signature or the application program operated in simulator.This instrument encapsulates UI Automation, utilizes its recording function can obtain the behavior act of user.Use-case action is as follows:
Var target = UITarget.localTarget();
Such script is also preserved with object form, and this is consistent with the design original intention of our instrument.
(iv) use-case is translated
1.android system uses the Robotium framework of increasing income as playback engine.Use java language to read the script xml file recorded during translation, its content is translated and becomes Robotium framework test case used.Because hand hands-operation limitednumber, we only need to be concerned about such as click, double-click, amplify, reduce, slide, the action such as dragging.
The use-case of 2.iOS system does not need again to translate, because the script that UI Automation records out has been available test case.
(v) playback use-case
Playback in 1.android system:
The playback action of use-case can show on mobile phone screen, but before playback performs, needs the preset playback environment of preset instrument.For the application program of Android system, only have heavily signature after could be familiar with by Robotium framework, pack again so this instrument will unpack heavily to sign to the apk bag of tested program, reinstall on mobile phone, the action that translated like this use-case just can be recorded before playback on mobile phone.
Playback in 2.iOS system:
Tested program needs Developer to sign equally, and we take the certificate of the upper developer of configuration after source code, be directly installed in real equipment by Xcode compiling, just can the automatic test script of playback UI Automation.
(vi) result verification
It not is final purpose that the behavior act of note user reappears, and we will realize the checking to program function.The checking that some check posts can realize expectation function, condition is added in automatized script.Use instrument uses the such form of assert (object, value) to insert check post in script, and check post can be translated into the checking statement that can be played framework and perform, and realizes the judgement to program normal condition and exception condition.
(vii) daily record
Robotization use-case holds that the mode of keeping runs often with nobody, its operation result will be checked by complete daily record.After playback task completes, can playback result be checked in the tool, comprise and perform use-case sum, by counting, unsuccessfully counting, skip number, failed error stack information, failed sectional drawing etc.Also email address can be configured, by daily record timed sending to responsible person concerned simultaneously.
(viii), business process map, see Fig. 6.
Compared with prior art, technical scheme of the present invention, at least can reach following beneficial effect:
(1) can generate automatized script easily, the input of tester in compile script is reduced greatly.It is compatible Android and iOS two kinds of main flow mobile phone operating systems also simultaneously, focal point are placed in operation flow instead of frequently switch, configuration testing environment.
(2) can be called by continuous integrating, automatic compiling, coil after carry out Black-box Testing, test result again continuous integration system read represent, make exploitation whole process realize closed loop.
(3) automatic test can improve testing efficiency, tester is made more to be absorbed in foundation and the exploitation of new test module, thus raising test coverage, secondly automatic test is more convenient for testing the digital management of assets, make test assets can obtain multiplexing in whole software test lifecycle, this feature especially has meaning in functional test and regression test.In addition, it is more proceduring that testing process automatic management can make the test activity of mechanism carry out, and meets the thought that CMMI process is improved.
More than be described with reference to the accompanying drawings technical scheme of the present invention, considered in correlation technique there is no easy, the unified solution for complicated type application testing.Existing application testing cannot complete the application testing process that complicated type participates in.Therefore, the present invention proposes a kind of Mobile solution automatic test device and a kind of Mobile solution automated testing method, can on existing application testing mode basis, make full use of the application testing that simple object type completes complex object type, set up general, the unified test thinking of the application testing that multi-object type participates in.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.