WO2021008029A1 - Case execution method, apparatus and device, and computer readable storage medium - Google Patents

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

Info

Publication number
WO2021008029A1
WO2021008029A1 PCT/CN2019/117309 CN2019117309W WO2021008029A1 WO 2021008029 A1 WO2021008029 A1 WO 2021008029A1 CN 2019117309 W CN2019117309 W CN 2019117309W WO 2021008029 A1 WO2021008029 A1 WO 2021008029A1
Authority
WO
WIPO (PCT)
Prior art keywords
case
execution
failure
state
fault
Prior art date
Application number
PCT/CN2019/117309
Other languages
French (fr)
Chinese (zh)
Inventor
胡鹏强
Original Assignee
平安普惠企业管理有限公司
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 平安普惠企业管理有限公司 filed Critical 平安普惠企业管理有限公司
Publication of WO2021008029A1 publication Critical patent/WO2021008029A1/en

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

Definitions

  • This application relates to the field of R&D management technology, and in particular to a case execution method, device, equipment, and computer-readable storage medium.
  • the case In the current execution control method for the case, the case often fails or is suspended during the execution process due to various reasons. For this situation, the solution in the prior art is to perform the case execution failure rerun and failure to continue. Operations such as re-running, selective suspension of re-running, etc., but most of the above-mentioned re-running operations are performed through manual inspection and manual control. For cases that cannot be continued, the case will be restarted and the case will be re-run. Execution, such a case control execution method consumes human resources and is not conducive to the current intelligent development requirements.
  • the main purpose of this application is to provide a case execution method, device, equipment, and computer-readable storage medium, aiming to solve the technical problem that the control of failure cases is too time-consuming due to the existing case execution control methods.
  • this application provides a case execution method, which includes the following steps:
  • the node position recorded in the case execution log is taken as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, and the The starting point is the execution point to continue executing the case;
  • case information is reloaded into the case execution unit of the device to restart the execution of the case.
  • the generating a case execution log based on the failure reason and the node location includes:
  • the template information is a table that records the execution status of the case and the information generated;
  • the context information includes at least one of a cookie, a login state, a variable, and a time stamp One kind.
  • the failure execution state includes an execution interruption state and an execution failure state
  • the obtaining the node location of the case in the current fault execution state, and generating a case execution log based on the fault cause and the node location includes:
  • the node location where the execution of the case is interrupted is acquired, and the node location is recorded in the case execution log;
  • the determining the cause of the failure of the execution of the case includes:
  • the working environment includes the configuration items of the device, the server of the device, the test scenario executed by the case, and the network used by the device;
  • the case execution method further includes:
  • the node position recorded in the case execution log is used as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, taking the starting point as the execution point Continuing the execution of the cases includes:
  • failure execution state is an execution failure state
  • class name and method name of the case in the execution failure state are acquired through reflection
  • the method before the step of reloading the case information into the case execution unit of the device to restart the execution of the case, the method further includes: classifying the case according to the cause of the failure ;
  • the reloading the case information into the case execution unit of the device to perform restart execution processing on the case includes:
  • this application also provides a case execution device, the case execution device includes:
  • the monitoring module is used to obtain information about a case that has been executed or that is being executed on the device, and check the execution of the case according to the case information to determine whether the case is in a faulty execution state;
  • the query module is used to, when the case is in the fault execution state, according to the fault execution state, from a preset table of the corresponding relationship between the fault execution state and the failure cause, query the case corresponding to the current fault execution state cause of issue;
  • the recording module is used to obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording the case Identification information of whether the fault has been processed;
  • the judgment module is used to judge whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
  • the processing module is configured to, when judging that the fault has been eliminated, use the node position recorded in the case execution log as the starting point of the case execution, and reload the case information to the case execution unit of the device , Continue to execute the case with the starting point as the execution point; and when it is determined that the fault has not been eliminated, reload the case information into the case execution unit of the device to restart the execution of the case .
  • the present application also provides a case execution device, the case execution device includes: a memory, a processor, and a case execution program stored on the memory and running on the processor, so When the case execution program is executed by the processor, the steps of the case execution method described in any one of the above are implemented.
  • the present application also provides a computer-readable storage medium with a case execution program stored on the computer-readable storage medium.
  • case execution program When the case execution program is executed by a processor, the implementation is as described in any of the above The steps of the case execution method described.
  • the continued execution can save the execution time of the case and increase the success rate of case execution.
  • FIG. 1 is a schematic flowchart of the first embodiment of the case execution method provided by this application;
  • FIG. 3 is a schematic structural diagram of a server operating environment involved in a solution of an embodiment of the application
  • FIG. 4 is a schematic diagram of functional modules of an embodiment of a case execution apparatus provided by this application.
  • Fig. 1 is a flowchart of a case execution method provided by an embodiment of the application.
  • the case execution method specifically includes the following steps:
  • Step S110 Obtain information about a case that has been executed or is being executed on the device, and check the execution of the case according to the case information to determine whether the case is in a faulty execution state;
  • the case can be understood as a test case, it can also be understood as the execution process or test process of a certain functional code on the system or device, or even an application and data processing case, etc. In practical applications, the case may be a collection including multiple cases.
  • the specific implementation can be collected from the code execution pool on the system or device, or read from the started application management background.
  • the real-time execution status includes two states of normal execution and failure execution.
  • the failure execution state can be understood as the case is interrupted, stopped, and temporarily suspended. Execution, even re-run execution.
  • case execution status acquisition means monitoring the case being executed on the device to obtain the information generated during the execution of the case; while for the case information that has been executed, it can be obtained from Obtained in the case execution log record, general equipment will record the case in a certain period of time during the execution of the case.
  • the monitoring of the failure is specifically through the records in the work log file generated during the execution of the monitoring case, the monitoring and comparison of each work log in the work log file is correct, and the calculation of the incorrect work log , Until the calculated number of work logs is greater than the preset value, it is considered that the execution of the case has failed, or it is stopped, suspended, etc.
  • Step S120 If the case is in the fault execution state, according to the fault execution state, query the fault cause corresponding to the current fault execution state of the case from the preset relationship table between the fault execution state and the fault cause ;
  • Step S130 Obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording the case's failure Whether the identification information has been processed;
  • the non-functional problems should be understood as problems caused by non-system defects, such as environmental problems, that is, some configurations of the system. Item configuration error, some systems' servers are restarting, some systems are being tested abnormally, some network failures, etc.
  • test statement is set for each execution statement in each case, and all the test statements are combined to obtain a test program for a case, and the program will start automatically when the case is executed , Through these test statements to monitor and record the execution of the case.
  • each statement basically reflects the value of "true” or "false”, and the execution status of each case statement of the case is realized by judging the "true” and “false” values of these statements Perform testing to determine whether there is a fault in the case.
  • the statement corresponding to the failure in the case is obtained, and the execution function of the statement in the case is analyzed to determine which failure execution state of the failure data is, and based on the failure experience or troubleshooting of the statement History is used to comprehensively judge the main reason for the failure.
  • the main function of the statement is to realize the path mapping of data retrieval.
  • the reason that the statement cannot be executed is that the mapped path information does not exist or the path information is incorrect. It can be seen that the cause of the failure is incorrect path information, and the incorrect path information is marked.
  • a case corresponds to a work log file, and when the work log file records the case execution, it is recorded in the order in which the statements of the case are executed. During the recording process, all states of the statement during the execution process are recorded. The information and the information that needs to be applied, as well as the fault label are recorded.
  • the processor analyzes the work log file and traverses the data generated during the execution of each sentence to check and compare to determine whether there is a fault label. If it exists, then Obtain the label and the position in the case sentence of the sentence corresponding to the label to determine the node position of the fault. Further, extract the fault label, case information, case sentence position where the label is located, and context information at that position. Take it down to form an inspection execution log, which can be used to process the case in subsequent case maintenance.
  • the position of the sentence in the case can be specifically determined by the pointing frame of the sentence when the case is executed.
  • the context information can also be variables and parameters in the case execution process, etc., and also include the class name and method name of the case that records the execution failure, and when recording node information, the class name and method can be created
  • the correspondence between names and context information is stored in the generated case execution log.
  • Step S140 judging whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
  • the troubleshooting in this step is mainly to eliminate the fault through artificial interference.
  • the system analyzes that there is a fault that causes the case to fail, it will detect the fault regularly, and detect whether the fault is Excluded, of course, the response to the troubleshooting of the fault can be through the response of the identification information after the fault is eliminated, or through the response of some other parameters. If it is eliminated, then transfer to step S160 to restart the case .
  • the identification information can be specifically identified by a binary identification bit, "0" means not excluded, and “1” means excluded. In this step, it is determined by obtaining 0 or 1 in the identification bit. Whether the fault has been eliminated; in addition, it can be identified by adding a symbol bit in the execution log.
  • the specific identification includes “N” and "Y”. "N” means not eliminated, and "Y” means eliminated, and judge The method is consistent with the binary identification bit, so I won’t repeat it here.
  • Step S150 if it is determined that the fault has been eliminated, the node position recorded in the case execution log is used as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, Continue to execute the case with the starting point as the execution point;
  • Step S160 If it is determined that the fault has not been eliminated, reload the case information into the case execution unit of the device to perform restart execution processing on the case.
  • the restart operation refers to re-running the case; when the system detects a response that the fault is eliminated, it returns to the execution process of the case, and obtains the node corresponding to the case from the execution log Record and retrieve the response processing method to rerun the case.
  • restart case loading data buffer After determining the case that needs to be restarted and executed, upload the corresponding case information to the buffer, and the buffer will upload The information of the case is saved in the restart table in the buffer. When the timer expires, you can directly read the case information in the table and execute the restart program to realize the restart operation of the case.
  • it in order to facilitate the subsequent operation of restarting the case, it also includes: classifying the case according to the reason that caused the execution of the case to fail.
  • the cases implemented are divided into one category and so on.
  • the reasons for the execution failure of the case can be specifically understood as being divided into the following categories: the startup of the new case is interrupted, the mapping of the statement is incorrect, the system hardware failure and the operating system failure, for the case according to the reason for the execution failure Specifically, according to the above-mentioned concentration reasons, the cases are preliminarily classified, and for the classified cases, whether to perform a continue operation or a restart operation, jump to step S140 for the next processing.
  • the re-running can be the continued execution of the case or the re-execution of the case.
  • the execution control of the case is realized, and different rerun operations are realized according to the classification of the case execution failure, thereby avoiding the problem of excessive execution time and resource consumption due to the re-execution of existing case failures. It realizes the control method that supports cases such as automatic re-run after failure, continued re-run after failure, and selective suspension and re-run, which greatly improves the user's use and operation experience.
  • generating a case execution log based on the failure cause and the node location includes:
  • the template information is a table that records the execution status of the case and the information generated;
  • the context information includes at least one of a cookie, a login state, a variable, and a time stamp One kind.
  • the record of the node position is specifically expressed as the execution code in the program of the case corresponding to the node position, that is, the execution code corresponding to the node position is recorded, and the context information of the node position is also recorded in the In the execution log, the context information includes at least one of a cookie, a login state, a variable, and a time stamp.
  • the failure execution state includes an execution interruption state and an execution failure state
  • the obtaining the node location of the case in the current fault execution state, and generating a case execution log based on the fault cause and the node location includes:
  • the node location where the execution of the case is interrupted is acquired, and the node location is recorded in the case execution log;
  • the execution interruption state it is optional to determine whether the execution of the case is considered to be an interrupt operation by detecting the case execution interrupt button in the system. If the case interrupt button is pressed, or the If the button has a response signal output, it is considered that the case is in an interrupted state.
  • the optional is to determine whether the execution method of the case is ended. If so, further analyze the reason for the termination to determine the reason for the termination. Under normal circumstances, the case There are several situations in which the execution method is terminated, which are environmental reasons, cases are manually terminated, system functional defects, etc.
  • the determining the cause of the failure of the execution of the case includes:
  • the working environment includes the configuration items of the device, the server of the device, the test scenario executed by the case, and the network used by the device;
  • the working environment refers to some configuration items of the system, the server of the system, the system being tested, the network, etc.
  • the change of the working environment refers to the configuration of some configuration items of the system incorrectly, and the server of the system is Restart, the system is being tested, the scene is abnormal, the network fails, etc.
  • the case execution method further includes:
  • the execution failure of a case may be due to the start of a case with a high priority level, but under the premise that the processing resources of the system are not enough, it will selectively stop some cases currently being executed to idle out. Part of the resources are used in new cases. For the case execution failure in this case, the case can be rerun by continuing the execution.
  • a case fails to execute due to a non-functional problem
  • the case is started by automatically re-executing the case, and the case is stopped until the case is completely executed successfully or the execution fails due to functional problems multiple times.
  • the specific implementation scheme can be to add monitoring of the test execution result in the @AfterMethod annotation method, and use the ITestResult interface to determine whether the test execution is successful. If it fails, get the class name and method name of the current execution failure case through reflection, and then call The method realizes one or more reruns, and the number of reruns can be set by yourself.
  • the failure execution state is the execution failure state
  • the node position recorded in the case execution log is used as the starting point of the case execution, and the case information is reloaded into the In the case execution unit of the device
  • the step of continuing to execute the case with the starting point as the execution point specifically includes:
  • reflection is a technique in java programming, through which the specified class object can be obtained.
  • reflection is used to obtain the class object, and the function is to save the class object when the execution fails, and save it, so that the object can be subsequently called to execute the subsequent step method of the corresponding case.
  • class names and method names it refers to the terms of some codes in the java programming code.
  • objects are created through classes and methods are manipulated through objects.
  • One method is to implement some data processing, that is, to complete the steps of some cases.
  • Reading context data means that when you click to continue executing the case, the background will read all the variable values stored in the database related to this case according to the previously saved class name and method name, and then redefine the variables and assign values , To reproduce the data environment of the case. As a result, the suspended case can continue to be executed.
  • the class name of the case and the method name of the execution of the case will be recorded at the same time.
  • the class name and method of the failure case of the division are queried through reflection Name, and rerun the case based on the recorded node position and context data.
  • the case cleaning program will be started, and all related to the terminated case will be cleaned up, so as to realize the closing operation of the case.
  • the method before the step of reloading the case information into the case execution unit of the device to restart the execution of the case, the method further includes: performing the case according to the failure cause Type division;
  • the reloading the case information into the case execution unit of the device to perform restart execution processing on the case includes:
  • the case execution method determines the execution status of the case by querying the case information of the device to obtain the execution status of the case, and then queries the corresponding failure cause according to the execution status, and then obtains the execution failure
  • the location of the node where the case is located based on the information obtained above to generate a case execution log, based on the information recorded in the case execution log to select the execution control of the case, choose whether to continue or restart the execution, that is, by executing the case Detect the cause of the failure, and classify the detected cause, and record the location of the node where the execution failed and the context data corresponding to the node.
  • the automatic case is arranged according to the node location and context data
  • the restart operation reduces the difficulty of the system's control over the case execution, and at the same time realizes the continued execution control when the case execution fails.
  • the continued execution can save the execution time of the case. It also improves the success rate of case execution.
  • Step S210 acquiring information about cases where execution failed on the device
  • this step it can specifically be a case that has been executed, but the end should be understood as the case information that has been stored in the case record table, that is, because it is recorded as the teacher table by the equipment system and has not been Cases to be re-executed; further, it can also be a case that is being executed, which has just been marked as a failed execution.
  • Step S220 Analyze and extract the location of the node that caused the execution of the case to fail during execution
  • this step there may be multiple node positions of this kind. For this, it is also necessary to determine whether the case can be continued according to the node position and the reason for the failure of the node position. If not, directly start the restart operation step .
  • Step S230 Determine the operability of the cause of the failure at the node location
  • the executability here includes useable to continue executing case operations and non-continuous case operations.
  • Step S240 select the control scheme of the case according to the judgment result
  • control scheme refers to continuing to perform operations and re-running operations.
  • Step S250 generating a case execution log file according to the node location and the control scheme
  • Step S260 Perform a control operation on the case according to the record information in the case execution log file.
  • the node location when the node location is recorded, it also includes the execution code of the node location and the context data of the location corresponding to the node location.
  • the context data includes information such as cookies, login status, variables, and time stamps, which are stored in the case execution Log file.
  • the execution failure is due to environmental problems.
  • the class of the current execution failure use case is obtained through reflection. Name and method name.
  • the context data is read, and the method at the failure of the current failed use case is called to continue the case.
  • the method of automatically re-executing the case is selected until the case is completely executed successfully or the execution fails due to a functional problem.
  • this application also provides a case execution device, which can be used to implement the case execution method provided in the embodiments of this application.
  • Its physical implementation exists in the form of a server.
  • the specific hardware implementation of the server is as follows: As shown in Figure 1.
  • the server includes: a processor 301, such as a CPU, a communication bus 302, a user interface 303, a network interface 304, and a memory 305.
  • the communication bus 302 is used to implement connection and communication between these components.
  • the user interface 303 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the network interface 304 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 305 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory.
  • the memory 305 may also be a storage device independent of the aforementioned processor 301.
  • the memory 305 as a non-volatile computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a case-based execution program.
  • the operating system is a program that manages and executes the device and software resources, and supports the operation of the execution program and other software and/or programs.
  • the network interface 104 is mainly used to access the network; the user interface 103 is used to execute case information on the device and data generated during the execution of the case, and the processor 301 can be used to call
  • the case execution program is stored in the memory 305 and executes the operations of each embodiment of the following case execution method.
  • the implementation of FIG. 3 can also be a mobile terminal capable of touch operation such as a mobile phone.
  • the processor of the mobile terminal can implement the case execution method by reading the data stored in the buffer or storage unit.
  • the program code is used to analyze the case and generate a case execution log to control which method is selected to perform operations on the case.
  • FIG. 4 is a schematic diagram of functional modules of the case execution device provided in an embodiment of the application.
  • the device includes:
  • the monitoring module 41 is configured to obtain information about cases that have been executed or being executed on the device, and check the execution of the case according to the case information to determine whether the case is in a faulty execution state;
  • the query module 42 is configured to, when the case is in the failure execution state, according to the failure execution state, from a preset table of the corresponding relationship between the failure execution state and the failure cause, query the case corresponding to the current failure execution state Cause of failure;
  • the recording module 43 is configured to obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording the Identification information of whether the failure of the case has been processed;
  • the judgment module 44 is configured to judge whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
  • the processing module 45 is configured to, when judging that the fault has been eliminated, use the node position recorded in the case execution log as the starting point of the case execution, and reload the case information to the case execution of the device In the unit, continue to execute the case with the starting point as the execution point; and when it is determined that the fault has not been eliminated, reload the case information into the case execution unit of the device to restart execution of the case deal with.
  • This embodiment detects the reasons for the execution failure of the case and classifies the detected reasons. At the same time, it records the location of the node where the execution failed and the context data corresponding to the node. After the cause of the execution failure is resolved, the location of the node The case execution log is generated with context data to arrange the automatic restart operation of the case. Based on this recording and automatic restart method, the rerun control of the case is realized, thereby reducing the difficulty of the system to control the execution of the case, and also realizes the case Continue execution control when execution fails. This control method can save the execution time of the case, improve the control efficiency of the case, and increase the success rate of case execution.
  • the present application also provides a computer-readable storage medium, where the computer-readable storage medium may be volatile or non-volatile, which is not specifically limited by the present application.
  • a case execution program is stored on the computer-readable storage medium, and the case execution program of the H5 webpage is executed by a processor to implement the steps of the case execution method described in any of the above embodiments.
  • the method implemented when the case execution program is executed by the processor can refer to the various embodiments of the case execution method of the present invention, so it will not be repeated.

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 present application relates to the technical field of research and development management. Disclosed is a case execution method, comprising: obtaining the execution status of a case by querying information about the case of a device, to determine the execution state of the case; querying, according to the execution state, a corresponding failure cause; obtaining a node position where the case having an execution failure is located; generating a case execution log on the basis of the obtained information; and selecting execution control, e.g., selecting to continue the execution or restart an execution, for the case on the basis of the information recorded in the case execution log. Also disclosed are a case execution apparatus and device, and a computer readable storage medium. According to the present application, an automatic restart operation for the case is performed on the basis of the node position and context data, thereby reducing the difficult of the system in case execution control, and also implementing execution continuing control when the case execution fails; moreover, continuing the execution not only reduces the execution control time of the case, but also improves the success rate of the case execution.

Description

案例执行方法、装置、设备及计算机可读存储介质Case execution method, device, equipment and computer readable storage medium
本申请要求于2019年07月15日提交中国专利局、申请号为201910634552.0、发明名称为“案例执行方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 201910634552.0, and the invention title is "case execution method, device, equipment and computer-readable storage medium" on July 15, 2019. The reference is incorporated in the application.
技术领域Technical field
本申请涉及研发管理技术领域,尤其涉及一种案例执行方法、装置、设备及计算机可读存储介质。This application relates to the field of R&D management technology, and in particular to a case execution method, device, equipment, and computer-readable storage medium.
背景技术Background technique
目前对于案例的执行控制方式中,经常会由于各种原因使得案例在执行过程中出现失败或者是暂停,对于这种情况,现有技术中的解决方案是对案例进行执行失败重跑、失败继续重跑、选择性暂停重跑等操作,但是实现上述重跑的操作大多数都是通过人为检查和人为控制是否继续执行,而对于无法实现继续的案例,则会进行案例的重启,重新对案例进行执行,这样的案例控制执行方式,是非常消耗人力资源的,不利于目前的智能化的发展要求。In the current execution control method for the case, the case often fails or is suspended during the execution process due to various reasons. For this situation, the solution in the prior art is to perform the case execution failure rerun and failure to continue. Operations such as re-running, selective suspension of re-running, etc., but most of the above-mentioned re-running operations are performed through manual inspection and manual control. For cases that cannot be continued, the case will be restarted and the case will be re-run. Execution, such a case control execution method consumes human resources and is not conducive to the current intelligent development requirements.
发明内容Summary of the invention
本申请的主要目的在于提供一种案例执行方法、装置、设备及计算机可读存储介质,旨在解决由于现有的案例执行控制方式中,对于故障案例的控制过于耗时的技术问题。The main purpose of this application is to provide a case execution method, device, equipment, and computer-readable storage medium, aiming to solve the technical problem that the control of failure cases is too time-consuming due to the existing case execution control methods.
为实现上述目的,本申请提供一种案例执行方法,所述案例执行方法包括以下步骤:In order to achieve the above objectives, this application provides a case execution method, which includes the following steps:
获取设备上已执行或者正在执行的案例信息,根据所述案例信息检查案例的执行情况,以确定所述案例是否处于故障执行状态;Acquire information about a case that has been executed or that is being executed on the device, and check the execution of the case based on the case information to determine whether the case is in a faulty execution state;
若所述案例处于故障执行状态,则根据所述故障执行状态,从预置的故障执行状态与故障原因对应的关系表中,查询出所述案例在当前故障执行状态对应的故障原因;If the case is in the fault execution state, according to the fault execution state, query the fault reason corresponding to the current fault execution state of the case from the preset relationship table between the fault execution state and the fault cause;
获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志,其中,在所述案例执行日志中还包括记录所述案例的故障是否已处理的标识信息;Obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording whether the case's failure has been processed Identification information;
根据所述案例执行日志中的标识信息判断与所述故障原因对应的故障是否被排除;Determine whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
若判断所述故障已被排除,则将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例;If it is determined that the fault has been eliminated, the node position recorded in the case execution log is taken as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, and the The starting point is the execution point to continue executing the case;
若判断所述故障未被排除,则将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理。If it is determined that the fault has not been eliminated, the case information is reloaded into the case execution unit of the device to restart the execution of the case.
可选的,所述基于所述故障原因和所述节点位置生成案例执行日志包括:Optionally, the generating a case execution log based on the failure reason and the node location includes:
获取所述案例执行日志的模板信息,所述模板信息为记录所述案例在执行情况和所产生的信息的表格;Acquiring template information of the case execution log, where the template information is a table that records the execution status of the case and the information generated;
获取所述节点位置所对应的执行代码,以及所述节点位置的上下文信息;Acquiring the execution code corresponding to the node position and the context information of the node position;
将所述节点位置的执行代、所述故障原因和所述上下文信息记录在所述表格中,以形成案例执行日志,其中,所述上下文信息包括cookie、登陆态、变量和时间戳中的至少一种。Record the execution generation of the node location, the failure reason 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 time stamp One kind.
可选的,所述故障执行状态包括执行中断状态和执行失败状态;Optionally, the failure execution state includes an execution interruption state and an execution failure state;
所述获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志包括:The obtaining the node location of the case in the current fault execution state, and generating a case execution log based on the fault cause and the node location includes:
判断所述故障执行状态是否为执行中断状态;Determine whether the fault execution state is an execution interruption state;
若判断为所述执行中断状态,则获取所述案例执行被中断所在的节点位置,将所述节点位置记录至所述案例执行日志中;If it is determined that the execution is interrupted, the node location where the execution of the case is interrupted is acquired, and the node location is recorded in the case execution log;
若判断不是所述执行中断状态,则判断所述故障执行状态是否满足所述执行失败状态的条件;If it is determined that it is not the execution interruption state, then it is determined whether the fault execution state meets the conditions of the execution failure state;
若判断满足所述执行失败状态的条件,则确定造成所述案例执行失败的故障原因,以及导致所述案例执行失败所在的节点位置,将所述故障原因和所述节点位置记录至所述案例执行日志中。If it is determined that the conditions for the execution failure state are met, determine the cause of the failure that caused the execution of the case and the location of the node that caused the execution of the case to fail, and record the cause of the failure and the location of the node to the case Execution log.
可选的,所述确定造成所述案例执行失败的故障原因包括:Optionally, the determining the cause of the failure of the execution of the case includes:
检测所述案例执行单元在执行所述案例过程中,是否存在有执行优先级设置的新案例被启动;Detecting whether a new case with execution priority setting is started during the execution of the case by the case execution unit;
检测执行所述案例对应的工作环境是否出现了变化,其中,所述工作环境包括所述设备的配置项、所述设备的服务器、所述案例执行的测试场景和所述设备所使用的网络;Detecting whether the working environment corresponding to the execution of the case has changed, where the working environment includes the configuration items of the device, the server of the device, the test scenario executed by the case, and the network used by the device;
检测所述案例是否是由于非功能问题导致的执行失败,其中,所述非功能问题为不是由所述设备的软件配置或者硬件配置所引起的故障。It is detected whether the case is an execution failure caused by a non-functional problem, where the non-functional problem is a failure not caused by a software configuration or a hardware configuration of the device.
可选的,在所述检测到存在有执行优先级设置的新案例被启动之后,所述案例执行方法还包括:Optionally, after it is detected that a new case with execution priority setting is started, the case execution method further includes:
判断所述新案例的执行优先级是否大于当前执行的案例的执行优先级;Determine whether the execution priority of the new case is greater than the execution priority of the currently executed case;
若是,则判断所述新案例与当前执行的案例是否为同一类型的案例;If yes, judge whether the new case and the currently executed case are the same type of case;
若是同一类型的案例,则将所述新案例替换当前执行的案例,并执行所述新案例;If it is a case of the same type, replace the currently executed case with the new case and execute the new case;
若不是同一类型的案例,则将当前执行的案例设置为执行中断状态或者执行失败状态,并跳转至所述新案例执行,待所述新案例执行完成后,返回至设置为执行中断状态或者执行失败状态的案例继续执行。If it is not the same type of case, set the currently executed case to the execution interrupted state or the execution failed state, and jump to the execution of the new case. After the execution of the new case is completed, return to the set execution interrupted state or The execution of the failed case continues.
可选的,所述将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例包括:Optionally, the node position recorded in the case execution log is used as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, taking the starting point as the execution point Continuing the execution of the cases includes:
若所述故障执行状态为执行失败状态,则通过反射获取到所述执行失败状态的所述案例的类名和方法名;If the failure execution state is an execution failure state, the class name and method name of the case in the execution failure state are acquired through reflection;
根据所述类名和方法名从所述案例执行日志中读取所述上下文信息,并调用案例执行失败处理策略对所述执行失败状态的案例进行重启操作。Read the context information from the case execution log according to the class name and method name, and call 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 restart the execution of the case, the method further includes: classifying the case according to the cause of the failure ;
所述将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理包括:The reloading the case information into the case execution unit of the device to perform restart execution processing on the case includes:
根据所述案例的类型从所述设备中选择对应的案例缓存区;Selecting a corresponding case buffer area from the device according to the type of the case;
将待重新加载的所述案例信息加载至所述案例缓存区中等待所述案例执行单元的调取执行。Load the case information to be reloaded into the case buffer area and wait for the call execution of the case execution unit.
此外,为实现上述目的,本申请还提供一种案例执行装置,所述案例执行装置包括:In addition, in order to achieve the above objective, this application also provides a case execution device, the case execution device includes:
监测模块,用于获取设备上已执行或者正在执行的案例信息,根据所述案例信息检查案例的执行情况,以确定所述案例是否处于故障执行状态;The monitoring module is used to obtain information about a case that has been executed or that is being executed on the device, and check the execution of the case according to the case information to determine whether the case is in a faulty execution state;
查询模块,用于在所述案例处于故障执行状态时,根据所述故障执行状态,从预置的故障执行状态与故障原因对应的关系表中,查询出所述案例在当前故障执行状态对应的故障原因;The query module is used to, when the case is in the fault execution state, according to the fault execution state, from a preset table of the corresponding relationship between the fault execution state and the failure cause, query the case corresponding to the current fault execution state cause of issue;
记录模块,用于获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志,其中,在所述案例执行日志中还包括记录所述案例的故障是否已处理的标识信息;The recording module is used to obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording the case Identification information of whether the fault has been processed;
判断模块,用于根据所述案例执行日志中的标识信息判断与所述故障原因对应的故障是否被排除;The judgment module is used to judge whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
处理模块,用于在判断所述故障已被排除时,将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例;以及在判 断所述故障未被排除时,将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理。The processing module is configured to, when judging that the fault has been eliminated, use the node position recorded in the case execution log as the starting point of the case execution, and reload the case information to the case execution unit of the device , Continue to execute the case with the starting point as the execution point; and when it is determined that the fault has not been eliminated, reload the case information into the case execution unit of the device to restart the execution of the case .
此外,为实现上述目的,本申请还提供一种案例执行设备,所述案例执行设备包括:存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的案例执行程序,所述案例执行程序被所述处理器执行时实现如上述任一项所述的案例执行方法的步骤。In addition, in order to achieve the above objective, the present application also provides a case execution device, the case execution device includes: a memory, a processor, and a case execution program stored on the memory and running on the processor, so When the case execution program is executed by the processor, the steps of the case execution method described in any one of the above are implemented.
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有案例执行程序,所述案例执行程序被处理器执行时实现如上述任一项所述的案例执行方法的步骤。In addition, in order to achieve the above object, the present application also provides a computer-readable storage medium with a case execution program stored on the computer-readable storage medium. When the case execution program is executed by a processor, the implementation is as described in any of the above The steps of the case execution method described.
通过对案例执行失败的原因的检测,并在对检测到的原因进行分类,同时记录执行失败的节点位置和节点对应的上下文数据,在解决了的执行失败的原因后,根据节点位置和上下文数据安排案例的自动重启操作,基于这种记录和自动重启的方式来实现对案例的重跑控制,从而降低了系统对案例执行的控制难度,同时也实现了对案例执行失败时的继续执行控制,与现有的案例重新执行的方式相比,继续执行可以节省了案例的执行时间,也提高了案例执行的成功率。Through the detection of the reasons for the execution failure of the case, and classify the detected reasons, at the same time record the location of the node where the execution failed and the context data corresponding to the node. After the cause of the execution failure is solved, according to the node location and context data Arrange the automatic restart operation of the case, and realize the rerun control of the case based on this recording and automatic restart method, thus reducing the difficulty of the system to control the case execution, and also realize the continued execution control when the case execution fails. Compared with the existing method of re-executing the case, the continued execution can save the execution time of the case and increase the success rate of case execution.
附图说明Description of the drawings
图1为本申请提供的案例执行方法第一实施例的流程示意图;FIG. 1 is a schematic flowchart of the first embodiment of the case execution method provided by this application;
图2为本申请提供的案例执行方法第二实施例的流程示意图;2 is a schematic flowchart of a second embodiment of the case execution method provided by this application;
图3为本申请实施例方案涉及的服务器运行环境的结构示意图;FIG. 3 is a schematic structural diagram of a server operating environment involved in a solution of an embodiment of the application;
图4为本申请提供的案例执行装置一实施例的功能模块示意图。FIG. 4 is a schematic diagram of functional modules of an embodiment of a case execution apparatus provided by this application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described herein are only used to explain the application, and not used to limit the application.
参照图1,图1为本申请实施例提供的案例执行方法的流程图。在本实施例中,所述案例执行方法具体包括以下步骤:Referring to Fig. 1, Fig. 1 is a flowchart of a case execution method provided by an embodiment of the application. In this embodiment, the case execution method specifically includes the following steps:
步骤S110,获取设备上已执行或者正在执行的案例信息,根据所述案例信息检查案例的执行情况,以确定所述案例是否处于故障执行状态;Step S110: Obtain information about a case that has been executed or is being executed on the device, and check the execution of the case according to the case information to determine whether the case is in a faulty execution state;
在该步骤中,所述案例可以理解为是测试案例,也可以理解为是系统或者设备上的某种功能代码的执行过程或者是测试过程,甚至还可以是应用程序和数据处理的案例等等,在实际应用中,所述案例可以是包括多个案例的 集合。In this step, the case can be understood as a test case, it can also be understood as the execution process or test process of a certain functional code on the system or device, or even an application and data processing case, etc. In practical applications, the case may be a collection including multiple cases.
对于这里的获取动作,具体实现可以是从系统或者设备上的代码执行池中采集,也可以是从启动的应用管理后台中读取。For the acquisition action here, the specific implementation can be collected from the code execution pool on the system or device, or read from the started application management background.
在该步骤中,具体是采集设备中对于案例的实时执行情况,所述实时执行情况包括正常执行和故障执行两种状态,其中故障执行状态可以理解为是案例被中断执行、停止执行、临时暂停执行,甚至是重跑执行。In this step, it is specifically the real-time execution status of the case in the collection device. The real-time execution status includes two states of normal execution and failure execution. The failure execution state can be understood as the case is interrupted, stopped, and temporarily suspended. Execution, even re-run execution.
当然在实际应用中,对于实时的案例执行情况获取,其就是设备上正在执行的案例进行监控获取其案例在执行过程的所产生的信息;而对于已执行的案例信息的获取,则是可以从案例执行日志记录中进行获取,一般的设备在案例的执行中都会对一定时间段上的案例进行短期的记录。Of course, in actual applications, for real-time case execution status acquisition, it means monitoring the case being executed on the device to obtain the information generated during the execution of the case; while for the case information that has been executed, it can be obtained from Obtained in the case execution log record, general equipment will record the case in a certain period of time during the execution of the case.
在本实施例中,对于故障的监控具体是通过监控案例执行过程中生成的工作日志文件中的记录,通过监控比对工作日志文件中的每条工作日志是否正确,并计算不正确的工作日志,直到计算的工作日志数量大于预设值时,则认为该案例的执行出现了故障,或者是停止、暂停等等。In this embodiment, the monitoring of the failure is specifically through the records in the work log file generated during the execution of the monitoring case, the monitoring and comparison of each work log in the work log file is correct, and the calculation of the incorrect work log , Until the calculated number of work logs is greater than the preset value, it is considered that the execution of the case has failed, or it is stopped, suspended, etc.
步骤S120,若所述案例处于故障执行状态,则根据所述故障执行状态,从预置的故障执行状态与故障原因对应的关系表中,查询出所述案例在当前故障执行状态对应的故障原因;Step S120: If the case is in the fault execution state, according to the fault execution state, query the fault cause corresponding to the current fault execution state of the case from the preset relationship table between the fault execution state and the fault cause ;
步骤S130,获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志,其中,在所述案例执行日志中还包括记录所述案例的故障是否已处理的标识信息;Step S130: Obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording the case's failure Whether the identification information has been processed;
在本实施例中,对于上述故障原因包括系统上的非功能问题、工作环境等等因素,该非功能问题应当理解为是非系统缺陷所导致的问题,例如环境问题,即是系统系统的一些配置项配置错误、某些系统的服务器正在重启、某些系统正在测试场景异常、某些网络故障等等。In this embodiment, for the above-mentioned failure causes including non-functional problems on the system, working environment and other factors, the non-functional problems should be understood as problems caused by non-system defects, such as environmental problems, that is, some configurations of the system. Item configuration error, some systems' servers are restarting, some systems are being tested abnormally, some network failures, etc.
在实际应用中,对于案例的执行情况的检查,具体可以通过以下方式来实现:In practical applications, the inspection of the execution of the case can be implemented in the following ways:
首先,在开发该案例时,针对每个案例中的每条执行语句中都设置有测试语句,将所有测试语句组合起来得到一个案例的测试程序,而该程序在执行该案例的同时会自行启动,通过这些测试语句对案例的执行情况进行监控和记录。First of all, when developing the case, a test statement is set for each execution statement in each case, and all the test statements are combined to obtain a test program for a case, and the program will start automatically when the case is executed , Through these test statements to monitor and record the execution of the case.
在实际应用中,而每个语句的执行基本上是反应为“真”或者“假”值,通过判断这些语句的“真”、“假”值来实现对案例的每个案例语句的执行状况进行检测,从而判断案例是否存在故障。In practical applications, the execution of each statement basically reflects the value of "true" or "false", and the execution status of each case statement of the case is realized by judging the "true" and "false" values of these statements Perform testing to determine whether there is a fault in the case.
若检查到存在语句故障时,则获取该案例中故障对应的语句,分析该语句在案例中的执行功能,从而来确定该故障数据哪种故障执行状态,并且根 据该语句的故障经验或者故障排查历史来综合判断导致该故障的主要原因,例如该语句的主要功能是实现数据调取的路径映射,那么一般来说导致该语句无法执行的原因就是映射的路径信息不存在或者路径信息不正确,由此可见其故障的原因为路径信息不正确,并进行路径信息不正确的标记。If a statement failure is detected, the statement corresponding to the failure in the case is obtained, and the execution function of the statement in the case is analyzed to determine which failure execution state of the failure data is, and based on the failure experience or troubleshooting of the statement History is used to comprehensively judge the main reason for the failure. For example, the main function of the statement is to realize the path mapping of data retrieval. Generally speaking, the reason that the statement cannot be executed is that the mapped path information does not exist or the path information is incorrect. It can be seen that the cause of the failure is incorrect path information, and the incorrect path information is marked.
在分析出原因后,从监控的工作日志文件中提取故障点的位置,并将该位置作为故障的节点位置;After analyzing the cause, extract the location of the fault point from the monitored work log file and use this location as the location of the faulty node;
基于该节点位置,确定案例执行代码中的节点代码位置;Based on the node position, determine the node code position in the case execution code;
将该代码位置上的代码以及该代码位置前后的代码数据(即是上下文数据)记录下来生成一个执行日志。Record the code at the code position and the code data before and after the code position (that is, the context data) to generate an execution log.
在实际应用中,一般一个案例对应一个工作日志文件,而工作日志文件在记录案例执行情况时,是按照案例的语句执行的顺序来进行记录,在记录过程中会对语句在执行过程的所有状态信息和需要应用的信息,以及故障标注都进行记录,通过处理器对工作日志文件的解析,遍历每个语句所执行时产生的数据进行检查比对来确定是否存在故障的标注,若存在,则获取该标注以及该标注对应的语句所在案例语句中的位置,从而确定故障的节点位置,进一步的,将故障的标注、案例的信息、标注所在的案例语句位置以及该位置上的上下文信息全部摘取下来,形成一个检查的执行日志,在后续的案例维护中通过该执行日志来对案例进行处理即可。优选的,对于语句在案例中的位置具体可以通过案例执行时语句的指向帧来确定。In practical applications, generally a case corresponds to a work log file, and when the work log file records the case execution, it is recorded in the order in which the statements of the case are executed. During the recording process, all states of the statement during the execution process are recorded. The information and the information that needs to be applied, as well as the fault label are recorded. The processor analyzes the work log file and traverses the data generated during the execution of each sentence to check and compare to determine whether there is a fault label. If it exists, then Obtain the label and the position in the case sentence of the sentence corresponding to the label to determine the node position of the fault. Further, extract the fault label, case information, case sentence position where the label is located, and context information at that position. Take it down to form an inspection execution log, which can be used to process the case in subsequent case maintenance. Preferably, the position of the sentence in the case can be specifically determined by the pointing frame of the sentence when the case is executed.
在本实施例中,该上下文信息还可以是案例执行过程中的变量和参数等等,同时还包括记录该执行失败的案例的类名和方法名,并且在记录节点信息时可以通过建立类名和方法名与上下文信息之间的对应关的方式存储,储存在生成的案例执行日志中。In this embodiment, the context information can also be variables and parameters in the case execution process, etc., and also include the class name and method name of the case that records the execution failure, and when recording node information, the class name and method can be created The correspondence between names and context information is stored in the generated case execution log.
步骤S140,根据所述案例执行日志中的标识信息判断与所述故障原因对应的故障是否被排除;Step S140, judging whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
该步骤中的故障排除,主要是通过人为的干扰方式来实现对故障的排除,而系统在分析出存在故障导致了案例执行失败时,会对该故障进行定时的探测,通过探测该故障是否被排除了,当然该故障被排除的响应,可以是通过排除故障后通过标识信息的反应,也可以是通过一些其他参数的反应来实现,若排除了,则调至步骤S160,进行案例的重启操作。The troubleshooting in this step is mainly to eliminate the fault through artificial interference. When the system analyzes that there is a fault that causes the case to fail, it will detect the fault regularly, and detect whether the fault is Excluded, of course, the response to the troubleshooting of the fault can be through the response of the identification information after the fault is eliminated, or through the response of some other parameters. If it is eliminated, then transfer to step S160 to restart the case .
在实际应用中,对于标识信息具体可以通过以二进制的标识位进行标识,“0”为未排除,“1”为已排除,而该步骤中,通过获取该标识位中的0或1来确定故障是否被排除;另外,还可以通过在执行日志中增加一个符号位来标识,具体标识包括“N”和“Y”两种,“N”为未排除,“Y”为已排除,而判断的方式与二进制的标识位一致,这里不再重复赘述。In practical applications, the identification information can be specifically identified by a binary identification bit, "0" means not excluded, and "1" means excluded. In this step, it is determined by obtaining 0 or 1 in the identification bit. Whether the fault has been eliminated; in addition, it can be identified by adding a symbol bit in the execution log. The specific identification includes "N" and "Y". "N" means not eliminated, and "Y" means eliminated, and judge The method is consistent with the binary identification bit, so I won’t repeat it here.
步骤S150,若判断所述故障已被排除,则将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例;Step S150, if it is determined that the fault has been eliminated, the node position recorded in the case execution log is used as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, Continue to execute the case with the starting point as the execution point;
步骤S160,若判断所述故障未被排除,则将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理。Step S160: If it is determined that the fault has not been eliminated, reload the case information into the case execution unit of the device to perform restart execution processing on the case.
在本实施例中,所述重启操作指的是对案例的重跑;当系统检测到故障被排除的响应后,返回该案例的执行流程,并从执行日志中获取到与该案例对应的节点记录,调取响应的处理方法对该案例进行重跑操作。In this embodiment, the restart operation refers to re-running the case; when the system detects a response that the fault is eliminated, it returns to the execution process of the case, and obtains the node corresponding to the case from the execution log Record and retrieve the response processing method to rerun the case.
在实际应用中,为了便于重启的处理,还包括设置一个重启案例加载数据缓存器,在确定需要进行重启执行处理的案例之后,将对应的案例的信息上传至该缓存器,该缓存器将上传的案例的信息保存到缓存器中重启表格中,当定时器计时到达后,直接读取表格中的案例的信息案例执行重启的程序即可实现对案例的重启执行操作。In actual applications, in order to facilitate restart processing, it also includes setting a restart case loading data buffer. After determining the case that needs to be restarted and executed, upload the corresponding case information to the buffer, and the buffer will upload The information of the case is saved in the restart table in the buffer. When the timer expires, you can directly read the case information in the table and execute the restart program to realize the restart operation of the case.
在本实施例中,为了便于后续对案例重启的操作,其还包括:根据造成案例执行失败的原因对案例进行分类,例如原因解决后将可以进行继续执行的案例分为一类,将可以重新执行的案例分为一类等等。In this embodiment, in order to facilitate the subsequent operation of restarting the case, it also includes: classifying the case according to the reason that caused the execution of the case to fail. The cases implemented are divided into one category and so on.
在本实施例中,对于案例执行失败的原因具体可以理解为分为以下几种:新案例启动被中断、语句的映射不正确、系统硬件故障和操作系统故障,对于根据执行失败的原因对案例的分类,具体的,根据上述的集中原因,对案例做初步的分类,而对于分类后的案例具体是执行继续操作还是重启操作,则跳转至步骤S140进行下一步的处理。In this embodiment, the reasons for the execution failure of the case can be specifically understood as being divided into the following categories: the startup of the new case is interrupted, the mapping of the statement is incorrect, the system hardware failure and the operating system failure, for the case according to the reason for the execution failure Specifically, according to the above-mentioned concentration reasons, the cases are preliminarily classified, and for the classified cases, whether to perform a continue operation or a restart operation, jump to step S140 for the next processing.
在本实施例中,对于重跑可以是对案例的继续执行,也可以是对案例的重新执行,当然优选的,根据造成案例故障执行的原因来选择继续执行还是重新执行。In this embodiment, the re-running can be the continued execution of the case or the re-execution of the case. Of course, it is preferable to choose whether to continue or re-execute the case according to the cause of the failure execution of the case.
基于上述的步骤实现对案例的执行控制,通过根据案例执行失败的分类实现不同的重跑操作,从而避免了现有的案例失败都是重新执行导致执行时间过于浪费,且消耗资源的问题。实现了支持失败自动重跑、失败继续重跑、选择性暂停重跑等案例的控制方式,大大提高了用户的使用和操作体验。Based on the above steps, the execution control of the case is realized, and different rerun operations are realized according to the classification of the case execution failure, thereby avoiding the problem of excessive execution time and resource consumption due to the re-execution of existing case failures. It realizes the control method that supports cases such as automatic re-run after failure, continued re-run after failure, and selective suspension and re-run, which greatly improves the user's use and operation experience.
进一步的,在本实施例中,所述基于所述故障原因和所述节点位置生成案例执行日志包括:Further, in this embodiment, generating a case execution log based on the failure cause and the node location includes:
获取所述案例执行日志的模板信息,所述模板信息为记录所述案例在执行情况和所产生的信息的表格;Acquiring template information of the case execution log, where the template information is a table that records the execution status of the case and the information generated;
获取所述节点位置所对应的执行代码,以及所述节点位置的上下文信息;Acquiring the execution code corresponding to the node position and the context information of the node position;
将所述节点位置的执行代、所述故障原因和所述上下文信息记录在所述表格中,以形成案例执行日志,其中,所述上下文信息包括cookie、登陆态、 变量和时间戳中的至少一种。Record the execution generation of the node location, the cause of the failure, 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 time stamp One kind.
具体的,对于节点位置的记录具体表现为将所述节点位置所对应的案例的程序中的执行代码,即是将节点位置对应的执行代码进行记录,同时还节点位置所在的上下文信息记录在所述执行日志中,所述上下文信息包括cookie、登陆态、变量和时间戳中的至少一种。Specifically, the record of the node position is specifically expressed as the execution code in the program of the case corresponding to the node position, that is, the execution code corresponding to the node position is recorded, and the context information of the node position is also recorded in the In the execution log, the context information includes at least one of a cookie, a login state, a variable, and a time stamp.
在本实施例中,所述故障执行状态包括执行中断状态和执行失败状态;In this embodiment, the failure execution state includes an execution interruption state and an execution failure state;
所述获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志包括:The obtaining the node location of the case in the current fault execution state, and generating a case execution log based on the fault cause and the node location includes:
判断所述故障执行状态是否为执行中断状态;Determine whether the fault execution state is an execution interruption state;
若判断为所述执行中断状态,则获取所述案例执行被中断所在的节点位置,将所述节点位置记录至所述案例执行日志中;If it is determined that the execution is interrupted, the node location where the execution of the case is interrupted is acquired, and the node location is recorded in the case execution log;
若判断不是所述执行中断状态,则判断所述故障执行状态是否满足所述执行失败状态的条件;If it is determined that it is not the execution interruption state, then it is determined whether the fault execution state meets the conditions of the execution failure state;
若判断满足所述执行失败状态的条件,则确定造成所述案例执行失败的故障原因,以及导致所述案例执行失败所在的节点位置,将所述故障原因和所述节点位置记录至所述案例执行日志中。If it is determined that the conditions for the execution failure state are met, determine the cause of the failure that caused the execution of the case and the location of the node that caused the execution of the case to fail, and record the cause of the failure and the location of the node to the case Execution log.
在实际应用中,对于执行中断状态的判断,可选的,是通过检测系统中的案例执行中断按钮来判断该案例的执行是否为认为的中断操作,若案例中断按钮被按下,或者是该按钮有响应信号输出,则认为是案例处于中断状态。In practical applications, for the judgment of the execution interruption state, it is optional to determine whether the execution of the case is considered to be an interrupt operation by detecting the case execution interrupt button in the system. If the case interrupt button is pressed, or the If the button has a response signal output, it is considered that the case is in an interrupted state.
基于处于中断状态时,且是用户主动的暂停。在平台上有暂停按钮,用户如果在案例执行过程中点击暂停,那么平台后台会将该案例进程挂起,并保存执行到某处的所有变量和信息,以便后续进程继续时可以正常继续执行。Based on the interruption state, and the user actively pauses. There is a pause button on the platform. If the user clicks pause during the execution of a case, the platform background will suspend the case process and save all variables and information executed somewhere so that the subsequent process can continue to execute normally.
对于执行失败状态的判断,可选的,是通过该案例的执行方法是否被结束,若是,则进一步对被结束的原因进行深入的分析,确定被结束的原因是什么,一般情况下,案例的执行方法被结束处理的情况会存在以下几种,分别是环境原因、案例被人为结束、系统功能缺陷等等。For the judgment of the execution failure status, the optional is to determine whether the execution method of the case is ended. If so, further analyze the reason for the termination to determine the reason for the termination. Under normal circumstances, the case There are several situations in which the execution method is terminated, which are environmental reasons, cases are manually terminated, system functional defects, etc.
在本实施例中,所述确定造成所述案例执行失败的故障原因包括:In this embodiment, the determining the cause of the failure of the execution of the case includes:
检测所述案例执行单元在执行所述案例过程中,是否存在有执行优先级设置的新案例被启动;Detecting whether a new case with execution priority setting is started during the execution of the case by the case execution unit;
检测执行所述案例对应的工作环境是否出现了变化,其中,所述工作环境包括所述设备的配置项、所述设备的服务器、所述案例执行的测试场景和所述设备所使用的网络;Detecting whether the working environment corresponding to the execution of the case has changed, where the working environment includes the configuration items of the device, the server of the device, the test scenario executed by the case, and the network used by the device;
检测所述案例是否是由于非功能问题导致的执行失败,其中,所述非功能问题为不是由所述设备的软件配置或者硬件配置所引起的故障。It is detected whether the case is an execution failure caused by a non-functional problem, where the non-functional problem is a failure not caused by a software configuration or a hardware configuration of the device.
在实际应用中,该工作环境指的是系统的一些配置项、系统的服务器、 系统正在测试场景、网络等等,而工作环境的变化指的是系统的一些配置项配置错误、系统的服务器正在重启、系统正在测试场景异常、网络故障等等。In practical applications, the working environment refers to some configuration items of the system, the server of the system, the system being tested, the network, etc., while the change of the working environment refers to the configuration of some configuration items of the system incorrectly, and the server of the system is Restart, the system is being tested, the scene is abnormal, the network fails, etc.
当案例执行失败是因为环境原因失败时,案例的执行流程将会被停留在失败的节点处,将失败时的上下文记录起来,当环境问题解决后,可以通过点击继续执行按钮,使得案例从失败节点处继续执行,或者是通过预先设置的案例重启程序来实现自动案例的自动启动。When the case execution fails due to environmental reasons, the execution process of the case will stay at the failed node, and the context of the failure will be recorded. When the environmental problem is solved, you can click the Continue Execution button to make the case fail. Continue execution at the node, or realize the automatic start of the automatic case through the preset case restart program.
对于环境原因的案例重跑的具体实现方案可以如下:The specific implementation plan for re-running cases for environmental reasons can be as follows:
记录下执行代码的上下文,即cookie、登陆态、变量、时间戳等信息,存在数据库中Record the context of the execution code, that is, cookies, login status, variables, timestamps and other information, stored in the database
当环境问题解决后,通过反射获取到当前执行失败用例的类名和方法名When the environmental problem is solved, the class name and method name of the current execution failure case are obtained through reflection
点击继续执行按钮时,读取上下文数据,调用当前失败用例的失败处的方法,从而继续该案例。When the continue execution button is clicked, the context data is read and the method at the failure point of the current failed case is called to continue the case.
在本实施例中,若分析到案例是由于新案例的启动而导致执行失败时,所述案例执行方法还包括:In this embodiment, if it is analyzed that the execution of the case fails due to the start of a new case, the case execution method further includes:
判断所述新案例的执行优先级是否大于当前执行的案例的执行优先级;Determine whether the execution priority of the new case is greater than the execution priority of the currently executed case;
若是,则判断所述新案例与当前执行的案例是否为同一类型的案例;If yes, judge whether the new case and the currently executed case are the same type of case;
若是同一类型的案例,则将所述新案例替换当前执行的案例,并执行所述新案例;If it is a case of the same type, replace the currently executed case with the new case and execute the new case;
若不是同一类型的案例,则将当前执行的案例设置为执行中断状态或者执行失败状态,并跳转至所述新案例执行,待所述新案例执行完成后,返回至设置为执行中断状态或者执行失败状态的案例继续执行。If it is not the same type of case, set the currently executed case to the execution interrupted state or the execution failed state, and jump to the execution of the new case. After the execution of the new case is completed, return to the set execution interrupted state or The execution of the failed case continues.
在实际应用中,对于一个案例的执行失败有可能是由于优先级别高的案例启动了,但是系统的处理资源又不够用的前提下,才会选择性的停止部分当前正在执行的案例来空闲出一部分资源供给新案例使用。对于这种情况的案例执行失败是可以通过继续执行的方式来重跑案例的。In practical applications, the execution failure of a case may be due to the start of a case with a high priority level, but under the premise that the processing resources of the system are not enough, it will selectively stop some cases currently being executed to idle out. Part of the resources are used in new cases. For the case execution failure in this case, the case can be rerun by continuing the execution.
进一步的,当案例是因非功能问题执行失败时,则直接选择自动重新执行该案例的方式启动案例,直至案例完整执行成功或者多次因功能问题执行失败为止,停止对该案例的操作。Further, when a case fails to execute due to a non-functional problem, the case is started by automatically re-executing the case, and the case is stopped until the case is completely executed successfully or the execution fails due to functional problems multiple times.
具体的实现方案可以是在@AfterMethod注解方法中,添加测试执行结果的监听,通过ITestResult接口去判断测试执行是否成功,如果失败了就通过反射获取到当前执行失败用例的类名和方法名,然后调用方法,实现了重跑一次或多次,对于重跑的次数可以自己设定。The specific implementation scheme can be to add monitoring of the test execution result in the @AfterMethod annotation method, and use the ITestResult interface to determine whether the test execution is successful. If it fails, get the class name and method name of the current execution failure case through reflection, and then call The method realizes one or more reruns, and the number of reruns can be set by yourself.
在本实施例中,若所述故障执行状态为执行失败状态时,所述将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述 案例的步骤具体包括:In this embodiment, if the failure execution state is the execution failure state, the node position recorded in the case execution log is used as the starting point of the case execution, and the case information is reloaded into the In the case execution unit of the device, the step of continuing to execute the case with the starting point as the execution point specifically includes:
通过反射获取到所述执行失败状态的所述案例的类名和方法名;Obtain the class name and method name of the case in the execution failure state through reflection;
根据所述类名和方法名从所述案例执行日志中读取所述上下文信息,并调用案例执行失败处理策略对所述执行失败状态的案例进行重启操作。Read the context information from the case execution log according to the class name and method name, and call a case execution failure processing strategy to restart the case in the execution failure state.
在实际应用中,上述反射是java编程中一种技术,通过反射可以获得指定的类对象。在本实施例中,运用了反射来获取类对象,作用是为了保存执行失败时的类对象,并保存下来,以便后续可以调用该对象执行对应案例的后续步骤方法。In practical applications, the above reflection is a technique in java programming, through which the specified class object can be obtained. In this embodiment, reflection is used to obtain the class object, and the function is to save the class object when the execution fails, and save it, so that the object can be subsequently called to execute the subsequent step method of the corresponding case.
对于类名和方法名是指java编程代码中一些代码的用语。在代码中,是通过类来创建对象,通过对象来操作方法的,而一个方法就是实现了一些数据处理,也就是完成了一些案例的操作步骤。For class names and method names, it refers to the terms of some codes in the java programming code. In the code, objects are created through classes and methods are manipulated through objects. One method is to implement some data processing, that is, to complete the steps of some cases.
读取上下文数据,是指在点击继续执行案例时,后台会根据之前保存的类名、方法名,去读取数据库中保存的所有与这条案例有关的变量值,然后通过重新定义变量并赋值,以此来重现案例的数据环境。从而,可以继续把暂停了的案例执行下去。Reading context data means that when you click to continue executing the case, the background will read all the variable values stored in the database related to this case according to the previously saved class name and method name, and then redefine the variables and assign values , To reproduce the data environment of the case. As a result, the suspended case can continue to be executed.
也即是说,在检测到案例为执行失败状态时,会同时记录案例的类名和执行该案例的方法名,在解决了导致执行失败的问题后,通过反射查询到师失败案例的类名和方法名,并基于记录的节点位置和上下文数据进行案例的重跑处理。In other words, when the case is detected as an execution failure state, the class name of the case and the method name of the execution of the case will be recorded at the same time. After the problem that caused the execution failure is solved, the class name and method of the failure case of the division are queried through reflection Name, and rerun the case based on the recorded node position and context data.
在本实施例中,若对于造成案例执行失败的原因是用户结束案例时,则会启动案例清理程序,对该终止的案例的相关进行全部清理,从而实现对案例的结束操作。In this embodiment, if the reason for the execution failure of the case is that the user ends the case, the case cleaning program will be started, and all related to the terminated case will be cleaned up, so as to realize the closing operation of the case.
在本实施例中,在所述将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理的步骤之前,还包括:根据所述故障原因对所述案例进行类型划分;In this embodiment, before the step of reloading the case information into the case execution unit of the device to restart the execution of the case, the method further includes: performing the case according to the failure cause Type division;
所述将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理包括:The reloading the case information into the case execution unit of the device to perform restart execution processing on the case includes:
根据所述案例的类型从所述设备中选择对应的案例缓存区;Selecting a corresponding case buffer area from the device according to the type of the case;
将待重新加载的所述案例信息加载至所述案例缓存区中等待所述案例执行单元的调取执行。Load the case information to be reloaded into the case buffer area and wait for the call execution of the case execution unit.
综上所述,本申请实施例提供的案例执行方法,通过对设备的案例信息的查询得到案例的执行情况来确定案例的执行状态,然后根据执行状态查询对应的故障原因,然后获取到执行故障的案例所在的节点位置,基于上述获取到的信息来生成一个案例执行日志,基于案例执行日志中记载的信息来选择对案例的执行控制,选择的继续执行还是重启执行,即是通过对案例执行 失败的原因的检测,并在对检测到的原因进行分类,同时记录执行失败的节点位置和节点对应的上下文数据,在解决了的执行失败的原因后,根据节点位置和上下文数据安排案例的自动重启操作,从而降低了系统对案例执行的控制难度,同时也实现了对案例执行失败时的继续执行控制,与现有的暗中重新执行的方式相比,继续执行可以节省了案例的执行时间,也提高了案例执行的成功率。To sum up, the case execution method provided in the embodiments of the present application determines the execution status of the case by querying the case information of the device to obtain the execution status of the case, and then queries the corresponding failure cause according to the execution status, and then obtains the execution failure The location of the node where the case is located, based on the information obtained above to generate a case execution log, based on the information recorded in the case execution log to select the execution control of the case, choose whether to continue or restart the execution, that is, by executing the case Detect the cause of the failure, and classify the detected cause, and record the location of the node where the execution failed and the context data corresponding to the node. After the cause of the execution failure is solved, the automatic case is arranged according to the node location and context data The restart operation reduces the difficulty of the system's control over the case execution, and at the same time realizes the continued execution control when the case execution fails. Compared with the existing secret re-execution method, the continued execution can save the execution time of the case. It also improves the success rate of case execution.
下面以具体的故障原因为例对本申请提供的案例执行方法进行详细的说明,如图2所示,为案例执行失败时的具体实现流程图,该方法具体包括以下步骤:The following takes specific failure causes as an example to describe in detail the case execution method provided in this application. As shown in Figure 2, it is a specific implementation flowchart when the case execution fails. The method specifically includes the following steps:
步骤S210,获取取设备上执行失败的案例信息;Step S210, acquiring information about cases where execution failed on the device;
在该步骤中,具体可以是已经执行结束的案例,但是该结束应当理解为是已经存储在案例记录表中的案例信息,即是说由于被设备系统记录为师表的且过了一段时间已经不再重新执行的案例;进一步的,还可以是正在执行的案例,刚被标记为执行失败的案例。In this step, it can specifically be a case that has been executed, but the end should be understood as the case information that has been stored in the case record table, that is, because it is recorded as the teacher table by the equipment system and has not been Cases to be re-executed; further, it can also be a case that is being executed, which has just been marked as a failed execution.
步骤S220,分析提取出该案例在执行时导致其执行失败的节点位置;Step S220: Analyze and extract the location of the node that caused the execution of the case to fail during execution;
在该步骤中,该种节点位置可能会存在多个,对此,还需要根据节点位置以及该节点位置导致失败的原因来判断案例是否可以进行继续执行操作,若不行,则直接启动重启操作步骤。In this step, there may be multiple node positions of this kind. For this, it is also necessary to determine whether the case can be continued according to the node position and the reason for the failure of the node position. If not, directly start the restart operation step .
进一步的,还可以通过对案例的执行历程进行履历来确定第一失败节点位置,判断第一失败节点位置的可执行性,若不可继续进行则直接重启操作,若可以,则继续判断下一节点位置的可执行性,直到案例的所有节点有只要有一个具有不可继续执行的,则重启,反之则继续执行。Further, it is also possible to determine the location of the first failed node by tracing the execution history of the case, determine the executability of the location of the first failed node, and restart the operation directly if it is impossible to proceed, and continue to determine the next node if possible Executability of the location, until all nodes in the case have a non-continuable execution, restart, otherwise continue execution.
步骤S230,判断节点位置的故障原因的可执行性;Step S230: Determine the operability of the cause of the failure at the node location;
在实际应用中,这里的可执行性包括可使用继续执行案例操作和不可继续执行案例操作。In practical applications, the executability here includes useable to continue executing case operations and non-continuous case operations.
步骤S240,根据判断的结果选择案例的控制方案;Step S240, select the control scheme of the case according to the judgment result;
在该步骤中,其控制方案指的是继续执行操作和重跑操作。In this step, its control scheme refers to continuing to perform operations and re-running operations.
步骤S250,根据节点位置和控制方案生成案例执行日志文件;Step S250, generating a case execution log file according to the node location and the control scheme;
步骤S260,根据案例执行日志文件中的记录信息对案例进行控制操作。Step S260: Perform a control operation on the case according to the record information in the case execution log file.
在本实施例中,在记录节点位置时,还包括记录节点位置的执行代码以及节点位置对应的位置的上下文数据,该上下文数据包括cookie、登陆态、变量、时间戳等信息,存储在案例执行日志文件中。In this embodiment, when the node location is recorded, it also includes the execution code of the node location and the context data of the location corresponding to the node location. The context data includes information such as cookies, login status, variables, and time stamps, which are stored in the case execution Log file.
在本实施例中,进一步检测到是由于环境问题导致执行失败的,环境问题解决后,可以选择继续执行的控制方案进行处理,具体当环境问题解决后,通过反射获取到当前执行失败用例的类名和方法名,点击继续执行按钮时, 读取上下文数据,调用当前失败用例的失败处的方法,从而继续该案例。In this embodiment, it is further detected that the execution failure is due to environmental problems. After the environmental problem is solved, you can choose to continue the execution control plan for processing. Specifically, when the environmental problem is solved, the class of the current execution failure use case is obtained through reflection. Name and method name. When you click the Continue Execution button, the context data is read, and the method at the failure of the current failed use case is called to continue the case.
进一步的,若是因非功能问题执行失败时,则选择自动重新执行该案例的方式控制,直至案例完整执行成功或者因功能问题执行失败为止。Further, if the execution fails due to a non-functional problem, the method of automatically re-executing the case is selected until the case is completely executed successfully or the execution fails due to a functional problem.
实现方案:在@AfterMethod注解方法中,添加测试执行结果的监听,通过ITestResult(最佳试验结果)接口去判断测试执行是否成功,如果失败了就通过反射获取到当前执行失败用例的类名和方法名,然后调用方法,实现了重跑一次(或多次,次数可以自己设定)。Implementation scheme: In the @AfterMethod annotation method, add monitoring of test execution results, use the ITestResult (best test result) interface to judge whether the test execution is successful, if it fails, get the class name and method name of the current execution failure case through reflection , And then call the method to rerun once (or multiple times, the number of times can be set by yourself).
为了解决上述的问题,本申请还提供一种案例执行设备,该案例执行设备可以用于实现本申请实施例提供的案例执行方法,其物理实现以服务器的方式存在,该服务器的具体硬件实现如图1所示。In order to solve the above-mentioned problems, this application also provides a case execution device, which can be used to implement the case execution method provided in the embodiments of this application. Its physical implementation exists in the form of a server. The specific hardware implementation of the server is as follows: As shown in Figure 1.
参见图3,该服务器包括:处理器301,例如CPU,通信总线302、用户接口303,网络接口304,存储器305。其中,通信总线302用于实现这些组件之间的连接通信。用户接口303可以包括显示屏(Display)、输入单元比如键盘(Keyboard),网络接口304可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器305可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器305可选的还可以是独立于前述处理器301的存储装置。Referring to FIG. 3, the server includes: a processor 301, such as a CPU, a communication bus 302, a user interface 303, a network interface 304, and a memory 305. Among them, the communication bus 302 is used to implement connection and communication between these components. The user interface 303 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the network interface 304 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 305 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory. Optionally, the memory 305 may also be a storage device independent of the aforementioned processor 301.
如图3所示,作为一种非易失性的计算机可读存储介质的存储器305中可以包括操作系统、网络通信模块、用户接口模块以及基于案例执行程序。其中,操作系统是管理和案例执行装置和软件资源的程序,支案例执行程序以及其它软件和/或程序的运行。As shown in FIG. 3, the memory 305 as a non-volatile computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a case-based execution program. Among them, the operating system is a program that manages and executes the device and software resources, and supports the operation of the execution program and other software and/or programs.
在图3所示的服务器的硬件结构中,网络接口104主要用于接入网络;用户接口103设备上执行的案例信息,以及执行案例过程中所产生的数据,而处理器301可以用于调用存储器305中存储的案例执行程序,并执行以下案例执行方法的各实施例的操作。In the hardware structure of the server shown in FIG. 3, the network interface 104 is mainly used to access the network; the user interface 103 is used to execute case information on the device and data generated during the execution of the case, and the processor 301 can be used to call The case execution program is stored in the memory 305 and executes the operations of each embodiment of the following case execution method.
在本大明实施例中,对于图3的实现还可以是一种手机等可以触控操作的移动终端,该移动终端的处理器通过读取存储在缓存器或者存储单元中的可以实现案例执行方法的程序代码来进行案例进行分析,生成案例执行日志,从而控制选择哪种方式对案例进行执行操作。In this embodiment of the Ming Dynasty, the implementation of FIG. 3 can also be a mobile terminal capable of touch operation such as a mobile phone. The processor of the mobile terminal can implement the case execution method by reading the data stored in the buffer or storage unit. The program code is used to analyze the case and generate a case execution log to control which method is selected to perform operations on the case.
为了解决上述的问题,本申请实施例还提供了一种案例执行装置,参照图4,图4为本申请实施例提供的案例执行装置的功能模块的示意图。在本实施例中,该装置包括:In order to solve the above-mentioned problems, an embodiment of the present application also provides a case execution device. Referring to FIG. 4, FIG. 4 is a schematic diagram of functional modules of the case execution device provided in an embodiment of the application. In this embodiment, the device includes:
监测模块41,用于获取设备上已执行或者正在执行的案例信息,根据所述案例信息检查案例的执行情况,以确定所述案例是否处于故障执行状态;The monitoring module 41 is configured to obtain information about cases that have been executed or being executed on the device, and check the execution of the case according to the case information to determine whether the case is in a faulty execution state;
查询模块42,用于在所述案例处于故障执行状态时,根据所述故障执行 状态,从预置的故障执行状态与故障原因对应的关系表中,查询出所述案例在当前故障执行状态对应的故障原因;The query module 42 is configured to, when the case is in the failure execution state, according to the failure execution state, from a preset table of the corresponding relationship between the failure execution state and the failure cause, query the case corresponding to the current failure execution state Cause of failure;
记录模块43,用于获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志,其中,在所述案例执行日志中还包括记录所述案例的故障是否已处理的标识信息;The recording module 43 is configured to obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording the Identification information of whether the failure of the case has been processed;
判断模块44,用于根据所述案例执行日志中的标识信息判断与所述故障原因对应的故障是否被排除;The judgment module 44 is configured to judge whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
处理模块45,用于在判断所述故障已被排除时,将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例;以及在判断所述故障未被排除时,将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理。The processing module 45 is configured to, when judging that the fault has been eliminated, use the node position recorded in the case execution log as the starting point of the case execution, and reload the case information to the case execution of the device In the unit, continue to execute the case with the starting point as the execution point; and when it is determined that the fault has not been eliminated, reload the case information into the case execution unit of the device to restart execution of the case deal with.
基于与上述本申请实施例的案例执行方法相同的实施例说明内容,因此本实施例对案例执行装置的实施例内容不做过多赘述。Based on the description of the embodiment that is the same as the case execution method of the above embodiment of the present application, the content of the embodiment of the case execution device in this embodiment will not be repeated.
本实施例通过对案例执行失败的原因的检测,并在对检测到的原因进行分类,同时记录执行失败的节点位置和节点对应的上下文数据,在解决了的执行失败的原因后,根据节点位置和上下文数据生成案例执行日志来安排案例的自动重启操作,基于这种记录和自动重启的方式来实现对案例的重跑控制,从而降低了系统对案例执行的控制难度,同时也实现了对案例执行失败时的继续执行控制,通过这样的控制方式可以节省了案例的执行时间,也提高了案例的控制效率,以及提高了案例执行的成功率。This embodiment detects the reasons for the execution failure of the case and classifies the detected reasons. At the same time, it records the location of the node where the execution failed and the context data corresponding to the node. After the cause of the execution failure is resolved, the location of the node The case execution log is generated with context data to arrange the automatic restart operation of the case. Based on this recording and automatic restart method, the rerun control of the case is realized, thereby reducing the difficulty of the system to control the execution of the case, and also realizes the case Continue execution control when execution fails. This control method can save the execution time of the case, improve the control efficiency of the case, and increase the success rate of case execution.
本申请还提供一种计算机可读存储介质,其中,该计算机可读存储介质可以为易失性的,也可以为非易失性的,具体本申请不做限定。The present application also provides a computer-readable storage medium, where the computer-readable storage medium may be volatile or non-volatile, which is not specifically limited by the present application.
本实施例中,所述计算机可读存储介质上存储有案例执行程序,所述H5网页的案例执行程序被处理器执行时实现如上述任一项实施例中所述的案例执行方法的步骤。其中,案例执行程序被处理器执行时所实现的方法可参照本发明案例执行方法的各个实施例,因此不再过多赘述。In this embodiment, a case execution program is stored on the computer-readable storage medium, and the case execution program of the H5 webpage is executed by a processor to implement the steps of the case execution method described in any of the above embodiments. Among them, the method implemented when the case execution program is executed by the processor can refer to the various embodiments of the case execution method of the present invention, so it will not be repeated.
基于上面结合附图对本发明的实施例进行了描述,但是本发明并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本发明的启示下,在不脱离本发明宗旨和权利要求所保护的范围情况下,还可做出很多形式,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,这些均属于本发明的保护之内。The embodiments of the present invention have been described based on the above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific embodiments. The above-mentioned specific embodiments are only illustrative and not restrictive. Those of ordinary skill in the art Under the enlightenment of the present invention, without departing from the purpose of the present invention and the scope of protection of the claims, many forms can be made, and any equivalent structure or equivalent process transformation made by using the content of the description and drawings of the present invention, Or directly or indirectly used in other related technical fields, all of which belong to the protection of the present invention.

Claims (20)

  1. 一种案例执行方法,所述案例执行方法包括以下步骤:A case execution method, the case execution method includes the following steps:
    获取设备上已执行或者正在执行的案例信息,根据所述案例信息检查案例的执行情况,以确定所述案例是否处于故障执行状态;Acquire information about a case that has been executed or that is being executed on the device, and check the execution of the case based on the case information to determine whether the case is in a faulty execution state;
    若所述案例处于故障执行状态,则根据所述故障执行状态,从预置的故障执行状态与故障原因对应的关系表中,查询出所述案例在当前故障执行状态对应的故障原因;If the case is in the fault execution state, according to the fault execution state, query the fault reason corresponding to the current fault execution state of the case from the preset relationship table between the fault execution state and the fault cause;
    获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志,其中,在所述案例执行日志中还包括记录所述案例的故障是否已处理的标识信息;Obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording whether the case's failure has been processed Identification information;
    根据所述案例执行日志中的标识信息判断与所述故障原因对应的故障是否被排除;Determine whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
    若判断所述故障已被排除,则将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例;If it is determined that the fault has been eliminated, the node position recorded in the case execution log is taken as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, and the The starting point is the execution point to continue executing the case;
    若判断所述故障未被排除,则将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理。If it is determined that the fault has not been eliminated, the case information is reloaded into the case execution unit of the device to restart the execution of the case.
  2. 如权利要求1所述的案例执行方法,所述基于所述故障原因和所述节点位置生成案例执行日志包括:The case execution method according to claim 1, wherein said generating a case execution log based on said failure cause and said node location comprises:
    获取所述案例执行日志的模板信息,所述模板信息为记录所述案例在执行情况和所产生的信息的表格;Acquiring template information of the case execution log, where the template information is a table that records the execution status of the case and the information generated;
    获取所述节点位置所对应的执行代码,以及所述节点位置的上下文信息;Acquiring the execution code corresponding to the node position and the context information of the node position;
    将所述节点位置的执行代、所述故障原因和所述上下文信息记录在所述表格中,以形成案例执行日志,其中,所述上下文信息包括cookie、登陆态、变量和时间戳中的至少一种。Record the execution generation of the node location, the failure reason 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 time stamp One kind.
  3. 如权利要求1所述的案例执行方法,所述故障执行状态包括执行中断状态和执行失败状态;The case execution method according to claim 1, wherein the failure execution state includes an execution interruption state and an execution failure state;
    所述获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志包括:The obtaining the node location of the case in the current fault execution state, and generating a case execution log based on the fault cause and the node location includes:
    判断所述故障执行状态是否为执行中断状态;Determine whether the fault execution state is an execution interruption state;
    若判断为所述执行中断状态,则获取所述案例执行被中断所在的节点位置,将所述节点位置记录至所述案例执行日志中;If it is determined that the execution is interrupted, the node location where the execution of the case is interrupted is acquired, and the node location is recorded in the case execution log;
    若判断不是所述执行中断状态,则判断所述故障执行状态是否满足所述执行失败状态的条件;If it is determined that it is not the execution interruption state, then it is determined whether the fault execution state meets the conditions of the execution failure state;
    若判断满足所述执行失败状态的条件,则确定造成所述案例执行失败的故障原因,以及导致所述案例执行失败所在的节点位置,将所述故障原因和所述节点位置记录至所述案例执行日志中。If it is determined that the conditions for the execution failure state are met, determine the cause of the failure that caused the execution of the case and the location of the node that caused the execution of the case to fail, and record the cause of the failure and the location of the node to the case Execution log.
  4. 如权利要求3所述的案例执行方法,所述确定造成所述案例执行失败的故障原因包括:The case execution method according to claim 3, wherein the determining the cause of the failure of the case execution failure comprises:
    检测所述案例执行单元在执行所述案例过程中,是否存在有执行优先级设置的新案例被启动;Detecting whether a new case with execution priority setting is started during the execution of the case by the case execution unit;
    检测执行所述案例对应的工作环境是否出现了变化,其中,所述工作环境包括所述设备的配置项、所述设备的服务器、所述案例执行的测试场景和所述设备所使用的网络;Detecting whether the working environment corresponding to the execution of the case has changed, where the working environment includes the configuration items of the device, the server of the device, the test scenario executed by the case, and the network used by the device;
    检测所述案例是否是由于非功能问题导致的执行失败,其中,所述非功能问题为不是由所述设备的软件配置或者硬件配置所引起的故障。It is detected whether the case is an execution failure caused by a non-functional problem, where the non-functional problem is a failure not caused by a software configuration or a hardware configuration of the device.
  5. 如权利要求4所述的案例执行方法,在所述检测到存在有执行优先级设置的新案例被启动之后,所述案例执行方法还包括:5. The case execution method according to claim 4, after detecting that a new case with execution priority setting is started, the case execution method further comprises:
    判断所述新案例的执行优先级是否大于当前执行的案例的执行优先级;Determine whether the execution priority of the new case is greater than the execution priority of the currently executed case;
    若是,则判断所述新案例与当前执行的案例是否为同一类型的案例;If yes, judge whether the new case and the currently executed case are the same type of case;
    若是同一类型的案例,则将所述新案例替换当前执行的案例,并执行所述新案例;If it is a case of the same type, replace the currently executed case with the new case and execute the new case;
    若不是同一类型的案例,则将当前执行的案例设置为执行中断状态或者执行失败状态,并跳转至所述新案例执行,待所述新案例执行完成后,返回至设置为执行中断状态或者执行失败状态的案例继续执行。If it is not the same type of case, set the currently executed case to the execution interrupted state or the execution failed state, and jump to the execution of the new case. After the execution of the new case is completed, return to the set execution interrupted state or The execution of the failed case continues.
  6. 如权利要求5所述的案例执行方法,所述将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例包括:The case execution method according to claim 5, wherein the node position recorded in the case execution log is used as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, Using the starting point as the execution point to continue executing the case includes:
    若所述故障执行状态为执行失败状态,则通过反射获取到所述执行失败状态的所述案例的类名和方法名;If the failure execution state is an execution failure state, the class name and method name of the case in the execution failure state are acquired through reflection;
    根据所述类名和方法名从所述案例执行日志中读取所述上下文信息,并调用案例执行失败处理策略对所述执行失败状态的案例进行重启操作。Read the context information from the case execution log according to the class name and method name, and call a case execution failure processing strategy to restart the case in the execution failure state.
  7. 如权利要求6所述的案例执行方法,在所述将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理的步骤之前,还包括:根据所述故障原因对所述案例进行类型划分;The case execution method according to claim 6, before the step of reloading the case information into the case execution unit of the device to restart the execution of the case, further comprising: according to the cause of the failure Classify the case;
    所述将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理包括:The reloading the case information into the case execution unit of the device to perform restart execution processing on the case includes:
    根据所述案例的类型从所述设备中选择对应的案例缓存区;Selecting a corresponding case buffer area from the device according to the type of the case;
    将待重新加载的所述案例信息加载至所述案例缓存区中等待所述案例执 行单元的调取执行。Load the case information to be reloaded into the case buffer area and wait for the call execution of the case execution unit.
  8. 一种案例执行装置,所述案例执行装置包括:A case execution device, the case execution device includes:
    监测模块,用于获取设备上已执行或者正在执行的案例信息,根据所述案例信息检查案例的执行情况,以确定所述案例是否处于故障执行状态;The monitoring module is used to obtain information about a case that has been executed or that is being executed on the device, and check the execution of the case according to the case information to determine whether the case is in a faulty execution state;
    查询模块,用于在所述案例处于故障执行状态时,根据所述故障执行状态,从预置的故障执行状态与故障原因对应的关系表中,查询出所述案例在当前故障执行状态对应的故障原因;The query module is used to, when the case is in the fault execution state, according to the fault execution state, from a preset table of the corresponding relationship between the fault execution state and the failure cause, query the case corresponding to the current fault execution state cause of issue;
    记录模块,用于获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志,其中,在所述案例执行日志中还包括记录所述案例的故障是否已处理的标识信息;The recording module is used to obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording the case Identification information of whether the fault has been processed;
    判断模块,用于根据所述案例执行日志中的标识信息判断与所述故障原因对应的故障是否被排除;The judgment module is used to judge whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
    处理模块,用于在判断所述故障已被排除时,将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例;以及在判断所述故障未被排除时,将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理。The processing module is configured to, when judging that the fault has been eliminated, use the node position recorded in the case execution log as the starting point of the case execution, and reload the case information to the case execution unit of the device , Continue to execute the case with the starting point as the execution point; and when it is determined that the fault has not been eliminated, reload the case information into the case execution unit of the device to restart the execution of the case .
  9. 如权利要求8所述的案例执行装置,所述故障执行状态包括执行中断状态和执行失败状态;所述记录模块包括检测子单元和记录子单元The case execution device according to claim 8, wherein the failure execution state includes an execution interruption state and an execution failure state; the recording module includes a detection subunit and a recording subunit
    所述检测子单元,用于判断所述故障执行状态是否为执行中断状态;The detection subunit is used to determine whether the fault execution state is an execution interruption state;
    所述记录子单元,用于在判断为所述执行中断状态时,获取所述案例执行被中断所在的节点位置,将所述节点位置记录至所述案例执行日志中;The recording subunit is configured to, when it is determined that the execution is interrupted, obtain the node position where the case execution is interrupted, and record the node position in the case execution log;
    所述检测子单元,用于在判断不是所述执行中断状态时,判断所述故障执行状态是否满足所述执行失败状态的条件;The detection subunit is configured to determine whether the faulty execution state meets the condition of the execution failure state when it is judged that it is not the execution interruption state;
    所述记录子单元,用于在判断满足所述执行失败状态的条件时,确定造成所述案例执行失败的故障原因,以及导致所述案例执行失败所在的节点位置,将所述故障原因和所述节点位置记录至所述案例执行日志中。The recording subunit is used to determine the cause of the failure of the execution of the case and the location of the node that caused the failure of the execution of the case when the conditions of the execution failure state are satisfied The node location is recorded in the case execution log.
  10. 如权利要求9所述的案例执行装置,所述记录子单元用于检测所述案例执行单元在执行所述案例过程中,是否存在有执行优先级设置的新案例被启动;检测执行所述案例对应的工作环境是否出现了变化,其中,所述工作环境包括所述设备的配置项、所述设备的服务器、所述案例执行的测试场景和所述设备所使用的网络;检测所述案例是否是由于非功能问题导致的执行失败,其中,所述非功能问题为不是由所述设备的软件配置或者硬件配置所引起的故障。9. The case execution device according to claim 9, wherein the recording sub-unit is used to detect whether a new case with execution priority setting is activated during the execution of the case by the case execution unit; detecting execution of the case Whether the corresponding working environment has changed, where the working environment includes the configuration items of the device, the server of the device, the test scenario executed by the case, and the network used by the device; check whether the case The execution failure is caused by a non-functional problem, where the non-functional problem is a failure not caused by the software configuration or hardware configuration of the device.
  11. 如权利要求10所述的案例执行装置,所述判断模块还用于判断所述 新案例的执行优先级是否大于当前执行的案例的执行优先级;若是,则判断所述新案例与当前执行的案例是否为同一类型的案例;The case execution device according to claim 10, wherein the judgment module is further configured to judge whether the execution priority of the new case is greater than the execution priority of the currently executed case; if so, judge whether the new case is different from the currently executed case Whether the cases are of the same type;
    在判断是同一类型的案例时,将所述新案例替换当前执行的案例,并执行所述新案例;When it is judged that the cases are of the same type, replace the currently executed case with the new case, and execute the new case;
    所述处理模块,用于在判断不是同一类型的案例时,将当前执行的案例设置为执行中断状态或者执行失败状态,并跳转至所述新案例执行,待所述新案例执行完成后,返回至设置为执行中断状态或者执行失败状态的案例继续执行。The processing module is used to set the currently executed case to the execution interrupted state or the execution failed state when it is judged that the case is not the same type, and jump to the execution of the new case, and after the execution of the new case is completed, Return to the case set to the execution interruption state or execution failure state to continue execution.
  12. 如权利要求11所述的案例执行装置,若所述故障执行状态为执行失败状态,所述处理模块用于通过反射获取到所述执行失败状态的所述案例的类名和方法名;根据所述类名和方法名从所述案例执行日志中读取所述上下文信息,并调用案例执行失败处理策略对所述执行失败状态的案例进行重启操作。The case execution device of claim 11, if the failure execution state is an execution failure state, the processing module is configured to obtain the class name and method name of the case in the execution failure state through reflection; according to the The class name and method name read the context information from the case execution log, and call the case execution failure processing strategy to restart the case in the execution failure state.
  13. 如权利要求12所述的案例执行装置,所述案例执行装置还包括分类模块,用于根据所述故障原因对所述案例进行类型划分;The case execution device according to claim 12, wherein the case execution device further comprises a classification module for classifying the case according to the cause of the failure;
    所述处理模块用于根据所述案例的类型从所述设备中选择对应的案例缓存区;将待重新加载的所述案例信息加载至所述案例缓存区中等待所述案例执行单元的调取执行。The processing module is configured to select a corresponding case buffer area from the device according to the type of the case; load the case information to be reloaded into the case buffer area and wait for the case execution unit to call carried out.
  14. 一种案例执行设备,所述案例执行设备包括:存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的案例执行程序,所述案例执行程序被所述处理器执行时实现如下所述的案例执行方法的步骤:A case execution device, the case execution device comprising: a memory, a processor, and a case execution program stored in the memory and capable of running on the processor, and when the case execution program is executed by the processor Steps to implement the case execution method described below:
    获取设备上已执行或者正在执行的案例信息,根据所述案例信息检查案例的执行情况,以确定所述案例是否处于故障执行状态;Acquire information about a case that has been executed or that is being executed on the device, and check the execution of the case based on the case information to determine whether the case is in a faulty execution state;
    若所述案例处于故障执行状态,则根据所述故障执行状态,从预置的故障执行状态与故障原因对应的关系表中,查询出所述案例在当前故障执行状态对应的故障原因;If the case is in the fault execution state, according to the fault execution state, query the fault reason corresponding to the current fault execution state of the case from the preset relationship table between the fault execution state and the fault cause;
    获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志,其中,在所述案例执行日志中还包括记录所述案例的故障是否已处理的标识信息;Obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording whether the case's failure has been processed Identification information;
    根据所述案例执行日志中的标识信息判断与所述故障原因对应的故障是否被排除;Determine whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
    若判断所述故障已被排除,则将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例;If it is determined that the fault has been eliminated, the node position recorded in the case execution log is taken as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, and the The starting point is the execution point to continue executing the case;
    若判断所述故障未被排除,则将所述案例信息重新加载至所述设备的案 例执行单元中对所述案例进行重启执行处理。If it is determined that the fault has not been eliminated, the case information is reloaded into the case execution unit of the device to restart execution of the case.
  15. 如权利要求14所述的案例执行设备,所述故障执行状态包括执行中断状态和执行失败状态;The case execution device according to claim 14, wherein the failure execution state includes an execution interruption state and an execution failure state;
    所述案例执行程序被所述处理器执行实现所述获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志的步骤时,包括以下步骤:When the case execution program is executed by the processor to realize the step of obtaining the node position of the case in the current fault execution state, and generating a case execution log based on the failure cause and the node position, the following steps are included :
    判断所述故障执行状态是否为执行中断状态;Determine whether the fault execution state is an execution interruption state;
    若判断为所述执行中断状态,则获取所述案例执行被中断所在的节点位置,将所述节点位置记录至所述案例执行日志中;If it is determined that the execution is interrupted, the node location where the execution of the case is interrupted is acquired, and the node location is recorded in the case execution log;
    若判断不是所述执行中断状态,则判断所述故障执行状态是否满足所述执行失败状态的条件;If it is determined that it is not the execution interruption state, then it is determined whether the fault execution state meets the conditions of the execution failure state;
    若判断满足所述执行失败状态的条件,则确定造成所述案例执行失败的故障原因,以及导致所述案例执行失败所在的节点位置,将所述故障原因和所述节点位置记录至所述案例执行日志中。If it is determined that the conditions for the execution failure state are met, determine the cause of the failure that caused the execution of the case and the location of the node that caused the execution of the case to fail, and record the cause of the failure and the location of the node to the case Execution log.
  16. 如权利要求15所述的案例执行设备,所述案例执行程序被所述处理器执行实现所述确定造成所述案例执行失败的故障原因的步骤时,包括以下步骤:15. The case execution device according to claim 15, when the case execution program is executed by the processor to implement the step of determining the cause of the failure causing the case execution failure, the step includes the following steps:
    检测所述案例执行单元在执行所述案例过程中,是否存在有执行优先级设置的新案例被启动;Detecting whether a new case with execution priority setting is started during the execution of the case by the case execution unit;
    检测执行所述案例对应的工作环境是否出现了变化,其中,所述工作环境包括所述设备的配置项、所述设备的服务器、所述案例执行的测试场景和所述设备所使用的网络;Detecting whether the working environment corresponding to the execution of the case has changed, where the working environment includes the configuration items of the device, the server of the device, the test scenario executed by the case, and the network used by the device;
    检测所述案例是否是由于非功能问题导致的执行失败,其中,所述非功能问题为不是由所述设备的软件配置或者硬件配置所引起的故障。It is detected whether the case is an execution failure caused by a non-functional problem, where the non-functional problem is a failure not caused by a software configuration or a hardware configuration of the device.
  17. 如权利要求16所述的案例执行设备,所述案例执行程序被所述处理器执行时,还实现以下案例执行方法的步骤:The case execution device according to claim 16, when the case execution program is executed by the processor, the following steps of the case execution method are further implemented:
    判断所述新案例的执行优先级是否大于当前执行的案例的执行优先级;Determine whether the execution priority of the new case is greater than the execution priority of the currently executed case;
    若是,则判断所述新案例与当前执行的案例是否为同一类型的案例;If yes, judge whether the new case and the currently executed case are the same type of case;
    若是同一类型的案例,则将所述新案例替换当前执行的案例,并执行所述新案例;If it is a case of the same type, replace the currently executed case with the new case and execute the new case;
    若不是同一类型的案例,则将当前执行的案例设置为执行中断状态或者执行失败状态,并跳转至所述新案例执行,待所述新案例执行完成后,返回至设置为执行中断状态或者执行失败状态的案例继续执行。If it is not the same type of case, set the currently executed case to the execution interrupted state or the execution failed state, and jump to the execution of the new case. After the execution of the new case is completed, return to the set execution interrupted state or The execution of the failed case continues.
  18. 如权利要求17所述的案例执行设备,所述案例执行程序被所述处理 器执行实现所述将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例的步骤时,包括以下步骤:The case execution device according to claim 17, wherein the case execution program is executed by the processor to realize the use of the node position recorded in the case execution log as the starting point of the case execution, and the case information When reloading into the case execution unit of the device, and continuing to execute the steps of the case with the starting point as the execution point, the following steps are included:
    若所述故障执行状态为执行失败状态,则通过反射获取到所述执行失败状态的所述案例的类名和方法名;If the failure execution state is an execution failure state, the class name and method name of the case in the execution failure state are acquired through reflection;
    根据所述类名和方法名从所述案例执行日志中读取所述上下文信息,并调用案例执行失败处理策略对所述执行失败状态的案例进行重启操作。Read the context information from the case execution log according to the class name and method name, and call a case execution failure processing strategy to restart the case in the execution failure state.
  19. 如权利要求18所述的案例执行设备,所述案例执行程序被所述处理器执行时,还实现以下案例执行方法的步骤:The case execution device according to claim 18, when the case execution program is executed by the processor, the following steps of the case execution method are further implemented:
    根据所述故障原因对所述案例进行类型划分;Classify the case according to the cause of the failure;
    所述将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理包括:The reloading the case information into the case execution unit of the device to perform restart execution processing on the case includes:
    根据所述案例的类型从所述设备中选择对应的案例缓存区;Selecting a corresponding case buffer area from the device according to the type of the case;
    将待重新加载的所述案例信息加载至所述案例缓存区中等待所述案例执行单元的调取执行。Load the case information to be reloaded into the case buffer area and wait for the call execution of the case execution unit.
  20. 一种计算机可读存储介质,所述计算机可读存储介质上存储有案例执行程序,所述案例执行程序被处理器执行时实现如下所述的案例执行方法的步骤:A computer-readable storage medium on which a case execution program is stored, and when the case execution program is executed by a processor, the steps of the case execution method described below are implemented:
    获取设备上已执行或者正在执行的案例信息,根据所述案例信息检查案例的执行情况,以确定所述案例是否处于故障执行状态;Acquire information about a case that has been executed or that is being executed on the device, and check the execution of the case based on the case information to determine whether the case is in a faulty execution state;
    若所述案例处于故障执行状态,则根据所述故障执行状态,从预置的故障执行状态与故障原因对应的关系表中,查询出所述案例在当前故障执行状态对应的故障原因;If the case is in the fault execution state, according to the fault execution state, query the fault reason corresponding to the current fault execution state of the case from the preset relationship table between the fault execution state and the fault cause;
    获取所述案例在当前故障执行状态时的节点位置,并基于所述故障原因和所述节点位置生成案例执行日志,其中,在所述案例执行日志中还包括记录所述案例的故障是否已处理的标识信息;Obtain the node position of the case in the current failure execution state, and generate a case execution log based on the failure cause and the node position, wherein the case execution log also includes recording whether the case's failure has been processed Identification information;
    根据所述案例执行日志中的标识信息判断与所述故障原因对应的故障是否被排除;Determine whether the fault corresponding to the cause of the fault is eliminated according to the identification information in the case execution log;
    若判断所述故障已被排除,则将所述案例执行日志中记录的节点位置作为所述案例执行的起点,并将所述案例信息重新加载至所述设备的案例执行单元中,以所述起点为执行点继续执行所述案例;If it is determined that the fault has been eliminated, the node position recorded in the case execution log is taken as the starting point of the case execution, and the case information is reloaded into the case execution unit of the device, and the The starting point is the execution point to continue executing the case;
    若判断所述故障未被排除,则将所述案例信息重新加载至所述设备的案例执行单元中对所述案例进行重启执行处理。If it is determined that the fault has not been eliminated, the case information is reloaded into the case execution unit of the device to restart the execution of the case.
PCT/CN2019/117309 2019-07-15 2019-11-12 Case execution method, apparatus and device, and computer readable storage medium WO2021008029A1 (en)

Applications Claiming Priority (2)

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

Publications (1)

Publication Number Publication Date
WO2021008029A1 true WO2021008029A1 (en) 2021-01-21

Family

ID=68585503

Family Applications (1)

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

Country Status (2)

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

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113434135A (en) * 2021-06-28 2021-09-24 青岛海尔科技有限公司 Interface call repetition determination method and device, storage medium and electronic device
CN113759876A (en) * 2021-09-14 2021-12-07 西安交通大学 Wind turbine generator fault diagnosis method and system based on case reasoning

Families Citing this family (3)

* 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
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
JPH08314751A (en) * 1995-05-18 1996-11-29 Hitachi Ltd Fault countermeasure supporting method
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
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
WO2015142234A1 (en) * 2014-03-20 2015-09-24 Telefonaktiebolaget L M Ericsson (Publ) Testing of electronic devices

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08314751A (en) * 1995-05-18 1996-11-29 Hitachi Ltd Fault countermeasure supporting method
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

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113434135A (en) * 2021-06-28 2021-09-24 青岛海尔科技有限公司 Interface call repetition determination method and device, storage medium and electronic device
CN113434135B (en) * 2021-06-28 2023-06-16 青岛海尔科技有限公司 Method and device for determining call repeatability of interface, storage medium and electronic device
CN113759876A (en) * 2021-09-14 2021-12-07 西安交通大学 Wind turbine generator fault diagnosis method and system based on case reasoning
CN113759876B (en) * 2021-09-14 2023-05-19 西安交通大学 Case-reasoning-based wind turbine generator fault diagnosis method and system

Also Published As

Publication number Publication date
CN110502366A (en) 2019-11-26
CN110502366B (en) 2023-02-14

Similar Documents

Publication Publication Date Title
WO2021008029A1 (en) Case execution method, apparatus and device, and computer readable storage medium
US10949225B2 (en) Automatic detection of user interface elements
Yuan et al. Automated known problem diagnosis with event traces
US20110307742A1 (en) Method and apparatus for cause analysis involving configuration changes
EP3591485B1 (en) Method and device for monitoring for equipment failure
CN110673936B (en) Breakpoint continuous operation method and device for arrangement service, storage medium and electronic equipment
CN112540887A (en) Fault drilling method and device, electronic equipment and storage medium
US20180143897A1 (en) Determining idle testing periods
WO2017164856A1 (en) Comparable user interface object identifications
CN112988503A (en) Analysis method, analysis device, electronic device, and storage medium
US11169910B2 (en) Probabilistic software testing via dynamic graphs
CN111737138B (en) Automatic recovery system and method for test environment
CN102521132A (en) Automated testing method and automated testing system for real-time output logs
CN110134558B (en) Method and device for detecting server
CN111125990A (en) Method for judging result correctness of parasitic parameters
CN111666200A (en) Testing method and terminal for time consumption of cold start of PC software
CN115391110A (en) Test method of storage device, terminal device and computer readable storage medium
US10255128B2 (en) Root cause candidate determination in multiple process systems
CN114817010A (en) Python-based Redfish automatic testing method and device
CN114064510A (en) Function testing method and device, electronic equipment and storage medium
CN113010417A (en) Script execution method and device based on automatic test
Li et al. EnergyDx: Diagnosing Energy Anomaly in Mobile Apps by Identifying the Manifestation Point
CN110990181A (en) Method and system for automatically reproducing probabilistic setting failure of options in BIOS (basic input/output System)
US20230010296A1 (en) System and method for splitting a video stream using breakpoints based on recognizing workflow patterns
CN109884435B (en) Relay protection device tester, automatic testing method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19937610

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 25/05/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19937610

Country of ref document: EP

Kind code of ref document: A1