Automatic test script repairing method and device, computer equipment and storage medium
By automatically analyzing error messages, positioning and replacing elements to be adjusted in the test script, the problem of inefficient adjustment of the test script is solved, and fast and efficient test script repair is achieved.
Patent Information
- Application Number
- CN202411431643.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-02-11
AI Technical Summary
When the application is updated, the test script needs to be quickly modified to adapt to the application changes, resulting in inefficient adjustments for a large number of test scripts.
By responding to the error message during the execution of the test script to be repaired, obtain execution feedback information, analyze the error reason, determine the repair type, locate the elements to be adjusted and replace them with the target element, and realize automatic repair of the test script.
It improves the adjustment efficiency when a test script error occurs, reduces the time for manual intervention and modification, and improves the testing efficiency.
Smart Images

Figure CN119415426A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software testing, and in particular to a test script automatic repair method, device, computer equipment and storage medium. Background Art
[0002] Automated test scripts can quickly execute a large number of repeated test cases, significantly improving test efficiency, and are widely used in software testing. With the increase of application functions and the iteration of versions, the number of test scripts is also increasing. When the application is updated, the test scripts often need to be updated to adapt to the changes in the application. Therefore, when the elements in the application change, how to quickly modify a large number of test scripts has become an urgent problem to be solved. Summary of the invention
[0003] The main purpose of the present application is to provide a test script automatic repair method, device, equipment and computer storage medium, aiming to improve the adjustment efficiency of the test script.
[0004] In a first aspect, the present application provides a test script automatic repair method, the test script automatic repair method comprising the following steps:
[0005] In response to error information during the execution of the test script to be repaired, obtaining execution feedback information of the test script to be repaired;
[0006] Analyze the error cause of the execution feedback information to determine the repair type corresponding to the test script to be repaired;
[0007] When the repair type meets the preset condition, obtaining the element to be adjusted in the test script to be repaired, and locating the corresponding target element according to the element to be adjusted;
[0008] The test script to be repaired is adjusted according to the element to be adjusted and the target element to obtain a target test script.
[0009] In a second aspect, the present application further provides a test script automatic repair device, the test script automatic repair device comprising:
[0010] A feedback information acquisition module, in response to error information during the execution of the test script to be repaired, acquires execution feedback information of the test script to be repaired;
[0011] A repair type analysis module, used to analyze the error cause of the execution feedback information and determine the repair type corresponding to the test script to be repaired;
[0012] A target element positioning module, used for obtaining the element to be adjusted in the test script to be repaired when the repair type meets the preset conditions, and locating the corresponding target element according to the element to be adjusted;
[0013] The target script determination module is used to adjust the test script to be repaired according to the element to be adjusted and the target element to obtain a target test script.
[0014] In a third aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the automatic test script repair method as described above is implemented.
[0015] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the test script automatic repair method as described above is implemented.
[0016] The present application provides a test script automatic repair method, device, equipment and computer storage medium. The present application obtains the execution feedback information of the test script to be repaired in response to the error information during the execution of the test script to be repaired; analyzes the error cause of the execution feedback information to determine the repair type corresponding to the test script to be repaired; obtains the element to be adjusted in the test script to be repaired when the repair type meets the preset conditions, and locates the corresponding target element according to the element to be adjusted; adjusts the test script to be repaired according to the element to be adjusted and the target element to obtain the target test script. Since the element to be adjusted in the test script is replaced with the target element by identifying the element to be adjusted and locating the target element, the adjustment efficiency when the test script fails is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A flowchart of a test script automatic repair method provided in one embodiment of the present application;
[0019] Figure 2 A usage scenario diagram of a test script automatic repair method provided in one embodiment of the present application;
[0020] Figure 3 A schematic block diagram of a test script automatic repair device provided in one embodiment of the present application;
[0021] Figure 4 The present invention is a block diagram showing the structure of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0023] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0024] Embodiments of the present application provide a test script automatic repair method, apparatus, computer equipment, and computer-readable storage medium.
[0025] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0026] Please refer to Figure 1 , Figure 1 A flow chart of a test script automatic repair method provided for an embodiment of the present application. The test script automatic repair method can be used in a terminal or a server to adjust the erroneous test script to be adjusted to a normal target test script. Among them, the terminal can be an electronic device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device; the server can be an independent server, or a server cluster, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0027] Please refer to Figure 2 , Figure 2 This is a usage scenario diagram provided by an embodiment of the present application. Figure 2As shown, when the error message is received, the corresponding test script to be repaired is located according to the error message, and the execution feedback information during the execution of the test script to be repaired is obtained, the repair type corresponding to the script to be repaired is identified, and when the repair type meets the preset conditions, the target element is determined, and the element to be adjusted in the script to be repaired is replaced with the target element, thereby obtaining the target test script.
[0028] like Figure 1 As shown, the test script automatic repair method includes steps S101 to S104.
[0029] Step S101: In response to error information during the execution of a test script to be repaired, execution feedback information of the test script to be repaired is obtained.
[0030] Exemplarily, a test script is a set of instructions or codes used in an automated testing process, which can simulate the user's operating behavior, verify whether the functions, performance, security, etc. of a software application, system, or component meet expectations, and perform functional testing, performance testing, security testing, compatibility testing, etc. on applications, etc. However, during the running of the test script, an execution error may occur due to problems with the code itself, or external environment problems, dependency problems, etc., generating an error message for prompting the user that an error has occurred in the test. Therefore, the test script automatic repair method provided in the embodiment of the present application responds to the error message generated by the test script to be repaired, and obtains corresponding execution feedback information in order to automatically repair the test script.
[0031] In some implementations, the step of obtaining execution feedback information of the test script to be repaired in response to error information during the execution of the test script to be repaired includes:
[0032] In response to the error message, at least one of a test result report, an execution log file, and an execution page screenshot corresponding to executing the test script to be repaired is obtained.
[0033] Exemplarily, during the automated testing process, when the test script fails to execute, the type of error can be determined by capturing and analyzing the error information. Among them, the execution feedback information can include test result reports, execution log files, execution page screenshots, etc. Specifically, the type of execution feedback information can be flexibly set according to the test framework. Some test frameworks can generate test result reports containing error information, including error type, error message, error code, file and line number where the error occurred, etc.; automated testing usually generates an execution log file, which contains detailed execution steps and status information. By analyzing the execution log file, the failed test cases and steps can be quickly located; in UI automated testing, if the test case fails, the execution page screenshot can also be automatically captured so that the status of the user interface at that time can be seen when the error is analyzed later. The test feedback information can also include other types of information, which are not limited here.
[0034] Step S102: Analyze the cause of the error on the execution feedback information to determine the repair type corresponding to the test script to be repaired.
[0035] Exemplarily, the execution feedback information of different types of scripts to be repaired usually has the same characteristics, and the execution feedback information can reflect the repair type of the script to be repaired. Therefore, by analyzing the error cause of the execution feedback information, the repair type corresponding to the test script to be repaired can be determined, so that different scripts to be repaired can be repaired according to the repair type.
[0036] In some implementations, analyzing the error cause of the execution feedback information to determine the repair type corresponding to the test script to be repaired includes:
[0037] Based on a preset neural network model, the repair type corresponding to the test script to be repaired is determined according to the execution feedback information as at least one of: an environment abnormality type, an interface change type, a control change type, and a data change type.
[0038] Exemplarily, the neural network model is good at automatically learning complex features from the original samples, which can capture the key information in the samples, thereby classifying different samples. In the test script automatic repair method provided in this embodiment, by analyzing a large amount of error-related data (such as log files, system reports, user feedback, screenshots, etc.), the neural network can find patterns and differences between different repair types, thereby classifying the scripts to be repaired according to the execution feedback information.
[0039] Specifically, by collecting the execution feedback information of historical scripts, including error logs, reports, screenshots, etc., these data are cleaned and preprocessed, such as extracting text information, key image features, etc., and extracting useful features from the preprocessed data. These features can represent different types of errors. For example, text features such as error codes and error messages can be extracted from error logs, or visual features can be extracted from screenshots using image recognition technology. And select a suitable neural network model for training. Unsupervised learning such as autoencoders can be used to learn the feature representation of normal scripts, and then abnormal scripts can be identified by reconstructing errors; or supervised learning can be used. If there is enough labeled data, the model can be directly trained to identify different types of repairs, which is not limited here.
[0040] Among them, the environment abnormality type usually occurs when the test environment is abnormal, such as network instability and other reasons. You only need to wait for the environment to return to normal before testing; the interface change type usually means that the interface change causes the test script that depends on the interface to fail, and the interface in the script to be repaired needs to be changed accordingly; the control change type may involve elements on the user interface, such as buttons, text boxes, etc., and the script to be repaired needs to be updated to match the new control properties or behaviors; the data change type may involve changes in the database structure, data type conversion errors, changes in data ranges, etc. Such errors may cause the test script to fail when performing data operations, and the test data and test scripts also need to be updated to ensure that the test script is compatible with the new data structure and type. By identifying and matching the corresponding repair method for the repair type, the pertinence of the test script automatic repair method is improved.
[0041] Step S103: when the repair type meets a preset condition, obtain the element to be adjusted in the test script to be repaired, and locate the corresponding target element according to the element to be adjusted.
[0042] For example, for some repair types, since external elements change and elements in the test script to be repaired are not updated in time, it is necessary to adjust the elements to be adjusted in the test script to be repaired to the target elements so that the script to be repaired can run normally.
[0043] In some implementations, when the repair type satisfies a preset condition, obtaining the element to be adjusted in the test script to be repaired, and locating the corresponding target element according to the element to be adjusted includes:
[0044] In the case that the repair type belongs to the interface change type, the interface to be adjusted in the test script to be repaired is obtained, and the corresponding target interface is located according to the interface to be adjusted based on a network packet capture tool.
[0045] Exemplarily, the element to be adjusted includes the interface to be adjusted, and the target element includes the target interface. If the reason for the error in the script to be repaired is that the interface has changed, the interface appearing in the script to be repaired can be extracted as the interface to be adjusted, and the target interface can be located according to the interface to be adjusted, so as to replace the interface to be adjusted with the target interface to obtain the target script.
[0046] In some implementations, the network packet capture tool locates the corresponding target interface according to the interface to be adjusted, including:
[0047] Acquiring original input data and / or original output data of the interface to be adjusted;
[0048] Capture current input data and / or current output data of each candidate interface based on a network packet capture tool;
[0049] The current input data is compared with the original input data, and / or the current output data is compared with the original output data, and the target interface is located according to the comparison result.
[0050] Exemplarily, the interface to be adjusted before adjustment and the target interface after adjustment have the same function, so the data output or input by the two are also the same or similar. Therefore, the data input or output by each interface of the application can be captured by a network packet capture tool, and the captured data can be compared with the data input or output by the interface to be adjusted during the previous test. When the current input data matches the original input data and / or the current output data matches the original output data, the interface that matches the interface to be adjusted is determined as the target interface. Among them, whether to compare the current input data with the original input data or the current output data with the original output data can be determined according to the actual situation of the interface. If the interface both inputs and outputs data, both are compared, which will not be repeated here.
[0051] Exemplarily, the current input data is compared with the original input data, and / or the current output data is compared with the original output data. The data names may be compared, or the data structures, data types, etc. are compared, which are not limited here.
[0052] In some implementations, before the network packet capture tool locates the corresponding target interface according to the interface to be adjusted, the method further includes:
[0053] Get the interface document corresponding to the interface to be adjusted;
[0054] Based on the interface document, locating the target interface according to the interface to be adjusted;
[0055] In the case that the target interface fails to be located based on the interface document, the corresponding target interface is located according to the interface to be adjusted based on the network packet capture tool.
[0056] For example, some applications will set up interface documents when changing the interface to describe the interface names before and after the change. In this case, the target interface corresponding to the interface to be adjusted can be determined directly by searching the interface document, reducing the complexity of automatic repair of the test script.
[0057] Step S104: adjust the test script to be repaired according to the element to be adjusted and the target element to obtain a target test script.
[0058] Exemplarily, the element to be adjusted is replaced with the target element, thereby obtaining a target test script based on the script to be repaired.
[0059] In some implementations, after adjusting the test script to be repaired according to the element to be adjusted and the target element to obtain a target test script, the method further includes:
[0060] The target test script is executed, and when the target test script generates an error message, the target test script is rolled back to the script to be repaired.
[0061] Exemplarily, if an error occurs in the running of a target test script, the target test script is rolled back so that the user can troubleshoot based on the original script to be repaired, thereby improving the robustness of the test script automatic repair method.
[0062] The test script automatic repair method provided by the above embodiment obtains the execution feedback information of the test script to be repaired by responding to the error information during the execution of the test script to be repaired; analyzes the error cause of the execution feedback information to determine the repair type corresponding to the test script to be repaired; obtains the element to be adjusted in the test script to be repaired when the repair type meets the preset conditions, and locates the corresponding target element according to the element to be adjusted; adjusts the test script to be repaired according to the element to be adjusted and the target element to obtain the target test script. Since the element to be adjusted in the test script is replaced with the target element by identifying the element to be adjusted and locating the target element, the adjustment efficiency of the test script when an error occurs is improved.
[0063] See also Figure 3 , Figure 3 It is a schematic diagram of a test script automatic repair device provided in an embodiment of the present application. The test script automatic repair device can be configured in a server or a terminal to execute the aforementioned test script automatic repair method.
[0064] like Figure 3 As shown, the test script automatic repair device includes: a feedback information acquisition module 110, a repair type analysis module 120, a target element positioning module 130, and a target script determination module 140.
[0065] The feedback information acquisition module 110 acquires the execution feedback information of the test script to be repaired in response to the error information during the execution of the test script to be repaired;
[0066] A repair type analysis module 120 is used to analyze the error cause of the execution feedback information and determine the repair type corresponding to the test script to be repaired;
[0067] The target element positioning module 130 is used to obtain the element to be adjusted in the test script to be repaired when the repair type meets the preset conditions, and locate the corresponding target element according to the element to be adjusted;
[0068] The target script determination module 140 is used to adjust the test script to be repaired according to the element to be adjusted and the target element to obtain a target test script.
[0069] In some implementations, the feedback information acquisition module 110, in the process of acquiring the execution feedback information of the test script to be repaired in response to the error information during the execution of the test script to be repaired, is used to implement:
[0070] In response to the error message, at least one of a test result report, an execution log file, and an execution page screenshot corresponding to executing the test script to be repaired is obtained.
[0071] In some implementations, the repair type analysis module 120, in the process of performing error cause analysis on the execution feedback information and determining the repair type corresponding to the test script to be repaired, is used to implement:
[0072] Based on a preset neural network model, the repair type corresponding to the test script to be repaired is determined according to the execution feedback information as at least one of: an environment abnormality type, an interface change type, a control change type, and a data change type.
[0073] In some implementations, the target element locating module 130, in the process of obtaining the element to be adjusted in the test script to be repaired and locating the corresponding target element according to the element to be adjusted when the repair type satisfies the preset condition, is used to implement:
[0074] In the case that the repair type belongs to the interface change type, the interface to be adjusted in the test script to be repaired is obtained, and the corresponding target interface is located according to the interface to be adjusted based on a network packet capture tool.
[0075] In some implementations, the target element locating module 130 is used to implement the following in the process of locating the corresponding target interface according to the interface to be adjusted based on the network packet capture tool:
[0076] Acquiring original input data and / or original output data of the interface to be adjusted;
[0077] Capture current input data and / or current output data of each candidate interface based on a network packet capture tool;
[0078] The current input data is compared with the original input data, and / or the current output data is compared with the original output data, and the target interface is located according to the comparison result.
[0079] In some implementations, the test script automatic repair is used to implement, before implementing the positioning of the corresponding target interface based on the interface to be adjusted by the network packet capture tool:
[0080] Get the interface document corresponding to the interface to be adjusted;
[0081] Based on the interface document, locating the target interface according to the interface to be adjusted;
[0082] In the case that the target interface fails to be located based on the interface document, the corresponding target interface is located according to the interface to be adjusted based on the network packet capture tool.
[0083] In some implementations, after adjusting the test script to be repaired according to the element to be adjusted and the target element to obtain the target test script, the test script automatic repair device is used to implement:
[0084] The target test script is executed, and when the target test script generates an error message, the target test script is rolled back to the script to be repaired.
[0085] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0086] The method and apparatus of the present application can be used in many general or special computing system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0087] Exemplarily, the above method and apparatus may be implemented in the form of a computer program. The computer program may be implemented in Figure 4 Runs on the computer device shown.
[0088] See also Figure 4 , Figure 4 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a server or a terminal.
[0089] like Figure 4 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory.
[0090] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any test script automatic repair method.
[0091] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0092] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute any test script automatic repair method.
[0093] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 4The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0094] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0095] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0096] In response to error information during the execution of the test script to be repaired, obtaining execution feedback information of the test script to be repaired;
[0097] Analyze the error cause of the execution feedback information to determine the repair type corresponding to the test script to be repaired;
[0098] When the repair type meets the preset condition, obtaining the element to be adjusted in the test script to be repaired, and locating the corresponding target element according to the element to be adjusted;
[0099] The test script to be repaired is adjusted according to the element to be adjusted and the target element to obtain a target test script.
[0100] In some implementations, the processor, in the process of obtaining the execution feedback information of the test script to be repaired in response to the error information during the execution of the test script to be repaired, is configured to implement:
[0101] In response to the error message, at least one of a test result report, an execution log file, and an execution page screenshot corresponding to executing the test script to be repaired is obtained.
[0102] In some implementations, the processor, in the process of analyzing the cause of the error on the execution feedback information and determining the repair type corresponding to the test script to be repaired, is configured to implement:
[0103] Based on a preset neural network model, the repair type corresponding to the test script to be repaired is determined according to the execution feedback information as at least one of: an environment abnormality type, an interface change type, a control change type, and a data change type.
[0104] In some implementations, the processor, in the process of obtaining the element to be adjusted in the test script to be repaired when the repair type satisfies a preset condition, and locating the corresponding target element according to the element to be adjusted, is used to implement:
[0105] In the case that the repair type belongs to the interface change type, the interface to be adjusted in the test script to be repaired is obtained, and the corresponding target interface is located according to the interface to be adjusted based on a network packet capture tool.
[0106] In some implementations, the processor, in the process of implementing the positioning of the corresponding target interface according to the interface to be adjusted based on the network packet capture tool, is used to implement:
[0107] Acquiring original input data and / or original output data of the interface to be adjusted;
[0108] Capture current input data and / or current output data of each candidate interface based on a network packet capture tool;
[0109] The current input data is compared with the original input data, and / or the current output data is compared with the original output data, and the target interface is located according to the comparison result.
[0110] In some implementations, the processor, before implementing the method, locates the corresponding target interface based on the interface to be adjusted based on the network packet capture tool, is configured to implement:
[0111] Get the interface document corresponding to the interface to be adjusted;
[0112] Based on the interface document, locating the target interface according to the interface to be adjusted;
[0113] In the case that the target interface fails to be located based on the interface document, the corresponding target interface is located according to the interface to be adjusted based on the network packet capture tool.
[0114] In some implementations, the processor, after implementing the method, adjusting the test script to be repaired according to the element to be adjusted and the target element to obtain the target test script, is configured to implement:
[0115] The target test script is executed, and when the target test script generates an error message, the target test script is rolled back to the script to be repaired.
[0116] It should be noted that technical personnel in the relevant field can clearly understand that, for the convenience and brevity of description, the specific working process of the automatic repair of the test script described above can refer to the corresponding process in the aforementioned test script automatic repair control method embodiment, and will not be repeated here.
[0117] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the test script automatic repair method of the present application.
[0118] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0119] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0120] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0121] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A test script automatic repair method, characterized in that: The method comprises: In response to error information during the execution of the test script to be repaired, obtaining execution feedback information of the test script to be repaired; Analyze the error cause of the execution feedback information to determine the repair type corresponding to the test script to be repaired; When the repair type meets the preset conditions, obtaining the element to be adjusted in the test script to be repaired, and locating the corresponding target element according to the element to be adjusted; The test script to be repaired is adjusted according to the element to be adjusted and the target element to obtain a target test script.
2. The test script automatic repair method according to claim 1, characterized in that: The step of obtaining, in response to error information during the execution of the test script to be repaired, execution feedback information of the test script to be repaired includes: In response to the error message, at least one of a test result report, an execution log file, and an execution page screenshot corresponding to executing the test script to be repaired is obtained.
3. The test script automatic repair method according to claim 1, characterized in that: The performing error cause analysis on the execution feedback information to determine the repair type corresponding to the test script to be repaired includes: Based on a preset neural network model, the repair type corresponding to the test script to be repaired is determined according to the execution feedback information as at least one of: an environment abnormality type, an interface change type, a control change type, and a data change type.
4. The test script automatic repair method according to claim 3, characterized in that: When the repair type satisfies a preset condition, obtaining the element to be adjusted in the test script to be repaired, and locating the corresponding target element according to the element to be adjusted, includes: In the case where the repair type belongs to the interface change type, the interface to be adjusted in the test script to be repaired is obtained, and the corresponding target interface is located according to the interface to be adjusted based on a network packet capture tool.
5. The test script automatic repair method according to claim 4, characterized in that: The network packet capture tool locates the corresponding target interface according to the interface to be adjusted, including: Acquiring original input data and / or original output data of the interface to be adjusted; Capture current input data and / or current output data of each candidate interface based on a network packet capture tool; The current input data is compared with the original input data, and / or the current output data is compared with the original output data, and the target interface is located according to the comparison result.
6. The test script automatic repair method according to claim 4, characterized in that: The method further includes, before the network packet capture tool locates the corresponding target interface according to the interface to be adjusted: Get the interface document corresponding to the interface to be adjusted; Based on the interface document, locating the target interface according to the interface to be adjusted; In the case that the target interface fails to be located based on the interface document, the corresponding target interface is located according to the interface to be adjusted based on the network packet capture tool.
7. The test script automatic repair method according to any one of claims 1 to 6, characterized in that: After adjusting the test script to be repaired according to the element to be adjusted and the target element to obtain the target test script, the method further includes: The target test script is executed, and when the target test script generates an error message, the target test script is rolled back to the script to be repaired.
8. A test script automatic repair device, characterized in that: The test script automatic repair device comprises: A feedback information acquisition module, in response to error information during the execution of the test script to be repaired, acquires execution feedback information of the test script to be repaired; A repair type analysis module, used to analyze the error cause of the execution feedback information and determine the repair type corresponding to the test script to be repaired; A target element positioning module, used for obtaining the element to be adjusted in the test script to be repaired when the repair type meets the preset conditions, and locating the corresponding target element according to the element to be adjusted; The target script determination module is used to adjust the test script to be repaired according to the element to be adjusted and the target element to obtain a target test script.
9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the test script automatic repair method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the test script automatic repair method according to any one of claims 1 to 7 are implemented.