Method, device and equipment for invoking debugging tool
By storing the usage time of the debugging tool in the cache, using the debugging identifier and preset time difference in the address bar parameters, the vConsole debugging tool is dynamically loaded, which solves the problem of lack of debugging tools for mobile browsers, and realizes continuous debugging of online environments, simplifies the debugging process.
Patent Information
- Application Number
- CN202111052360.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-08
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2041-09-08
AI Technical Summary
In the prior art, mobile browsers do not have their own debugging tools, resulting in cumbersome debugging processes and the inability to dynamically evoke vConsole debugging tools in the online environment, affecting development efficiency.
By storing the usage time of the debugging tool in the cache, using the debugging identifier and preset time difference in the address bar parameters, the vConsole debugging tool is dynamically loaded to achieve continuous debugging of the online environment.
The debugging process is simplified, continuous debugging within the cache preset time is realized, and development efficiency is improved.
Smart Images

Figure CN113900927B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, and device for invoking a debugging tool. Background Art
[0002] When developing business projects, bugs are inevitable, requiring constant debugging. However, mobile browsers lack built-in debugging tools, making the debugging process cumbersome. The vConsole debugging tool effectively solves this problem. vConsole is a front-end developer debugging panel for mobile web pages. It allows for page debugging on mobile devices, making development and debugging more convenient.
[0003] There are two main methods for invoking the vConsole debugging tool in the prior art:
[0004] (1) The debugging tool cannot be dynamically invoked in the online environment. It is invoked globally by default in the offline environment and cannot be turned off.
[0005] The offline environment is used by developers for project development and debugging and is not open to external systems. Since the vConsole debugging tool cannot be invoked dynamically, this method cannot invoke the vConsole debugging tool in the user's online environment, preventing the user from observing the debugging process or viewing the debugging interface.
[0006] (2) The second method is to dynamically invoke the vConsole debugging tool. When a developer needs to debug a business, they add a callout flag to the address bar parameters of the business process. When the project code created for the business is run, if the callout flag is detected, the vConsole debugging tool can be invoked for debugging.
[0007] This method involves manually adding a callout identifier to the address bar parameters. If you need to debug the entire business process, different processes correspond to different address links that can jump to different pages. Therefore, when jumping from the current page to another page, the callout identifier in the original address bar parameter will not exist. If you need to debug the entire business process, you need to manually add the callout identifier to all possible page links, making the entire debugging process extremely cumbersome. Summary of the Invention
[0008] Embodiments of the present application provide a method, apparatus, and device for invoking a debugging tool to simplify the debugging process of a service.
[0009] In a first aspect, an embodiment of the present application provides a method for invoking a debugging tool, the method comprising:
[0010] Obtaining address bar parameters of a first process of a service requiring debugging, and entering the first process according to the address bar parameters;
[0011] When the address bar parameter contains a debugging identifier, the time of entering the first process is stored in the cache and the debugging tool is dynamically loaded;
[0012] When entering the subsequent process of the business, if the address bar parameter of the current entry process does not contain a debugging identifier, it is determined whether the time of the current entry process and the time stored in the cache exceeds a preset time difference. If not, the time stored in the cache is updated with the time of the current entry process, and the debugging tool is dynamically loaded; if yes, the time stored in the cache is cleared.
[0013] In some possible implementations, the method further includes:
[0014] Generate a QR code for the address bar parameters of the business process in advance, and use the business APP to scan the code to obtain the address bar parameters.
[0015] In some possible implementations, the method further includes:
[0016] A preset time difference is set according to the historical debugging time of the business process.
[0017] In some possible implementations, the debugging identifier is a preset custom parameter.
[0018] In some possible implementations, the cache includes:
[0019] localStorage cache or Cookie cache.
[0020] In some possible implementations, the debugging tool includes:
[0021] vConsole debugging tool.
[0022] In a second aspect, an embodiment of the present application provides a device for invoking a debugging tool, the device comprising an acquisition module, a loading module, and a judgment module:
[0023] The acquisition module is used to: acquire the address bar parameters of the first process of the service that needs to be debugged, and enter the first process according to the address bar parameters;
[0024] The loading module is configured to: when the address bar parameter contains a debugging identifier, store the time of entering the first process in a cache and dynamically load a debugging tool;
[0025] When the time of currently entering the process differs from the time stored in the cache by no more than a preset time difference, the time stored in the cache is updated using the time of currently entering the process, and the debugging tool is dynamically loaded;
[0026] The judgment module is used to: when entering the subsequent process of the business, if the address bar parameter of the current entry process does not contain a debugging identifier, then determine whether the time of the current entry process and the time stored in the cache is greater than a preset time difference; if so, clear the time stored in the cache.
[0027] In a third aspect, an embodiment of the present application provides a device for invoking a debugging tool, the device comprising a memory and a processor:
[0028] The memory is used to store relevant program codes;
[0029] The processor is used to call the program code to execute the method of invoking the debugging tool as described in any one of the implementations of the first aspect above.
[0030] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method of invoking a debugging tool as described in any one of the implementations of the first aspect above.
[0031] In the above implementation method of the embodiment of the present application, the address bar parameters of the first process of the business that needs to be debugged are first obtained, and the first process is entered according to the address bar parameters. When the address bar parameters contain a debugging identifier, the time of entering the first process is stored in the cache, and the debugging tool is dynamically loaded; when entering the subsequent process of the business, if the address bar parameters of the current entry process do not contain a debugging identifier, it is determined whether the difference between the time of the current entry process and the time stored in the cache exceeds the preset time difference. If not, the time stored in the cache is updated with the time of the current entry process, and the debugging tool is dynamically loaded; if so, the time stored in the cache is cleared. The method for invoking the debugging tool provided in the embodiment of the present application, by storing the current time in the cache as a cache identifier, can not only dynamically invoke the debugging tool in an online environment, but also realize continuous debugging in the entire process of the business within the preset time difference of the cache, thereby simplifying the debugging process. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments provided in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0033] Figure 1 This is a flow chart of a method for invoking a debugging tool in an embodiment of the present application;
[0034] Figure 2 This is a flow chart of a method for invoking the vConsole debugging tool in an embodiment of the present application;
[0035] Figure 3 This is a flow chart of the principle of invoking the vConsole debugging tool in an embodiment of the present application;
[0036] Figure 4 This is a flow chart of another method for invoking the vConsole debugging tool in an embodiment of the present application;
[0037] Figure 5 A schematic diagram of a device for invoking a debugging tool according to an embodiment of the present application;
[0038] Figure 6 This is a schematic diagram of a device for invoking a debugging tool in an embodiment of the present application. DETAILED DESCRIPTION
[0039] In existing methods for dynamically invoking debugging tools, developers add a callout identifier to the service's address bar parameters when debugging a business. When the project code created for that business is run, the presence of the callout identifier is detected, and vConsole is invoked for debugging. However, if, while debugging the entire business process, you jump from the current page to another page, the callout identifier in the original address bar parameter no longer exists. If you need to debug the entire business process, you need to manually splice the callout identifier into all possible page links, making the entire debugging process extremely cumbersome.
[0040] Based on this, the embodiment of the present application provides a method for invoking a debugging tool, which can not only dynamically invoke the debugging tool in an online environment, but also simplify the debugging process. In specific implementation, first obtain the address bar parameters of the first process of the business that needs to be debugged, and enter the first process according to the address bar parameters. When the address bar parameters contain a debugging identifier, the time of entering the first process is stored in the cache, and the debugging tool is dynamically loaded; when entering the subsequent process of the business, if the address bar parameters of the current entry process do not contain a debugging identifier, it is determined whether the difference between the time of currently entering the process and the time stored in the cache exceeds the preset time difference. If not, the time stored in the cache is updated with the time of currently entering the process, and the debugging tool is dynamically loaded; if so, the time stored in the cache is cleared. The method for invoking a debugging tool provided in the embodiment of the present application, by storing the current time in the cache as a cache identifier, can not only dynamically invoke the debugging tool in an online environment, but also realize continuous debugging in the entire process of the business within the preset time difference of the cache, thereby simplifying the debugging process.
[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. The described embodiments are only exemplary implementation methods of the present application and are not all implementation methods. Those skilled in the art can combine the embodiments of the present application to obtain other embodiments without creative work, and these embodiments are also within the scope of protection of the present application.
[0042] See also Figure 1 , this figure is a flow chart of a method for invoking a debugging tool provided in an embodiment of the present application.
[0043] In order to dynamically invoke the debugging tool in an online environment and ensure that the current debugging status is maintained in a complete business process, the embodiment of the present application stores the current time in the cache. When it is determined that the time difference for continuous debugging of business processes does not exceed the preset time difference, the business is ensured to remain in the debugging state for a period of time.
[0044] The method for invoking the debugging tool provided in this embodiment specifically includes the following steps:
[0045] S101: Acquire the address bar parameters of the first process of the service to be debugged, and enter the first process according to the address bar parameters;
[0046] The "first process" mentioned above is just a name identifier and does not represent the first in order. When debugging a certain business, you need to obtain the address bar parameters of the first process of the business and enter the process based on the address bar parameters.
[0047] S102: When the address bar parameter contains a debugging identifier, the time of entering the first process is stored in the cache, and the debugging tool is dynamically loaded;
[0048] When the project code of the business detects that the address bar parameter of the first process contains a debug flag, it indicates that the debugging tool can be dynamically invoked based on the debug flag. At this time, the time of entering the first process is stored in the cache, and the debugging tool is dynamically loaded to debug the first process.
[0049] S103: When entering the subsequent process of the business, if the address bar parameter of the current entry process does not contain a debugging identifier, it is determined whether the time of the current entry process and the time stored in the cache exceeds the preset time difference. If not, the time stored in the cache is updated with the time of the current entry process, and the debugging tool is dynamically loaded; if yes, the time stored in the cache is cleared.
[0050] After the debugging of the first process of the business is completed, it is still necessary to debug other processes of the business. When entering other subsequent processes of the business, check whether the address bar parameters of the current entered process still have a debugging mark. If there is no debugging mark, obtain the time of the current entry into the process, and determine whether the difference between the time of the current entry into the process and the time stored in the cache exceeds the preset time difference. If it does not exceed the preset time difference, you can load the debugging tool, debug the current entered process, and use the time of the current entry into the process to update the time stored in the cache. On the contrary, if it exceeds the preset time difference, the debugging tool cannot be loaded, and the time stored in the cache needs to be cleared.
[0051] It should be noted that the time of entering different business processes can be obtained in real time. In addition, the embodiment of the present application does not limit the setting method of the preset time difference. One possible implementation method is to set a preset time difference based on the time required for debugging the business process before, for example, ten minutes. That is, when the current time of entering the process differs from the time stored in the cache by no more than ten minutes, the debugging tool can be loaded and the time stored in the cache can be updated with the current time of entering the process. If the difference exceeds ten minutes, the time stored in the cache needs to be cleared.
[0052] In actual applications, some services contain processes that follow a specific sequence, meaning that the service must be used according to a predetermined process. Existing technologies, by adding a call-up identifier to the address bar parameters of the service process, directly enter the debugging process of the service process. This does not allow for full process debugging of the entire service, resulting in incomplete debugging. The method for calling up the debugging tool provided in this embodiment utilizes a cache to store the time of entering the process. When debugging the first process of the service is complete, debugging can continue according to the established process within the preset time difference in the cache. The debugging tool can still be loaded when entering other processes of the service, enabling continuous debugging of the entire service process.
[0053] When debugging a business process, if it is the first time to debug the business, you need to obtain the address bar parameters of the business process to enter the process. Developers can directly enter the address bar parameters in the address bar to enter the corresponding process for debugging, but the address bar parameters are not easy to remember. Therefore, a preferred implementation method can generate corresponding QR codes for the address bar parameters in advance, which is convenient for developers to store. When you need to debug the business process, use the business app to scan the QR code to obtain the address bar parameters of the corresponding process and enter the process based on the address bar parameters.
[0054] In the embodiment of the present application, the debugging tool is a debugging tool for mobile web pages, but the implementation form of the debugging tool is not limited. In this embodiment, the vConsole debugging tool is used as an example for explanation.
[0055] In addition, the method provided in this embodiment requires the use of mobile phone cache to store the time of entering the business process. This embodiment does not limit the cache method, for example, localStorage cache or Cookie cache can be used. In this embodiment, localStorage cache is used as an example for explanation.
[0056] LocalStorage is used to store website data permanently. As long as localStorage is used to store data, the data will be stored on the user's client. Even if the user closes the browser and restarts it, the data will still exist until the user manually deletes it.
[0057] The following will be combined Figure 2 This section describes how to invoke the vConsole debugging tool.
[0058] See also Figure 2 , which is a flow chart of a method for invoking the vConsole debugging tool provided in an embodiment of the present application. The method specifically includes the following steps:
[0059] S201: Obtaining address bar parameters of a first process of a service requiring debugging, and entering the first process according to the address bar parameters;
[0060] Similarly, the "first process" mentioned above is just a name identifier and does not mean the first in order.
[0061] S202: When the address bar parameter contains a debugging flag, the time of entering the first process is stored in the localStorage cache, and the vConsole debugging tool is dynamically loaded;
[0062] It should be noted that this embodiment does not impose any formal limitation on the debugging flag, and the debugging flag can be a parameter customized by the developer according to actual needs.
[0063] When the business project code detects a debug flag in the address bar parameter of the first process, it indicates that the vConsole debugging tool can be dynamically invoked based on the debug flag. At this time, the time of entering the first process is stored in the localStorage cache, and the vConsole debugging tool is loaded to debug the first process.
[0064] S203: When entering a subsequent process of the business, if the address bar parameter of the current entry process does not contain a debugging identifier, it is determined whether the time of the current entry process and the time stored in the localStorage cache differ by more than a preset time difference. If not, the time stored in the localStorage cache is updated with the time of the current entry process, and the vConsole debugging tool is dynamically loaded; if yes, the time stored in the localStorage cache is cleared.
[0065] The following will be combined Figure 3 This section describes the principles of debugging the entire business process.
[0066] See also Figure 3 , which is a flow chart of the principle of invoking the vConsole debugging tool provided by the embodiment of the present application. The principle of debugging this business process for the first time corresponds to Figure 3 The process marked by the solid line includes steps S3011, S3012, S3013 and S3014. The principle of debugging the subsequent process corresponds to Figure 3 The process indicated by the dotted line includes steps S3021, S3022, S3013 and S3014.
[0067] When debugging the business process for the first time, when the debug flag is detected in the address bar parameter, the current time is stored in the localStorage cache, and the vConsole debugging tool is dynamically loaded based on the debug flag in the address bar parameter. After the business process is debugged for the first time, you can directly enter other business processes and determine whether the difference between the current entry time and the time stored in the localStorage cache exceeds the preset time difference. If not, the time stored in the localStorage cache is updated to the current time, and the vConsole debugging tool is dynamically loaded. If it exceeds the preset time difference, the time stored in the cache is cleared. By adding the judgment logic of the preset time difference in the cache, continuous debugging of business processes is achieved, simplifying the debugging process.
[0068] The following describes the method for invoking the debugging tool provided in this embodiment, using a specific application scenario. In this embodiment, the business scenario is set to a shopping app, which includes the following processes: selecting a product, entering the product details page, adding the product to the shopping cart, and paying for the product, which are marked as the first process, the second process, the third process, and the fourth process, respectively.
[0069] It should be noted that the terms “first”, “second”, “third” and “fourth” described are only used as name identifiers and do not represent the first, second, etc. in order.
[0070] When the entire process of the shopping app needs to be debugged, the address bar parameters of a process with a debug flag need to be obtained first. In this embodiment, the address bar parameters of the first process are set to have a debug flag. Taking the address bar parameters of the first process as an example, the address bar parameters of the first process are first obtained, and the corresponding QR code is generated in advance from the address bar parameters of the first process.
[0071] It should be noted that the embodiment of the present application does not limit the setting method of the preset time difference. One possible implementation method is to set the preset time difference to ten minutes in this application scenario. Figure 4 This section describes the principles of invoking the vConsole debugging tool.
[0072] See also Figure 4 , this figure is a flow chart of another method for invoking the vConsole debugging tool provided in an embodiment of the present application.
[0073] The method provided in this embodiment specifically includes the following steps:
[0074] S401: Scan the QR code using the business APP to obtain the address bar parameters of the first process, and enter the first process according to the address bar parameters;
[0075] Since the corresponding QR code is generated in advance for the address bar parameters of the first process, it is convenient for developers to obtain the address bar parameters. When debugging the corresponding process, the address bar parameters of the process can be obtained by scanning the code using the business APP.
[0076] S402: When the address bar parameter contains a debugging flag, the time of entering the first process is stored in the localStorage cache, and the vConsole debugging tool is dynamically loaded;
[0077] When it is detected that the address bar parameter of the first process contains a debugging identifier, the time of entering the first process is stored in the localStorage cache, and the vConsole debugging tool is dynamically loaded according to the debugging identifier.
[0078] S403: When entering the subsequent process of the business, if the address bar parameter of the current entry process does not contain a debugging identifier, it is determined whether the time of the current entry process and the time stored in the localStorage cache differ by more than ten minutes. If not, the time stored in the localStorage cache is updated with the time of the current entry process, and the vConsole debugging tool is dynamically loaded; if so, the time stored in the localStorage cache is cleared.
[0079] After debugging the first process, you can directly enter the subsequent process of the service without scanning the code. For example, if you enter the second process of the service, it is detected that the address bar parameters of the second process do not contain a debugging logo. Since the mobile phone can obtain the current time at any time, it is determined whether the difference between the time of entering the current process and the time stored in the localStorage cache is more than ten minutes. If it is not more than ten minutes, the time stored in the localStorage cache is updated with the time of entering the second process, and the vConsole debugging tool is dynamically loaded. If it is more than ten minutes, the time stored in the localStorage cache is cleared.
[0080] By judging the address bar parameters, cache and preset time difference, the vConsole debugging tool can be dynamically invoked, and developers can continue debugging for a period of time in online business processes, simplifying the entire debugging process.
[0081] Based on the method for invoking a debugging tool provided in the above embodiment, an embodiment of the present application further provides a device for invoking a debugging tool, which includes an acquisition module, a loading module, and a judgment module.
[0082] See also Figure 5 , which is a schematic diagram of a device for invoking a debugging tool provided in an embodiment of the present application.
[0083] The device 500 includes: an acquisition module 501, a loading module 502 and a judgment module 503, wherein:
[0084] The acquisition module 501 is used to: acquire the address bar parameters of the first process of the service to be debugged, and enter the first process according to the address bar parameters;
[0085] The loading module 502 is used to: when the address bar parameter contains a debugging flag, store the time of entering the first process in the cache and dynamically load the debugging tool;
[0086] When the time of entering the current process does not differ from the time stored in the cache by more than the preset time difference, the time stored in the cache is updated with the time of entering the current process, and the debugging tool is dynamically loaded;
[0087] The judgment module 503 is used to: when entering the subsequent process of the business, if the address bar parameter of the current entry process does not contain a debugging identifier, then determine whether the time of the current entry process and the time stored in the cache exceeds a preset time difference. If so, clear the time stored in the cache.
[0088] In the apparatus 500 provided in this embodiment, the acquisition module 501 is used to acquire the address bar parameters of the first process of the debugging service, and then enter the first process according to the address bar parameters.
[0089] When a debug flag is detected in the address bar parameter, the loading module 502 stores the time of entering the process in a cache and dynamically loads the debugging tool. When entering a subsequent process of the service, if the difference between the current time of entering the subsequent process and the time stored in the cache does not exceed a preset time difference, the time stored in the cache is updated with the current time of entering the process, and the debugging tool is dynamically loaded. Whether the difference between the current time of entering the subsequent process and the time stored in the cache exceeds the preset time difference is determined by the judgment module 503.
[0090] By storing the current time in the cache, you can dynamically invoke the debugging tool in the online environment and continuously debug the entire business process within the preset time difference of the cache, simplifying the debugging process.
[0091] The present application also provides a device for invoking a debugging tool. Figure 6 , which is a schematic diagram of a device for invoking a debugging tool provided in an embodiment of the present application.
[0092] The device 600 includes a memory 601 and a processor 602, wherein:
[0093] The memory 601 is used to store relevant program codes;
[0094] The processor 602 is configured to call program code to execute the method of invoking the debugging tool in the above method embodiment.
[0095] In addition, an embodiment of the present application further provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to execute the method of invoking a debugging tool in the above method embodiment.
[0096] Each embodiment in this specification is described in a progressive manner. Similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely illustrative, wherein the units or modules described as separate components may or may not be physically separated, and the components displayed as units or modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units or modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without making any creative efforts.
[0097] The above description is merely an exemplary embodiment of the present application and does not limit the present application in any form. Any equivalent changes or modifications made to the above embodiments fall within the scope of protection of the present application.
Claims
1. A method for invoking a debugging tool, characterized in that: The method comprises: Obtaining address bar parameters of a first process of a service requiring debugging, and entering the first process according to the address bar parameters; When the address bar parameter contains a debugging identifier, the time of entering the first process is stored in the cache and the debugging tool is dynamically loaded; When entering the subsequent process of the business, if the address bar parameter of the current entry process does not contain a debugging identifier, it is determined whether the time of the current entry process and the time stored in the cache exceeds a preset time difference. If not, the time stored in the cache is updated with the time of the current entry process, and the debugging tool is dynamically loaded; if yes, the time stored in the cache is cleared.
2. The method according to claim 1, characterized in that The method further comprises: Generate a QR code for the address bar parameters of the business process in advance, and use the business APP to scan the code to obtain the address bar parameters.
3. The method according to claim 1, characterized in that The method further comprises: Set a preset time difference based on the historical debugging time of the business process.
4. The method according to claim 1, wherein The debugging identifier is a preset custom parameter.
5. The method according to claim 1, wherein The cache includes: localStorage cache or Cookie cache.
6. The method according to claim 1, wherein The debugging tools include: vConsole debugging tool.
7. A device for invoking a debugging tool, characterized in that: The device includes an acquisition module, a loading module and a judgment module: The acquisition module is used to: acquire the address bar parameters of the first process of the service that needs to be debugged, and enter the first process according to the address bar parameters; The loading module is configured to: when the address bar parameter contains a debugging identifier, store the time of entering the first process in a cache and dynamically load a debugging tool; When the time of currently entering the process differs from the time stored in the cache by no more than a preset time difference, the time stored in the cache is updated using the time of currently entering the process, and the debugging tool is dynamically loaded; The judgment module is used to: when entering the subsequent process of the business, if the address bar parameter of the current entry process does not contain a debugging identifier, then determine whether the time of the current entry process and the time stored in the cache is greater than a preset time difference; if so, clear the time stored in the cache.
8. A device for invoking a debugging tool, characterized in that: The device includes a memory and a processor: The memory is used to store relevant program codes; The processor is configured to call the program code and execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for debugging performance test scripts
CN101727390A