Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides the test system and the test method for quickly recovering the test program, so that the operating system can be restarted in time and the test program can be recovered to the initial state when the test program has problems, and the test efficiency is improved.
The invention provides a test system for rapidly recovering a test program, which comprises:
the generating module is used for creating a virtual system, configuring the virtual system and starting a test program after the configuration is finished;
the running state judging module is used for monitoring the running state of the test program after the test program is started, and when the running state is normal, the test program starts a test task; sending a restart command when the running state of the test program is abnormal;
the restarting module is used for restarting the system when receiving a restarting command sent by the running state judging module;
and the initialization module is used for automatically restarting the test program after restarting the system and carrying out initialization operation on the test parameters of the test program.
Further, the generating module is further configured to determine an operation mode of the test program after the test program is restarted, and execute a corresponding operation according to a determination result.
Further, the operation mode comprises an administrator mode and a user mode; when the test program is in the administrator mode, changing data in the test program; and when the mode is the user mode, entering a test program to perform a test task.
Further, the changes include modification of initial test parameters, addition or modification of program application files in the absence of files, and configuration files.
Further, the running state judgment module is further configured to send a file missing signal to the generation module when the running state of the test program is that a file is missing; and the generating module switches the operation mode into the administrator mode after receiving the file missing signal.
Further, the generating module is specifically configured to establish a disk copy when the virtual system is configured; marking a system disk as read-only; redirecting operations to the established disk copy; and (4) refreshing the disk copy operation.
The invention also provides a test method for rapidly recovering the test program, which comprises the following steps:
creating a virtual system, configuring, and starting a test program after configuration is completed;
monitoring the running state of the test program after the test program is started, and starting a test task by the test program when the running state is normal; sending a restart command when the running state of the test program is abnormal;
restarting the system upon receiving the transmitted restart command;
and automatically restarting the test program after restarting the system and carrying out initialization operation on the test parameters of the test program.
Further, after the test program is restarted, the operation mode of the test program is judged, and corresponding operation is executed according to the judgment result.
Further, the operation mode comprises an administrator mode and a user mode; when the test program is in the administrator mode, changing data in the test program; when the mode is the user mode, entering a test program to perform a test task;
wherein the changes include modification of initial test parameters, addition or modification of program application files in the absence of files, and configuration files.
Further, the step of creating and configuring a virtual system specifically includes:
establishing a disk copy;
marking a system disk as read-only;
redirecting operations to the established disk copy; and (4) refreshing the disk copy operation.
Compared with the prior art, the test program is operated under the virtual system, the test program in the virtual system is monitored, and the operating system can be automatically restarted and the test program can be initialized when the test program has problems, so that the problem that the test program needs to be reconfigured when the same test is performed again every time is reduced, the problem that the test program needs to be manually maintained when the test program is crashed is also avoided, the time for configuring the test program by a tester is reduced, the test time is greatly shortened, and the working efficiency is improved.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
The invention relates to a test system for rapidly recovering a test program, which comprises:
the generating module is used for creating a virtual system, configuring the virtual system and starting a test program after the configuration is finished;
the running state judging module is used for monitoring the running state of the test program after the test program is started, and when the running state is normal, the test program starts a test task; sending a restart command when the running state of the test program is abnormal;
the restarting module is used for restarting the system when receiving a restarting command sent by the running state judging module;
and the initialization module is used for automatically restarting the test program after restarting the system and carrying out initialization operation on the test parameters of the test program.
The generating module is also used for judging the running mode of the test program after the test program is restarted and executing corresponding operation according to the judgment result.
The operation mode comprises an administrator mode and a user mode; when the test program is in the administrator mode, changing data in the test program; and when the mode is the user mode, entering a test program to perform a test task.
The changes include modification of initial test parameters, addition or modification of program application files in the absence of files, and configuration files.
The running state judging module is also used for sending a file missing signal to the generating module when the running state of the test program is file missing; and the generating module switches the operation mode into the administrator mode after receiving the file missing signal.
The generating module is specifically used for establishing a disk copy when the virtual system is configured; marking a system disk as read-only; redirecting operations to the established disk copy; and (4) refreshing the disk copy operation.
As shown in fig. 1, as an embodiment of the test system for rapidly recovering a test program according to the present invention, the test system is built to run in a virtual system (i.e. a virtual operating system), and the test system includes:
the generating module is used for creating and configuring a virtual system after the Windows operating system is started, and starting a test program after the configuration is finished;
the running state judging module is used for monitoring the running state of the test program after the test program is started, and when the running state is normal, the test program starts a test task; sending a restart command to a restart module when the running state of the test program is abnormal;
the restarting module is used for restarting the Windows operating system after receiving the restarting command sent by the running state judging module;
and the initialization module is used for initializing the test parameters of the test program after the test program is started.
The generating module is also used for judging the running mode of the test program after the test program is started and executing corresponding operation according to the judgment result.
The operation mode comprises an administrator mode and a user mode; when the test program is in the administrator mode, a user changes data in the test program, wherein the change comprises modification of initial test parameters, addition or modification of a program application file and a configuration file when the file is missing, after the change is completed, a generation module sends the changed data to an initialization module, the initialization module replaces or adds the changed data and the initial data, after the replacement or addition, a replacement completion signal is sent to the generation module, and the generation module receives the replacement completion signal and then switches to the user mode;
when the mode is the user mode, the user enters a test program to perform a test task. Therefore, the data can be prevented from being manually restored when the next test is carried out due to the fact that the data are randomly modified in the test program, the test effect is improved, and the time for debugging the test program is shortened. Typically, the user mode is the test system default start-up item.
When the change is the modification of the initial test parameters, after the administrator finishes the modification of the test parameters, the generation module sends the modified test parameters to the output module, and the initialization module replaces the modified test parameters with the initial test parameters.
The running state judging module is further used for sending a file missing signal to the generating module when the running state of the test program is file missing, and the generating module switches the operation mode to the administrator mode after receiving the file missing signal.
When the change is a file loss, an administrator adds or modifies a program application file or a configuration file to data in the test program, after the operation is completed, the generation module sends the changed data to the initialization module, and the initialization module writes or replaces the changed data into the test program to complete the repair of the test program, so that the test program can perform a test task.
And the administrator mode is logged in by means of a user name and a password, and a maintenance management entry is provided for an administrator.
The invention relates to a test method for quickly recovering a test program, which comprises the following steps:
creating a virtual system, configuring, and starting a test program after configuration is completed;
monitoring the running state of the test program after the test program is started, and starting a test task by the test program when the running state is normal; sending a restart command when the running state of the test program is abnormal;
restarting the system upon receiving the transmitted restart command;
and automatically restarting the test program after restarting the system and carrying out initialization operation on the test parameters of the test program.
And judging the running mode of the test program after the test program is restarted, and executing corresponding operation according to the judgment result.
The operation mode comprises an administrator mode and a user mode; when the test program is in the administrator mode, changing data in the test program; when the mode is the user mode, entering a test program to perform a test task;
wherein the changes include modification of initial test parameters, addition or modification of program application files in the absence of files, and configuration files.
The step of creating and configuring a virtual system specifically includes:
establishing a disk copy;
marking a system disk as read-only;
redirecting operations to the established disk copy; and (4) refreshing the disk copy operation.
As shown in fig. 2, an embodiment of the test method for quickly recovering a test program according to the present invention includes the following steps:
step one, S01, after the Windows operating system is started, creating a virtual system and configuring, and after the configuration is finished, starting a test program;
step two, S02, initializing a test program;
step three, S03, judging the running mode of the test program, and if the running mode is the administrator mode, entering the step S06; if the mode is the user mode, go to step S04;
step four S04, judging the running state of the test program, if normal, entering step five S05; if the abnormal condition is determined, J enters a step seven S07; if the file is missing, step S06 is performed;
step five S05, starting a test task by the test program;
step six S06, the administrator changes the data in the test program, and the original data is replaced after the change is finished, and the step four S04 is returned; the modification comprises modification of initial test parameters, addition or modification of program application files and configuration files when files are missing; when the initial test parameters are modified, the administrator modifies the initial test parameters, and returns to step S04 after replacing the initial test parameters after the modification is completed; when the file is missing, the administrator adds or modifies the program application file or configuration file to the test program, and after the modification is completed, writes or replaces the modified data into the test program and returns to step S04.
Step S07, restarting the Windows operating system and returning to the step one S01.
The configuration of the virtual system in the invention can be carried out by adopting a configuration method of the virtual system in the prior art, and can also adopt the following method. As shown in fig. 3, the steps of configuring the virtual system by the generating module and configuring the virtual system in the recovery method both include:
step one, S101, establishing a disk copy, establishing a disk under a virtual system, and isolating the disk from a system disk of a Windows operating system, so as to avoid damaging, mistakenly deleting or tampering a system file in the system disk of the Windows operating system;
step two, S102, marking a system disk of the original Windows operating system as read-only, and limiting any modification operation in a user operating mode;
step three, S103, redirecting operation to the established disk copy; any operation on the system disk of the Windows operating system points to the disk created under the virtual system;
step S104, refreshing the disk copy operation to enable the disk created by the virtual system to be capable of reading, writing and modifying.
The following describes the present invention in detail with reference to the test system and test method of the present invention:
step one, after a Windows operating system is started, a generating module creates a virtual system and configures, and after configuration is completed, a test program is started and an initialization instruction is sent to an initialization module;
step two, the initialization module initializes the test program after receiving the initialization instruction and returns completion information to the generation module after completing initialization;
step three, after receiving the completion information, the generation module judges the running mode of the test program, and if the running mode is the administrator mode, the generation module enters step six; if the mode is the user mode, entering a step four;
step four, the running state judging module judges the running state of the test program, and if the running state is normal, the step five is carried out; the file missing operation state judgment module sends a file missing signal to the generation module and enters the sixth step; entering the seventh step if the abnormality occurs;
step five, starting a test task by the test program;
step six, the generation module enters an administrator mode, an administrator modifies the data in the test program, the generation module sends the modified data to an initialization module, the initialization module replaces or increases the modified data and the initial data, a replacement completion signal is sent to the generation module after replacement or increase, and the generation module returns to the step four after receiving the replacement completion signal;
and step seven, the running state judgment module sends a restart command to the restart module, and the restart module restarts the Windows operating system after receiving the restart command and returns to the step one.
The modification comprises modification of initial test parameters, addition or modification of program application files and configuration files when files are missing;
in the sixth step, when the generation module receives the file missing signal, the generation module switches the operation mode into an administrator mode, an administrator adds or modifies a program application file or a configuration file to the test program, after the operation is completed, the generation module sends the modified data to the initialization module, and the initialization module writes or replaces the modified data into the test program to complete the repair of the test program, so that the test program can perform a test task.
When the mode is the user mode, the user enters a test program to perform a test task. Therefore, the data can be prevented from being manually restored when the next test is carried out due to random data modification in the test city, the test effect is improved, and the time for debugging the test program is shortened. Typically, the user mode is the test system default start-up item.
The test program is a default starting program in the virtual system, and the test program is a corresponding test program required to be tested in a laboratory, and is not particularly limited herein.
While the invention has been shown and described with reference to certain embodiments, those skilled in the art will understand that: various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims and their equivalents.