Summary of the invention
The objective of the invention is to overcome the deficiencies in the prior art, a kind of random testing method based on Android is provided, make the CMD order of windows and the random test Monkey order of Android combine, realize test automatically, improved efficient.
In order to achieve the above object, the technical solution used in the present invention is, a kind of random testing method based on Android, and its step is as follows:
The CMD order guiding user of step 1, use Windows tests;
Step 2, each .bat file of use CMD command calls carry out the monkey test;
Step 3, use CMD order help monkey to produce stray parameter;
Step 4, use monkey order carrying out random test;
The log journal file of monkey is derived in step 5, use CMD order;
Step 6, the log journal file that uses CMD order filtering monkey to occur;
Step 7, use CMD to order to judge that thereby file is whether occupied judges whether test procedure continues.
Stray parameter in the above-mentioned steps 3 is the number of times and the test duration spacing of test seed number, test.Described seed is any one random number, and same random number produces same action, carries out same test, can reappear problem if test goes wrong by same seed.
Compared with prior art, the invention has the beneficial effects as follows: the first, the Monkey command history of the CMD of windows order and android is oversimplified the software test of mobile phone; The second, can allow the tester needn't carry out Monkey test study, only need just can carry out test, improve testing efficiency, reduce and use threshold according to prompting operation; Three, a series of automatic tests are together in series, make full use of free time to test, improve testing efficiency.
Embodiment
Purport of the present invention is to overcome the deficiencies in the prior art, a kind of random testing method based on Android is provided, carry out CMD order and Monkey order comprehensive, use the test function of system, file, document management function, integration of user interaction functionality and the random test monkey of CMD, both are combined, realize automatic test, improve testing efficiency.Be elaborated with reference to accompanying drawing below in conjunction with embodiment, so that 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 random testing method based on Android, its step is as follows:
The CMD order guiding user of step 1, use Windows tests;
Step 2, each .bat file of use CMD command calls carry out the monkey test;
Step 3, use CMD order help monkey to produce stray parameter;
Step 4, use monkey order carrying out random test;
The log journal file of monkey is derived in step 5, use CMD order;
Step 6, the log journal file that uses CMD order filtering monkey to occur;
Step 7, use CMD to order to judge that thereby file is whether occupied judges whether test procedure continues
Stray parameter in the above-mentioned steps 3 is the number of times and the test duration spacing of test seed number, test.
The concrete operations example flow chart of method of testing of the present invention as shown in Figure 2, on the android mobile phone that uses click-through software, test, click-through software only need be double-clicked mouse for the user, according to the prompting input parameter not even the needs input parameter just can test, simple and quick, the operation steps on the android mobile phone of click-through software is as follows:
Step 1, click-through .bat program bring into operation;
Step 2, the current item that can test of demonstration, the user selects the own input test bag of test event user name;
Step 3, the input by the user are judged and the .bat file that calls each module is tested;
Step 4, manual input test number of times or using system default number of times;
Step 5, input seed number or use random number;
Step 6, input test operation ratio or use default scale;
Step 7, test beginning show parameter such as start time, number of times, seed and these parameters are imported in the log journal file;
In step 8, the test, program is carried out the monkey random test;
Step 9, the complete log journal file of generation;
Step 10, prompting user test are finished, and show log journal file storeroom;
Step 11, whether file to occur occupied;
Step 12, the occupied then operation problem of file solve .bat and judge whether to continue test, and unoccupied then directly the judging whether of file continues to test;
Step 13, program are proceeded test and are then skipped to step 2, do not continue then termination routine.
Seed described in the above-mentioned steps 5 is any one random number, and same random number produces same action, carries out same test, can reappear problem if test goes wrong by same seed.
In addition, program is adjusted down a little, then do not needed the user to carry out any input and only need double-click the .bat instrument of opening, then the .bat instrument will be tested all modules to be tested, make full use of the vacant time, the user can utilize and open computer evening and automatically instrument is tested.Adjusted program step is as follows:
Step 1, user double-click and open .Bat;
Step 2, use CMD order help monkey to produce stray parameter;
Step 3, use monkey order begin all modules are carried out random test;
Step 4, test beginning show parameter such as start time, number of times, seed and these parameters are imported in the log journal file;
Step 5, test produce log, and derive log by CMD;
Step 6, CMD screen log;
Step 7, the complete log journal file of generation;
Step 8, prompting user test are finished, and show log journal file storeroom.
Although the present invention has made clear and complete description to how to realize based on the random 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.