A kind of Android automatic test record screen mechanism and record screen system departing from PCTechnical field
The present invention relates to automatization testing technique field, particularly the system of mechanism and application the method thereof is shielded in a kind of Android automatic test record departing from PC.
Background technology
Automatic test is by automated test tool or other means, tests automatically according to the scheduled plan of Test Engineer, thus reaches the object improving software quality.The most frequently used means of Test Engineer, exactly by writing automatic test script, being gone to perform by the use-case made by being allowed tested program, being found the defect of tested program by contrast test result and expected results.When there is expected results and test result is inconsistent, retain abnormal on-the-spot related data particularly important, data are preserved more complete, then be more beneficial to defect or leak that research staff repairs tested program.
Existing automatic test mechanism, there is not a set of perfect monitoring mechanism for script ruuning situation, once make a mistake in the operational process of script, just preserve wrong on-the-spot related data by modes such as sectional drawing, preservation daily records, this mode has two larger drawbacks, one is that data are preserved imperfect, current mechanism is only the data of preserving wrong time of origin point current time, but the failed likely a series of operation of the operation of a script causes, and only preserves the data of wrong time point and cannot absolutely prove problem; Two is that data are directly perceived not, is unfavorable for that mistake inducement is inferred.Tester goes misjudgment inducement only according to several sectional drawings or correlation log, needs by rule of thumb and reasoning, brings certain difficulty to the location of bugs or leak and deduction.If can monitor the operation of the time adjacent segments of wrong time of origin point, the mode of ruuning situation by record screen is preserved, greatly will facilitate location, although the instrument having some PC to hold at present can carry out record screen to mobile phone, often need to depart from PC at race automatic test script and run.Based on above background, the present invention proposes a kind of Android automatic test record screen mechanism departing from PC.
Summary of the invention
The present invention, for solving the problem, provides a kind of the Android automatic test record screen mechanism and the record screen system that depart from PC, reaches object that is effective, complete, that preserve wrong on-the-spot related data intuitively, solve the drawback existing for current mechanism.
For achieving the above object, the technical solution used in the present invention is:
A kind of Android automatic test record screen mechanism departing from PC, it comprises the following steps:
10. start automatic test script, and the ruuning situation of operation record screen program to described automatic test script is monitored;
The snoop results of described record screen program is recorded by 20., and generates record screen cache file;
Whether the operation of the automatic test script described in 30. judgements there is exception, if not, then terminates to record and shields and empty described record screen cache file; If so, then record screen cache file abnormal time point occurring relevant is preserved.
Preferably, described step 10 comprises further:
11. run record screen program, open thread uninterruptedly record screen by Android application program to be tested;
12. by the automatic test script described in Android application program launching to be tested;
Record screen program described in 13. is monitored according to the ruuning situation of script ruuning situation feedback mechanism to described automatic test script.
Preferably, after generating record screen cache file in described step 20, be adopt first in first out, last-in, last-out the buffering of stack architecture by the record screen cache file that generates stored in buffer area, each record screen cache file has default fixing duration.
Preferably, in described step 30, judge whether the operation of described automatic test script exception occurs, refer to when described automatic test script is out of service, judge whether this automatic test script exception occurs by script ruuning situation feedback mechanism:
If 31. described automatic test scripts are normally out of service, then terminate to record shield and empty described record and shield cache file;
If 32. described automatic test scripts are the operation that abends, then record screen cache file abnormal time point occurring relevant is preserved;
33. record screen cache files relevant according to described generation abnormal time point carry out abnormal inducement judgement and analysis.
In addition, the present invention also provides a kind of Android automatic test record screen system departing from PC, and it comprises:
Script runs modules A, for starting automatic test script;
Record panel module B, monitors for running the ruuning situation of record screen program to described automatic test script, and the snoop results of described record screen program is recorded;
Cache module C, for generating record screen cache file by the snoop results of recorded record screen program;
Analysis module D, for judging whether the operation of described automatic test script exception occurs, if not, then terminates to record and shields and empty described record screen cache file; If so, then record screen cache file abnormal time point occurring relevant is preserved;
Memory module E, for preserving the relevant record screen cache file of described generation abnormal time point.
The invention has the beneficial effects as follows:
A kind of Android automatic test record screen mechanism and record screen system departing from PC of the present invention, it is by starting automatic test script, and the ruuning situation of operation record screen program to described automatic test script is monitored, the snoop results of described record screen program is recorded, and generate record screen cache file, then judge whether the operation of described automatic test script exception occurs, if not, then terminate to record and shield and empty described record screen cache file; If so, then record screen cache file abnormal time point occurring relevant is preserved; Thus only preserve the record screen cache file occurred near abnormal time point, filter other unnecessary information, not only saved storage space, and save the analytical work amount of follow-up abnormal inducement, make test analysis work more targeted, the efficiency of test abnormality processing is higher.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide a further understanding of the present invention, forms a part of the present invention, and schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is a kind of general flow chart departing from the Android automatic test record screen mechanism of PC of the present invention;
Fig. 2 is a kind of structural representation departing from the Android automatic test record screen system of PC of the present invention.
Embodiment
In order to make technical matters to be solved by this invention, technical scheme and beneficial effect clearly, understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
As shown in Figure 1, a kind of Android automatic test record screen mechanism departing from PC of the present invention, it comprises the following steps:
10. start automatic test script, and the ruuning situation of operation record screen program to described automatic test script is monitored;
The snoop results of described record screen program is recorded by 20., and generates record screen cache file;
Whether the operation of the automatic test script described in 30. judgements there is exception, if not, then terminates to record and shields and empty described record screen cache file; If so, then record screen cache file abnormal time point occurring relevant is preserved.
Described automatic test script carries out Scripting Edition according to specified format, or imported the test script edited according to specified format by testing tool outward, and set the time interval etc. performed between the number of times of test case and execution thereof, the time interval of execution and two test cases; Also can set the parameter of carrying out system resource monitoring in test process simultaneously.
Described record screen program can be a kind ofly use common programs language, and such as c language development is out and independent of the executable file of application program to be tested; In the present embodiment, described record screen program is an independently Android application program, and when carrying out the method for testing of Android terminal application program, user carries out startup record screen by the functional module double-clicking described record screen program.
Described step 10 comprises further:
11. run record screen program, open thread uninterruptedly record screen by Android application program to be tested;
12. by the automatic test script described in Android application program launching to be tested;
Record screen program described in 13. is monitored according to the ruuning situation of script ruuning situation feedback mechanism to described automatic test script.
After generating record screen cache file in described step 20, be adopt first in first out, last-in, last-out stack architecture buffering by generate record screen cache file stored in buffer area, each record screen cache file has default fixing duration, such as, the duration of each record screen cache file is 1 minute.
Judge in described step 30 whether the operation of described automatic test script exception occurs, refer to when described automatic test script is out of service, judge whether this automatic test script exception occurs by script ruuning situation feedback mechanism:
If 31. described automatic test scripts are normally out of service, then terminate to record shield and empty described record and shield cache file;
If 32. described automatic test scripts are the operation that abends, then record screen cache file abnormal time point occurring relevant is preserved, such as, abnormal time point occurs described automatic test script is the K moment, then only preserve K moment adjacent several records screen cache files, and empty remaining and shield cache file with record that generation abnormal time point has nothing to do;
33. record screen cache files relevant according to described generation abnormal time point carry out abnormal inducement judgement and analysis.
As shown in Figure 2, the present invention also provides a kind of Android automatic test record screen system departing from PC, and it comprises:
Script runs module, for starting automatic test script;
Record panel module, monitors for running the ruuning situation of record screen program to described automatic test script, and the snoop results of described record screen program is recorded;
Cache module, for generating record screen cache file by the snoop results of recorded record screen program;
Analysis module, for judging whether the operation of described automatic test script exception occurs, if not, then terminates to record and shields and empty described record screen cache file; If so, then record screen cache file abnormal time point occurring relevant is preserved;
Memory module, for preserving the relevant record screen cache file of described generation abnormal time point.
It should be noted that, each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.For record screen system embodiment, because itself and record shield mechanism embodiment basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.And, in this article, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.In addition, one of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be ROM (read-only memory), disk or CD etc.
Above-mentioned explanation illustrate and describes the preferred embodiments of the present invention, be to be understood that the present invention is not limited to the form disclosed by this paper, should not regard the eliminating to other embodiments as, and can be used for other combinations various, amendment and environment, and can in invention contemplated scope herein, changed by the technology of above-mentioned instruction or association area or knowledge.And the change that those skilled in the art carry out and change do not depart from the spirit and scope of the present invention, then all should in the protection domain of claims of the present invention.