Summary of the invention
The technical problem to be solved is to provide in a kind of automatic test the target program progress control method and device that can automatically recover, solve in the running of automatic test program, when being caused system operation exception by software issue, ensure that automatic test program can revert to the problem that normal condition continues to run with, reach the purpose of Windows system automation test.
In order to solve the problems referred to above, the invention provides the target program progress control method that can automatically recover in a kind of automatic test, comprise the steps:
Described target program is sequentially divided into multiple there is uniquely identified can the module of independent operating, set up a configuration file for recording the implementation status of the module being currently executing, and the configuration file of described target program and correspondence is saved in nonsystematic subregion;
Performance objective program, it is judged that if current system operation exception, then according to pre-setting automatic reboot operation system, and use the system image file access pattern operating system made in advance;
After recovery system, that inquires about in described configuration file record causes abnormal module id, brings into operation described target program from the next module of this module id.
Further, said method may also include, and described image file is stored in nonsystematic subregion by making in advance, provides and recover boot entry in system starting process, startup is pointed to described image file by this recovery boot entry, and uses this image file recovery operation system.
Further, said method may also include, and described target program is preconfigured to and automatically runs after os starting.
Further, said method may also include, if described judgement current system operation exception, then according to the step pre-setting automatic reboot operation system, is by being pre-configured with realization.
Further, said method may also include, and after each os starting, described target program first the acquiescence boot entry in start-up course is pointed to described recovery boot entry.
Further, said method may also include, and during described target program runs, it is judged that if current system normally restarts, is then pointed to by the acquiescence boot entry in described start-up course before restarting and normally starts boot entry.
Further, said method may also include, described described target program is sequentially divided into multiple there is uniquely identified can the module of independent operating, set up a configuration file for recording the implementation status of the module being currently executing, and the configuration file of described target program and correspondence is saved in the step of nonsystematic subregion, farther include:
It is pre-configured with the action after system operation exception for Debugging message dump to nonsystematic subregion is generated dump file.
Further, said method may also include, and after each os starting, whether having newly-increased dump file, if had, backing up the content of described newly-increased dump file in inquiry nonsystematic subregion.
Further, said method may also include, and after described target program has performed last module, collects the dump file of described backup, automatically generates and perform report.
Present invention also offers the target program operating control device that can automatically recover in a kind of automatic test, including:
Target program performs record unit, for described target program is sequentially divided into multiple there is uniquely identified can the module of independent operating, setting up a configuration file for recording the implementation status of the module being currently executing, the configuration file of wherein said target program and correspondence is saved in nonsystematic subregion; And
Object program executing unit, for performance objective program, if judging current system operation exception, then according to pre-setting automatic reboot operation system, and by after the system image file access pattern operating system that makes in advance, that inquires about in described configuration file record causes abnormal module id, brings into operation described target program from the next module of this module id.
Further, said apparatus may also include system backup unit, for manufacturing system image file and be stored in nonsystematic subregion; And
Acquiescence boot entry amendment unit, for after each os starting, acquiescence boot entry in start-up course is pointed to one and recovers boot entry, the image file of the system partitioning that this recovery boot entry is made in advance by this system backup unit and generate, described image file is pointed in startup, and uses this image file recovery operation system.
Further, said apparatus may also include, described acquiescence boot entry amendment unit, is further used in described target program runs, if judging when current system normally restarts, then before restarting, the acquiescence boot entry in described start-up course is pointed to and normally start boot entry.
Further, said apparatus may also include dispensing unit, for being configured to after os starting automatically run by the startup item of described target program, and configures the action after system operation exception for resetting automatically;
Described object program executing unit is to realize automatic reboot operation system by arranging of dispensing unit of reading.
Further, said apparatus may also include, described dispensing unit, is further used for the action after configuration system operation exception for Debugging message dump to nonsystematic subregion is generated dump file.
Further, said apparatus may also include dump file backup units, for, after each os starting, whether having newly-increased dump file, if had, backing up the content of described newly-increased dump file in inquiry nonsystematic subregion.
Further, said apparatus may also include collector unit, for, after described target program has performed last module, collecting the dump file of described backup, automatically generate and perform report.
Compared with prior art, the application present invention, can ensure that in automatic test course, simulation windows under real user behavior and due to software issue cause system operation exception time, can automatic recovery system and automatically perform test process, what guarantee automatic test continuously carries out ability, is truly realized unattended automatic test. The current present invention, through practice, has the plurality of advantages such as the software compatibility, stability, vigorousness, reliability.
Detailed description of the invention
Below in conjunction with the drawings and specific embodiments, the invention will be further described.
As in figure 2 it is shown, the target program progress control method that can automatically recover in a kind of automatic test of the present invention, comprise the steps:
Step 210, described target program is sequentially divided into multiple there is uniquely identified can the module of independent operating, set up a configuration file for recording the implementation status of the module being currently executing, and the configuration file of described target program and correspondence is saved in nonsystematic subregion;
Step 220, performance objective program, it is judged that if current system operation exception, then according to pre-setting automatic reboot operation system, and use the system image file access pattern operating system made in advance;
If described judgement current system operation exception, then according to the step pre-setting automatic reboot operation system, it is by being pre-configured with realization.
After step 230, recovery system, that inquires about in described configuration file record causes abnormal module id, brings into operation described target program from the next module of this module id.
Wherein, described image file is stored in nonsystematic subregion by making in advance, and for for the recovery boot entry in start-up course, startup is pointed to described image file by this recovery boot entry, and uses this image file recovery operation system.
The startup item of described target program is preconfigured to automatically to be run after os starting.
After each os starting, described target program first the acquiescence boot entry in start-up course is pointed to described recovery boot entry. All restoring system after system can being started every time by this setting, guarantee after system operation exception, after os starting, target program can carry out system reducing by recovery boot entry, normally starts boot entry without entering, again leads to system operation exception.
Further, during described target program runs, it is judged that if current system normally restarts, then before restarting, the acquiescence boot entry in described start-up course is pointed to and normally start boot entry. By this setting, it is possible to when normally starting after normally having performed certain module, it is not necessary to carry out system reducing, save system resource every time, also reduce the time that target program runs, improve efficiency.
Also include: be pre-configured with the action after system operation exception for Debugging message dump to nonsystematic subregion is generated dump file.
After each os starting, whether inquiry nonsystematic subregion there is newly-increased dump file, if had, backing up the content of described newly-increased dump file.
Farther include: after described target program has performed last module, collect the dump file of described backup, automatically generate and perform report.
Pass through dump file, it is possible to clearly analyze the concrete reason of the module causing system operation exception, it is simple to user is adjusted, it is to avoid reappear system operation exception.
As it is shown on figure 3, control method of the present invention occurs the embodiment of restoring system during blue screen for test module in testing, comprise the following steps:
Step 310, system being backed-up and stores, being arranged to the configuration file of system test, this configuration file is for recording the execution information of test module;
Wherein, by the mode of Ghost mirror image, system can be backed-up.
After system is backed-up, can pass through to arrange the mode of system registry, make system restart when blue screen occurs, and obtain blue screen Debugging message when blue screen occurs in system and store this blue screen Debugging message.
Wherein, the execution information testing module includes the serial number (CaseID) of test module and the status information of test module.
In the status information of test module, 0 represents the original state of whole test, represents that test program needs to bring into operation; 1 represents beginning state, represents that test module starts to perform; 2 represent done state, represent that test module performs to terminate. Such as: serial number is the test module of 35, and its status information is 2, illustrate that it has completed test; Serial number is the test module of 36, and its status information is 1, illustrates that it starts test, it is likely that test does not pass through, the like. The serial number of status information and its correspondence testing module can be passed through, determine which test module present stage goes to, and will also realize that the implementation status of executed test module, for in status information 0,1 and 2, simply enumerate, for the indicating mode of other status informations, the present invention is not construed as limiting.
Step 320, startup automatic test, perform test module successively and new configuration file is more tested the execution information of module, if judgement restarts system after there is blue screen, system reducing is carried out, according to the execution information of the test module of record in configuration file, it is determined that cause that the test module of blue screen occurs in system by the system backup stored, skip this test module, performing next one test module, the rest may be inferred, until completing the test of all test modules.
Wherein, to carry out system reducing be by the mode of Ghost according to storage system backup system is reduced.
Described according to the execution information of the test module of record in configuration file, it is determined that to cause that the test module of blue screen occurs in system, perform the step of next one test module, including:
Serial number according to the status information He its correspondence of testing module in configuration file, it is determined that cause that the serial number of the test module of blue screen occurs in system, performs the test module of next serial number.
Such as: when going to the 3rd test module, blue screen occur, restart after system and carry out system reducing, being 1 according to the state of the 3rd test module of record in configuration file, system determines that the 3rd module causes blue screen, performs the 4th test module; When going to the 8th test module, blue screen occurs again, restart after system and carry out system reducing, it is 1 according to the state of the 3rd test module of record in configuration file, and the state of the record the 8th test module is also 1, now system determines that current 8th module causes blue screen, performs the 9th test module, the rest may be inferred, until completing the test of all test modules.
After completing the test of all test modules, also include: read the blue screen Debugging message of storage, the reason of the test module causing that blue screen occurs in system can be analyzed according to blue screen Debugging message.
Farther include: before bringing into operation after restarting system every time, carry out system reducing by the system backup stored. Namely after the execution process being successfully completed a test module, restart system, system reducing can be carried out. So by system introducing to reduction-mode after restarting system, can automatically into the system reducing process of Ghost, automatic recovery system after blue screen now occurs.
Present invention can ensure that automatic test course is when the real user behavior simulated under windows causes system operation exception (as blue screen occurs in system) due to software issue (program or drive compatibility issue), can automatic recovery system and automatically perform test process, what guarantee automatic test continuously carries out ability, is truly realized unattended automatic test. The current present invention, through practice, has the plurality of advantages such as the software compatibility, stability, vigorousness, reliability.
From brand-new angle, the present invention considers that existing technology performs pattern, originally artificial operation is replaced with the execution automatically of computer, it is truly realized the unmanned in automatic test and automatic recovery system function, greatly reduce workload, improve the work efficiency of automatic test, this invention can be widely used in the solution of all kinds of software automated testing.
Another embodiment of the present invention is presented herein below, comprises the steps:
The image file of manufacturing system subregion in advance, and store to nonsystematic subregion, to provide the recovery boot entry in start-up course, startup is pointed to described image file by this recovery boot entry, and uses this image file recovery operation system;
In advance the startup item of described target program is configured to after os starting automatically run, and configures the action after system operation exception for resetting automatically;
Described target program is sequentially divided into multiple module, and is one unique mark of each module assignment, set up a configuration file for recording the module id being currently executing, and the configuration file of described target program and correspondence is saved in nonsystematic subregion;
After each os starting, first the acquiescence boot entry in start-up course is pointed to described recovery boot entry by described target program, and inquire about in described configuration file the module id of record, bring into operation described target program from the next module of this module id.
An instantiation according to above-mentioned embodiment is presented herein below, and whole execution flow process can be divided into 3 parts:
One, the initialization context preparatory stage
A) initialize system environments and make Ghost mirror image
I. system environments (being used for the CrashDump mode after system blue screen is set and follow-up system autostart function) is initialized.
1. configure the startup item (allowing automatic test program automatically run after every time restarting system) of automatic test program
A) need to arrange one string item auto of establishment under system registry list item HKEY_LOCAL_MACHINE SOFTWARE Microsoft Windows CurrentVersion Run, content point to start automatic test program path, for instance: e: autotool autotest.exe.
2. as shown in Figure 4, the configuration after blue screen occurs in system is set:
A) human window input controlsysdm.cpl, starts system property window,
B) click senior-> to arrange, be on and fault recovery window;
C) setting is resetted automatically;
The write complete core dump of Debugging message-> (obtaining complete blue screen Debugging message during for obtaining fulldump and blue screen) d) is set;
E) dump file path is set, it is noted here that use system default path %SystemRoot% MEMORY.DMP, this refers to c: under windows path, All Files under c dish all can be recovered to fall by each system reducing, MEMORY.DMP file just cannot remain, be therefore arranged on here e: MEMORY.DMP;
F) any existing file of covering is cancelled. (MEMORY.DMP also for after each blue screen of reservation);
G) initialized system reducing mirror image is made, as it is shown in figure 5, select a key Ghost to realize;
H) the system image GHO file made can automatically save in systems under last drive, for instance F:��1 C_PAN.GHO, so far environmental preparation has worked.
Two, automatic test cases performs the stage
A) automatic test program performs a collection of test case (namely testing module) due to needs, it is thus desirable to record a configuration file under test catalogue, as shown in Figure 6, for preserving the test case ID (CaseID) of last execution; Simultaneously need to record one performs pattern, definition 0 here is the original state of whole test, and test program needs to bring into operation, and 1 represents beginning state, represents that CaseID starts to perform, and 2 represent done state, represents that CaseID performs to terminate.
B) automatically performing after restarting system owing to being provided with automatic test program in the reduction mirror image of test execution environments, therefore, program can pass through the value the configuring mode switch as the execution of automatic test program every time. Working as of acquiescence is absent from above-mentioned configuration file under automatization's catalogue, be not carried out automatic test case, but automatically terminate after normally starting with system after restarting system.
When c) starting whole automatic test program, tester has disposed measurand by hand and has namely installed the software of beta version in systems every time, so that it may start automatic test program.
D) automatic test program requires over a batch processing before activation first to arrange the mode value of configuration file is 0, caseID arrange needs from which use-case start to perform, and then calling interface Auto_reboot (), restarts system.
E) now automatic test program with system start-up, bring into operation, the moment automatic test program brought into operation after every time restarting system arranges system at once and enters reduction-mode (this is the key arranged in test), but does not restart system.
Automatic test program brings into operation:
I. the system that arranges enters reduction-mode, it is possible to calling external interface Auto_setrecover () and complete, its principles illustrated is as follows:
1. enter system recovery at present, depend on corresponding menu.lst in Ghost and set the One-key recovery systemic-function of a key reduction;
2. as it is shown in fig. 7, preserve configuration file c: dosh ghost gho_run.ini:
Wherein timeout represents to restart after rear waiting time 5s, default=2 representative is restarted and enters system reducing pattern, for the Ghost mirror image that automatic reduction step 1 init state preserves, recovery system.
3. as shown in Figure 8, inlet point after system reboot is set;
4. specifically, under XP system directly amendment c: boot.ini, wherein default=C: GHLDR (acquiescence enter Ghost reduce menu);
5. specifically, under Win7 or vista system configure bootmgr, arrange startup item be C: GHLDR.
Ii following automatic test program starts properly functioning, order implementation of test cases.
1. when meeting with blue screen in running, system can initially enter dumpmemory state automatically, after this process completes, system is restarted automatically, due to every secondary program system run before all by system introducing to reduction-mode, can automatically into the system reducing process of Ghost after blue screen now occurs, automatic recovery system, after system recovery, automatic test program reads local configuration file, owing to being configured with reservation before blue screen, find have a new MEMORY.DMP file to occur simultaneously, now it is believed that the last time blue screen occurred, start to back up MEMORY.DMP, skip a caseID simultaneously, automatically next use-case is performed, thus ensure that a whole set of program circuit has been smoothed out.
2. when restarting system in system operation normally without blue screen generation, program recovers the system reducing state configured before before restarting, operating system can normally be restarted until a whole set of testing process has run.
3 EP (end of program) states
A) when automatic test program completes the execution of the last item test case, system automatically generates report, before collection, the MEMORY.DMP file of backup, completes whole automatic test course, it is possible to produced the reason of blue screen by each test case of MEMORY.DMP file analysis.
It is based on the basis of existing Ghost reduction software (wherein indication is Ghost one-key restoration software) improvement and expansion that carry out in instances, certainly it is fixed to be not limited, as long as system backup can be realized and the mode reduced can serve as embodiments of the present invention.
As shown in Figure 9, a kind of target program operating control device that can automatically recover in the automatic test of the present invention, including: target program performs record unit 901, object program executing unit 902, system backup unit 903, acquiescence boot entry amendment unit 904, dispensing unit 905, dump file backup units 906 and collector unit 907, wherein
Target program performs record unit 901, for described target program is sequentially divided into multiple there is uniquely identified can the module of independent operating, setting up a configuration file for recording the implementation status of the module being currently executing, the configuration file of wherein said target program and correspondence is saved in nonsystematic subregion;
Object program executing unit 902, for performance objective program, if judging current system operation exception, then according to pre-setting automatic reboot operation system, and by after the system image file access pattern operating system that makes in advance, that inquires about in described configuration file record causes abnormal module id, brings into operation described target program from the next module of this module id;
System backup unit 903, for manufacturing system image file and be stored in nonsystematic subregion;
Acquiescence boot entry amendment unit 904, for after each os starting, acquiescence boot entry in start-up course is pointed to one and recovers boot entry, the image file of the system partitioning that this recovery boot entry is made in advance by this system backup unit 903 and generate, described image file is pointed in startup, and uses this image file recovery operation system;
Dispensing unit 905, for the startup item of described target program is configured to after os starting automatically run, and configuring the action after system operation exception for resetting automatically, the action after configuration system operation exception is that Debugging message dump to nonsystematic subregion is generated dump file;
Whether dump file backup units 906, for, after each os starting, having newly-increased dump file in inquiry nonsystematic subregion, if had, backing up the content of described newly-increased dump file;
Collector unit 907, for, after described target program has performed last module, collecting the dump file of described backup, automatically generate and perform report.
Described acquiescence boot entry amendment unit 904, is further used in described target program runs, it is judged that if current system normally restarts, then pointed to by the acquiescence boot entry in described start-up course before restarting and normally start boot entry.
Described object program executing unit 902 is to realize automatic reboot operation system by arranging of dispensing unit 905 of reading.
The present invention is that all kinds of automatic test program encounters system when there is blue screen in the process of implementation, a kind of recovery process automatically is provided, and recovery test environment ensure that the solution continued executing with, for guaranteeing automatic test program in the process of implementation, particularly perform the software compatibility, during robustness testing automatic test cases, completely disengage from manual monitoring, there is provided strong guarantee, it is ensured that automatic test program reliability of operation and seriality.
The above; being only the present invention preferably detailed description of the invention, but protection scope of the present invention is not limited thereto, any people being familiar with this technology is in the technical scope that disclosed herein; the change that can readily occur in or replacement, all should be encompassed within protection scope of the present invention. Therefore, protection scope of the present invention should be as the criterion with scope of the claims.