Test defect reproduction method and device
By generating and sending reproduction requests for test defects, and using packet capture and recording tools to capture output results, the problem of reproduction of occasionally-type bugs is solved, development costs are reduced, and program is ensured to be online stably.
Patent Information
- Application Number
- CN202310572648.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-19
- Publication Date
- 2024-11-22
AI Technical Summary
The existing technology is difficult to effectively reproduce and repair even-present bugs, resulting in high development costs, long time and the inability to ensure stable online programs.
By generating a reproduction request for testing defects, it is sent to the reproduction terminal, and the output results of the reproduction operation are captured and compared with the defect results by using the packet capture tool and recording tool, and a dynamic picture is generated after the reproduction is successful to locate the generation path of the test defect.
It reduces the time, labor and development costs of testing and repair, accurately locates the path of occurrence of multiple bugs, and ensures that the program is stable and runs online.
Smart Images

Figure CN119003323A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data technology, and in particular to a method and device for reproducing a test defect. Background Art
[0002] Before various applications, applets, and software go online, they must all be tested by testers to confirm that there are no test defects before they can run stably. Test defects (or bugs) refer to loopholes and errors in applications, applets, and software.
[0003] When developers are fixing test defects, they classify them into inevitable bugs or occasional bugs based on whether the test defects can be reproduced. Inevitable bugs are bugs that will inevitably reappear when developers repeat the test steps, while occasional bugs are bugs with a low probability of reappearance.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0005] Inevitable bugs can be reproduced through fixed operation steps, and developers can just track and record them and fix them. Occasional bugs have a low probability of recurrence (need to repeat the operation dozens or even hundreds of times before recurring, or recurring from time to time without any pattern), so it takes a lot of time, manpower and development costs to find, debug, fix and verify, and even waste a lot of costs and still cannot be solved, making the early development go to waste. Summary of the invention
[0006] In view of this, an embodiment of the present invention provides a method and device for reproducing test defects, which can capture various test defects, especially accurately locate the generation path of occasional bugs to facilitate repair, reduce the time, manpower and development costs of testing and repair, and ensure the stable online operation of the program.
[0007] Furthermore, the probability of occurrence of occasional bugs can be counted to provide developers with a reference for subsequent development.
[0008] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for reproducing a test defect is provided, comprising:
[0009] Generate a reproduction request for the test defect according to the test defect of the tested program, and send it to the reproduction terminal; wherein the reproduction request includes the URL address of the tested program, the defect result of the test defect and the process to be reproduced corresponding to the test defect;
[0010] In response to the reproduction operation performed by the reproduction terminal on the tested program according to the steps to be reproduced of the process to be reproduced, the output results of each reproduction operation are captured, the reproduction operation is recorded, and the output results of the reproduction operation are compared with the defect result;
[0011] When it is determined that the output result of the reproduction operation is the same as the defect result, the reproduction result of the reproduction request is determined to be successful reproduction, and the generation path of the test defect is determined according to the recorded dynamic picture of the reproduction operation.
[0012] Optionally, the reproduction request further includes a target interface corresponding to the test defect; and the capturing of output results of each of the reproduction operations includes:
[0013] Using a packet capture tool to determine whether the interface corresponding to the recurrence operation is the target interface;
[0014] When the interface corresponding to the recurrence operation is the target interface, the output result of the target interface is captured.
[0015] Optionally, recording the reproducing operation includes:
[0016] According to a preset time interval, a recording tool is used to capture process images of the reproducing terminal.
[0017] Optionally, when it is determined that the reproduction result of the reproduction request is successful, the method further includes:
[0018] Generate an end instruction of the reproduction request; wherein the end instruction includes a packet capture end instruction and a recording end instruction.
[0019] Optionally, it also includes:
[0020] According to the packet capture end instruction, obtaining operation information of the recurrence operation;
[0021] The operation information of the reproduction operation is stored in the test defect database; wherein the operation information of the reproduction operation includes the request cookie of the tester to log in to the tested program, the method name of the target interface, the message body of the target interface, the input parameters of the target interface and the output result of the target interface.
[0022] Optionally, it also includes:
[0023] According to the recording end instruction, obtaining recording information of the reproduction request; wherein the recording information of the reproduction request includes a screenshot of the reproduction operation during the reproduction process;
[0024] The dynamic image is generated using a plurality of non-repeating screenshots corresponding to the reproduction operation.
[0025] Optionally, when it is determined that the reproduction result of the reproduction request is successful, alternatively, the method further includes:
[0026] The steps to be reproduced included in the process to be reproduced are used as the generation path of the test defect.
[0027] According to another aspect of an embodiment of the present invention, a device for reproducing a test defect is provided, comprising:
[0028] A generation module, used to generate a reproduction request of the test defect according to the test defect of the tested program, and send it to the reproduction terminal; wherein the reproduction request includes the URL address of the tested program, the defect result of the test defect and the process to be reproduced corresponding to the test defect;
[0029] A comparison module, configured to respond to the reproduction operation performed by the reproduction terminal on the tested program according to the steps to be reproduced of the process to be reproduced, capture the output results of each of the reproduction operations, record the reproduction operation, and compare the output results of the reproduction operation with the defect result;
[0030] A path determination module is used to determine that the reproduction result of the reproduction request is a successful reproduction when it is determined that the output result of the reproduction operation is the same as the defect result, and determine the generation path of the test defect based on the recorded dynamic image of the reproduction operation.
[0031] According to another aspect of an embodiment of the present invention, there is provided an electronic device for testing the reproduction of a defect, comprising:
[0032] one or more processors;
[0033] a storage device for storing one or more programs,
[0034] When the one or more programs are executed by the one or more processors, the one or more processors implement the test defect reproduction method provided by the present invention.
[0035] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for reproducing a test defect provided by the present invention is implemented.
[0036] An embodiment of the above invention has the following advantages or beneficial effects: because after a test defect occurs, the corresponding process to be reproduced is determined according to the implementation method of the defect function corresponding to the test defect, so that the reproduction terminal executes the process to be reproduced; during the execution process, the packet capture tool and the recording tool are opened at the same time, the output parameters of the target interface are captured, and compared with the defect result. If the two are the same, it means that the reproduction is successful. For occasional reproducible bugs, the generation path of the occasional reproducible bug can be determined through the steps of the corresponding process to be reproduced; for occasional difficult to reproduce bugs, the dynamic pictures recorded by the recording tool are analyzed to determine the generation path of the occasional difficult to reproduce bug. Therefore, the existing occasional bugs cannot be located, and high time, manpower and development costs are required for searching, debugging, repairing and verifying, and even a large cost is wasted and still cannot be solved, which makes the early development go to waste. The technical effect of being able to capture various test defects, especially accurately locating the generation path of occasional bugs, so as to facilitate repair, reduce the time, manpower and development costs of testing and repair, and ensure the stable online operation of the program is achieved.
[0037] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0039] Figure 1 is a schematic diagram of the main process of the method for reproducing a test defect according to an embodiment of the present invention;
[0040] Figure 2 is a schematic diagram of the main process of a recording method for a reproduction process according to an embodiment of the present invention;
[0041] Figure 3 is a schematic diagram of the packet capture principle of the packet capture tool according to an embodiment of the present invention;
[0042] Figure 4 is a schematic diagram of main modules of a device for reproducing a test defect according to an embodiment of the present invention;
[0043] Figure 5 An exemplary system architecture diagram of a test defect reproduction method or a test defect reproduction device suitable for application in an embodiment of the present invention is shown;
[0044] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0045] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0046] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0047] URL: Uniform Resource Locator, Uniform Resource Locator, refers to the method used to specify the location of information on the World Wide Web service program of the Internet.
[0048] Selenium: is a tool for web application testing that runs directly in the browser to test the functionality of the application.
[0049] Proxy SwitchyOmega: is a browser extension that can manage and switch the browser's proxy settings.
[0050] mitmproxy: A MITM (Man-in-the-middle attack) proxy that can forward requests to ensure communication between the server and the terminal, and record request or response data. It is a tool that can capture terminal data online directly through a browser, and can be used with Python scripts to capture packets.
[0051] TLS: Transport Layer Security, a secure transport layer protocol, is used to provide confidentiality and data integrity between two communicating applications. The protocol includes the TLS Record Protocol and the TLS Handshake Protocol.
[0052] Program testing refers to the process of operating a program under specified conditions to discover program errors, measure software quality, and evaluate whether it can meet design requirements. The occasional bugs that appear during the test process can also be divided into occasional reproducible bugs and occasional difficult to reproduce bugs. Occasional reproducible bugs refer to the existence of a reproduction path, but it takes more than ten or even hundreds of times to reproduce once. For example, the bug fails to create a new folder. The reproduction path includes ① creating a folder after creating a new map in the normal operation process, and ② creating a folder after creating a map with a template. When reproducing, the creation is successful according to path ① and the creation fails according to path ②. Therefore, when fixing the bug, it can be analyzed that it is because the program test only focuses on the problem itself and does not combine other functions for verification. Occasional difficult to reproduce bugs refer to the absence of any rules and no reproduction path, but appear from time to time. For example, the bug is an error when the road screen is generated. When fixing the bug, it is analyzed that it is because the longitude and latitude cannot form a closed surface, and no rules are found after multiple searches and verifications. The above-mentioned occasional bugs require testers to consume a lot of manpower and time costs to reproduce, or, if they cannot be reproduced, developers are required to debug the entire program. All of these may delay the online cycle, make it impossible to guarantee on-time delivery, and poor user experience.
[0053] Figure 1 FIG. 1 is a schematic diagram of the main process of the method for reproducing a test defect according to an embodiment of the present invention. Figure 1 As shown, the test defect reproduction method of the present invention includes the following steps:
[0054] Step S101, generating a reproduction request of the test defect according to the test defect of the tested program, and sending it to a reproduction terminal; wherein the reproduction request includes the URL address of the tested program, the defect result of the test defect and the process to be reproduced corresponding to the test defect.
[0055] In the embodiment of the present invention, the test defect reproduction method of the present invention is executed by the server.
[0056] In an embodiment of the present invention, after a test defect occurs in a tested program, the defect information of the test defect of the tested program is counted to facilitate the reproduction of the test defect. The server constructs a test defect database to store the defect information of the test defect of each tested program, including the URL address of the tested program, the IP address to which the defect belongs or the domain name to which the defect belongs, the interface name of the interface to which the defect belongs, the request method of the interface to which the defect belongs, the defect function, one or more defect results, etc. Among them, the interface type of the defect interface can be an http interface or an https interface, and the request method of the defect interface is the method of reading data by the defect interface, for example, the request method of the http interface includes post, get, etc.
[0057] Furthermore, the server generates a reproduction request for the test defect based on the defect information of the test defect of the tested program, and sends it to each reproduction terminal, so that the small program written by the tester or test / developer of the reproduction terminal executes the reproduction request for the test defect of the tested program. The reproduction request includes the URL address of the tested program, the defect result of the test defect, the target IP or target domain name generated according to the IP to which the defect belongs or the domain name to which the defect belongs, the target interface name generated according to the interface name of the interface to which the defect belongs, the target interface request method generated according to the request method of the interface to which the defect belongs, and the process to be reproduced generated according to the defect corresponding function of the test defect. Among them, a reproduction request can include one or more target IPs or one or more target domain names, one or more target interface names, one or more target interface request methods, one or more processes to be reproduced to implement the corresponding functions of the defect, and one or more defect results, which can be selectively set according to the actual test situation.
[0058] Furthermore, each process to be reproduced that implements the function corresponding to the defect may include one or more steps to be reproduced, and one process to be reproduced may correspond to one or more defect results.
[0059] Step S102, in response to the reproduction terminal performing a reproduction operation on the tested program according to the steps to be reproduced of the process to be reproduced, capturing the output results of each of the reproduction operations, recording the reproduction operation, and comparing the output results of the reproduction operation with the defect result.
[0060] In an embodiment of the present invention, after receiving the reproduction request, the small program written by the tester or test / developer of the reproduction terminal accesses the URL address of the tested program according to the URL address of the tested program included in the reproduction request, the name of the packet capture interface, the packet capture interface request mode, and the process to be reproduced, and performs the reproduction operation according to the steps to be reproduced of the process to be reproduced. In the reproduction process of the reproduction terminal, the packet capture tool and the recording tool are synchronously opened, so that while recording the reproduction process of the reproduction terminal, each input parameter (or input parameter) and output result (or output parameter) of the target interface in the reproduction process are captured, and the output result of the packet capture is judged.
[0061] In the embodiment of the present invention, Figure 2 As shown, the recording method of the reproduction process of the present invention includes the following steps:
[0062] Step S201, receiving a notification of starting the reproduction process, and then proceeding to step S202 and step S211.
[0063] In an embodiment of the present invention, before receiving a reproduction request, the tester configures a packet capture tool and a recording tool on the reproduction terminal. The packet capture tool can be a browser proxy. The tester sets a proxy for the browser of the reproduction terminal in advance, so that when executing the reproduction request, the URL address of the tested program is accessed, and the browser proxy is used to capture the input and output parameters of the target interface. The recording tool can be selenium. The tester installs selenium on the reproduction terminal in advance, so that when executing the reproduction request, the browser is started through the selenium architecture, the URL address of the tested program is accessed, and the picture of the reproduction process is captured.
[0064] Furthermore, you can set up a proxy for your browser through an extension in your browser, such as Proxy SwitchyOmega, or you can use the proxy option in the network and Internet of the reproducing terminal to set it up.
[0065] In the embodiment of the present invention, Figure 3 As shown, the packet capture principle of the packet capture tool of the present invention includes the following steps:
[0066] ① The reproduction terminals 301, 302, 303 establish a connection with the browser proxy 304 and send a connection request. The reproduction terminals 301, 302, 303 may be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc.
[0067] ② The browser proxy 304 responds and establishes a connection between the reproduction terminals 301, 302, 303 and the server 305.
[0068] ③ After receiving the response from the browser proxy 304, the reproducing terminals 301, 302, and 303 start a TLS connection, wherein the TLS connection includes a host name to be connected.
[0069] ④ The browser proxy 304 connects to the server 305 and uses the host name included in the recurring terminals 301, 302, and 303 to establish a TLS connection.
[0070] ⑤ The server 305 responds with a matching certificate, which contains the common name and subject alternative name required to generate the interception certificate.
[0071] ⑥ The browser proxy 304 generates an interception certificate and returns it to the reproducing terminal 301, 302, 303TLS.
[0072] ⑦ The reproduction terminals 301, 302, and 303 send http requests to the browser proxy 304 through the established TLS connection.
[0073] ⑧The browser proxy 304 passes the http request to the server 305.
[0074] In this way, the browser proxy can capture the data of http requests or https requests.
[0075] In the embodiment of the present invention, the browser proxy may be Python's mitmproxy, which captures http or https requests.
[0076] In an embodiment of the present invention, when a small program written by a tester or a tester / developer executes a reproduction request, the URL address of the tested program is entered, and after logging in by entering a user name, password or verification code, the tested program is accessed, and the reproduction process begins. The packet capture tool and the recording tool simultaneously enter the ready state, and packet capture and recording begin. When the reproduction process begins, the server receives a notification of starting the reproduction process, and captures data and takes screenshots through the packet capture tool and the recording tool.
[0077] Step S202, using the packet capture tool, determine whether the interface corresponding to the recurrence operation is the target interface, if yes, go to step S203; if not, go to step S210.
[0078] Step S203: Capture the output result of the target interface.
[0079] In the embodiment of the present invention, when the operation interface corresponding to the reproduction operation is the target interface, the output parameters of the target interface are captured to facilitate subsequent judgment on whether the reproduction request is successfully reproduced.
[0080] Step S204, compare the output result of the target interface with the defect result of the target interface to determine whether the output result of the target interface is the same as the defect result of the target interface, if yes, go to step S205; if not, go to step S210.
[0081] Step S205, determining that the reproduction result of the reproduction request is successful, generating an end instruction, and going to step S206 and step S208.
[0082] In the embodiment of the present invention, when the output result of the target interface is the same as the defect result, the reproduction result of the reproduction request is determined to be successful reproduction, and an end instruction including a packet capture end instruction and a recording end instruction is generated.
[0083] In the embodiment of the present invention, the end instruction may also be generated by the tester or the small program written by the tester / developer to actively end the reproduction operation after discovering the test defect. The test defect discovered by the small program written by the tester or the tester / developer may be different from or the same as the test defect in the test defect database.
[0084] Furthermore, the defect information of test defects discovered by testers or small programs written by testers / developers that are different from the test defect database is stored in the test defect database for sharing with other testers or developers, so that it can be repaired in time to ensure the stable launch of the tested program and save testing, repair and other costs.
[0085] Step S206: Acquire operation information of the recurrence operation according to the packet capture end instruction.
[0086] In an embodiment of the present invention, the operation information of the reproduction operation includes the request cookie of the tester logging into the tested program, the URL of the tested program accessed, the method name of the target interface, the message body of the target interface, the input parameters of the target interface, the output results of the target interface, the process to be reproduced corresponding to the reproduction operation and the steps to be reproduced.
[0087] Step S207: storing the operation information of the recurrence operation in a test defect database.
[0088] In the embodiment of the present invention, the data of the test defect database can be shared to guide testers and developers to improve the probability of recurrence of occasional bugs and reduce development costs.
[0089] Step S208: Acquire recording information of the reproduction request according to the recording end instruction.
[0090] In the embodiment of the present invention, the recording information of the reproduction request includes screenshots of the reproduction operation during the reproduction process, and the multiple screenshots are not repeated.
[0091] Step S209: Generate and store a dynamic image according to the recording information of the copy request.
[0092] In the embodiment of the present invention, a plurality of non-repeating screenshots of the reproduction operation in the reproduction process are used to generate and store dynamic images, so as to determine the generation path of the test defect.
[0093] Step S210, continue judging and go to step S202.
[0094] In an embodiment of the present invention, when the interface corresponding to the reproduction operation is not the target interface, or the output result of the target interface is different from the defect result of the target interface, the next interface of the reproduction operation or the next reproduction operation is continuously determined until the test defect is located.
[0095] In the embodiment of the present invention, it is also possible to determine whether the number of operations of the recurring operation exceeds the preset number of operations, if so, delete the data of the recurring operation that has been performed to save system resources; if not, continue to determine. For example, the preset number of operations is 300.
[0096] Step S211, according to a preset time interval, using the recording tool to capture a process picture of the reproduction terminal.
[0097] In the embodiment of the present invention, during the reproduction process, the recording tool and the packet capture tool work simultaneously, and screenshots are taken of the reproduction operations performed by the tester through the reproduction terminal according to a preset time interval, for example, the preset time interval is 0.5s.
[0098] Step S212, determine whether the recording stop instruction is received, if yes, go to step S208; if not, go to step S213.
[0099] Step S213, determine whether the process image is repeated, if yes, go to step S214; if not, go to step S215.
[0100] Step S214, deleting repeated process pictures, and / or deleting process pictures according to the screenshot time.
[0101] In an embodiment of the present invention, when process images are repeated, the repeated process images are deleted and only the most recent screenshot is retained, thereby preventing redundant images from being generated when the tester has not operated for a long time due to various reasons during the reproduction process, thereby saving system resources.
[0102] In an embodiment of the present invention, when the number of images of the process image exceeds the preset number of images, the screenshots exceeding the preset number of images are deleted in the order of screenshot time from far to near, thereby deleting invalid screenshots of the reproduction operation that does not reproduce the test defect, saving system resources.
[0103] Step S215, determine whether the number of pictures in the process picture exceeds the preset number of pictures, if yes, go to step S214; if no, go to step S212.
[0104] In the embodiment of the present invention, for example, the preset number of pictures is 200.
[0105] In an embodiment of the present invention, through the recording method of the reproduction process of the present invention, during the reproduction process, a packet capture tool and a recording tool can be started at the same time, and the packet capture tool is used to compare the output parameters and defect results of the captured target interface. When the two are the same, the test defect reproduction is determined, and the operation information and dynamic images of the reproduction operation are stored to facilitate the later generation of the test defect generation path, thereby reducing the time, manpower and development costs of testing and repair.
[0106] Step S103, when it is determined that the output result of the reproduction operation is the same as the defect result, the reproduction result of the reproduction request is determined to be successful reproduction, and the generation path of the test defect is determined according to the recorded dynamic picture of the reproduction operation.
[0107] In an embodiment of the present invention, for occasional reproducible bugs, when there are multiple ways to implement the defect function corresponding to the test defect, that is, when the reproduction request includes multiple possible processes to be reproduced, in order to determine the generation path of the test defect, when the tester executes various processes to be reproduced respectively, the output result of the captured target interface is compared with the defect result, and the screenshot of the process to be reproduced or the reproduction operation with the same output result of the target interface and the defect result is the generation path of the test defect. When the generation path of the test defect is determined by the process to be reproduced, according to the comparison result of the packet capture tool, the process to be reproduced corresponding to the reproduction operation and its steps to be reproduced are used as the generation path of the test defect; when the generation path of the test defect is determined by the screenshot of the reproduction operation, according to the comparison result of the packet capture tool, the screenshot of the reproduction operation recorded by the recording tool is extracted, and the dynamic picture generated by the screenshot of the reproduction operation is used as the generation path of the test defect. The dynamic picture includes each reproduction operation of the tester, that is, how the test defect is generated, thereby generating the corresponding generation path.
[0108] Furthermore, the generation path may be the same as the generation path of the test defects during the testing process, or it may be the possible generation path of the newly discovered test defects. In either case, the generation path of the occasional reproducible bug can be located through the above method, allowing developers to repair it, reducing the developers' search and debugging costs.
[0109] In an embodiment of the present invention, for occasional bugs that are difficult to reproduce, the recording tool serves as an auxiliary to the packet capture tool. When the test defect is determined to be reproduced again based on the packet capture data, the dynamic image of the recorded reproduction process can be viewed, and the reproduction operation can be analyzed to locate the generation path of the occasional bug that is difficult to reproduce. Specifically, the generation path of the test defect is determined using the reproduction operation, and according to the comparison result of the packet capture tool, the screenshot of the reproduction operation recorded by the recording tool is extracted, and the dynamic image generated by the screenshot of the reproduction operation is used as the generation path of the test defect. In this way, occasional difficult to reproduce bugs that do not have any rules and no reproduction path but appear from time to time can be repaired in a timely manner, reducing the manpower and time costs of testers and developers.
[0110] In an embodiment of the present invention, the number of occurrences of occasional bugs can also be counted, and the probability of occurrence of occasional bugs can be calculated to store data, and subsequently generate a probability model of occasional bugs to guide testers or developers to locate the generation path of test defects in other tested programs, thereby saving testing costs and development costs.
[0111] It should be noted that since the must-occur type bug can be reproduced by following fixed steps, for the must-occur type bug, the method of the present invention can be used to determine the generation path according to the to-be-reproduced process and its to-be-reproduced steps or any one of the dynamic pictures corresponding to the reproduction operation.
[0112] In an embodiment of the present invention, a reproduction request of a test defect is generated according to a test defect of a tested program, and sent to a reproduction terminal; wherein the reproduction request includes a URL address of the tested program, a defect result of the test defect, and a process to be reproduced corresponding to the test defect; in response to the reproduction operation performed by the reproduction terminal on the tested program according to the steps to be reproduced of the process to be reproduced, the output results of each reproduction operation are captured, the reproduction operation is recorded, and the output result of the reproduction operation is compared with the defect result; when it is determined that the output result of the reproduction operation is the same as the defect result, the reproduction result of the reproduction request is determined to be a successful reproduction, and according to the recorded dynamic picture of the reproduction operation, the generation path of the test defect is determined, etc., various test defects can be captured, especially the generation path of occasional bugs can be accurately located to facilitate repair, thereby reducing the time, manpower and development costs of testing and repair, and ensuring the stable online operation of the program.
[0113] Figure 4 is a schematic diagram of the main modules of the device for reproducing a test defect according to an embodiment of the present invention, such as Figure 4 As shown, the test defect reproduction device 400 of the present invention includes:
[0114] The generation module 401 is used to generate a reproduction request of the test defect according to the test defect of the tested program and send it to the reproduction terminal; wherein the reproduction request includes the URL address of the tested program, the defect result of the test defect and the process to be reproduced corresponding to the test defect.
[0115] The comparison module 402 is used to respond to the reproduction operation of the tested program performed by the reproduction terminal according to the steps to be reproduced of the process to be reproduced, capture the output results of each of the reproduction operations, record the reproduction operation, and compare the output results of the reproduction operation with the defect result.
[0116] The path determination module 403 is used to determine that the reproduction result of the reproduction request is a successful reproduction when it is determined that the output result of the reproduction operation is the same as the defect result, and determine the generation path of the test defect according to the recorded dynamic picture of the reproduction operation.
[0117] In an embodiment of the present invention, various test defects can be captured by generating modules, comparing modules, and determining paths, especially accurately locating the generation paths of occasional bugs, so as to facilitate repairs, thereby reducing the time, manpower, and development costs of testing and repairs, and ensuring the stable online operation of the program.
[0118] Figure 5 An exemplary system architecture diagram of a test defect reproduction method or a test defect reproduction device suitable for application in an embodiment of the present invention is shown. Figure 5 As shown, an exemplary system architecture of a test defect reproduction method or a test defect reproduction device according to an embodiment of the present invention includes:
[0119] like Figure 5 As shown, the system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. The network 504 is used to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 105. The network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0120] The user can use the terminal devices 501, 502, 503 to interact with the server 505 through the network 504 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 501, 502, 503, such as the tested application, shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0121] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0122] The server 505 may be a server that provides various services, such as a background management server that provides support for the tested websites browsed by the users using the terminal devices 501, 502, and 503. The background management server may analyze and process the received output results, process pictures and other data, and feed back the processing results (such as test defect reproduction prompts or dynamic pictures) to the terminal devices 501, 502, and 503.
[0123] It should be noted that the test defect reproduction method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the test defect reproduction device is generally disposed in the server 505 .
[0124] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0125] Figure 6 is a schematic diagram of a computer system of a terminal device or server suitable for implementing an embodiment of the present invention, such as Figure 6 As shown, the computer system 600 of the terminal device or server of the embodiment of the present invention includes:
[0126] A central processing unit (CPU) 601 can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the system 600 are also stored in the RAM 603. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0127] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0128] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0129] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0130] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0131] The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The modules described may also be arranged in a processor, for example, they may be described as: a processor including a generation module, a comparison module and a path determination module. The names of these modules do not constitute limitations on the modules themselves in certain cases. For example, the comparison module may also be described as "a module that responds to the reproduction operation performed by the tester of the reproduction terminal on the tested program according to multiple steps to be reproduced of the process to be reproduced, captures the output results of each of the reproduction operations, records the reproduction operation, and compares the output results of the reproduction operation with the defect result".
[0132] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: generating a reproduction request of a test defect according to the test defect of the tested program, and sending it to a reproduction terminal; wherein the reproduction request includes the URL address of the tested program, the defect result of the test defect and the to-be-reproduced process corresponding to the test defect; in response to the reproduction operation performed by the reproduction terminal on the tested program according to the to-be-reproduced steps of the to-be-reproduced process, the output results of each of the reproduction operations are captured, and the reproduction operation is recorded at the same time, and the output result of the reproduction operation is compared with the defect result; when it is determined that the output result of the reproduction operation is the same as the defect result, the reproduction result of the reproduction request is determined to be a successful reproduction, and the generation path of the test defect is determined according to the recorded dynamic picture of the reproduction operation.
[0133] According to the technical solution of the embodiment of the present invention, the reproduction of the test defect is determined based on the captured packet parameters, and the tester is promptly prompted. As long as one person can reproduce it, it can be captured in time; duplicate screenshots are discarded to save system resources; the probability of occasional bugs is counted to provide a reference for subsequent development.
[0134] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for reproducing a test defect, characterized in that: include: Generate a reproduction request for the test defect according to the test defect of the tested program, and send it to the reproduction terminal; wherein the reproduction request includes the URL address of the tested program, the defect result of the test defect and the process to be reproduced corresponding to the test defect; In response to the reproduction operation performed by the reproduction terminal on the tested program according to the steps to be reproduced of the process to be reproduced, the output results of each reproduction operation are captured, the reproduction operation is recorded, and the output results of the reproduction operation are compared with the defect result; When it is determined that the output result of the reproduction operation is the same as the defect result, the reproduction result of the reproduction request is determined to be successful reproduction, and the generation path of the test defect is determined according to the recorded dynamic picture of the reproduction operation.
2. The method according to claim 1, characterized in that The reproduction request also includes a target interface corresponding to the test defect; and the capturing of the output results of each of the reproduction operations includes: Using a packet capture tool to determine whether the interface corresponding to the recurrence operation is the target interface; When the interface corresponding to the recurrence operation is the target interface, the output result of the target interface is captured.
3. The method according to claim 1, characterized in that The recording of the recurrence operation includes: According to a preset time interval, a recording tool is used to capture process images of the reproducing terminal.
4. The method according to claim 2 or 3, characterized in that: When it is determined that the reproduction result of the reproduction request is successful, the method further includes: Generate an end instruction of the reproduction request; wherein the end instruction includes a packet capture end instruction and a recording end instruction.
5. The method according to claim 4, characterized in that Also includes: According to the packet capture end instruction, obtaining operation information of the recurrence operation; The operation information of the reproduction operation is stored in the test defect database; wherein the operation information of the reproduction operation includes the request cookie of the tester to log in to the tested program, the method name of the target interface, the message body of the target interface, the input parameters of the target interface and the output result of the target interface.
6. The method according to claim 4, characterized in that Also includes: According to the recording end instruction, obtaining recording information of the reproduction request; wherein the recording information of the reproduction request includes a screenshot of the reproduction operation during the reproduction process; The dynamic image is generated using a plurality of non-repeating screenshots corresponding to the reproduction operation.
7. The method according to claim 1, characterized in that In the case where it is determined that the reproduction result of the reproduction request is successful, alternatively, the method further includes: The steps to be reproduced included in the process to be reproduced are used as the generation path of the test defect.
8. A test defect reproduction device, characterized in that: include: A generation module, used to generate a reproduction request of the test defect according to the test defect of the tested program, and send it to the reproduction terminal; wherein the reproduction request includes the URL address of the tested program, the defect result of the test defect and the process to be reproduced corresponding to the test defect; A comparison module, configured to respond to the reproduction operation performed by the reproduction terminal on the tested program according to the steps to be reproduced of the process to be reproduced, capture the output results of each of the reproduction operations, record the reproduction operation, and compare the output results of the reproduction operation with the defect result; A path determination module is used to determine that the reproduction result of the reproduction request is a successful reproduction when it is determined that the output result of the reproduction operation is the same as the defect result, and determine the generation path of the test defect based on the recorded dynamic image of the reproduction operation.
9. An electronic device for testing the reproduction of defects, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
