Summary of the invention
The objective of the invention is to overcome the deficiencies in the prior art, a kind of automated testing method based on Android is provided, simple to operation, and all kinds of automatic tests are carried out integrated, only need a mobile phone just can carry out automatic test, efficient height.
In order to achieve the above object, the technical solution used in the present invention is, a kind of automated testing method based on Android, and step is as follows:
Step 1, all kinds of test procedures that call Android and inner shell instruction;
Step 2, code is compiled in instruction to all kinds of test procedures and inner shell;
But form a series of random call cycle testss behind step 3, the volume code, and produce corresponding test event;
After step 4, code were write and finished, reserved storage space was in order to writing the expansion interface program;
Step 5, code is compiled by the Linux translation and compiling environment, form executable file;
Step 6, executable file call the monkey random test order of Android all kinds of test procedures are carried out random test when test.
All kinds of test procedures described in the above-mentioned steps 1,2 comprise software automated testing program, file management class automatic test program, outfield class automatic test program and hardware automatic test program etc.; Executable file described in the above-mentioned steps 5 is the abbreviation of APK(Android Package) file of form.
Compared with prior art, the invention has the beneficial effects as follows: the monkey method of the first, calling android by the inner shell instruction of integrated Android principle, what be implemented in the mobile phone side passes through the equipment simulating manually-operated, form reliable software stability test system, various test procedures are encoded, test by calling each test procedure during test, test simple and conveniently, improve testing efficiency; The second, operation interface is visual, does not need by PC, only needs an Android mobile phone just can test whenever and wherever possible; Three, coding the time is reserved with expansion interface, can add other test procedures as required, with the test procedure into test procedure of encoding, in order to test, has good extendability; Four, be adapted to the mobile phone of android system, favorable compatibility is arranged.
Embodiment
Purport of the present invention is to overcome the deficiencies in the prior art, a kind of automated testing method based on Android is provided, call the monkey method of android by the inner shell instruction of integrated android principle, what be implemented in the mobile phone side passes through the equipment simulating manually-operated, forms reliable software stability test system.All kinds of test procedures are comprised that software automated testing program, file management class automatic test program and outfield class automatic test program etc. encode, program energy all kinds of test procedures of random call behind the coding also carry out automatic test, form an automatic test system, all kinds of test procedures are concentrated within a framework, can be called each class method at any time and carry out automatic test.The code that writes is compiled by the translation and compiling environment on the linux, and formation can be installed in the executable file installation kit on the mobile phone, carries out each class testing anywhere or anytime thereby make anyone only need that executable file is installed on mobile phone and according to explanation.
Be elaborated with reference to accompanying drawing below in conjunction with embodiment, in order to technical characterictic of the present invention and advantage are carried out more deep annotation.
Software flow pattern of the present invention as shown in Figure 1, a kind of automated testing method based on Android, step is as follows:
Step 1, all kinds of test procedures that call Android and inner shell instruction;
Step 2, code is compiled in instruction to all kinds of test procedures and inner shell;
But form a series of random call cycle testss behind step 3, the volume code, and produce corresponding test event;
After step 4, code were write and finished, reserved storage space was in order to writing the expansion interface program;
Step 5, code is compiled by the Linux translation and compiling environment, form executable file;
Step 6, executable file call the monkey random test order of Android all kinds of test procedures are carried out random test when test.
All kinds of test procedures described in the above-mentioned steps 1,2 comprise software automated testing program, file management class automatic test program, outfield class automatic test program and hardware automatic test program etc.; Executable file described in the above-mentioned steps 5 is the file of APK form.
Need a series of parameter at the execution automatic test, as,
(1) all kinds of test procedure module code names: the corresponding corresponding module of corresponding code name, the test subscriber can select need oneself to feel the module of test;
(2) starting index: i.e. SEED, different SEED produces different random test sequence samples, and the random occurrence that same SEED carries out out is the same, can reappear problem by same SEED;
(3) test time delay: the interval between per two random actions is unit with the millisecond, if there is not time delay or very little, may cause procedure termination by keydipatchtimeout;
(4) testing time: the number of clicks that namely produces random test;
(5) Log journal file: click and check that log can check the log that the problem of test back mobile phone appearance produces, the log title is with " bag name "+" date "+" time " .txt name.
In the use, executable file is installed on the Android mobile phone, open executable file, then the automatic test catalogue can appear, catalogue is all kinds of test name, as software automated testing, file management class automatic test, outfield class automatic test and other tests, use for the convenience of the user, in catalogue, add and use imprint.After the test event of user in the hit testing catalogue, then enter corresponding test procedure and test, test result can form the log journal file, and test result is presented on the mobile phone screen.
Although the present invention has made the clear description finished to how to realize based on the automated testing method of Android by instantiation, but the present invention is not limited only to described embodiment, and to reach identical purpose be contingent and all be included in the present invention by simple reprogramming.