Script online debugging method, system and storage medium
By building an independent container debugging environment in the automated testing platform and using the Java virtual machine for remote debugging, the problem of the automated interface testing platform lacking script debugging function is solved, and the independence and efficiency of online script debugging are achieved.
Patent Information
- Application Number
- CN202111279884.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2041-10-29
AI Technical Summary
The existing automated interface testing platform lacks script debugging capabilities, and adding debugging capabilities will affect the debugging progress of other users.
After script debugging is enabled on the automated testing platform, it is determined whether the current user has a container debugging environment. If not, an independent container debugging environment is built, and the script content is obtained through a remote connection. The debugging request instructions are received for debugging, and the Java virtual machine is used to implement operations such as single-step entry, single-step execution, jump out, and continue running.
The online script debugging function is implemented to avoid mutual interference between debugging of different users and improve the efficiency of script testing.
Smart Images

Figure CN113961469B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automated testing, and in particular to a script online debugging method, system and storage medium. Background Art
[0002] Automated interface testing platforms currently available on the market typically include several modules: request message assembly, interface request processing, return message parsing, data assertion, and more. To provide more flexible control over the entire interface testing process, scripts written in JavaScript or other languages are often introduced to control the entire testing process. For example, different message assembly methods can be adopted based on different requests, or an additional request can be sent when the return message meets certain conditions. This allows the testing platform to be compatible with diverse business processes.
[0003] The current automated interface testing platform has two major problems: 1. It lacks script debugging capabilities; 2. After adding the debugging function, breakpoints added to the current script will cause other users debugging the script to also be interrupted, affecting the current user's debugging progress. Summary of the Invention
[0004] In view of this, embodiments of the present application provide a script online debugging method, system, and storage medium, aiming to solve the problem that scripts cannot be automatically debugged online.
[0005] The present invention provides a method for online script debugging, which includes:
[0006] After enabling script debugging on the automated testing platform, determine whether the current user already has a container debugging environment.
[0007] If the container debugging environment does not exist for the current user, start and build an independent container debugging environment;
[0008] Establishing a remote connection between the automated testing platform and the independent container debugging environment, and obtaining script content after the remote connection is successful;
[0009] Receive a debugging request instruction from the automated testing platform, and debug the script content based on the debugging request instruction and the independent container debugging environment.
[0010] In one embodiment, receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes:
[0011] receiving a single-step entry request instruction from the automated testing platform, and determining whether a current statement is a first preset statement;
[0012] If the current statement is the first preset statement, then the current thread is restored and the script content is debugged; wherein the first preset statement is a return statement of the script matching method;
[0013] If the current statement is not the first preset statement, a Java virtual machine single-step entry debugging request is constructed, and the current thread is restored to debug the script content.
[0014] In one embodiment, receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes:
[0015] receiving a single-step execution request instruction from the automated testing platform, and determining whether the current statement is a first preset statement;
[0016] If the current statement is the first preset statement, resuming the current thread and debugging the script content;
[0017] If the current statement is not the first preset statement, determining whether the current statement is a second preset statement; wherein the second preset statement is a return statement of a script method other than the script matching method;
[0018] If the current statement is the second preset statement, then jump out of the single-step entry request instruction;
[0019] If the current statement is not the second preset statement, a Java virtual machine is constructed to execute a single-step debugging request, and the current thread is restored to debug the script content.
[0020] In one embodiment, receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes:
[0021] Receive an exit request instruction from the automated testing platform, and determine whether the current statement is a third preset statement; wherein the third preset statement is a return statement of the script's total method;
[0022] If the current statement is the third preset statement, resuming the current thread and debugging the script content;
[0023] If the current statement is not the third preset statement, determining whether the current statement reaches the top of the method stack;
[0024] If the current statement reaches the top of the method stack, the current thread is restored and the script content is debugged;
[0025] If the current statement has not reached the top of the method stack, a Java virtual machine is constructed to exit the debugging request, and the current thread is restored to debug the script content.
[0026] In one embodiment, receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes:
[0027] Receiving a continue-run request instruction from the automated testing platform, parsing the continue-run request instruction and obtaining the line number of the breakpoint of each script and the name of the script;
[0028] Through the independent container debugging environment, the line number of the breakpoint of each script and the name of the script are forwarded to the Java virtual machine to complete the setting of the script breakpoint, and the current thread is restored to debug the script content.
[0029] In one embodiment, after the step of determining whether the current user already has a container debugging environment after script debugging is enabled on the automated testing platform, the following steps are further included:
[0030] If the container debugging environment exists for the current user, the container debugging environment is used as the independent container debugging environment.
[0031] In one embodiment, establishing a remote connection between the automated testing platform and the independent container debugging environment, and obtaining script content after the remote connection is successful, includes:
[0032] Obtaining the Internet Protocol address and port of the independent container debugging environment;
[0033] Connecting the automated testing platform to a corresponding Java virtual machine based on the Internet Protocol address and the port to complete a remote connection between the automated testing platform and the independent container debugging environment;
[0034] After the remote connection is successful, the script content is obtained through the script number and the independent container debugging environment.
[0035] In one embodiment, after the step of receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment, the method further includes:
[0036] Returning the generated debugging results to the automated testing platform for display;
[0037] The debugging result includes current parameter values and / or method stack.
[0038] To achieve the above object, a script online debugging system is also provided, the system comprising:
[0039] The judgment module is used to determine whether the current user already has a container debugging environment after script debugging is enabled on the automated testing platform;
[0040] A construction module, configured to start and build an independent container debugging environment if the container debugging environment does not exist for the current user;
[0041] An acquisition module is used to establish a remote connection between the automated testing platform and the independent container debugging environment, and obtain the script content after the remote connection is successful;
[0042] The debugging module is used to receive a debugging request instruction from the automated testing platform and debug the script content based on the debugging request instruction and the independent container debugging environment.
[0043] To achieve the above object, a computer storage medium is further provided, on which a script online debugging method program is stored. When the script online debugging method program is executed by a processor, the steps of any of the above-mentioned script online debugging methods are implemented.
[0044] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: after script debugging is started on the automated testing platform, it is determined whether the current user already has a container debugging environment; if the current user does not have the container debugging environment, an independent container debugging environment is started and built; by determining the current user's test environment and, if the current user does not have a container debugging environment, reconstructing the current user's independent container debugging environment, it is ensured that script debugging between different users does not affect each other.
[0045] Establishing a remote connection between the automated testing platform and the independent container debugging environment, and upon successful remote connection, obtaining the script content; receiving a debugging request instruction from the automated testing platform, and debugging the script content based on the debugging request instruction and the independent container debugging environment. The remote connection between the automated testing platform and the independent container debugging environment and the debugging request instruction enable online script debugging. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 This is a flow chart of the first embodiment of the script online debugging method of this application;
[0047] Figure 2 This is a flowchart of the specific implementation steps of step S140 in the first embodiment of the script online debugging method of this application;
[0048] Figure 3 This is a flowchart of another specific implementation step of step S140 in the first embodiment of the script online debugging method of this application;
[0049] Figure 4 This is a flowchart of another specific implementation step of step S140 in the first embodiment of the script online debugging method of this application;
[0050] Figure 5 This is a flowchart of another specific implementation step of step S140 in the first embodiment of the script online debugging method of this application;
[0051] Figure 6 This is a flowchart of the specific implementation steps of step S130 in the first embodiment of the script online debugging method of this application;
[0052] Figure 7 This is a functional module diagram of the online debugging system for this application script;
[0053] Figure 8 This is a functional module diagram of the online debugging device for this application script. DETAILED DESCRIPTION
[0054] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0055] The main solution of the embodiment of the present invention is: after the automated testing platform starts script debugging, it is determined whether the current user already has a container debugging environment; if the current user does not have the container debugging environment, an independent container debugging environment is started and built; a remote connection is established between the automated testing platform and the independent container debugging environment, and after the remote connection is successful, the script content is obtained; a debugging request instruction from the automated testing platform is received, and the script content is debugged based on the debugging request instruction and the independent container debugging environment. The present invention solves the problem that scripts cannot be debugged online automatically, realizes online debugging of control scripts in automated interface cases, and avoids the mutual influence of script debugging between different users.
[0056] In order to better understand the above technical solution, the above technical solution will be described in detail below with reference to the accompanying drawings and specific implementation methods.
[0057] Reference Figure 1 , Figure 1 This is the first embodiment of the script online debugging method of this application, the method comprising:
[0058] Step S110: After script debugging is enabled on the automated testing platform, it is determined whether the current user already has a container debugging environment;
[0059] Specifically, the container debugging environment can be a docker debugging environment, which is a docker container started through the online service of the automated testing platform. The docker container is a debugging service written in java and executes scripts through jdk.nashorn. The scripts can be javascript scripts or other scripting languages, which are not limited here.
[0060] Step S120: If the container debugging environment does not exist for the current user, start and build an independent container debugging environment;
[0061] In one embodiment, after the step of determining whether the current user already has a container debugging environment after script debugging is enabled on the automated testing platform, the following steps are further included:
[0062] If the container debugging environment exists for the current user, the container debugging environment is used as the independent container debugging environment.
[0063] Specifically, when opening the Javascript debugging page on the automated testing platform's online service, the automated interface testing platform determines whether the current user already has a Docker debugging environment. If so, the current Docker debugging environment is reused. If not, a separate debugging environment is allocated for the current user by launching a separate Docker container. This ensures that execution and debugging by different users do not affect each other. This solves the problem of other users debugging the same script also entering the same debugging context while the current user is debugging.
[0064] Step S130: establishing a remote connection between the automated testing platform and the independent container debugging environment, and obtaining script content after the remote connection is successful;
[0065] Specifically, building a remote connection between the automated testing platform and the independent container debugging environment can facilitate more users to debug scripts online, thereby reducing the cost of user script debugging.
[0066] Specifically, the script content can be obtained by the script number or the script name, which is not limited here.
[0067] Step S140: receiving a debugging request instruction from the automated testing platform, and debugging the script content based on the debugging request instruction and the independent container debugging environment.
[0068] Specifically, after obtaining the script content, the automated interface testing platform online service can implement JavaScript script debugging in the Docker debugging environment by sending a debugging request.
[0069] In one embodiment, after the step of receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment, the method further includes:
[0070] Returning the generated debugging results to the automated testing platform for display;
[0071] The debugging result includes current parameter values and / or method stack.
[0072] Specifically, after the request is processed, the parameter values and method stack after the current statement is executed are returned to the automated testing platform online service and displayed on the page. The debugging results can also include at least the name and current value of each variable, the current line number, and the method stack.
[0073] Specifically, debugging requests include at least Step In, Step Over, Step Out, and Continue. For pause / execution operations during the process, the Java Virtual Machine controls the current thread to pause or execute. Each debugging operation returns the current parameter values and method stack for the tester to view.
[0074] In the above embodiment, the beneficial effects are as follows: after the automated testing platform starts script debugging, it is determined whether the current user already has a container debugging environment; if the current user does not have the container debugging environment, an independent container debugging environment is started and built; by determining the current user's test environment and, if the current user does not have a container debugging environment, reconstructing the current user's independent container debugging environment, it is ensured that script debugging between different users does not affect each other.
[0075] Establishing a remote connection between the automated testing platform and the independent container debugging environment, and upon successful remote connection, obtaining the script content; receiving a debugging request instruction from the automated testing platform, and debugging the script content based on the debugging request instruction and the independent container debugging environment. The remote connection between the automated testing platform and the independent container debugging environment and the debugging request instruction enable online script debugging.
[0076] Reference Figure 2 , Figure 2 The specific implementation steps of step S140 in the first embodiment of the script online debugging method of this application include receiving the debugging request instruction of the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment, including:
[0077] Step S141-1: receiving a single-step entry request instruction from the automated testing platform, and determining whether the current statement is a first preset statement; wherein the first preset statement is a return statement of a script matching method;
[0078] Specifically, the single-step entry request instruction is triggered by the interactive button of the single-step entry (Step In) operation on the online service page of the automated testing platform; on the page of the online service of the automated testing platform, clicking the single-step entry button will send a single-step entry (Step In) request to the docker debugging environment.
[0079] Specifically, the first preset statement may be a return statement of the script's exec() method; the docker debugging environment determines whether the current statement is a return statement of the script's exec() method.
[0080] Step S142-1: If the current statement is the first preset statement, then restore the current thread and debug the script content;
[0081] Specifically, if the current statement is a return statement of the script's exec() method, the current thread execution is resumed to complete the debugging of the script.
[0082] Step S143-1: If the current statement is not the first preset statement, construct a Java virtual machine single-step entry debugging request, and restore the current thread to debug the script content.
[0083] Specifically, if the current statement is not the return statement of the script's exec() method, a new Step In debugging request is created based on the established debugging environment connection and sent to the Java virtual machine, resuming the current thread to normal execution. After the request is processed, the parameter values and method stack after the current statement execution are returned to the automated testing platform online service and displayed on the page.
[0084] In the above embodiment, there are beneficial effects: a new single-step entry debugging function is added, which realizes the debugging request of the online single-step entry operation and improves the efficiency of user script testing.
[0085] Reference Figure 3 , Figure 3 This is another specific implementation step of step S140 in the first embodiment of the script online debugging method of this application, wherein receiving the debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes:
[0086] Step S141-2: receiving a single-step execution request instruction from the automated testing platform, and determining whether the current statement is a first preset statement;
[0087] Specifically, the single-step execution request instruction is triggered by the interactive button of the single-step entry (Step Over) operation on the online service page of the automated testing platform; on the page of the online service of the automated testing platform, clicking the single-step entry button will send a single-step entry (Step Over) request to the docker debugging environment.
[0088] Specifically, for a single-step execution (Step Over) request for debugging, the Docker debugging environment will determine whether the current statement is a return statement of the script's exec() method.
[0089] Step S142-2: If the current statement is the first preset statement, then restore the current thread and debug the script content;
[0090] Specifically, if the current statement is a return statement of the script's exec() method, the current thread execution is resumed to complete the debugging of the script.
[0091] Step S143-2: If the current statement is not the first preset statement, determine whether the current statement is a second preset statement; wherein the second preset statement is a return statement of a script method other than the script matching method;
[0092] Specifically, if the current statement is not a return statement of the script's exec() method, it is further determined whether the current statement is a return statement of a common method in the script.
[0093] Step S144-2: If the current statement is the second preset statement, then jump out of the single-step entry request instruction;
[0094] Specifically, the second preset statement can be a return statement of a common method in the script, or other statements; if the current statement is a return statement of a common method in the script, then the method is jumped out, that is, the debugging process of the jump operation is executed.
[0095] Step S145-2: If the current statement is not the second preset statement, construct a Java virtual machine single-step execution debugging request, and restore the current thread to debug the script content.
[0096] Specifically, if the current statement is not a return statement in a typical method within the script, a new Step Out debugging request is created based on the established debugging environment connection and sent to the Java virtual machine, resuming the current thread to normal execution. After the request is processed, the parameter values and method stack after the current statement is executed are returned to the automated testing platform online service and displayed on the page.
[0097] In the above embodiment, the beneficial effects are: a new single-step execution debugging function is added, which realizes the debugging request of the online single-step execution operation and improves the efficiency of user script testing.
[0098] Reference Figure 4 , Figure 4 This is another specific implementation step of step S140 in the first embodiment of the script online debugging method of this application, wherein receiving the debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes:
[0099] Step S141-3: receiving a jump request instruction from the automated testing platform, and determining whether the current statement is a third preset statement; wherein the third preset statement is a return statement of the script's main method;
[0100] Specifically, the jump request instruction is triggered by the interactive button of the single-step entry (StepOut) operation on the online service page of the automated testing platform; on the page of the online service of the automated testing platform, clicking the single-step entry button will send a single-step entry (StepOut) request to the docker debugging environment.
[0101] Specifically, the third preset statement may be a return statement of the script's overall method, or may be another statement; or may be used to determine whether the current statement is a return statement of the script's overall method.
[0102] Step S142-3: If the current statement is the third preset statement, then the current thread is restored and the script content is debugged;
[0103] Specifically, if the current statement is a return statement of the script's main method, the current thread execution is resumed to complete the debugging of the script.
[0104] Step S143-3: If the current statement is not the third preset statement, determining whether the current statement reaches the top of the method stack;
[0105] Specifically, if the current statement is not a statement of the script's main method, it is further determined whether the current statement reaches the top of the method stack.
[0106] Step S144-3: If the current statement reaches the top of the method stack, the current thread is restored and the script content is debugged;
[0107] Step S145-3: If the current statement has not reached the top of the method stack, a Java virtual machine exit debugging request is constructed, and the current thread is restored to debug the script content.
[0108] Specifically, after the request processing is completed, the parameter values and method stack after the current statement execution will be returned to the automated testing platform online service and displayed on the page.
[0109] In the above embodiment, the beneficial effects are: a new jump out debugging function is added, which realizes the debugging request of the online jump out operation and improves the efficiency of user script testing.
[0110] Reference Figure 5 , Figure 5 This is another specific implementation step of step S140 in the first embodiment of the script online debugging method of this application, wherein receiving the debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes:
[0111] Step S141 - 4 : receiving a continue-running request instruction from the automated testing platform, parsing the continue-running request instruction and obtaining the line number of each script's breakpoint and the name of the script;
[0112] Step S142-4: forwarding the line number of the breakpoint of each script and the name of the script to the Java virtual machine through the independent container debugging environment to complete the setting of the script breakpoint, and restore the current thread to debug the script content.
[0113] Specifically, for a Continue request during debugging, the automated testing platform online service first obtains the line number corresponding to the JavaScript script breakpoint on the page, sends the specific script name and line number of each breakpoint to the debugging environment, and then forwards it to the Java virtual machine to complete the breakpoint setting. The Java virtual machine then resumes execution of the current thread to debug the script. After the request is processed, if the breakpoint is reached, the parameter values and method stack of the current breakpoint line are returned to the automated testing platform online service and displayed on the page. If script execution is complete, no debugging information is displayed.
[0114] In the above embodiment, the beneficial effects are: a new continuing running debugging function is added, which realizes the debugging request of continuing running online and improves the efficiency of user script testing.
[0115] Reference Figure 6 , Figure 6 The specific implementation steps of step S130 in the first embodiment of the script online debugging method of this application are: establishing a remote connection between the automated testing platform and the independent container debugging environment, and obtaining the script content after the remote connection is successful, including:
[0116] Step S131: Obtain the Internet Protocol address and port of the independent container debugging environment;
[0117] Specifically, after establishing an independent container debugging environment, the IP and port of the debugging environment can be obtained. The automated interface testing platform uses the com.sun.jdi package to connect to the corresponding Java virtual machine, thereby establishing a remote connection with the debugging environment.
[0118] Step S132: connecting the automated testing platform to a corresponding Java virtual machine based on the Internet Protocol address and the port, so as to complete a remote connection between the automated testing platform and the independent container debugging environment;
[0119] Specifically, the automated testing platform online service remotely connects to the Java virtual machine in the docker debugging environment, sends a debugging request, and completes script debugging.
[0120] Step S133: After the remote connection is successful, the script content is obtained through the script number and the independent container debugging environment.
[0121] Specifically, after the connection is established, the Docker debugging environment will obtain the script content through the script number, automatically put the methods that the script depends on into the script, and wrap the script's process statements with the method function exec(){} to facilitate subsequent debugging.
[0122] In the above embodiment, the beneficial effect is that by establishing a remote connection between the automated testing platform and the independent container debugging environment, multiple new debugging requests are realized, and online debugging of the script is completed.
[0123] This application also protects a script online debugging system 20, the system 20 comprising:
[0124] The judgment module 21 is used to judge whether the current user already has a container debugging environment after script debugging is enabled on the automated testing platform;
[0125] A construction module 22 is configured to start and build an independent container debugging environment if the container debugging environment does not exist for the current user;
[0126] The acquisition module 23 is used to establish a remote connection between the automated testing platform and the independent container debugging environment, and obtain the script content after the remote connection is successful;
[0127] The debugging module 24 is configured to receive a debugging request instruction from the automated testing platform and debug the script content based on the debugging request instruction and the independent container debugging environment.
[0128] Figure 7 The system shown includes a judgment module 21, a construction module 22, an acquisition module 23, and a debugging module 24. The device can execute Figures 1 to 6 For the method of the embodiment shown in FIG. 1 , reference may be made to the description of the part not described in detail in the embodiment. Figures 1 to 6 The implementation process and technical effects of this technical solution can be found in Figures 1 to 6 The description in the illustrated embodiment will not be repeated here.
[0129] The present application also protects a computer storage medium, characterized in that a script online debugging method program is stored on the computer storage medium, and the script online debugging method program is executed by a processor to perform any of the steps of the script online debugging method described above.
[0130] This application relates to a script online debugging device 10 including: Figure 8 As shown: at least one processor 12 and memory 11. The processor 12 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the hardware integrated logic circuit in the processor 12 or by instructions in the form of software. The above-mentioned processor 12 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor may be a microprocessor or any conventional processor. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 11, and the processor 12 reads the information in the memory 11 and completes the steps of the above method in combination with its hardware.
[0131] It is understood that the memory 11 in the embodiment of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 11 of the systems and methods described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.
[0132] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0133] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0134] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0136] It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claim. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third etc. does not indicate any order. These words may be interpreted as names.
[0137] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0138] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A script online debugging method, characterized in that: The method comprises: After enabling script debugging on the automated testing platform, determine whether the current user already has a container debugging environment. If the container debugging environment does not exist for the current user, start and build an independent container debugging environment; Establishing a remote connection between the automated testing platform and the independent container debugging environment, and obtaining script content after the remote connection is successful; receiving a debugging request instruction from the automated testing platform, and debugging the script content based on the debugging request instruction and the independent container debugging environment; The receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes: receiving a single-step entry request instruction from the automated testing platform, and determining whether a current statement is a first preset statement; If the current statement is the first preset statement, then the current thread is restored and the script content is debugged; wherein the first preset statement is a return statement of the script matching method; If the current statement is not the first preset statement, a Java virtual machine single-step entry debugging request is constructed, and the current thread is restored to debug the script content.
2. The script online debugging method according to claim 1, wherein: The receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes: receiving a single-step execution request instruction from the automated testing platform, and determining whether the current statement is a first preset statement; If the current statement is the first preset statement, resuming the current thread and debugging the script content; If the current statement is not the first preset statement, determining whether the current statement is a second preset statement; wherein the second preset statement is a return statement of a script method other than the script matching method; If the current statement is the second preset statement, then jump out of the single-step entry request instruction; If the current statement is not the second preset statement, a Java virtual machine is constructed to execute a single-step debugging request, and the current thread is restored to debug the script content.
3. The script online debugging method according to claim 1, wherein: The receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes: Receiving a jump request instruction from the automated testing platform, and determining whether the current statement is a third preset statement; wherein the third preset statement is a return statement of the script's total method; If the current statement is the third preset statement, resuming the current thread and debugging the script content; If the current statement is not the third preset statement, determining whether the current statement reaches the top of the method stack; If the current statement reaches the top of the method stack, the current thread is restored and the script content is debugged; If the current statement has not reached the top of the method stack, a Java virtual machine is constructed to exit the debugging request, and the current thread is restored to debug the script content.
4. The script online debugging method according to claim 1, wherein: The receiving a debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment includes: Receiving a continue-run request instruction from the automated testing platform, parsing the continue-run request instruction and obtaining the line number of the breakpoint of each script and the name of the script; Through the independent container debugging environment, the line number of the breakpoint of each script and the name of the script are forwarded to the Java virtual machine to complete the setting of the script breakpoint, and the current thread is restored to debug the script content.
5. The script online debugging method according to claim 1, wherein: After the step of determining whether the current user already has a container debugging environment after script debugging is enabled on the automated testing platform, the following steps are also included: If the container debugging environment exists for the current user, the container debugging environment is used as the independent container debugging environment.
6. The script online debugging method according to claim 1, wherein: The step of establishing a remote connection between the automated testing platform and the independent container debugging environment and obtaining script content after the remote connection is successful includes: Obtaining the Internet Protocol address and port of the independent container debugging environment; Connecting the automated testing platform to a corresponding Java virtual machine based on the Internet Protocol address and the port to complete a remote connection between the automated testing platform and the independent container debugging environment; After the remote connection is successful, the script content is obtained through the script number and the independent container debugging environment.
7. The script online debugging method according to claim 1, wherein: After the step of receiving the debugging request instruction from the automated testing platform and debugging the script content based on the debugging request instruction and the independent container debugging environment, the method further includes: Returning the generated debugging results to the automated testing platform for display; The debugging result includes current parameter values and / or method stack.
8. A script online debugging system, characterized in that: The system comprises: The judgment module is used to determine whether the current user already has a container debugging environment after script debugging is enabled on the automated testing platform; A construction module, configured to start and build an independent container debugging environment if the container debugging environment does not exist for the current user; An acquisition module is used to establish a remote connection between the automated testing platform and the independent container debugging environment, and obtain the script content after the remote connection is successful; A debugging module, configured to receive a debugging request instruction from the automated testing platform and debug the script content based on the debugging request instruction and the independent container debugging environment; The debugging module is also used to receive a single-step entry request instruction from the automated testing platform and determine whether the current statement is a first preset statement; if the current statement is the first preset statement, the current thread is restored and the script content is debugged; wherein the first preset statement is a return statement of the script matching method; if the current statement is not the first preset statement, a Java virtual machine single-step entry debugging request is constructed, and the current thread is restored to debug the script content.
9. A computer storage medium, characterized in that The computer storage medium stores a script online debugging method program, which, when executed by a processor, implements the steps of the script online debugging method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Script debugging method and device and computer storage medium
CN109783342A
Service interface online testing method and device based on container and VNC
CN111104336A