CN110502366B - Case execution method, device, equipment and computer readable storage medium - Google Patents

Case execution method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN110502366B
CN110502366B CN201910634552.0A CN201910634552A CN110502366B CN 110502366 B CN110502366 B CN 110502366B CN 201910634552 A CN201910634552 A CN 201910634552A CN 110502366 B CN110502366 B CN 110502366B
Authority
CN
China
Prior art keywords
case
execution
fault
state
information
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
CN201910634552.0A
Other languages
Chinese (zh)
Other versions
CN110502366A (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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201910634552.0A priority Critical patent/CN110502366B/en
Priority to PCT/CN2019/117309 priority patent/WO2021008029A1/en
Publication of CN110502366A publication Critical patent/CN110502366A/en
Application granted granted Critical
Publication of CN110502366B publication Critical patent/CN110502366B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1417Boot up procedures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Retry When Errors Occur (AREA)

Abstract

The invention relates to the technical field of research and development management, and discloses a case execution method. The invention also discloses a case executing device, equipment and a computer readable storage medium, and arranges the automatic restart operation of the case according to the node position and the context data, thereby reducing the control difficulty of the system for executing the case, simultaneously realizing the continuous execution control when the case fails to be executed, saving the execution control time of the case by continuously executing, and improving the success rate of case execution.

Description

Case execution method, device, equipment and computer readable storage medium
Technical Field
The present invention relates to the field of research and development management technologies, and in particular, to a case execution method, apparatus, device, and computer-readable storage medium.
Background
In the existing execution control mode for the case, the case often fails or is paused for various reasons in the execution process, and for such a situation, the solution in the prior art is to perform operations such as failed re-running, failed continued re-running, and selectively paused re-running on the case, but most of the operations for realizing the re-running are performed by manual inspection and manual control, and for the case which cannot be continued, the case is restarted and the case is re-executed, and such a case control execution mode is very human resource-consuming and is not favorable for the current development requirement of intellectualization.
Disclosure of Invention
The invention mainly aims to provide a case execution method, a case execution device, case execution equipment and a computer-readable storage medium, and aims to solve the technical problem that control over fault cases is time-consuming in the existing case execution control mode.
In order to achieve the above object, the present invention provides a case executing method, which includes the following steps:
acquiring executed or executing case information on equipment, and checking the execution condition of a case according to the case information to determine whether the case is in a fault execution state;
if the case is in the fault execution state, inquiring a fault reason corresponding to the case in the current fault execution state from a preset relation table corresponding to the fault execution state and the fault reason according to the fault execution state;
acquiring a node position of the case in a current fault execution state, and generating a case execution log based on the fault reason and the node position, wherein the case execution log further comprises identification information for recording whether the fault of the case is processed;
judging whether the fault corresponding to the fault reason is eliminated or not according to the identification information in the case execution log;
if the fault is judged to be eliminated, taking the node position recorded in the case execution log as a starting point of case execution, reloading the case information into a case execution unit of the equipment, and continuously executing the case by taking the starting point as an execution point;
and if the fault is judged not to be eliminated, reloading the case information into a case execution unit of the equipment to restart and execute the case.
Optionally, the generating a case execution log based on the failure cause and the node location includes:
acquiring template information of the case execution log, wherein the template information is a table for recording the execution condition of the case and the generated information;
acquiring an execution code corresponding to the node position and context information of the node position;
recording the execution generation of the node location, the failure reason and the context information in the table to form a case execution log, wherein the context information comprises at least one of a cookie, a login state, a variable and a timestamp.
Optionally, the fault execution state includes an execution interruption state and an execution failure state;
the obtaining of the node position of the case in the current fault execution state, and generating a case execution log based on the fault cause and the node position includes:
judging whether the fault execution state is an execution interruption state;
if the execution interruption state is judged, acquiring the node position where the case execution is interrupted, and recording the node position into the case execution log;
if the execution state is not the execution interruption state, judging whether the fault execution state meets the condition of the execution failure state;
if the condition of the execution failure state is judged to be met, determining a fault reason causing the case execution failure and a node position causing the case execution failure, and recording the fault reason and the node position into the case execution log.
Optionally, the determining a failure cause causing the case execution failure includes:
detecting whether a new case with execution priority setting is started in the case execution process of the case execution unit;
detecting whether a working environment corresponding to the execution of the case changes, wherein the working environment comprises configuration items of the equipment, a server of the equipment, a test scene of the case execution and a network used by the equipment;
detecting whether the case is an execution failure due to a non-functional problem, wherein the non-functional problem is a failure not caused by software configuration or hardware configuration of the device.
Optionally, after detecting that there is a new case with execution priority set, the case execution method further includes:
judging whether the execution priority of the new case is greater than the execution priority of the currently executed case;
if yes, judging whether the new case and the currently executed case are the same type of case;
if the cases are the same type, replacing the currently executed case with the new case, and executing the new case;
if the cases are not of the same type, setting the currently executed case as an execution interruption state or an execution failure state, skipping to the new case for execution, and returning to the case set as the execution interruption state or the execution failure state for continuous execution after the new case is executed.
Optionally, the taking the node position recorded in the case execution log as a starting point of case execution, and reloading the case information into a case execution unit of the device, where continuing to execute the case with the starting point as an execution point includes:
if the fault execution state is an execution failure state, acquiring the class name and the method name of the case in the execution failure state through reflection;
and reading the context information from the case execution log according to the class name and the method name, and calling a case execution failure processing strategy to restart the case in the execution failure state.
Optionally, before the step of reloading the case information into the case execution unit of the device to perform restart execution processing on the case, the method further includes: performing type division on the case according to the fault reason;
the reloading the case information into the case execution unit of the device to perform the restart execution processing on the case includes:
selecting a corresponding case cache region from the equipment according to the type of the case;
and loading the case information to be reloaded into the case cache region to wait for the calling and execution of the case execution unit.
In addition, to achieve the above object, the present invention provides a case executing apparatus, including:
the monitoring module is used for acquiring executed or executing case information on equipment and checking the execution condition of a case according to the case information to determine whether the case is in a fault execution state;
the query module is used for querying a fault reason corresponding to the case in the current fault execution state from a preset relation table corresponding to the fault execution state and the fault reason according to the fault execution state when the case is in the fault execution state;
the recording module is used for acquiring the node position of the case in the current fault execution state and generating a case execution log based on the fault reason and the node position, wherein the case execution log further comprises identification information for recording whether the fault of the case is processed or not;
the judging module is used for judging whether the fault corresponding to the fault reason is eliminated or not according to the identification information in the case execution log;
the processing module is used for taking the node position recorded in the case execution log as a starting point of case execution when the fault is judged to be eliminated, reloading the case information into a case execution unit of the equipment, and continuously executing the case by taking the starting point as an execution point; and when the fault is judged not to be eliminated, reloading the case information into a case execution unit of the equipment to restart and execute the case.
Optionally, the recording module includes an acquisition subunit and a log generation subunit;
the acquisition subunit is used for acquiring template information of the case execution log, wherein the template information is a table for recording the case execution condition and the generated information; acquiring an execution code corresponding to the node position and context information of the node position;
and the log generating subunit is configured to record the execution generation of the node location, the failure cause, and the context information in the table to form a case execution log, where the context information includes at least one of a cookie, a login state, a variable, and a timestamp.
Optionally, the fault execution state includes an execution interruption state and an execution failure state; the recording module comprises a detection subunit and a recording subunit
The detection subunit is configured to determine whether the fault execution state is an execution interruption state;
the recording subunit is configured to, when the execution interruption state is determined, obtain a node position where the execution of the case is interrupted, and record the node position into the case execution log;
the detection subunit is configured to, when it is determined that the execution interruption state is not the execution interruption state, determine whether the failure execution state satisfies a condition of the execution failure state;
and the recording subunit is configured to, when it is determined that the condition of the execution failure state is satisfied, determine a failure cause causing the case execution failure and a node position at which the case execution failure is caused, and record the failure cause and the node position in the case execution log.
Optionally, the recording subunit is configured to detect whether a new case with execution priority set exists and is started in the process of executing the case by the case executing unit; detecting whether a working environment corresponding to the execution of the case is changed or not, wherein the working environment comprises configuration items of the equipment, a server of the equipment, a test scene executed by the case and a network used by the equipment; detecting whether the case is an execution failure due to a non-functional problem, wherein the non-functional problem is a failure not caused by software configuration or hardware configuration of the device.
Optionally, the determining module is further configured to determine whether the execution priority of the new case is greater than the execution priority of the currently executed case; if yes, judging whether the new case and the currently executed case are the same type of case;
when the cases are judged to be of the same type, replacing the currently executed case with the new case, and executing the new case;
and the processing module is used for setting the currently executed case as an execution interruption state or an execution failure state when judging that the cases are not of the same type, skipping to the new case for execution, and returning to the case set as the execution interruption state or the execution failure state for continuing the execution after the new case is executed.
Optionally, if the fault execution state is an execution failure state, the processing module is configured to obtain, through reflection, the class name and the method name of the case in the execution failure state; and reading the context information from the case execution log according to the class name and the method name, and calling a case execution failure processing strategy to restart the case in the execution failure state.
Optionally, the case executing apparatus further includes a classifying module, configured to classify the cases according to the failure cause;
the processing module is used for selecting a corresponding case buffer area from the equipment according to the type of the case; and loading the case information to be reloaded into the case cache region to wait for the calling and execution of the case execution unit.
In addition, to achieve the above object, the present invention provides a case executing apparatus, including: a memory, a processor, and a case execution program stored on the memory and executable on the processor, the case execution program when executed by the processor implementing the steps of the case execution method as in any of the above.
Furthermore, to achieve the above object, the present invention provides a computer-readable storage medium, on which a case execution program is stored, the case execution program, when executed by a processor, implementing the steps of the case execution method according to any one of the above.
The method and the device have the advantages that the reason of case execution failure is detected, the detected reasons are classified, the position of the node with the execution failure and the context data corresponding to the node are recorded, the automatic restart operation of the case is arranged according to the position of the node and the context data after the reason of the execution failure is solved, and the re-running control of the case is realized based on the recording and automatic restart mode, so that the control difficulty of the system for executing the case is reduced, meanwhile, the continuous execution control of the case when the case is failed is realized.
Drawings
Fig. 1 is a schematic flow chart of a case execution method according to a first embodiment of the present invention;
fig. 2 is a schematic flowchart of a case execution method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a server operating environment according to an embodiment of the present invention;
fig. 4 is a functional block diagram of a case execution device according to an embodiment of the present invention.
The implementation, functional features and advantages of the present invention will be further described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The case execution control method provided by the invention can be realized by mobile equipment, the physical implementation of the mobile equipment can be a smart phone, a tablet, a special-function device and the like, and can also be realized by a case execution system, the physical implementation of the system can be a Personal Computer (PC), a server and the like, and based on the hardware result, various embodiments of the case execution method are provided, and the case execution control method is described by taking the server as an example for convenience of description.
Referring to fig. 1, fig. 1 is a flowchart of a case execution method according to an embodiment of the present invention. In this embodiment, the case executing method specifically includes the following steps:
step S110, obtaining executed or executing case information on equipment, and checking the execution condition of a case according to the case information to determine whether the case is in a fault execution state;
in this step, the case may be understood as a test case, an execution process or a test process of some function code on a system or a device, and may even be an application program and a data processing case, and in an actual application, the case may be a set including a plurality of cases.
For the obtaining action, the specific implementation may be to collect from a code execution pool on the system or the device, or to read from a started application management background.
In this step, in particular, the real-time execution situation of the case in the collecting device includes two states of normal execution and fault execution, wherein the fault execution state can be understood as that the case is interrupted from execution, stops execution, temporarily suspends execution, and even runs again.
In practical applications, the real-time case execution situation is obtained, that is, the case being executed on the device is monitored to obtain the information generated during the execution process of the case; the executed case information can be acquired from the case execution log record, and a general device can record the case in a short period of time during the execution of the case.
In this embodiment, the monitoring of the failure is specifically to monitor records in a work log file generated in the execution process of the case, compare whether each work log in the work log file is correct or not by monitoring, and calculate an incorrect work log, until the number of the calculated work logs is greater than a preset value, it is determined that the case has a failure, or is stopped, suspended, or the like.
Step S120, if the case is in the fault execution state, according to the fault execution state, inquiring a fault reason corresponding to the case in the current fault execution state from a preset relation table corresponding to the fault execution state and the fault reason;
step S130, acquiring a node position of the case in a current fault execution state, and generating a case execution log based on the fault reason and the node position, wherein the case execution log further comprises identification information for recording whether the fault of the case is processed;
in the present embodiment, the failure cause includes non-functional problems on the system, working environment and other factors, and the non-functional problems should be understood as problems caused by non-system defects, such as environmental problems, that is, some configuration items of the system are configured incorrectly, some servers of the system are restarting, some systems are testing scene exceptions, some network failures and the like.
In practical applications, the checking of the execution condition of the case can be specifically realized by the following steps:
firstly, when the case is developed, test sentences are arranged in each execution sentence in each case, all the test sentences are combined to obtain a test program of the case, the program can be started by self while the case is executed, and the execution condition of the case is monitored and recorded through the test sentences.
In practical applications, the execution of each statement basically reflects a "true" or "false" value, and the execution status of each case statement in a case is detected by determining the "true" or "false" values of the statements, so as to determine whether a fault exists in the case.
If a statement fault exists, obtaining a statement corresponding to the fault in the case, analyzing an execution function of the statement in the case to determine which fault execution state of the fault data, and comprehensively judging a main cause causing the fault according to fault experience or fault troubleshooting history of the statement, for example, if the main function of the statement is to implement path mapping for data retrieval, the reason causing the statement to be unable to execute is that the mapped path information does not exist or the path information is incorrect, so that the fault cause is incorrect path information, and marking the path information as incorrect.
After the reason is analyzed, extracting the position of a fault point from the monitored work log file, and taking the position as the node position of the fault;
determining a node code position in the case execution code based on the node position;
the code at the code position and the code data before and after the code position (i.e., context data) are recorded to generate an execution log.
In practical application, a case generally corresponds to a work log file, when the case execution condition is recorded, the work log file records according to the execution sequence of statements of the case, all state information of the statements in the execution process, information to be applied and fault labels are recorded in the recording process, a processor analyzes the work log file, data generated in the execution process of each statement is traversed to check and compare to determine whether the fault label exists, if so, the label and the position of the statement corresponding to the label in the case statement are obtained, so that the node position of the fault is determined, further, the label of the fault, the information of the case, the position of the case statement where the label exists and the context information on the position are all picked up to form an execution log of the inspection, and the case is processed through the execution log in the subsequent case maintenance. Preferably, the location of the statement in the case can be determined by the pointing frame of the statement at the time of case execution.
In this embodiment, the context information may also be variables, parameters, and the like during case execution, and also include a class name and a method name for recording the case with the execution failure, and may be stored in a manner of establishing a correspondence between the class name and the method name and the context information when recording the node information, and stored in the generated case execution log.
Step S140, judging whether the fault corresponding to the fault reason is eliminated according to the identification information in the case execution log;
the fault elimination in this step is mainly realized by a man-made interference mode, and when the system analyzes that case execution fails due to the existence of a fault, the system detects the fault regularly, and detects whether the fault is eliminated, and certainly, the response of the fault elimination can be realized by the reaction of identification information after the fault elimination or the reaction of some other parameters, and if the fault is eliminated, the step S160 is shifted to restart the case.
In practical application, the identification information may be specifically identified by a binary identification bit, "0" is not excluded and "1" is excluded, and in this step, whether a fault is excluded is determined by obtaining 0 or 1 in the identification bit; in addition, a sign bit may be added to the execution log to identify, where the specific identifier includes "N" and "Y", where "N" is not excluded and "Y" is excluded, and the determination mode is consistent with the binary identification bit, and details are not repeated here.
Step S150, if the fault is judged to be eliminated, taking the node position recorded in the case execution log as a starting point of case execution, reloading the case information into a case execution unit of the equipment, and continuing to execute the case by taking the starting point as an execution point;
step S160, if it is determined that the fault is not eliminated, reloading the case information to a case execution unit of the device to perform restart execution processing on the case.
In this embodiment, the restart operation refers to a rerun of a case; and when the system detects the response that the fault is eliminated, returning to the execution process of the case, acquiring the node record corresponding to the case from the execution log, and calling the response processing method to perform the rerun operation on the case.
In practical application, in order to facilitate the processing of restarting, a restart case loading data buffer is further arranged, after a case needing to be restarted and executed is determined, information of the corresponding case is uploaded to the buffer, the buffer stores the uploaded information of the case into a restart table in the buffer, and after the timer is timed up, the information of the case in the table is directly read to execute a restart program, so that the restart execution operation of the case can be realized.
In this embodiment, in order to facilitate the subsequent operation of restarting the case, the method further includes: the cases are classified according to the reason causing the case execution failure, for example, the cases that can be continuously executed are classified into one class after the reason is solved, the cases that can be re-executed are classified into one class, and the like.
In the present embodiment, the reasons for case execution failure can be specifically understood as the following: the starting of the new case is interrupted, the mapping of the statement is incorrect, the system hardware is faulty and the operating system is faulty, the cases are classified according to the reason of the execution failure, specifically, the cases are primarily classified according to the centralized reason, and the classified cases are specifically executed to continue operation or restart operation, and then the process goes to step S140 to perform the next processing.
In the present embodiment, the re-running may be performed on the case or performed on the case again, and it is naturally preferable to select whether to perform the re-running or performed on the case again according to the reason causing the case to perform the failure.
The execution control of the cases is realized based on the steps, and different re-running operations are realized according to the classification of case execution failures, so that the problems that the execution time is too wasted and resources are consumed due to re-execution of the existing case failures are solved. The control mode of supporting the cases of failed automatic re-running, failed continuous re-running, selective pause of re-running and the like is realized, and the use and operation experience of the user is greatly improved.
Further, in this embodiment, the generating a case execution log based on the failure cause and the node location includes:
acquiring template information of the case execution log, wherein the template information is a table for recording the execution condition of the case and the generated information;
acquiring an execution code corresponding to the node position and context information of the node position;
recording the execution generation of the node location, the failure reason and the context information in the table to form a case execution log, wherein the context information comprises at least one of a cookie, a login state, a variable and a timestamp.
Specifically, the recording of the node position is embodied as recording an execution code in the program of the case corresponding to the node position, that is, recording the execution code corresponding to the node position, and recording context information of the node position in the execution log, where the context information includes at least one of a cookie, a login state, a variable, and a timestamp.
In this embodiment, the faulty execution state includes an execution interruption state and an execution failure state;
the obtaining of the node position of the case in the current fault execution state, and generating a case execution log based on the fault cause and the node position includes:
judging whether the fault execution state is an execution interruption state;
if the execution interruption state is judged, acquiring the node position where the case execution is interrupted, and recording the node position into the case execution log;
if the execution state is not the execution interruption state, judging whether the fault execution state meets the condition of the execution failure state;
if the condition of the execution failure state is judged to be met, determining a fault reason causing the case execution failure and a node position causing the case execution failure, and recording the fault reason and the node position into the case execution log.
In practical applications, for the judgment of the execution interruption state, it is optional to judge whether the execution of the case is considered to be an interruption operation by detecting a case execution interruption button in the system, and if the case interruption button is pressed down or the button has a response signal output, the case is considered to be in the interruption state.
Based on a pause that is active by the user while in the interrupted state. There is a pause button on the platform, if the user clicks pause in case execution, the platform background will suspend the case process and save all variables and information executed to some place, so that the subsequent process can continue execution normally when continuing.
For the judgment of the execution failure state, optionally, whether the execution method of the case is ended is determined, if yes, the reason of the ending is further analyzed, and what the reason of the ending is determined, and generally, the following cases, namely, the environmental reason, the case is ended artificially, the system function defect, and the like, exist when the execution method of the case is ended and processed.
In this embodiment, the determining the cause of the failure causing the case execution failure includes:
detecting whether a new case with execution priority setting is started in the case execution process of the case execution unit;
detecting whether a working environment corresponding to the execution of the case is changed or not, wherein the working environment comprises configuration items of the equipment, a server of the equipment, a test scene executed by the case and a network used by the equipment;
detecting whether the case is an execution failure due to a non-functional problem, wherein the non-functional problem is a failure not caused by software configuration or hardware configuration of the device.
In practical applications, the working environment refers to some configuration items of the system, servers of the system, a scenario under test of the system, a network, and the like, and the change of the working environment refers to some configuration items of the system being configured incorrectly, servers of the system being restarted, a scenario under test of the system being abnormal, a network failure, and the like.
When the case execution fails due to the environmental reason, the execution flow of the case is stopped at the failed node, the context in failure is recorded, and after the environmental problem is solved, the case can be continuously executed from the failed node by clicking a continuous execution button, or the automatic starting of the automatic case is realized by a preset case restart program.
A specific implementation of case rerun for environmental reasons may be as follows:
recording the context of the executed code, namely information such as cookie, login state, variable, timestamp and the like, and storing the information in a database
After the environmental problem is solved, the class name and the method name of the current execution failure case are obtained through reflection
And when the continue execution button is clicked, reading the context data, and calling the method at the failure position of the current failure use case so as to continue the case.
In this embodiment, if it is analyzed that the case fails to be executed due to the starting of the new case, the case execution method further includes:
judging whether the execution priority of the new case is greater than the execution priority of the currently executed case;
if yes, judging whether the new case and the currently executed case are the same type of case;
if the cases are the same type, replacing the currently executed case with the new case, and executing the new case;
if the cases are not of the same type, setting the currently executed case as an execution interruption state or an execution failure state, skipping to the new case for execution, and returning to the case set as the execution interruption state or the execution failure state for continuous execution after the new case is executed.
In practical applications, the execution failure of a case may be due to the case with a high priority being started, but the processing resources of the system are not enough, and then the currently executed case is selectively stopped to free up a part of the resources for a new case. Case execution failure for this case is such that the case can be rerun by continuing execution.
Furthermore, when the case fails to be executed due to the non-functional problem, the case is started by directly selecting a mode of automatically re-executing the case until the case is completely executed successfully or the case fails to be executed due to the functional problem for multiple times, and the operation on the case is stopped.
The specific implementation scheme can be that monitoring of a test execution result is added in the @ AfterMethod annotation method, whether test execution succeeds or not is judged through an ITestResult interface, if the test execution fails, a class name and a method name of a current execution failed case are obtained through reflection, then the method is called, re-running is achieved for one time or multiple times, and the number of re-running times can be set by the user.
In this embodiment, if the fault execution state is an execution failure state, the step of taking the node position recorded in the case execution log as a starting point of case execution and reloading the case information into the case execution unit of the device, where the step of continuing to execute the case with the starting point as an execution point specifically includes:
acquiring the class name and the method name of the case in the execution failure state through reflection;
and reading the context information from the case execution log according to the class name and the method name, and calling a case execution failure processing strategy to restart the case in the execution failure state.
In practical applications, the reflection is a technique in java programming, and the specified class object can be obtained through reflection. In this embodiment, reflection is used to obtain the class object, which is used to store the class object when the execution fails, so that the object can be called to execute the method of the subsequent step of the corresponding case in the following.
For class names and method names, some code expressions in java programming code are referred to. In the code, objects are created through classes, methods are operated through the objects, and one method realizes some data processing, namely completes operation steps of some cases.
Reading the context data means that when the case is continuously executed by clicking, the background reads all the variable values related to the case stored in the database according to the previously stored class name and method name, and then reproduces the data environment of the case by redefining the variables and assigning values. Thus, the suspended case can be continuously executed.
That is, when a case is detected to be in an execution failure state, the class name of the case and the name of the method for executing the case are recorded at the same time, after the problem causing the execution failure is solved, the class name and the name of the method of the failed case are inquired through reflection, and the re-running processing of the case is carried out based on the recorded node position and the context data.
In this embodiment, if the reason for causing the case execution failure is that the user ends the case, the case cleaning program is started to completely clean the correlation of the terminated case, thereby implementing the end operation of the case.
In this embodiment, before the step of reloading the case information into the case execution unit of the device to perform restart execution processing on the case, the method further includes: performing type division on the case according to the fault reason;
the reloading the case information into the case execution unit of the device to perform the restart execution processing on the case includes:
selecting a corresponding case cache area from the equipment according to the type of the case;
and loading the case information to be reloaded into the case cache region to wait for the calling and execution of the case execution unit.
In summary, the case execution method provided in the embodiments of the present invention determines the execution state of a case by obtaining the execution condition of the case through querying case information of a device, then queries a corresponding fault reason according to the execution state, then obtains a node location where the case where the fault is executed is located, generates a case execution log based on the obtained information, and selects execution control over the case based on information recorded in the case execution log, where the selected execution is continued or restarted, that is, by detecting the reason why the case fails to be executed, and classifying the detected reason, and simultaneously recording the node location where the execution fails and context data corresponding to the node, and after the reason why the execution fails is solved, arranges automatic restart operation of the case according to the node location and the context data, thereby reducing the difficulty in controlling the case execution by the system, and simultaneously realizing the execution control over the case when the case fails.
The following describes the case execution method provided by the present invention in detail by taking a specific fault reason as an example, as shown in fig. 2, which is a specific implementation flowchart when the case execution fails, and the method specifically includes the following steps:
step S210, acquiring case information of failed execution on the equipment;
in this step, in particular, cases for which an end has been executed can be mentioned, but this end is to be understood as case information which has been stored in the case record table, that is to say since it has been recorded as a master by the system of equipment and has not been executed again after some time has elapsed; further, there may be an executing case, just marked as a case of failed execution.
Step S220, analyzing and extracting the position of the node which causes the case to fail to execute when the case is executed;
in this step, there may be a plurality of node locations, and for this reason, it is also necessary to determine whether the case can continue to execute the operation according to the node locations and the reason why the node locations fail, and if not, directly start the restart operation step.
Furthermore, the position of the first failed node can be determined by performing the execution process of the case, the performability of the position of the first failed node is judged, if the first failed node cannot be continuously executed, the operation is directly restarted, if the first failed node can be continuously executed, the performability of the position of the next node is continuously judged until all the nodes of the case are restarted as long as one of the nodes cannot be continuously executed, otherwise, the execution is continuously executed.
Step S230, judging the performability of the fault reason of the node position;
in practical applications, the performability here includes that case operations can be performed using continuous execution and case operations can not be performed continuously.
Step S240, selecting a control scheme of the case according to the judgment result;
in this step, the control scheme thereof refers to the continuation of the execution operation and the re-running operation.
Step S250, generating a case execution log file according to the node position and the control scheme;
and step S260, performing control operation on the case according to the record information in the case execution log file.
In this embodiment, when recording the node position, the method further includes an execution code for recording the node position and context data of a position corresponding to the node position, where the context data includes information such as a cookie, a login state, a variable, and a timestamp, and is stored in the case execution log file.
In this embodiment, it is further detected that the execution fails due to an environmental problem, and after the environmental problem is solved, a control scheme to be continuously executed may be selected for processing, specifically, after the environmental problem is solved, a class name and a method name of a currently-executed failed case are obtained through reflection, and when a continuous execution button is clicked, context data is read, and a method at a failure point of the currently-failed case is called, so that the case is continued.
Further, if the execution fails due to the non-functional problem, the mode control of automatically re-executing the case is selected until the case is completely executed successfully or the execution fails due to the functional problem.
The implementation scheme is as follows: in the @ AfterMethod annotation method, monitoring of a test execution result is added, whether the test execution succeeds or not is judged through an ITestResult (best test result) interface, if the test execution fails, a class name and a method name of a current execution failed case are obtained through reflection, and then the method is called, so that the re-running is realized once (or for multiple times, the times can be set by self).
In order to solve the above problem, the present invention further provides a case execution device, where the case execution device may be configured to implement the case execution method provided by the embodiment of the present invention, and a physical implementation of the case execution device exists in a manner of a server, and a specific hardware implementation of the server is shown in fig. 1.
Referring to fig. 3, the server includes: a processor 301, e.g. a CPU, a communication bus 302, a user interface 303, a network interface 304, a memory 305. Wherein a communication bus 302 is used to enable the connection communication between these components. The user interface 303 may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the network interface 304 may optionally comprise a standard wired interface, a wireless interface (e.g. WI-FI interface). Memory 305 may be a high-speed RAM memory or may be a non-volatile memory, such as a disk memory. The memory 305 may alternatively be a storage device separate from the processor 301.
Those skilled in the art will appreciate that the hardware configuration of the apparatus shown in fig. 3 does not constitute a limitation of the case execution apparatus, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 3, the memory 305, which is a kind of computer-readable storage medium, may include therein an operating system, a network communication module, a user interface module, and a case-based execution program. Among other things, the operating system is a program that manages and manages the execution of the device and software resources, and supports the execution of the program and other software and/or programs.
In the hardware configuration of the server shown in fig. 3, the network interface 104 is mainly used for accessing a network; case information executed on the user interface 103 device, and data generated during the execution of the case, and the processor 301 may be used to invoke the case execution program stored in the memory 305 and perform the operations of the embodiments of the case execution method described below.
In the embodiment of the present disclosure, the implementation of fig. 3 may also be a mobile terminal such as a mobile phone and the like that can be operated by touch, where a processor of the mobile terminal performs case analysis by reading a program code that is stored in a buffer or a storage unit and that can implement a case execution method, and generates a case execution log, so as to control which way is selected to perform an operation on a case.
In order to solve the above problem, an embodiment of the present invention further provides a case execution device, and referring to fig. 4, fig. 4 is a schematic diagram of functional modules of the case execution device provided in the embodiment of the present invention. In this embodiment, the apparatus comprises:
the monitoring module 41 is configured to obtain executed or executing case information on the device, and check an execution condition of a case according to the case information to determine whether the case is in a fault execution state;
the query module 42 is configured to, when the case is in the fault execution state, query a fault cause corresponding to the case in the current fault execution state from a preset relation table between the fault execution state and the fault cause according to the fault execution state;
a recording module 43, configured to obtain a node position of the case in a current fault execution state, and generate a case execution log based on the fault reason and the node position, where the case execution log further includes identification information for recording whether a fault of the case has been processed;
a judging module 44, configured to judge whether a fault corresponding to the fault cause is eliminated according to the identification information in the case execution log;
a processing module 45, configured to, when it is determined that the fault is eliminated, use a node position recorded in the case execution log as a starting point of case execution, reload the case information to a case execution unit of the device, and continue to execute the case with the starting point as an execution point; and when the fault is judged not to be eliminated, reloading the case information into a case execution unit of the equipment to restart and execute the case.
Based on the same embodiment description contents as those of the case execution method according to the embodiment of the present invention, the embodiment of the present invention will not be described in detail.
According to the embodiment, the method and the device have the advantages that the reason of case execution failure is detected, the detected reasons are classified, the position of the node with the execution failure and the context data corresponding to the node are recorded, after the reason of the execution failure is solved, the case execution log is generated according to the position of the node and the context data to arrange the automatic restart operation of the case, and the restart control of the case is realized based on the record and the automatic restart mode, so that the control difficulty of the system for executing the case is reduced, meanwhile, the continuous execution control of the case when the case is failed is realized, the execution time of the case can be saved through the control mode, the control efficiency of the case is improved, and the success rate of case execution is improved.
The invention also provides a computer readable storage medium.
In this embodiment, the computer-readable storage medium has a case execution program stored thereon, and the case execution program, when executed by the processor, implements the steps of the case execution method as described in any one of the above embodiments. The method implemented by the case execution program executed by the processor may refer to various embodiments of the case execution method of the present invention, and thus, the details are not described herein.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM) and includes several instructions for enabling a terminal (which may be a mobile phone, a computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
The present invention is described in connection with the accompanying drawings, but the present invention is not limited to the above embodiments, which are only illustrative and not restrictive, and those skilled in the art can make various changes without departing from the spirit and scope of the invention as defined by the appended claims, and all changes that come within the meaning and range of equivalency of the specification and drawings that are obvious from the description and the attached claims are intended to be embraced therein.

Claims (10)

1. A case execution method, comprising:
acquiring executed or executing case information on equipment, and checking the execution condition of a case according to the case information to determine whether the case is in a fault execution state;
if the case is in the fault execution state, inquiring a fault reason corresponding to the case in the current fault execution state from a preset relation table corresponding to the fault execution state and the fault reason according to the fault execution state;
acquiring a node position of the case in a current fault execution state, and generating a case execution log based on the fault reason and the node position, wherein the case execution log further comprises identification information for recording whether the fault of the case is processed or not;
judging whether the fault corresponding to the fault reason is eliminated or not according to the identification information in the case execution log;
if the fault is eliminated, taking the node position recorded in the case execution log as a starting point of case execution, reloading the case information into a case execution unit of the equipment, and continuously executing the case by taking the starting point as an execution point;
if the fault is judged not to be eliminated, the case information is reloaded to a case execution unit of the equipment to restart the case for execution processing;
if the fault is judged not to be eliminated, reloading the case information to a case execution unit of the equipment to restart the case, and executing the processing, wherein the processing comprises the following steps: and setting a restart case loading data buffer, after determining the case needing to be restarted and executed, uploading the information of the corresponding case to the buffer, storing the uploaded information of the case into a restart table in the buffer by the buffer, and directly reading the information case of the case in the table to execute a restart program after the timer is timed up so as to realize the restart execution operation of the case.
2. The case execution method of claim 1, wherein said generating a case execution log based on the cause of failure and the node location comprises:
acquiring template information of the case execution log, wherein the template information is a table for recording the execution condition of the case and the generated information;
acquiring an execution code corresponding to the node position and context information of the node position;
recording the execution generation of the node location, the failure reason and the context information in the table to form a case execution log, wherein the context information comprises at least one of a cookie, a login state, a variable and a timestamp.
3. The case execution method of claim 1, wherein the faulty execution state comprises an execution interruption state and an execution failure state;
the obtaining of the node position of the case in the current fault execution state, and generating a case execution log based on the fault cause and the node position includes:
judging whether the fault execution state is an execution interruption state;
if the execution interruption state is judged, acquiring the node position where the case execution is interrupted, and recording the node position into the case execution log;
if the execution state is not the execution interruption state, judging whether the fault execution state meets the condition of the execution failure state;
if the condition of the execution failure state is judged to be met, determining a fault reason causing the case execution failure and a node position causing the case execution failure, and recording the fault reason and the node position into the case execution log.
4. The case execution method of claim 3, wherein the determining the cause of the failure that caused the case execution to fail comprises:
detecting whether a new case with execution priority setting is started or not in the case execution process of the case execution unit;
detecting whether a working environment corresponding to the execution of the case is changed or not, wherein the working environment comprises configuration items of the equipment, a server of the equipment, a test scene executed by the case and a network used by the equipment;
detecting whether the case is an execution failure due to a non-functional problem, wherein the non-functional problem is a failure not caused by software configuration or hardware configuration of the device.
5. The case execution method of claim 4, wherein after the detecting that there are new cases with execution priority settings initiated, the case execution method further comprises:
judging whether the execution priority of the new case is greater than the execution priority of the currently executed case;
if yes, judging whether the new case and the currently executed case are the same type of case;
if the cases are the same type, replacing the currently executed case with the new case, and executing the new case;
if the cases are not of the same type, setting the currently executed case as an execution interruption state or an execution failure state, skipping to the new case for execution, and returning to the case set as the execution interruption state or the execution failure state for continuous execution after the new case is executed.
6. The case execution method of claim 2, wherein the taking the node location recorded in the case execution log as a starting point for case execution and reloading the case information into a case execution unit of the device, and continuing to execute the case with the starting point as an execution point comprises:
if the fault execution state is an execution failure state, acquiring the class name and the method name of the case in the execution failure state through reflection;
and reading the context information from the case execution log according to the class name and the method name, and calling a case execution failure processing strategy to restart the case in the execution failure state.
7. The case execution method of claim 6, further comprising, prior to the step of reloading the case information into a case execution unit of the device for performing re-boot execution processing on the case: performing type division on the case according to the fault reason;
the reloading the case information into the case execution unit of the device to perform the restart execution processing on the case includes:
selecting a corresponding case cache region from the equipment according to the type of the case;
and loading the case information to be reloaded into the case cache region to wait for the calling execution of the case execution unit.
8. A case execution apparatus, characterized in that the case execution apparatus comprises:
the monitoring module is used for acquiring executed or executing case information on equipment and checking the execution condition of a case according to the case information to determine whether the case is in a fault execution state;
the query module is used for querying a fault reason corresponding to the case in the current fault execution state from a preset relation table corresponding to the fault execution state and the fault reason according to the fault execution state when the case is in the fault execution state;
the recording module is used for acquiring the node position of the case in the current fault execution state and generating a case execution log based on the fault reason and the node position, wherein the case execution log further comprises identification information for recording whether the fault of the case is processed or not;
the judging module is used for judging whether the fault corresponding to the fault reason is eliminated according to the identification information in the case execution log;
the processing module is used for taking the node position recorded in the case execution log as a starting point of case execution when the fault is judged to be eliminated, reloading the case information into a case execution unit of the equipment, and continuously executing the case by taking the starting point as an execution point; when the fault is judged not to be eliminated, the case information is reloaded to a case execution unit of the equipment to restart the case for execution processing;
the processing module is further configured to set a restart case loading data buffer, upload information of a corresponding case to the buffer after determining a case that needs to be restarted and executed, store the uploaded information of the case in a restart table in the buffer by the buffer, and directly read the information case of the case in the table to execute a restart program after the timer reaches the time, so that the restart execution operation on the case can be realized.
9. A case execution apparatus, the case execution apparatus comprising: a memory, a processor, and a case execution program stored on the memory and executable on the processor, the case execution program when executed by the processor implementing the steps of the case execution method as recited in any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a case execution program, which when executed by a processor implements the steps of the case execution method according to any one of claims 1-7.
CN201910634552.0A 2019-07-15 2019-07-15 Case execution method, device, equipment and computer readable storage medium Active CN110502366B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910634552.0A CN110502366B (en) 2019-07-15 2019-07-15 Case execution method, device, equipment and computer readable storage medium
PCT/CN2019/117309 WO2021008029A1 (en) 2019-07-15 2019-11-12 Case execution method, apparatus and device, and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910634552.0A CN110502366B (en) 2019-07-15 2019-07-15 Case execution method, device, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110502366A CN110502366A (en) 2019-11-26
CN110502366B true CN110502366B (en) 2023-02-14

Family

ID=68585503

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910634552.0A Active CN110502366B (en) 2019-07-15 2019-07-15 Case execution method, device, equipment and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN110502366B (en)
WO (1) WO2021008029A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111626770A (en) * 2020-04-30 2020-09-04 上海携程商务有限公司 Crowd calculation control method, system, device and medium
CN111680974B (en) * 2020-05-29 2023-09-22 泰康保险集团股份有限公司 Method and device for positioning problems of electronic underwriting process
CN113434135B (en) * 2021-06-28 2023-06-16 青岛海尔科技有限公司 Method and device for determining call repeatability of interface, storage medium and electronic device
CN113759876B (en) * 2021-09-14 2023-05-19 西安交通大学 Case-reasoning-based wind turbine generator fault diagnosis method and system
CN114089722B (en) * 2021-11-17 2024-03-26 国家石油天然气管网集团有限公司 Portable diagnosis method for industrial control network communication faults of gas transmission station

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015142234A1 (en) * 2014-03-20 2015-09-24 Telefonaktiebolaget L M Ericsson (Publ) Testing of electronic devices
CN105426257A (en) * 2015-12-25 2016-03-23 北京奇虎科技有限公司 Method and device for executing task
CN108501980A (en) * 2018-03-23 2018-09-07 固安信通信号技术股份有限公司 The monitoring method and terminal device of track circuit equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3291642B2 (en) * 1995-05-18 2002-06-10 株式会社日立製作所 Failure support method
JP3952544B2 (en) * 1996-09-17 2007-08-01 株式会社東芝 Distributed system
US7634687B2 (en) * 2005-01-13 2009-12-15 Microsoft Corporation Checkpoint restart system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015142234A1 (en) * 2014-03-20 2015-09-24 Telefonaktiebolaget L M Ericsson (Publ) Testing of electronic devices
CN105426257A (en) * 2015-12-25 2016-03-23 北京奇虎科技有限公司 Method and device for executing task
CN108501980A (en) * 2018-03-23 2018-09-07 固安信通信号技术股份有限公司 The monitoring method and terminal device of track circuit equipment

Also Published As

Publication number Publication date
WO2021008029A1 (en) 2021-01-21
CN110502366A (en) 2019-11-26

Similar Documents

Publication Publication Date Title
CN110502366B (en) Case execution method, device, equipment and computer readable storage medium
CN107341098B (en) Software performance testing method, platform, equipment and storage medium
US8312322B2 (en) System for automated generation of computer test procedures
CN108521339B (en) Feedback type node fault processing method and system based on cluster log
CN108508874B (en) Method and device for monitoring equipment fault
CN112506915B (en) Application data management system, processing method and device and server
CN111563014A (en) Interface service performance test method, device, equipment and storage medium
CN101719097A (en) Debug method and system of automation test script and automation application server
CN110297767B (en) Automatic execution method, device, equipment and storage medium for test cases
US20180143897A1 (en) Determining idle testing periods
CN104850499A (en) Automatic test method and device for base band software
CN113946499A (en) Micro-service link tracking and performance analysis method, system, equipment and application
CN109409948B (en) Transaction abnormity detection method, device, equipment and computer readable storage medium
CN111090593A (en) Method, device, electronic equipment and storage medium for determining crash attribution
CN116302989A (en) Pressure testing method and system, storage medium and computer equipment
CN109542341B (en) Read-write IO monitoring method, device, terminal and computer readable storage medium
CN101706752B (en) Method and device for in-situ software error positioning
CN111258765A (en) Load balancing method and device, computing equipment and storage medium
CN111666200A (en) Testing method and terminal for time consumption of cold start of PC software
CN112416735A (en) Application program detection method and device, terminal equipment and storage medium
CN116230067A (en) Automatic testing method, system, equipment and medium for solid state disk
CN115391110A (en) Test method of storage device, terminal device and computer readable storage medium
CN111506422B (en) Event analysis method and system
CN111752786A (en) Data storage method, data summarization method, equipment and medium in pressure test process
CN111752782B (en) Stability testing method, system, device and storage medium

Legal Events

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