CN104750537B - Method and device for executing test case - Google Patents

Method and device for executing test case Download PDF

Info

Publication number
CN104750537B
CN104750537B CN201310751996.5A CN201310751996A CN104750537B CN 104750537 B CN104750537 B CN 104750537B CN 201310751996 A CN201310751996 A CN 201310751996A CN 104750537 B CN104750537 B CN 104750537B
Authority
CN
China
Prior art keywords
virtual machine
test
test execution
execution agent
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310751996.5A
Other languages
Chinese (zh)
Other versions
CN104750537A (en
Inventor
林奕
潘在亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201310751996.5A priority Critical patent/CN104750537B/en
Publication of CN104750537A publication Critical patent/CN104750537A/en
Application granted granted Critical
Publication of CN104750537B publication Critical patent/CN104750537B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a method and a device for executing a test case, wherein the method comprises the following steps: synchronizing the test code to a test execution agent set in the virtual machine, and sending the test case to the test execution agent; detecting the state of a virtual machine in the process that the test execution agent executes the test case according to the test code; and recording abnormal error information of the virtual machine when the state of the virtual machine is detected to be an abnormal state. By adopting the method and the device, the test case can be executed in the virtual machine, so that the occurrence of blue screen errors of the host machine of the virtual machine is avoided, and the stability of test execution is ensured.

Description

Method and device for executing test case
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for executing a test case.
Background
Software testing has become more and more popular and has taken a very important position in the process of developing a project.
In the prior art, the method for software testing can be stand-alone execution testing. The single machine execution test means that test execution and execution control are on the same machine, and although the test execution scheme is simple and low in cost, when some test cases are executed to cause a system blue screen error, the stability of test execution cannot be guaranteed.
Disclosure of Invention
The technical problem to be solved by the embodiments of the present invention is to provide a method and a device for executing a test case, which can ensure stability of test execution by executing the test case in a virtual machine.
A first aspect of an embodiment of the present invention provides a method for executing a test case, where the method may include:
synchronizing the test code to a test execution agent set in the virtual machine, and sending the test case to the test execution agent;
detecting the state of a virtual machine in the process that the test execution agent executes the test case according to the test code;
and recording abnormal error information of the virtual machine when the state of the virtual machine is detected to be an abnormal state.
A second aspect of the embodiments of the present invention provides a device for executing a test case, where the device may include:
the test execution interface module is used for synchronizing the test codes to a test execution agent arranged in the virtual machine and sending the test cases to the test execution agent;
the virtual machine detection module is used for detecting the state of a virtual machine in the process that the test execution agent executes the test case according to the test code;
and the virtual machine debugging module is used for recording abnormal error information of the virtual machine when the virtual machine detection module detects that the state of the virtual machine is an abnormal state.
In the embodiment of the invention, the test cases are executed in the virtual machine, so that when the virtual machine has a blue screen error due to the execution of some test cases by the virtual machine, the blue screen error of a host machine of the virtual machine can be avoided, the stability of test execution is ensured, and meanwhile, abnormal error information about the blue screen error of the virtual machine can be timely recorded.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for executing a test case according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another method for executing a test case according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a further method for executing a test case according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an apparatus for executing a test case according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of another apparatus for executing test cases according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a virtual machine debugging module according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a test execution interface module according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a schematic flow chart of a method for executing a test case according to an embodiment of the present invention is shown, where the method includes:
s101, synchronizing a test code to a test execution agent set in a virtual machine, and sending a test case to the test execution agent;
specifically, a virtual machine is created in a host machine, and the virtual machine provides an execution environment of a sandbox and is used for isolating execution of a test case with a risk of a blue screen error, so that the blue screen error of a system of the host machine is avoided. The host machine may synchronize the test code to a test execution agent set in the virtual machine, and send the test case to the test execution agent, so that the test execution agent executes the test case. The test execution agent can run in a virtual machine system, mainly provides a remote execution capability, and is used for receiving and executing test cases submitted by a host system.
The host machine synchronizes the test code or executable program required by the current test execution into the virtual machine system. The host machine also comprises a test execution interface which is used for providing a use interface and a control end for a user. The test code or executable program may be transmitted through an interprocess communication channel between the test execution interface and the test execution agent, for example, the test code or executable program may be transmitted by means of RPC (Remote Procedure Call Protocol); the test code or executable program may also be transmitted through a network file system between the test execution interface and the test execution agent.
S102, detecting the state of a virtual machine in the process that the test execution agent executes the test case according to the test code;
specifically, in the process that the test execution agent executes the test case according to the test code, the state of the virtual machine can be detected in real time through a virtual machine debugger, and the virtual machine debugger is mainly used for monitoring whether the test execution agent causes a blue screen error of the virtual machine when executing the test case. The virtual machine debugger monitors the virtual machine system by using a kernel debugging technology and a virtual equipment port of the virtual machine. Different kernel debuggers need to be used for different virtual machine system types.
Of course, when the virtual machine has an interface for monitoring the state of the virtual machine, the virtual machine debugger can be replaced by the interface.
S103, recording abnormal error information of the virtual machine when the state of the virtual machine is detected to be abnormal;
specifically, when it is detected that the state of the virtual machine is an abnormal state, the virtual machine debugger may further record abnormal error information of the virtual machine. The abnormal state may be a state in which a blue screen error occurs, and the abnormal error may be system context information of the virtual machine when the blue screen error occurs. When the virtual machine generates a blue screen error, the test execution interface loses the connection with the test execution agent. The virtual machine debugger can also send the abnormal error information to the test execution interface, so that a user can check the abnormal error information through the test execution interface.
In the embodiment of the invention, the test cases are executed in the virtual machine, so that when the virtual machine has a blue screen error due to the execution of some test cases by the virtual machine, the blue screen error of a host machine of the virtual machine can be avoided, the stability of test execution is ensured, and meanwhile, abnormal error information about the blue screen error of the virtual machine can be timely recorded.
Referring to fig. 2 again, a flow chart of another method for executing a test case according to an embodiment of the present invention is shown, where the method includes:
s201, starting a virtual machine and initializing the virtual machine;
specifically, a virtual machine is created in a host machine, and the virtual machine provides an execution environment of a sandbox and is used for isolating execution of a test case with a risk of a blue screen error, so that the blue screen error of a system of the host machine is avoided. When the test case needs to be executed in the virtual machine, the virtual machine can be started and initialized through the virtual machine controller. The virtual machine controller is used for controlling the virtual machine to start, restart, recover and the like by the host system. The virtual machine controller is realized by a control interface provided by the virtual machine, and the interface is different according to different virtual machine systems.
S202, synchronizing the test code to a test execution agent set in the virtual machine;
the host machine may synchronize test code to a test execution agent provided in the virtual machine. The test execution agent can run in a virtual machine system, mainly provides a remote execution capability, and is used for receiving and executing test cases submitted by a host system.
The host machine synchronizes the test code or executable program required by the current test execution into the virtual machine system. The host machine also comprises a test execution interface which is used for providing a use interface and a control end for a user. The test code or executable program may be transmitted through an interprocess communication channel between the test execution interface and the test execution agent, for example, the test code or executable program may be transmitted by means of RPC; the test code or executable program may also be transmitted through a network file system between the test execution interface and the test execution agent.
S203, serializing the test cases, and sending the serialized test cases to the test execution agent so that the test execution agent performs deserialization on the serialized test cases to obtain the test cases;
specifically, in the process that the test execution interface sends the test case to the test execution agent, the test execution interface performs serialization processing on the test case and sends the serialized test case to the test execution agent, so that the test execution agent performs deserialization processing on the serialized test case to obtain the test case.
S204, detecting the state of the virtual machine in the process that the test execution agent executes the test case according to the test code;
specifically, in the process that the test execution agent executes the test case according to the test code, the state of the virtual machine can be detected in real time through a virtual machine debugger, and the virtual machine debugger is mainly used for monitoring whether the test execution agent causes a blue screen error of the virtual machine when executing the test case. The virtual machine debugger monitors the virtual machine system by using a kernel debugging technology and a virtual equipment port of the virtual machine. Different kernel debuggers need to be used for different virtual machine system types.
S205, when the virtual machine state is detected to be an abnormal state, collecting system context information of the virtual machine;
s206, recording the system context information of the virtual machine as abnormal error information of the virtual machine;
specifically, when it is detected that the state of the virtual machine is an abnormal state, the virtual machine debugger may further collect system context information of the virtual machine, and record the system context information of the virtual machine as abnormal error information of the virtual machine. The abnormal state may be a state in which a blue screen error occurs, and the abnormal error may be system context information of the virtual machine when the blue screen error occurs. When the virtual machine generates a blue screen error, the test execution interface loses the connection with the test execution agent.
S207, controlling the virtual machine to restart and recover;
after the virtual machine debugger records the abnormal error information, the virtual machine controller may also control the virtual machine to restart and recover.
S208, prompting abnormal error information of the virtual machine;
after the virtual machine debugger records the abnormal error information, the host machine may prompt the user with the abnormal error information of the virtual machine, and the implementation process may be: the virtual machine debugger sends the recorded abnormal error information of the virtual machine to the test execution interface, and the test execution interface can send the abnormal error information of the virtual machine to a client side, so that a user can check the abnormal error information of the virtual machine.
In the embodiment of the invention, the test cases are executed in the virtual machine, so that when the virtual machine has a blue screen error due to the execution of some test cases by the virtual machine, the blue screen error of a host machine of the virtual machine can be avoided, the stability of test execution is ensured, and meanwhile, abnormal error information about the blue screen error of the virtual machine can be timely recorded.
Referring to fig. 3 again, a flow chart of another method for executing a test case according to an embodiment of the present invention is shown, where the method includes:
s301, starting a virtual machine and initializing the virtual machine;
specifically, a virtual machine is created in a host machine, and the virtual machine provides an execution environment of a sandbox and is used for isolating execution of a test case with a risk of a blue screen error, so that the blue screen error of a system of the host machine is avoided. When the test case needs to be executed in the virtual machine, the virtual machine can be started and initialized through the virtual machine controller. The virtual machine controller is used for controlling the virtual machine to start, restart, recover and the like by the host system. The virtual machine controller is realized by a control interface provided by the virtual machine, and the interface is different according to different virtual machine systems.
S302, synchronizing the test code to a test execution agent set in the virtual machine;
the host machine may synchronize test code to a test execution agent provided in the virtual machine. The test execution agent can run in a virtual machine system, mainly provides a remote execution capability, and is used for receiving and executing test cases submitted by a host system.
The host machine synchronizes the test code or executable program required by the current test execution into the virtual machine system. The host machine also comprises a test execution interface which is used for providing a use interface and a control end for a user. The test code or executable program may be transmitted through an interprocess communication channel between the test execution interface and the test execution agent, for example, the test code or executable program may be transmitted by means of RPC; the test code or executable program may also be transmitted through a network file system between the test execution interface and the test execution agent.
S303, serializing the test cases, and sending the serialized test cases to the test execution agent so that the test execution agent performs deserialization on the serialized test cases to obtain the test cases;
specifically, in the process that the test execution interface sends the test case to the test execution agent, the test execution interface performs serialization processing on the test case and sends the serialized test case to the test execution agent, so that the test execution agent performs deserialization processing on the serialized test case to obtain the test case.
S304, detecting the state of the virtual machine in the process that the test execution agent executes the test case according to the test code;
specifically, in the process that the test execution agent executes the test case according to the test code, the state of the virtual machine can be detected in real time through a virtual machine debugger, and the virtual machine debugger is mainly used for monitoring whether the test execution agent causes a blue screen error of the virtual machine when executing the test case. The virtual machine debugger monitors the virtual machine system by using a kernel debugging technology and a virtual equipment port of the virtual machine. Different kernel debuggers need to be used for different virtual machine system types.
S305, when the virtual machine state is detected to be a normal state, judging whether the test execution agent successfully executes the test case;
specifically, when the virtual machine debugger detects that the state of the virtual machine is a normal state, that is, the virtual machine system runs normally, it may be determined whether the test case is successfully executed by the test execution agent. When the virtual machine debugger detects that the virtual machine state is an abnormal state, namely a blue screen error occurs in a virtual machine system, abnormal error information about the virtual machine blue screen error can be recorded.
S306, receiving a normal execution result sent by the test execution agent;
when it is determined in the step S305 that the test case is successfully executed by the test execution agent, the normal execution result sent by the test execution agent may be received through the test execution interface.
S307, receiving an abnormal execution result sent by the test execution agent;
when it is determined in the step S305 that the test case is not successfully executed by the test execution agent, the abnormal execution result sent by the test execution agent may be received through the test execution interface.
In the embodiment of the invention, the test cases are executed in the virtual machine, so that when the virtual machine has blue screen errors due to the fact that the virtual machine executes some test cases, the blue screen errors of a host machine of the virtual machine can be avoided, the stability of test execution is ensured, meanwhile, abnormal error information about the blue screen errors of the virtual machine can be recorded in time, and the execution result of the virtual machine after the test cases are executed can be received when the virtual machine normally runs.
Referring to fig. 4, a schematic structural diagram of an apparatus 1 for executing a test case according to an embodiment of the present invention is shown, where the apparatus 1 for executing a test case includes: the test execution interface module 10, the virtual machine detection module 20 and the virtual machine debugging module 30;
the test execution interface module 10 is configured to synchronize a test code to a test execution agent set in a virtual machine, and send a test case to the test execution agent;
specifically, a virtual machine is created in a host machine, and the virtual machine provides an execution environment of a sandbox and is used for isolating execution of a test case with a risk of a blue screen error, so that the blue screen error of a system of the host machine is avoided. The test execution interface module 10 may synchronize the test code to a test execution agent provided in the virtual machine, and send the test case to the test execution agent, so that the test execution agent executes the test case. The test execution agent can run in a virtual machine system, mainly provides a remote execution capability, and is used for receiving and executing test cases submitted by a host system.
The test code may also be replaced with an executable program, and the test execution interface module 10 synchronizes the test code or the executable program required for the current test execution into the virtual machine system. The test execution interface module 10 may be a test execution interface, which is a use interface and a control terminal for providing to a user. The test code or executable program may be transmitted through an interprocess communication channel between the test execution interface module 10 and the test execution agent, for example, by means of RPC; the test code or executable program may also be transmitted via a network file system between the test execution interface module 10 and the test execution agent.
The virtual machine detection module 20 is configured to detect a virtual machine state during the process that the test execution agent executes the test case according to the test code;
specifically, in the process that the test execution agent executes the test case according to the test code, the virtual machine detection module 20 may detect the state of the virtual machine in real time, and the virtual machine detection module 20 may be a virtual machine debugger, which is mainly used to monitor whether the test execution agent causes a blue screen error in the virtual machine when executing the test case. The virtual machine debugger monitors the virtual machine system by using a kernel debugging technology and a virtual equipment port of the virtual machine. Different kernel debuggers need to be used for different virtual machine system types.
Of course, when the virtual machine has an interface for monitoring the state of the virtual machine, the virtual machine debugger can be replaced by the interface.
The virtual machine debugging module 30 is configured to record abnormal error information of the virtual machine when the virtual machine detection module 20 detects that the state of the virtual machine is an abnormal state;
specifically, when the virtual machine detection module 20 detects that the state of the virtual machine is an abnormal state, the virtual machine debugging module 30 may record abnormal error information of the virtual machine. The abnormal state may be a state in which a blue screen error occurs, and the abnormal error may be system context information of the virtual machine when the blue screen error occurs. When the virtual machine generates a blue screen error, the test execution interface loses the connection with the test execution agent. The virtual machine debugging module 30 may further send the exception error information to the test execution interface, so that a user may view the exception error information through the test execution interface module 10. The virtual machine debugging module 30 and the virtual machine detection module 20 may belong to a virtual machine debugger.
In the embodiment of the invention, the test cases are executed in the virtual machine, so that when the virtual machine has a blue screen error due to the execution of some test cases by the virtual machine, the blue screen error of a host machine of the virtual machine can be avoided, the stability of test execution is ensured, and meanwhile, abnormal error information about the blue screen error of the virtual machine can be timely recorded.
Referring to fig. 5 again, a schematic structural diagram of another device 1 for executing a test case according to an embodiment of the present invention is provided, where the device 1 for executing a test case includes: the test execution interface module 10, the virtual machine detection module 20, the virtual machine debugging module 30, the judgment module 40 and the virtual machine control module 50;
the test execution interface module 10 is configured to synchronize a test code to a test execution agent set in a virtual machine, and send a test case to the test execution agent;
specifically, a virtual machine is created in a host machine, and the virtual machine provides an execution environment of a sandbox and is used for isolating execution of a test case with a risk of a blue screen error, so that the blue screen error of a system of the host machine is avoided. The test execution interface module 10 may synchronize the test code to a test execution agent provided in the virtual machine, and send the test case to the test execution agent, so that the test execution agent executes the test case. The test execution agent can run in a virtual machine system, mainly provides a remote execution capability, and is used for receiving and executing test cases submitted by a host system.
The test code may also be replaced with an executable program, and the test execution interface module 10 synchronizes the test code or the executable program required for the current test execution into the virtual machine system. The test execution interface module 10 may be a test execution interface, which is a use interface and a control terminal for providing to a user. The test code or executable program may be transmitted through an interprocess communication channel between the test execution interface module 10 and the test execution agent, for example, by means of RPC; the test code or executable program may also be transmitted via a network file system between the test execution interface module 10 and the test execution agent.
The virtual machine detection module 20 is configured to detect a virtual machine state during the process that the test execution agent executes the test case according to the test code;
specifically, in the process that the test execution agent executes the test case according to the test code, the virtual machine detection module 20 may detect the state of the virtual machine in real time, and the virtual machine detection module 20 may be a virtual machine debugger, which is mainly used to monitor whether the test execution agent causes a blue screen error in the virtual machine when executing the test case. The virtual machine debugger monitors the virtual machine system by using a kernel debugging technology and a virtual equipment port of the virtual machine. Different kernel debuggers need to be used for different virtual machine system types.
Of course, when the virtual machine has an interface for monitoring the state of the virtual machine, the virtual machine debugger can be replaced by the interface.
The virtual machine debugging module 30 is configured to record abnormal error information of the virtual machine when the virtual machine detection module 20 detects that the state of the virtual machine is an abnormal state;
specifically, when the virtual machine detection module 20 detects that the state of the virtual machine is an abnormal state, the virtual machine debugging module 30 may record abnormal error information of the virtual machine. The abnormal state may be a state in which a blue screen error occurs, and the abnormal error may be system context information of the virtual machine when the blue screen error occurs. When the virtual machine generates a blue screen error, the test execution interface loses the connection with the test execution agent. The virtual machine debugging module 30 may further send the exception error information to the test execution interface, so that a user may view the exception error information through the test execution interface module 10. The virtual machine debugging module 30 and the virtual machine detection module 20 may belong to a virtual machine debugger.
The judging module 40 is configured to, when the virtual machine detecting module 20 detects that the state of the virtual machine is a normal state, judge whether the test executing agent has successfully executed the test case;
specifically, when the virtual machine detection module 20 detects that the state of the virtual machine is a normal state, the determination module 40 may determine whether the test case is successfully executed by the test execution agent. At this time, the test execution interface module 10 is further configured to receive a normal execution result sent by the test execution agent if the judgment module 40 judges that the result is yes; the test execution interface module 10 is further configured to receive an abnormal execution result sent by the test execution agent if the judgment module 40 judges that the test execution result is negative.
The virtual machine control module 50 is configured to control the virtual machine to restart and recover after the virtual machine debugging module 30 records the abnormal error information of the virtual machine;
specifically, the virtual machine control module 50 may control the virtual machine to restart and recover after the virtual machine debugging module 30 records the abnormal error information of the virtual machine. The virtual machine control module 50 may be a virtual machine controller for controlling virtual machine startup, restart, and recovery, etc. by a host system. The virtual machine controller is realized by a control interface provided by the virtual machine, and the interface is different according to different virtual machine systems.
When the test case needs to be executed in the virtual machine, the virtual machine control module 50 is further configured to start the virtual machine and initialize the virtual machine.
In addition, the test execution interface module 10 is further configured to receive the abnormal error information of the virtual machine recorded by the virtual machine debugging module 30, and prompt the received abnormal error information of the virtual machine;
specifically, the test execution interface module 10 may issue the received abnormal error information of the virtual machine to the client, so that a user may check the abnormal error information of the virtual machine.
The device 1 for executing the test case and the virtual machine can belong to the same host machine, so that the cost is saved, and the stability of test execution is ensured.
Further, referring to fig. 6 again, which is a schematic structural diagram of a virtual machine debugging module 30 according to an embodiment of the present invention, the virtual machine debugging module 30 may include: an acquisition unit 301 and an information recording unit 302;
the acquiring unit 301 is configured to acquire system context information of the virtual machine when the virtual machine debugging module 30 detects that the state of the virtual machine is an abnormal state;
the information recording unit 302 is configured to record system context information of the virtual machine as exception error information of the virtual machine.
Further, referring to fig. 7 again, which is a schematic structural diagram of a test execution interface module 10 according to an embodiment of the present invention, the test execution interface module 10 may include: a synchronization unit 101 and a serialization transmission unit 102;
the synchronization unit 101 is configured to synchronize the test code to a test execution agent set in the virtual machine;
the serialization sending unit 102 is configured to perform serialization processing on the test case, and send the serialized test case to the test execution agent, so that the test execution agent performs deserialization processing on the serialized test case to obtain the test case.
In the embodiment of the invention, the test cases are executed in the virtual machine, so that when the virtual machine has a blue screen error due to the execution of some test cases by the virtual machine, the blue screen error of a host machine of the virtual machine can be avoided, the stability of test execution is ensured, and meanwhile, abnormal error information about the blue screen error of the virtual machine can be timely recorded.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.

Claims (11)

1. A method for executing test cases, comprising:
synchronizing the test code to a test execution agent set in the virtual machine, and sending the test case to the test execution agent; wherein the test code is synchronized from a host machine to the test execution agent, and the test code is transmitted through a test execution interface and an interprocess communication channel of the test execution agent;
the test execution agent runs in the virtual machine system and is used for receiving and executing the test case;
detecting the state of a virtual machine in the process that the test execution agent executes the test case according to the test code;
when the virtual machine state is detected to be an abnormal state, the virtual machine debugger records abnormal error information of the virtual machine through a virtual equipment port of the virtual machine, wherein when the abnormal state is a blue screen error, the test execution interface loses the connection with the test execution agent;
the virtual machine debugger sends the recorded abnormal error information of the virtual machine to the test execution interface, and the test execution interface sends the abnormal error information of the virtual machine to a client;
after the virtual machine debugger records abnormal error information of a virtual machine, the virtual machine controller controls the virtual machine to start or restart or recover through a control interface provided by the virtual machine under the control of the host machine; when the virtual machine state is detected to be a normal state, judging whether the test execution agent successfully executes the test case; if the judgment result is yes, the test execution interface receives a normal execution result sent by the test execution agent; if not, the test execution interface receives the abnormal execution result sent by the test execution agent.
2. The method of claim 1, wherein when detecting that the virtual machine state is an abnormal state, the virtual machine debugger records abnormal error information of the virtual machine through a virtual device port of the virtual machine, and the method comprises:
when the virtual machine state is detected to be an abnormal state, collecting system context information of the virtual machine;
and recording the system context information of the virtual machine as abnormal error information of the virtual machine.
3. The method of claim 2, wherein synchronizing the test code to a test execution agent disposed in a virtual machine and sending test cases to the test execution agent comprises:
synchronizing the test code to a test execution agent set in the virtual machine;
and carrying out serialization processing on the test cases, and sending the serialized test cases to the test execution agent so that the test execution agent carries out deserialization processing on the serialized test cases to obtain the test cases.
4. The method of claim 3, wherein after the step of recording, by the virtual machine debugger, the abnormal error information of the virtual machine through the virtual device port of the virtual machine when the virtual machine state is detected to be the abnormal state, the method further comprises:
and prompting the abnormal error information of the virtual machine.
5. The method of claim 4, wherein prior to the step of synchronizing test code to a test execution agent disposed in a virtual machine and sending test cases to the test execution agent, further comprising:
starting a virtual machine and initializing the virtual machine.
6. An apparatus for executing a test case, comprising:
the test execution interface module is used for synchronizing the test codes to a test execution agent arranged in the virtual machine and sending the test cases to the test execution agent; wherein the test code is synchronized from a host machine to the test execution agent, and the test code is transmitted through the test execution interface module and an interprocess communication channel of the test execution agent;
the test execution agent runs in the virtual machine system and is used for receiving and executing the test case;
the virtual machine detection module is used for detecting the state of a virtual machine in the process that the test execution agent executes the test case according to the test code;
the virtual machine debugging module is used for recording abnormal error information of the virtual machine through a virtual equipment port of the virtual machine when the virtual machine detection module detects that the state of the virtual machine is an abnormal state, wherein the test execution interface loses the connection with the test execution agent when the abnormal state is a blue screen error; sending the recorded abnormal error information of the virtual machine to the test execution interface module, and sending the abnormal error information of the virtual machine to a client by the test execution interface module;
the virtual machine control module is used for controlling the virtual machine to start or restart or recover through a control interface provided by the virtual machine under the control of the host machine after the virtual machine debugger records abnormal error information of the virtual machine;
the judging module is used for judging whether the test executing agent successfully executes the test case or not when the virtual machine detecting module detects that the state of the virtual machine is a normal state;
the test execution interface module is further configured to receive a normal execution result sent by the test execution agent if the judgment module judges that the test execution interface module is yes;
the test execution interface module is further configured to receive an abnormal execution result sent by the test execution agent if the judgment module judges that the test execution interface module is not the test execution interface module.
7. The apparatus of claim 6, wherein the virtual machine debugging module comprises:
the acquisition unit is used for acquiring system context information of the virtual machine when the virtual machine debugging module detects that the state of the virtual machine is an abnormal state;
and the information recording unit is used for recording the system context information of the virtual machine as the abnormal error information of the virtual machine.
8. The apparatus of claim 7, wherein the test execution interface module comprises:
the synchronous unit is used for synchronizing the test codes to the test execution agent arranged in the virtual machine;
and the serialization sending unit is used for carrying out serialization processing on the test cases and sending the serialized test cases to the test execution agent so that the test execution agent carries out deserialization processing on the serialized test cases to obtain the test cases.
9. The apparatus of claim 8,
the test execution interface module is further configured to receive the abnormal error information of the virtual machine recorded by the virtual machine debugging module, and prompt the received abnormal error information of the virtual machine.
10. The apparatus of claim 9,
the virtual machine control module is further configured to start the virtual machine and initialize the virtual machine.
11. A computer-readable storage medium, characterized in that the computer storage medium stores a computer program which, when executed, is adapted to carry out the method of any one of claims 1-5.
CN201310751996.5A 2013-12-31 2013-12-31 Method and device for executing test case Active CN104750537B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310751996.5A CN104750537B (en) 2013-12-31 2013-12-31 Method and device for executing test case

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310751996.5A CN104750537B (en) 2013-12-31 2013-12-31 Method and device for executing test case

Publications (2)

Publication Number Publication Date
CN104750537A CN104750537A (en) 2015-07-01
CN104750537B true CN104750537B (en) 2020-07-14

Family

ID=53590283

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310751996.5A Active CN104750537B (en) 2013-12-31 2013-12-31 Method and device for executing test case

Country Status (1)

Country Link
CN (1) CN104750537B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598594B (en) * 2016-12-14 2020-09-01 捷开通讯(深圳)有限公司 Test system and method for rapidly recovering test program
CN107729187A (en) * 2017-11-03 2018-02-23 郑州云海信息技术有限公司 A kind of test case management disaster recovery method and system based on virtual platform
CN111355629B (en) * 2020-02-17 2021-01-15 苏州亿歌网络科技有限公司 Client test method and device, computer equipment and storage medium
CN113703913B (en) * 2021-08-06 2024-04-23 长江存储科技有限责任公司 Equipment testing method and device
CN114117409A (en) * 2021-11-19 2022-03-01 上海商汤临港智能科技有限公司 User code operation method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102637144A (en) * 2012-03-31 2012-08-15 奇智软件(北京)有限公司 System fault processing method and device
CN102779094A (en) * 2012-08-21 2012-11-14 深圳中兴网信科技有限公司 Terminal and software exception test method
CN102902599A (en) * 2012-09-17 2013-01-30 华为技术有限公司 Virtual machine internal fault processing method, device and system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6978401B2 (en) * 2002-08-01 2005-12-20 Sun Microsystems, Inc. Software application test coverage analyzer
US20050223362A1 (en) * 2004-04-02 2005-10-06 Gemstone Systems, Inc. Methods and systems for performing unit testing across multiple virtual machines
CN101252471B (en) * 2008-03-20 2010-09-29 中兴通讯股份有限公司 Distributed automatization test system and method
CN101447892B (en) * 2008-11-24 2011-12-28 中兴通讯股份有限公司 Distributed test method, system and test server
CN102736972B (en) * 2011-03-30 2016-03-09 国际商业机器公司 The test case treating Test Application carries out the method and system processed
CN102866950B (en) * 2012-09-13 2016-04-20 浪潮(北京)电子信息产业有限公司 A kind of performance test methods of virtual server and testing tool

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102637144A (en) * 2012-03-31 2012-08-15 奇智软件(北京)有限公司 System fault processing method and device
CN102779094A (en) * 2012-08-21 2012-11-14 深圳中兴网信科技有限公司 Terminal and software exception test method
CN102902599A (en) * 2012-09-17 2013-01-30 华为技术有限公司 Virtual machine internal fault processing method, device and system

Also Published As

Publication number Publication date
CN104750537A (en) 2015-07-01

Similar Documents

Publication Publication Date Title
US10491671B2 (en) Method and apparatus for switching between servers in server cluster
CN104750537B (en) Method and device for executing test case
EP3121726B1 (en) Fault processing method, related device and computer
CN101354677B (en) Method for detecting and restoring application program running state and restoring device thereof
CN104133709B (en) The upgrade method and device of embedded system
CN110838953B (en) Test method, test system, electronic equipment and storage medium
CN102279787B (en) Method and device for testing average fault-free time
WO2014169645A1 (en) Method for detecting fault of intelligent terminal, and intelligent terminal
EP2798428B1 (en) Apparatus and method for managing operation of a mobile device
CN107894935B (en) OPS computer module detection processing method and device and electronic equipment
CN106371938A (en) Automatic intelligent delaying shutdown system and method
CN106168974B (en) Method and system for processing multi-system screenshot file
US9465626B2 (en) Method and apparatus for acquiring time spent on system shutdown
WO2024119787A1 (en) Method and apparatus for amd server system installation power-off processing, device and medium
CN106406963B (en) Initialization method and device of Linux system
CN111130888B (en) Fault information collection and prompt method, device, storage medium and mobile terminal
CN1983206A (en) Method and device for automatically restoring software system
CN103235728B (en) The installation method of preset third-party application and device in Android terminal
CN106130815B (en) Board level testing method and device
CN103139036A (en) Electronic equipment and information processing method thereof
CN109032643A (en) The method and apparatus of software upgrading
CN105426304A (en) Control method and device of restart test
CN108347521A (en) A kind of data back up method and device
CN103049344B (en) The method and apparatus of hardware plug fault-tolerant processing
JP5268820B2 (en) Rewriting method for monitoring device program

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant