A dynamic data debugging method, device and equipment
Through dynamic data debugging methods, the text/json data sent by the server is directly modified on the client, solving the problems of cumbersome steps and inability to debug on the mobile terminal in the existing technology, and achieving efficient and accurate data debugging.
Patent Information
- Application Number
- CN202110578299.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-26
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2041-05-26
AI Technical Summary
The existing client debugging solution cannot directly modify the text/json data sent by the server on the client, and requires the help of packet capture tools. The steps are cumbersome, the error rate is high, and it cannot be implemented on the mobile terminal.
Provide a dynamic data debugging method, by obtaining the data source from the server, analyzing the data source object to be debugged, outputting the corresponding interface in response to user instructions, obtaining modification information, modifying the data source object, cache debugging data, and replacing the corresponding data in the data source.
It directly modifyes the data source objects issued by the server on the client side, reduces the steps of manual operation by developers, reduces the error rate, improves debugging efficiency, and supports debugging on mobile terminals and PCs.
Smart Images

Figure CN113190462B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a dynamic data debugging method, device and equipment. Background Art
[0002] When the client is running normally, it receives the text / json data sent by the server and completes functions such as data display based on the data. When developing and debugging the client, developers often need to modify the specific value of a certain text / json data sent by the server to detect whether the client will have anomalies under text / json data with different values, and debug the above client functions.
[0003] The solution to achieve the above client debugging in the related technology is: add a packet capture tool that implements the intermediate proxy function between the client and the server, obtain and modify the relevant data sent by the above server through the above packet capture tool, and send the modified relevant data to the client, so that the client can use the modified relevant data for functional debugging. However, because the above packet capture tool only has a data display function, developers cannot modify the data directly on the packet capture tool. Therefore, developers need to manually copy the relevant data obtained by the above packet capture tool to the local computer, and then modify the data, and manually configure the mapping information to match and replace the locally modified relevant data with the original data in the above packet capture tool, and then the above packet capture tool sends the modified relevant data to the client.
[0004] The above existing client debugging solutions cannot modify the text / json data sent by the server directly on the client, and must be implemented through packet capture tools; and developers are required to manually copy data and manually configure mapping information to replace the modified data. The steps are cumbersome, which will increase the configuration error rate and reduce R&D efficiency; the text / json data sent by the server can only be modified through the PC, which cannot be implemented on mobile terminals, and the application scenarios are relatively limited. Summary of the invention
[0005] The embodiments of the present invention provide a dynamic data debugging method, device and equipment to solve the problems of the existing client debugging solution, which cannot directly modify the data source object sent by the server on the client, requires manual operation by the developer, has a high error rate, cannot be modified on the mobile terminal, and has a relatively limited application scenario.
[0006] In a first aspect, an embodiment of the present invention provides a dynamic data debugging method, which is applied to a client device, and the method includes:
[0007] Obtain a data source from a server, and parse the data source to obtain a data source object to be debugged;
[0008] In response to the instruction for displaying the data to be debugged, outputting a first interface for displaying the data source object;
[0009] In response to the data debugging instruction, determining a first data source object to be selected for modification, and outputting a second interface showing the modification of the first data source object;
[0010] Acquire modification information of the first data source object through the second interface, modify the first data source object according to the modification information to obtain debugging data, and cache the debugging data;
[0011] The debugging data is used to replace the corresponding first data source object in the data source, and the current data source is loaded to update the application program interface.
[0012] In a possible implementation manner, after parsing the data source to obtain the data source object to be debugged, the method further includes:
[0013] Determine that the data source object includes a second data source object, where the second data source object is a data source object having corresponding debugging data cached locally;
[0014] The second data source object is replaced with debug data corresponding to the second data source.
[0015] The dynamic data debugging method provided by the embodiment of the present invention uses corresponding debugging data to replace the data source object that has the corresponding debugging data cached locally, provides a specific way to replace the parsed data source object with the debugging data cached locally, and improves the reliability and rationality of the above-mentioned dynamic data debugging method.
[0016] In a possible implementation, in response to the instruction for displaying data to be debugged, outputting a first interface for displaying the data source object includes:
[0017] Outputting and displaying a trigger icon on the current application interface, and outputting and displaying a first interface of the data source object according to a display instruction to be debugged generated by a user clicking the trigger icon; or
[0018] According to the to-be-debugged data display instruction generated by the user's hardware operation, a first interface of the data source object is output and displayed.
[0019] The dynamic data debugging method provided by the embodiment of the present invention generates a data display instruction to be debugged by the user clicking a trigger icon or operating the hardware, provides two different specific triggering methods for the data display instruction to be debugged, expands the implementation path for triggering the above-mentioned data display instruction to be debugged, and improves the feasibility of the above-mentioned dynamic data debugging method.
[0020] In a possible implementation manner, in response to the data debugging instruction, before determining to select the first data source object to be modified, the method further includes:
[0021] When the query information input by the user on the first interface is monitored, a data source object matching the query information is obtained, and output and displayed through a third interface;
[0022] The data debugging instruction is generated according to the user's selection operation on the data source object on the third interface.
[0023] The dynamic data debugging method provided by the embodiment of the present invention matches the data source objects by monitoring the query information input by the user, and outputs and displays the matched data source objects through the third interface, and generates data debugging instructions through the user's selection operation, provides a specific triggering method for data debugging instructions, and an interaction scenario of the first interface and the third interface, thereby improving the feasibility and reliability of the above-mentioned dynamic data debugging method.
[0024] In a possible implementation, obtaining a data source object matching the query information and outputting and displaying it through a third interface includes:
[0025] Matching the query information with the data source object to be debugged, and searching for a data source object whose object identifier is consistent with the query information;
[0026] When a data source object consistent with the query information is found, the found data source object is output and displayed through a third interface;
[0027] Otherwise, the query information is used as a keyword to search for data source objects whose object identifiers include part of the keyword, and the found data source objects are output and displayed through the third interface.
[0028] The dynamic data debugging method provided by the embodiment of the present invention obtains the data source object matching the query information by searching for the data source object whose object identifier is consistent with the query information, or the data source object whose object identifier includes part of the query information, and provides a specific query method for querying the data source object. By combining the two query methods of precise query and fuzzy query, the data source object can be queried quickly and accurately, thereby improving the practicality of the data source object query and improving the feasibility and reliability of the above-mentioned dynamic data debugging method.
[0029] In a possible implementation, parsing the data source to obtain a data source object to be debugged includes:
[0030] Parsing the data source to determine the value object in the data source;
[0031] Parse the attribute information of the value object, and use the fields information of the value object obtained by parsing as the data source object to be debugged;
[0032] Modifying the first data source object according to the modification information to obtain debugging data includes:
[0033] The fields information corresponding to the first data source object is modified according to the modification information, and the modified fields information is assigned to the corresponding value object through instantiation to obtain debugging data.
[0034] The dynamic data debugging method provided by the embodiment of the present invention uses the field fields information of the value object in the data source as the data source object to be debugged, and assigns the fields information modified according to the modification information to the corresponding value object to obtain debugging data, and provides a specific data source object parsing method and a data source object modification method, thereby improving the feasibility and reliability of the above-mentioned dynamic data debugging method.
[0035] In a possible implementation manner, after obtaining the data source from the server and before parsing the data source, the method further includes:
[0036] Cache the fields information corresponding to the value object in the data source as the original data source in the first local list;
[0037] The debugging data is cached, including:
[0038] Cache the fields information corresponding to the value object in the debugging data in the second list;
[0039] Replacing the corresponding first data source object in the data source with the debugging data and loading the current data source includes:
[0040] When it is determined that the same value object in the data source has corresponding field information in both the first list and the second list, the value object corresponding to the field information in the second list is loaded.
[0041] The dynamic data debugging method provided by the embodiment of the present invention caches the fields information corresponding to the value objects in the original data source and the debugging data in the first list and the second list respectively, distinguishes the above data, prevents the loss of the original data source, and avoids developers from confusing the above data; and when the same value object has corresponding field information in both the first list and the second list, the field information in the second list is loaded first, thereby realizing the replacement of the first data source object with the debugging data, and improving the feasibility and reliability of the above dynamic data debugging method.
[0042] In a possible implementation manner, replacing the corresponding first data source object in the data source with the debugging data includes:
[0043] When it is determined that the debugging data is effective, replacing the corresponding first data source object in the data source with the debugging data;
[0044] Wherein, when the debugging data is an uninitialized non-global variable, the debugging data takes effect in real time;
[0045] When the debugging data is a global variable / initialized variable, the debugging data takes effect after the application is restarted.
[0046] The dynamic data debugging method provided in the embodiment of the present invention defines the effectiveness conditions for different types of debugging data. For uninitialized non-global variables, it takes effect in real time, and data debugging can be performed dynamically. For global variables / initialized variables, it takes effect after the application is restarted, which reduces the probability of application failure during data debugging and improves the feasibility and reliability of the above-mentioned dynamic data debugging method.
[0047] In a possible implementation manner, after the current data source is loaded and the application program interface is updated, the method further includes:
[0048] When it is determined that there is effective debugging data in the local cache, obtaining the effective debugging data;
[0049] After the effective debugging data is converted into a string format that is not lost when power is off, a prompt message that the debugging data in the string format has taken effect is output through a user prompt control.
[0050] The dynamic data debugging method provided by the embodiment of the present invention saves the debugging data in the string format, permanently saves the effective debugging data locally, and outputs prompt information to remind developers that the debugging data in the string format has taken effect, thereby avoiding understanding the debugging effect of the debugging data as a configuration exception, reducing unnecessary processing work, and improving the efficiency of data debugging.
[0051] In a possible implementation, the method further includes:
[0052] According to the configuration data of the persistence option, when it is determined that the persistent storage function is currently enabled, the currently cached debugging data is converted into a string format that is not lost when power is off and then stored;
[0053] When it is determined that the persistent storage function is currently in a disabled state according to the configuration data of the persistence option, the debugging data in the string format stored locally is cleared.
[0054] The dynamic data debugging method provided by the embodiment of the present invention enables the persistent storage function through the configuration data of the persistence option to persistently store the debugging data; or disables the persistent storage function to clear the stored debugging data, so that the application is restored to the initial state before debugging, and flexibly stores and clears the debugging data, thereby improving the feasibility and reliability of the above-mentioned dynamic data debugging method.
[0055] In a possible implementation, the cached debugging data is fields information of a value object, the fields information includes a field identifier and a field content, and the currently cached debugging data is converted into a string format that is not lost upon power failure and then stored, further comprising:
[0056] Convert the field content in the fields information of the currently cached value object into a string that will not be lost when the power is off, and establish a mapping relationship between the string and the field identifier;
[0057] In response to the application restart instruction, when it is determined that the application has completed restarting, the string is converted into field fields information of the corresponding value object according to the mapping relationship.
[0058] The dynamic data debugging method provided by the embodiment of the present invention establishes a mapping relationship between a string and a field identifier, and converts the string into the field fields information of the corresponding value object when the application is restarted, thereby improving the efficiency of data debugging and improving the feasibility and reliability of the above-mentioned dynamic data debugging method.
[0059] In a possible implementation manner, after acquiring the modification information of the first data source object through the second interface, the method further includes:
[0060] When it is determined that the data type of the modification information is a string, Gson is used to verify whether the string is in JSON format;
[0061] When it is determined that the string is in JSON format, the verification passes, otherwise an error prompt message is displayed.
[0062] The dynamic data debugging method provided by the embodiment of the present invention uses Gson to verify whether the string is in JSON format, performs format verification on the modification information input by the user, and displays an error prompt message when the verification fails, thereby reducing the impact of human errors on data debugging, improving the accuracy of data debugging, and improving the feasibility and reliability of the above-mentioned dynamic data debugging method.
[0063] In a second aspect, an embodiment of the present invention provides a dynamic data debugging device, including:
[0064] A data acquisition unit, used to acquire a data source from a server, and parse the data source to obtain a data source object to be debugged;
[0065] A first display unit, configured to output and display a first interface of the data source object in response to a display instruction for data to be debugged;
[0066] A second display unit, configured to determine, in response to the data debugging instruction, a first data source object selected for modification, and output a second interface for displaying the modification of the first data source object;
[0067] a data debugging unit, configured to obtain modification information of the first data source object through the second interface, modify the first data source object according to the modification information to obtain debugging data, and cache the debugging data;
[0068] The data loading unit is used to replace the corresponding first data source object in the data source with the debugging data, and load the current data source to update the application program interface.
[0069] In a possible implementation manner, after parsing the data source to obtain the data source object to be debugged, the data loading unit is further used to:
[0070] Determine that the data source object includes a second data source object, where the second data source object is a data source object having corresponding debugging data cached locally;
[0071] The second data source object is replaced with debug data corresponding to the second data source.
[0072] In a possible implementation manner, the first display unit outputs a first interface for displaying the data source object in response to the instruction for displaying the data to be debugged, including:
[0073] Outputting and displaying a trigger icon on the current application interface, and outputting and displaying a first interface of the data source object according to a display instruction to be debugged generated by a user clicking the trigger icon; or
[0074] According to the to-be-debugged data display instruction generated by the user's hardware operation, a first interface of the data source object is output and displayed.
[0075] In a possible implementation manner, in response to the data debugging instruction, before determining to select the modified first data source object, the second display unit is further configured to:
[0076] When the query information input by the user on the first interface is monitored, a data source object matching the query information is obtained, and output and displayed through a third interface;
[0077] The data debugging instruction is generated according to the user's selection operation on the data source object on the third interface.
[0078] In a possible implementation manner, the second display unit acquires the data source object matching the query information and outputs and displays it through the third interface, including:
[0079] Matching the query information with the data source object to be debugged, and searching for a data source object whose object identifier is consistent with the query information;
[0080] When a data source object consistent with the query information is found, the found data source object is output and displayed through a third interface;
[0081] Otherwise, the query information is used as a keyword to search for data source objects whose object identifiers include part of the keyword, and the found data source objects are output and displayed through the third interface.
[0082] In a possible implementation, the data acquisition unit parses the data source to obtain the data source object to be debugged, including:
[0083] Parsing the data source to determine the value object in the data source;
[0084] Parse the attribute information of the value object, and use the fields information of the value object obtained by parsing as the data source object to be debugged;
[0085] The data debugging unit modifies the first data source object according to the modification information to obtain debugging data, including:
[0086] The fields information corresponding to the first data source object is modified according to the modification information, and the modified fields information is assigned to the corresponding value object through instantiation to obtain debugging data.
[0087] In a possible implementation, after acquiring the data source from the server and before parsing the data source, the data acquisition unit is further configured to:
[0088] Cache the fields information corresponding to the value object in the data source as the original data source in the first local list;
[0089] The data debugging unit caches the debugging data, including:
[0090] Cache the fields information corresponding to the value object in the debugging data in the second list;
[0091] The data loading unit replaces the corresponding first data source object in the data source with the debugging data and loads the current data source, including:
[0092] When it is determined that the same value object in the data source has corresponding field information in both the first list and the second list, the value object corresponding to the field information in the second list is loaded.
[0093] In a possible implementation manner, the data loading unit replaces the corresponding first data source object in the data source with the debugging data, including:
[0094] When it is determined that the debugging data is effective, replacing the corresponding first data source object in the data source with the debugging data;
[0095] Wherein, when the debugging data is an uninitialized non-global variable, the debugging data takes effect in real time;
[0096] When the debugging data is a global variable / initialized variable, the debugging data takes effect after the application is restarted.
[0097] In a possible implementation manner, after loading the current data source to update the application program interface, the data loading unit is further configured to:
[0098] When it is determined that there is effective debugging data in the local cache, obtaining the effective debugging data;
[0099] After the effective debugging data is converted into a string format that is not lost when power is off, a prompt message that the debugging data in the string format has taken effect is output through a user prompt control.
[0100] In a possible implementation, it further includes:
[0101] The persistence unit is used to convert the currently cached debugging data into a string format that will not be lost upon power failure and then store it when it is determined according to the configuration data of the persistence option that the persistent storage function is currently in the on state; and to clear the locally stored string format debugging data when it is determined according to the configuration data of the persistence option that the persistent storage function is currently in the off state.
[0102] In a possible implementation, the cached debugging data is fields information of a value object, the fields information includes a field identifier and a field content, and the currently cached debugging data is converted into a string format that is not lost upon power failure and then stored. The persistence unit is further used for:
[0103] Convert the field content in the fields information of the currently cached value object into a string that will not be lost when the power is off, and establish a mapping relationship between the string and the field identifier;
[0104] In response to the application restart instruction, when it is determined that the application has completed restarting, the string is converted into field fields information of the corresponding value object according to the mapping relationship.
[0105] In a possible implementation manner, after acquiring the modification information of the first data source object through the second interface, the data debugging unit is further configured to:
[0106] When it is determined that the data type of the modification information is a string, Gson is used to verify whether the string is in JSON format;
[0107] When it is determined that the string is in JSON format, the verification passes, otherwise an error prompt message is displayed.
[0108] In a third aspect, an embodiment of the present invention provides a dynamic data debugging device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes:
[0109] Obtain a data source from a server, and parse the data source to obtain a data source object to be debugged;
[0110] In response to the instruction for displaying the data to be debugged, outputting a first interface for displaying the data source object;
[0111] In response to the data debugging instruction, determining a first data source object to be selected for modification, and outputting a second interface showing the modification of the first data source object;
[0112] Acquire modification information of the first data source object through the second interface, modify the first data source object according to the modification information to obtain debugging data, and cache the debugging data;
[0113] The debugging data is used to replace the corresponding first data source object in the data source, and the current data source is loaded to update the application program interface.
[0114] In a possible implementation manner, after parsing the data source to obtain the data source object to be debugged, the processor is further configured to:
[0115] Determine that the data source object includes a second data source object, where the second data source object is a data source object having corresponding debugging data cached locally;
[0116] The second data source object is replaced with debug data corresponding to the second data source.
[0117] In a possible implementation, the processor outputs a first interface displaying the data source object in response to the instruction for displaying data to be debugged, including:
[0118] Outputting and displaying a trigger icon on the current application interface, and outputting and displaying a first interface of the data source object according to a display instruction to be debugged generated by a user clicking the trigger icon; or
[0119] According to the to-be-debugged data display instruction generated by the user's hardware operation, a first interface of the data source object is output and displayed.
[0120] In a possible implementation, in response to the data debugging instruction, before determining to select the first data source object to be modified, the processor is further configured to:
[0121] When the query information input by the user on the first interface is monitored, a data source object matching the query information is obtained, and output and displayed through a third interface;
[0122] The data debugging instruction is generated according to the user's selection operation on the data source object on the third interface.
[0123] In a possible implementation, the processor obtains a data source object matching the query information and outputs and displays it through a third interface, including:
[0124] Matching the query information with the data source object to be debugged, and searching for a data source object whose object identifier is consistent with the query information;
[0125] When a data source object consistent with the query information is found, the found data source object is output and displayed through a third interface;
[0126] Otherwise, the query information is used as a keyword to search for data source objects whose object identifiers include part of the keyword, and the found data source objects are output and displayed through the third interface.
[0127] In a possible implementation manner, the processor parses the data source to obtain a data source object to be debugged, including:
[0128] Parsing the data source to determine the value object in the data source;
[0129] Parse the attribute information of the value object, and use the fields information of the value object obtained by parsing as the data source object to be debugged;
[0130] The processor modifies the first data source object according to the modification information to obtain debugging data, including:
[0131] The fields information corresponding to the first data source object is modified according to the modification information, and the modified fields information is assigned to the corresponding value object through instantiation to obtain debugging data.
[0132] In a possible implementation, after acquiring the data source from the server and before parsing the data source, the processor is further configured to:
[0133] Cache the fields information corresponding to the value object in the data source as the original data source in the first local list;
[0134] The processor caches the debugging data, including:
[0135] Cache the fields information corresponding to the value object in the debugging data in the second list;
[0136] The processor replaces the corresponding first data source object in the data source with the debugging data and loads the current data source, including:
[0137] When it is determined that the same value object in the data source has corresponding field information in both the first list and the second list, the value object corresponding to the field information in the second list is loaded.
[0138] In a possible implementation, the processor replacing the corresponding first data source object in the data source with the debugging data includes:
[0139] When it is determined that the debugging data is effective, replacing the corresponding first data source object in the data source with the debugging data;
[0140] Wherein, when the debugging data is an uninitialized non-global variable, the debugging data takes effect in real time;
[0141] When the debugging data is a global variable / initialized variable, the debugging data takes effect after the application is restarted.
[0142] In a possible implementation manner, after loading the current data source to update the application program interface, the processor is further configured to:
[0143] When it is determined that there is effective debugging data in the local cache, obtaining the effective debugging data;
[0144] After the effective debugging data is converted into a string format that is not lost when power is off, a prompt message that the debugging data in the string format has taken effect is output through a user prompt control.
[0145] In a possible implementation, the processor is further configured to:
[0146] According to the configuration data of the persistence option, when it is determined that the persistent storage function is currently on, the currently cached debug data is converted into a string format that will not be lost when power is off and then stored; according to the configuration data of the persistence option, when it is determined that the persistent storage function is currently off, the locally stored debug data in string format is cleared.
[0147] In a possible implementation, the cached debugging data is fields information of a value object, the fields information includes a field identifier and a field content, and the currently cached debugging data is converted into a string format that is not lost upon power failure and then stored, and the processor is further configured to:
[0148] Convert the field content in the fields information of the currently cached value object into a string that will not be lost when the power is off, and establish a mapping relationship between the string and the field identifier;
[0149] In response to the application restart instruction, when it is determined that the application has completed restarting, the string is converted into field fields information of the corresponding value object according to the mapping relationship.
[0150] In a possible implementation manner, after acquiring the modification information of the first data source object through the second interface, the processor is further configured to:
[0151] When it is determined that the data type of the modification information is a string, Gson is used to verify whether the string is in JSON format;
[0152] When it is determined that the string is in JSON format, the verification passes, otherwise an error prompt message is displayed.
[0153] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the steps of the dynamic data debugging method provided in the first aspect above.
[0154] The dynamic data debugging method provided by the embodiment of the present invention modifies the debugging data through the modification information input through the second interface, and uses the debugging data to replace the corresponding first data source object in the data source, and uses the replaced data source to update the application program interface. The data source object sent by the server can be modified directly on the client device; and less manual operation is required from the developer, which reduces the error rate, saves labor costs, and improves the efficiency of data debugging; modifications can be made on the mobile terminal or PC, which increases the application scenarios for data debugging. BRIEF DESCRIPTION OF THE DRAWINGS
[0155] Figure 1 A schematic diagram of an application scenario of a dynamic data debugging method provided by an embodiment of the present invention;
[0156] Figure 2 A flow chart of a dynamic data debugging method provided by an embodiment of the present invention;
[0157] Figure 3 A schematic diagram of a trigger icon provided by an embodiment of the present invention;
[0158] Figure 4 A schematic diagram of a first interface provided by an embodiment of the present invention;
[0159] Figure 5 A schematic diagram of a second interface provided by an embodiment of the present invention;
[0160] Figure 6 A schematic diagram of a third interface provided by an embodiment of the present invention;
[0161] Figure 7 A schematic diagram of a first list and a second list provided in an embodiment of the present invention;
[0162] Figure 8 A flowchart of updating an application program interface provided by an embodiment of the present invention;
[0163] Fig. 9 A schematic diagram of outputting prompt information through a user prompt control provided by an embodiment of the present invention;
[0164] Fig.10 A flowchart for implementing a persistent storage function provided by an embodiment of the present invention;
[0165] Fig.11 A schematic diagram of a dynamic data debugging device provided by an embodiment of the present invention;
[0166] Fig.12 A schematic diagram of a dynamic data debugging device provided by an embodiment of the present invention;
[0167] Fig.13 A schematic diagram of a dynamic data debugging program product provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0168] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0169] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0170] According to an embodiment of the present invention, a dynamic data debugging method, device and equipment are proposed.
[0171] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.
[0172] For ease of understanding, the terms involved in the embodiments of the present application are explained below:
[0173] JSON format: It is a string format that uses specific symbols to mark elements. Compared with the data structure of Extensible Markup Language (XML), the JSON format is smaller but has good descriptive capabilities. It can reduce more traffic and speed up data transmission over the network.
[0174] Java reflection mechanism: When the program is running, you can construct objects of any class, understand the class to which any object belongs, understand the member variables and methods of any class, and call the properties and methods of any object. This function of dynamically obtaining program information and dynamically calling objects is called the reflection mechanism of the Java language.
[0175] Toast prompt: The Toast prompt in the Android platform is a simple message prompt box that prompts users with information, but it cannot be clicked. In addition, the display time of Toast is limited and it will disappear automatically after the set display time.
[0176] Edit Text component: It is a window for users to transfer data with applications. For example, to implement a login interface, users are required to enter their account and password. The content entered by the user is then obtained and submitted to the background server for judgment and corresponding processing.
[0177] Instantiation: In object-oriented programming, the process of creating objects using classes is called instantiation, which is the process of converting an abstract concept class into a physical object of that class.
[0178] Gson: is a Java-based open source library for serializing Java objects into JSON and vice versa.
[0179] Debug configuration: After turning on the DEBUG mode, if an exception occurs in the code, the specific error information and the specific error code location can be seen on the browser page, which is convenient for developers to debug data.
[0180] Collection key information: the value is the stored data, and the key is the value number, for example: Map map = new HashMap(); map.put("name", "qianke158"), where the key is name and the value is qianke158.
[0181] Shared Preferences: It is a lightweight storage class on the Android platform that is used to save common configurations of applications. It provides a storage interface for Java's regular Long, Int, String and other data types.
[0182] The principle and spirit of the present invention are explained in detail below with reference to several representative embodiments of the present invention. SUMMARY OF THE INVENTION
[0184] The inventors have found that when developers are developing and debugging a client, they often need to modify the specific value of a certain text / json data sent by the server to detect whether the client will have an exception under text / json data with different values, so as to debug the above client functions.
[0185] The solution to achieve the above-mentioned client debugging in the related technology is: between the client device and the server, add a packet capture tool that implements the intermediate proxy function, obtain and modify the relevant data sent by the above-mentioned server through the above-mentioned packet capture tool, and send the modified relevant data to the client, so that the client can use the modified relevant data for functional debugging. However, because the above-mentioned packet capture tool only has a data display function, the developer cannot modify the data directly on the packet capture tool. Therefore, the developer needs to manually copy the relevant data obtained by the above-mentioned packet capture tool to the local computer, and then modify the data, and manually configure the mapping information to match and replace the locally modified relevant data with the original data in the above-mentioned packet capture tool, and then the above-mentioned packet capture tool sends the modified relevant data to the client.
[0186] The above existing client debugging solutions cannot modify the text / json data sent by the server directly on the client, and must be implemented through packet capture tools; and developers are required to manually copy data and manually configure mapping information to replace the modified data. The steps are cumbersome, which will increase the configuration error rate and reduce R&D efficiency; the text / json data sent by the server can only be modified through the PC, which cannot be implemented on mobile terminals, and the application scenarios are relatively limited.
[0187] In view of this, an embodiment of the present invention provides a dynamic data debugging method, including: obtaining a data source from a server, parsing the data source to obtain a data source object to be debugged; in response to an instruction to display the data to be debugged, outputting a first interface displaying the data source object; in response to a data debugging instruction, determining to select a first data source object for modification, and outputting a second interface displaying the modification of the first data source object; obtaining modification information of the first data source object through the second interface, modifying the first data source object according to the modification information to obtain debugging data, and caching the debugging data; replacing the corresponding first data source object in the data source with the debugging data, and loading the current data source update application interface, so as to directly modify the data source object issued by the server on the client, dynamically perform data debugging, and improve the accuracy and efficiency of data debugging.
[0188] After introducing the basic principles of the present invention, various non-limiting embodiments of the present invention are described in detail below.
[0189] Application Scenario Overview
[0190] First reference Figure 1 , which is a schematic diagram of an application scenario of a dynamic data debugging method provided by an embodiment of the present invention.
[0191] The client device 11 is used to obtain a data source from a server, parse the data source to obtain a data source object to be debugged; in response to an instruction to display data to be debugged, output a first interface to display the data source object; in response to a data debugging instruction, determine to select a first data source object to be modified, and output a second interface to display the modification of the first data source object; obtain modification information of the first data source object through the second interface, modify the first data source object according to the modification information to obtain debugging data, and cache the debugging data; use the debugging data to replace the corresponding first data source object in the data source, and load the current data source to update the application interface.
[0192] The server 12 is used to send the data source to the client device 11 .
[0193] The client device 11 and the server 12 are connected to each other through a network, which may be a local area network, a wide area network, or the like.
[0194] The client device 11 may be a portable device (eg, a mobile phone, a tablet, a laptop, etc.) or a personal computer (PC).
[0195] The server 12 may be any device capable of providing Internet services.
[0196] The user interacts with the server 12 via the client installed in the client device 11, wherein the client may be a web browser or an application client installed in a mobile user device such as a mobile phone, a tablet computer, etc.
[0197] It should be noted that the above application scenario is only an illustration of a possible implementation method in the embodiment of the present invention, and does not limit the embodiment of the present invention. On the contrary, the implementation method of the present application can be applied to any applicable scenario, and the above application scenario can be added, deleted, or modified according to the specific implementation situation.
[0198] Exemplary Methods
[0199] like Figure 2 As shown, it is a flowchart of a dynamic data debugging method provided by an embodiment of the present invention, which is applied to the above-mentioned client device 11 and includes the following steps:
[0200] Step S201, obtaining a data source from a server, parsing the data source to obtain a data source object to be debugged;
[0201] Read the data source sent by the server. The data source is text data that cannot be recognized by the client device. The client device parses the data source into a value object, and then parses the value object into fields information that can be recognized by the client. The fields information is used as the data source object to be debugged.
[0202] As an optional implementation manner, parsing the data source to obtain a data source object to be debugged includes:
[0203] Parsing the data source to determine the value object in the data source;
[0204] Specifically, the data source may be parsed according to the JSON format to determine a value object in the data source that can modify data.
[0205] Parse the attribute information of the value object, and use the fields information of the value object obtained by parsing as the data source object to be debugged;
[0206] According to the value object in the above data source, the Java reflection mechanism is used to obtain the fields information, and the above fields information is used as the data source object to be debugged.
[0207] The fields information is attribute information corresponding one-to-one to the value object, including an identity document (ID) corresponding one-to-one to the value object, which is equivalent to a configuration file for identifying the value object.
[0208] Step S202, in response to the instruction for displaying the data to be debugged, outputting a first interface for displaying the data source object;
[0209] Implementation method 1: outputting and displaying a trigger icon on the current application interface, and outputting and displaying a first interface of the data source object according to a display instruction of data to be debugged generated by a user clicking the trigger icon;
[0210] The above-mentioned clicking method can be achieved by lightly touching the above-mentioned trigger icon, or clicking the above-mentioned trigger icon twice / multiple times in a row.
[0211] like Figure 3 As shown, an embodiment of the present invention provides a schematic diagram of a trigger icon.
[0212] In the above Figure 3 In the example, the current application interface is an interface of a news application. A circular trigger icon is displayed on the right side of the interface. Clicking the trigger icon generates a display instruction for data to be debugged. In response to the display instruction for data to be debugged, the first interface of the data source object is output and displayed.
[0213] It should be noted that the form of the above-mentioned trigger icon is only an example of a possible implementation method of the trigger icon of the embodiment of the present invention. Any trigger icon that can generate instructions for displaying the data to be debugged can be applied to the embodiment of the present invention. The embodiment of the present invention does not impose any limitation on the implementation details such as the shape of the above-mentioned trigger icon, the position of the above-mentioned trigger icon relative to the above-mentioned current application interface, etc.
[0214] Implementation method 2: according to the display instruction of the data to be debugged generated by the user's hardware operation, the first interface of the data source object is output and displayed.
[0215] When the above-mentioned client device is a mobile terminal, the above-mentioned hardware operation can be pressing function keys such as a power button and / or a volume button, or by pressing function keys on an external device, such as a volume button, a switch button, a pause button, etc. on headphones; when the above-mentioned client device is a PC device, the above-mentioned hardware operation can be pressing a preset key or a preset key combination on the keyboard.
[0216] like Figure 4 As shown, an embodiment of the present invention provides a schematic diagram of a first interface.
[0217] In the above Figure 4 In the embodiment, the first interface is in the lower half of the current application interface and displays data source objects 1-4 and contents describing the functions of the data source objects 1-4.
[0218] It should be noted that when the above-mentioned first interface is displayed on the above-mentioned current application interface, other functions of the application cannot be used. For example, there is no response when clicking on the upper half of the above-mentioned current application interface, and functions such as the news content and search box above the above-mentioned first interface cannot be used normally.
[0219] It should be noted that the form of the above-mentioned first interface is only an example of a possible implementation method of the first interface of the embodiment of the present invention. Any first interface that can display the data source object can be applied to the embodiment of the present invention. The embodiment of the present invention does not impose any limitation on the specific form of the above-mentioned first interface.
[0220] It should be noted that the execution order of the above step S201 and the above step S202 can be reversed: first, execute in response to the instruction to display the data to be debugged, output a first interface for displaying the data source object; then execute to obtain the data source from the server, parse the data source to obtain the data source object to be debugged, and display the parsed data source object on the above first interface. In specific implementation, the execution order of the above step S201 and the above step S202 can be flexibly adjusted to adapt to different implementation situations.
[0221] Return to the above Figure 2 In step S203, in response to the data debugging instruction, determining the first data source object to be modified, and outputting a second interface showing the modification of the first data source object;
[0222] The data debugging instruction is generated according to the user's selection operation on the data source object on the first interface / the third interface described below.
[0223] As mentioned above Figure 4 In the above, according to the user clicking on the selection icon corresponding to the above data source object displayed on the right side of the above data source object on the above first interface, a data debugging instruction for selecting and modifying the selected first data source object is generated.
[0224] like Figure 5 As shown, an embodiment of the present invention provides a schematic diagram of a second interface.
[0225] In the above Figure 5 In the example, the second interface is in the lower half of the current application interface, the name of the first data source object selected for modification is displayed in the upper part of the second interface, the editing area is displayed in the lower part of the second interface, and a confirmation button is displayed.
[0226] The user enters the modification information of the first data source object in the editing area of the second interface, and when confirming that the modification is complete, clicks the confirmation icon to complete the input of the modification information.
[0227] As an optional implementation, the second interface is implemented through an EditText component.
[0228] It should be noted that the form of the above-mentioned second interface is only an example of a possible implementation method of the second interface of the embodiment of the present invention. Any second interface that can realize the modification of the first data source object can be applied to the embodiment of the present invention. The embodiment of the present invention does not impose any limitation on the specific form of the above-mentioned second interface.
[0229] As an optional implementation manner, in response to the data debugging instruction, before determining to select the first data source object to be modified, the method further includes:
[0230] When the query information input by the user on the first interface is monitored, a data source object matching the query information is obtained, and output and displayed through a third interface;
[0231] The data debugging instruction is generated according to the user's selection operation on the data source object on the third interface.
[0232] As mentioned above Figure 4 As shown, click the magnifying glass icon and enter the query information.
[0233] Register a SearchQuery listener to listen to the user's input behavior on the first interface and obtain the input query information.
[0234] like Figure 6 As shown, an embodiment of the present invention provides a schematic diagram of a third interface.
[0235] In the above Figure 6 The third interface is in the lower half of the current application interface, the query information input by the user is displayed in the upper part of the third interface, the data source object matching the query information is displayed in the lower part of the third interface, and the selection icon corresponding to the data source object is displayed on the right side of the data source object.
[0236] According to the user clicking the selection icon corresponding to the above-mentioned data source object on the above-mentioned third interface, a data debugging instruction for selecting and modifying the selected first data source object is generated.
[0237] It should be noted that the form of the above-mentioned third interface is only an example of a possible implementation method of the third interface of the embodiment of the present invention. Any third interface that can display the data source object that matches the query information can be applied to the embodiment of the present invention. The embodiment of the present invention does not impose any limitation on the specific form of the above-mentioned third interface.
[0238] As an optional implementation, obtaining a data source object matching the query information and outputting and displaying it through a third interface includes:
[0239] Matching the query information with the data source object to be debugged, and searching for a data source object whose object identifier is consistent with the query information;
[0240] When a data source object consistent with the query information is found, the found data source object is output and displayed through a third interface;
[0241] Otherwise, the query information is used as a keyword to search for data source objects whose object identifiers include part of the keyword, and the found data source objects are output and displayed through the third interface.
[0242] First, perform an exact query by searching the data source fields list for the data source object whose object identifier is consistent with the above query information. If the query is successful, the queried data source object is output and displayed. If not found, perform a fuzzy query by searching the data source fields list for the data source object whose object identifier includes some keywords, and output and display the queried data source object.
[0243] Return to Figure 2 , step S204, obtaining modification information of the first data source object through the second interface, modifying the first data source object according to the modification information to obtain debugging data, and caching the debugging data;
[0244] After the user clicks the confirmation icon, the modification information of the first data source object input by the user in the second interface is obtained.
[0245] As an optional implementation manner, modifying the first data source object according to the modification information to obtain debugging data includes:
[0246] The fields information corresponding to the first data source object is modified according to the modification information, and the modified fields information is assigned to the corresponding value object through instantiation to obtain debugging data.
[0247] After obtaining the fields information corresponding to the first data source object through the Java reflection mechanism, the first data source object is modified by modifying the corresponding fields information.
[0248] According to the control ID information, the fields information corresponding to the first data source object is obtained in the data source fields list, and the fields information is instantiated into a value object. More specifically, the modification information entered by the user in the EditText in the Dialog interface box is obtained, and the modification information is assigned to the value object instantiated from the field information.
[0249] Step S205: Use the debugging data to replace the corresponding first data source object in the data source, and load the current data source to update the application program interface.
[0250] The fields information obtained from the data source sent by the parsing server includes different types of variables. The above variables are modified using the modification information to obtain debugging data. During the modification, only the specific value of the variable is modified, and the type of the above variable is not changed. Therefore, the above debugging data is the above different types of variables. According to the role, the above variables include global variables and non-global variables; according to whether they are initialized, the above variables include initialized variables and uninitialized variables.
[0251] When the debugging data is confirmed to be effective, the debugging data can be used to replace the corresponding first data source object in the data source. For different types of variables, the effectiveness conditions of the debugging data are different:
[0252] When the debugging data is an uninitialized non-global variable, the debugging data takes effect in real time;
[0253] When the debugging data is a global variable / initialized variable, the debugging data takes effect after the application is restarted.
[0254] When the above debugging data is an uninitialized variable and a non-global variable, it takes effect in real time; when the above debugging data is a global variable or when the above debugging data is an initialized variable, it takes effect after the above application is restarted.
[0255] In addition to using the modification information obtained through the second interface to modify the debugging data obtained by the first data source object and replace the first data source object, you can also use the locally cached debugging data to replace the corresponding data source object:
[0256] After parsing the data source to obtain the data source object to be debugged, the method further includes:
[0257] Determine that the data source object includes a second data source object, where the second data source object is a data source object having corresponding debugging data cached locally;
[0258] The second data source object is replaced with debug data corresponding to the second data source.
[0259] When any data source object to be debugged has corresponding debugging data cached locally, the corresponding debugging data is used to replace the data source object to be debugged.
[0260] After replacing the corresponding data source object in the data source with the debugging data, the replaced data source is loaded to update the application program interface.
[0261] The data source sent by the server and the modified debugging data are stored in different lists, such as Figure 7 As shown, an embodiment of the present invention provides a schematic diagram of a first list and a second list:
[0262] After obtaining the data source from the server and before parsing the data source, the following steps are also included:
[0263] Cache the fields information corresponding to the value object in the data source as the original data source in the first local list;
[0264] The original data source without any modification is stored in the first list to implement the storage of the original data source.
[0265] As mentioned above Figure 4 As shown, the original data source is behind the label "Halley Switch [from Server]" and has a value by default.
[0266] The debugging data is cached, including:
[0267] Cache the fields information corresponding to the value object in the debugging data in the second list;
[0268] The modified fields information is stored in the second list to implement the storage of debugging data.
[0269] The debugging data is behind the label "Harley switch [from local]". There is no value by default. The value can be modified. Some default values come from annotations.
[0270] The fields information corresponding to the original data source and the debugging data are cached in the first list and the second list respectively, so as to isolate the original data source and the debugging data and avoid the influence of the debugging data on the original data source.
[0271] According to the fields information in the first list and the second list, the current data source is loaded. When the value object in the data source has corresponding field information in both the first list and the second list, the value object corresponding to the field information in the second list is loaded first. When it is determined that the same value object in the data source has corresponding field information in both the first list and the second list, the value object corresponding to the field information in the second list is loaded.
[0272] It should be noted that when caching the fields information corresponding to the value objects in the above debugging data into the second list, it is necessary to mark the global variables / initialized variables in the above debugging data according to the variable type of the above debugging data, and when loading the value objects corresponding to the fields information in the above second list, only load the unmarked data to avoid the above global variables / initialized variables taking effect when the application is not restarted, resulting in data debugging errors; after the application is restarted, when restoring the field fields information of the corresponding value object according to the debugging data in the string format of the local persistent storage, the variable type is no longer distinguished, and the global variables / initialized variables take effect.
[0273] Update the application interface through the value object corresponding to the loaded field information.
[0274] like Figure 8 As shown, an embodiment of the present invention provides a flowchart of updating an application program interface, including:
[0275] Step S801, in response to an application program interface update request, obtaining a data source from a server;
[0276] The user clicks on the icon of the above application program interface, or generates a request for updating the above application program interface through hardware operation.
[0277] Step S802, caching the fields information corresponding to the multiple value objects in the above data source as the original data source in a first local list;
[0278] Step S803, determining whether at least one value object in the data source has corresponding field information in the second list, if yes, executing step S804, otherwise, executing step S805;
[0279] Step S804, load the value object corresponding to the fields information corresponding to the at least one value object in the second list, load the value objects corresponding to the fields information corresponding to other value objects other than the at least one value object in the first list, and execute step S806;
[0280] Step S805, loading the value objects corresponding to the fields information corresponding to the multiple value objects in the data source in the first list, and executing step S806;
[0281] Step S806, updating the application program interface according to the loaded value object;
[0282] Prioritize loading the value objects corresponding to the fields information cached in the second list. When the corresponding fields information does not exist in the second list, load the value objects corresponding to the fields information cached in the first list, and update the application interface according to the loaded value objects.
[0283] Through the above steps S801-S806, it is achieved to update the application interface by using the data cached in the first list or the second list.
[0284] Step S807, parsing the above data source to obtain the data source object to be debugged;
[0285] Step S808, in response to the instruction for displaying the data to be debugged, outputting a first interface for displaying the data source object to be debugged;
[0286] Step S809, in response to the data debugging instruction, determining the first data source object selected for modification, and outputting a second interface showing the modification of the first data source object;
[0287] Step S810, obtaining modification information of the first data source object through the second interface, modifying the first data source object according to the modification information to obtain debugging data, and caching the debugging data;
[0288] Step S811: Use the debugging data to replace the corresponding first data source object in the data source, and load the current data source to update the application program interface.
[0289] For the detailed implementation method of the above steps S807-S811, please refer to the description of the above dynamic data debugging method, which will not be repeated here.
[0290] Through the above steps S807-S811, when the user performs data debugging in real time through the above dynamic data debugging method and completes the replacement of the data source object, the replaced data source is used to update the application program interface.
[0291] After updating the application interface, determine whether the above application is normal based on whether the updated application interface is consistent with the expected effect. For example, change the current status of a product in the product purchase application to be unavailable for purchase. After the application interface is updated, determine whether the above application is normal by verifying whether the current status of the above product is unavailable for purchase.
[0292] In order to prevent the debugger from forgetting that the application page changes are caused by the configured debugging data, after loading the current data source to update the application interface, it also includes:
[0293] When it is determined that there is effective debugging data in the local cache, obtaining the effective debugging data;
[0294] After the effective debugging data is converted into a string format that is not lost when power is off, a prompt message that the debugging data in the string format has taken effect is output through a user prompt control.
[0295] After a preset time (for example, 5 seconds) of restarting the application, a prompt message that the debugging data in the string format has taken effect is output through the user reminder control to avoid forgetting the Debug configuration and affecting normal business display.
[0296] As an optional implementation, the user reminder control is a Toast prompt.
[0297] like Fig. 9 As shown, an embodiment of the present invention provides a schematic diagram of outputting prompt information through a user reminder control.
[0298] The user reminder control displays "Effective debugging data: [string name of debugging data]" in the lower half of the above current application interface.
[0299] Get the effective debugging data, parse the above debugging data in JSON format into an object, and parse the above object into a collection using a serialization tool, traverse the collection key information, generate a string name String for the debugging data, and output a prompt message "Effective debugging data: [string name of debugging data]" through a user prompt control.
[0300] It should be noted that the form of the above-mentioned user reminder control is only an example of a possible implementation method of the user reminder control of an embodiment of the present invention. Any user reminder control that can output prompt information can be applied to the embodiment of the present invention. The embodiment of the present invention does not impose any limitation on the specific form of the above-mentioned user reminder control.
[0301] By modifying the configuration data of the persistence option, you can turn on / off the persistent storage function and persist / clear the debug data:
[0302] According to the configuration data of the persistence option, when it is determined that the persistent storage function is currently enabled, the currently cached debugging data is converted into a string format that is not lost when power is off and then stored;
[0303] When it is determined that the persistent storage function is currently in a disabled state according to the configuration data of the persistence option, the debugging data in the string format stored locally is cleared.
[0304] As mentioned above Figure 4As shown in the persistence icon in the figure, you can adjust the position of the persistence icon, modify the configuration data of the persistence option, and turn on / off the persistent storage function:
[0305] When the circular icon in the above-mentioned persistence icon slides to the left, the configuration data of the persistence option is configured as the first data, and the above-mentioned persistence storage function is turned off; when the circular icon in the above-mentioned persistence icon slides to the right, the configuration data of the persistence option is configured as the second data, and the above-mentioned persistence storage function is turned on.
[0306] When it is determined that the persistent storage function is currently enabled, the currently cached debug data is serialized into debug data in string format using JSON format, and the debug data in string format is saved locally through SharedPreferences to ensure that the locally stored debug data is not lost after the application is restarted.
[0307] When it is determined that the persistent storage function is currently disabled, clear the debugging data in string format stored locally.
[0308] like Fig.10 As shown, an embodiment of the present invention provides a flowchart for implementing a persistent storage function, including:
[0309] Step S1001, obtaining configuration data of the persistence option;
[0310] Step S1002, determining whether the persistent storage function is currently enabled, if so, executing step S1003, otherwise, executing step S1004;
[0311] Step S1003, converting the currently cached debugging data into a string format that is not lost when power is off and then storing it;
[0312] Step S1004, clearing the debugging data in the string format stored locally.
[0313] In order to restore the fields information according to the debugging data in the string format above after the application is restarted, the currently cached debugging data is converted into a string format that will not be lost when power is off and then stored, and also includes:
[0314] Convert the field content in the fields information of the currently cached value object into a string that will not be lost when the power is off, and establish a mapping relationship between the string and the field identifier;
[0315] In response to the application restart instruction, when it is determined that the application has completed restarting, the string is converted into field fields information of the corresponding value object according to the mapping relationship.
[0316] The cached debugging data is the fields information of the value object. The fields information includes a field identifier and a field content. A mapping relationship between a string and a field identifier is established so that when the application is restarted, the string is converted into fields information according to the mapping relationship.
[0317] In order to avoid data debugging errors caused by manually inputting modification information with incorrect format, after obtaining the modification information of the first data source object through the second interface, the method further includes:
[0318] When it is determined that the data type of the modification information is a string, Gson is used to verify whether the string is in JSON format;
[0319] When it is determined that the string is in JSON format, the verification passes, otherwise an error prompt message is displayed.
[0320] After obtaining the modification information of the first data source object, first determine the data type of the modification information. When the data type does not match the required modification information, for example, when the data type is not a string, display an error prompt message. When the data type matches the required modification information, for example, when the data type is a string, use Gson to verify whether the string is in JSON format. When it is determined that the string is in JSON format, the verification passes, and a prompt message indicating the verification passes may be displayed, for example, "Congratulations, the modification is successful!". When it is determined that the string is not in JSON format, the verification fails, and an error prompt message is displayed, for example, "Data verification failed, modification failed!".
[0321] The dynamic data debugging method provided by the embodiment of the present invention provides an interface for data debugging during the application running stage, and uses the Java reflection mechanism to find and modify the content of corresponding data to achieve the purpose of dynamic debugging of data, replacing the traditional packet capture tool to match text / json data, thereby reducing the error rate of data debugging, improving development efficiency, and saving labor costs.
[0322] Exemplary Devices
[0323] After introducing the method of the exemplary embodiment of the present invention, next, the dynamic data debugging device and equipment of the exemplary embodiment of the present application are introduced.
[0324] like Fig.11 As shown, based on the same inventive concept, an embodiment of the present invention further provides a dynamic data debugging device, including:
[0325] The data acquisition unit 1101 is used to acquire a data source from a server and parse the data source to obtain a data source object to be debugged;
[0326] The first display unit 1102 is used to output and display the first interface of the data source object in response to the instruction to display the data to be debugged;
[0327] The second display unit 1103 is used to determine the first data source object selected for modification in response to the data debugging instruction, and output a second interface for displaying the modification of the first data source object;
[0328] The data debugging unit 1104 is used to obtain modification information of the first data source object through the second interface, modify the first data source object according to the modification information to obtain debugging data, and cache the debugging data;
[0329] The data loading unit 1105 is used to replace the corresponding first data source object in the data source with the debugging data, and load the current data source to update the application program interface.
[0330] In a possible implementation manner, after parsing the data source to obtain the data source object to be debugged, the data loading unit 1105 is further configured to:
[0331] Determine that the data source object includes a second data source object, where the second data source object is a data source object having corresponding debugging data cached locally;
[0332] The second data source object is replaced with debug data corresponding to the second data source.
[0333] In a possible implementation manner, the first display unit 1102 outputs a first interface for displaying the data source object in response to the instruction for displaying the data to be debugged, including:
[0334] Outputting and displaying a trigger icon on the current application interface, and outputting and displaying a first interface of the data source object according to a display instruction to be debugged generated by a user clicking the trigger icon; or
[0335] According to the to-be-debugged data display instruction generated by the user's hardware operation, a first interface of the data source object is output and displayed.
[0336] In a possible implementation manner, in response to the data debugging instruction, before determining to select the modified first data source object, the second display unit 1103 is further configured to:
[0337] When the query information input by the user on the first interface is monitored, a data source object matching the query information is obtained, and output and displayed through a third interface;
[0338] The data debugging instruction is generated according to the user's selection operation on the data source object on the third interface.
[0339] In a possible implementation, the second display unit 1103 acquires the data source object matching the query information and outputs and displays it through the third interface, including:
[0340] Matching the query information with the data source object to be debugged, and searching for a data source object whose object identifier is consistent with the query information;
[0341] When a data source object consistent with the query information is found, the found data source object is output and displayed through a third interface;
[0342] Otherwise, the query information is used as a keyword to search for data source objects whose object identifiers include part of the keyword, and the found data source objects are output and displayed through the third interface.
[0343] In a possible implementation, the data acquisition unit 1101 parses the data source to obtain the data source object to be debugged, including:
[0344] Parsing the data source to determine the value object in the data source;
[0345] Parse the attribute information of the value object, and use the fields information of the value object obtained by parsing as the data source object to be debugged;
[0346] The data debugging unit 1104 modifies the first data source object according to the modification information to obtain debugging data, including:
[0347] The fields information corresponding to the first data source object is modified according to the modification information, and the modified fields information is assigned to the corresponding value object through instantiation to obtain debugging data.
[0348] In a possible implementation, after acquiring the data source from the server and before parsing the data source, the data acquisition unit 1101 is further configured to:
[0349] Cache the fields information corresponding to the value object in the data source as the original data source in the first local list;
[0350] The data debugging unit 1104 caches the debugging data, including:
[0351] Cache the fields information corresponding to the value object in the debugging data in the second list;
[0352] The data loading unit 1104 replaces the corresponding first data source object in the data source with the debugging data and loads the current data source, including:
[0353] When it is determined that the same value object in the data source has corresponding field information in both the first list and the second list, the value object corresponding to the field information in the second list is loaded.
[0354] In a possible implementation manner, the data loading unit 1105 replaces the corresponding first data source object in the data source with the debugging data, including:
[0355] When it is determined that the debugging data is effective, replacing the corresponding first data source object in the data source with the debugging data;
[0356] Wherein, when the debugging data is an uninitialized non-global variable, the debugging data takes effect in real time;
[0357] When the debugging data is a global variable / initialized variable, the debugging data takes effect after the application is restarted.
[0358] In a possible implementation manner, after loading the current data source to update the application program interface, the data loading unit 1105 is further configured to:
[0359] When it is determined that there is effective debugging data in the local cache, obtaining the effective debugging data;
[0360] After the effective debugging data is converted into a string format that is not lost when power is off, a prompt message that the debugging data in the string format has taken effect is output through a user prompt control.
[0361] In a possible implementation, it further includes:
[0362] The persistence unit is used to convert the currently cached debugging data into a string format that will not be lost upon power failure and then store it when it is determined according to the configuration data of the persistence option that the persistent storage function is currently in the on state; and to clear the locally stored string format debugging data when it is determined according to the configuration data of the persistence option that the persistent storage function is currently in the off state.
[0363] In a possible implementation, the cached debugging data is fields information of a value object, the fields information includes a field identifier and a field content, and the currently cached debugging data is converted into a string format that is not lost upon power failure and then stored. The persistence unit is further used for:
[0364] Convert the field content in the fields information of the currently cached value object into a string that will not be lost when the power is off, and establish a mapping relationship between the string and the field identifier;
[0365] In response to the application restart instruction, when it is determined that the application has completed restarting, the string is converted into field fields information of the corresponding value object according to the mapping relationship.
[0366] In a possible implementation manner, after acquiring the modification information of the first data source object through the second interface, the data debugging unit 1105 is further configured to:
[0367] When it is determined that the data type of the modification information is a string, Gson is used to verify whether the string is in JSON format;
[0368] When it is determined that the string is in JSON format, the verification passes, otherwise an error prompt message is displayed.
[0369] Refer to the following Fig.12 The dynamic data debugging device 120 according to this embodiment of the present invention is described. Fig.12 The dynamic data debugging device 120 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiment of the present invention.
[0370] like Fig.12 As shown, the dynamic data debugging device 120 can be expressed in the form of a general computing device, for example, it can be a terminal device. The components of the dynamic data debugging device 120 can include but are not limited to: at least one processing unit 121, at least one storage unit 122, and a bus 123 connecting different system components (including the storage unit 122 and the processing unit 121).
[0371] The bus 123 may include a data bus, an address bus, and a control bus.
[0372] The storage unit 122 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 1221 and / or a cache memory 1222 , and may further include a read-only memory (ROM) 1223 .
[0373] The storage unit 122 may also include a program / utility 1225 having a set (at least one) of program modules 1224, such program modules 1224 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0374] The dynamic data debugging device 120 can also communicate with one or more external devices 124 (e.g., keyboards, pointing devices, etc.), and such communication can be performed through an input / output (I / O) interface 125. In addition, the dynamic data debugging device 120 can also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter 126. As shown in the figure, the network adapter 126 communicates with other modules of the dynamic data debugging device 120 through a bus 123. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the dynamic data debugging device 120, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0375] Exemplary Program Products
[0376] In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code. When the program product runs on a server device, the program code is used to enable the server device to execute the steps of each module in the dynamic data debugging device according to various exemplary implementations of the present invention described in the above "Exemplary Method" section of this specification. For example, a client device may use a dynamic data debugging method, including: obtaining a data source from a server, parsing the data source to obtain a data source object to be debugged; in response to an instruction to display data to be debugged, outputting a first interface displaying the data source object; in response to a data debugging instruction, determining to select a modified first data source object, and outputting a second interface displaying the modification of the first data source object; obtaining modification information of the first data source object through the second interface, modifying the first data source object according to the modification information to obtain debugging data, and caching the debugging data; replacing the corresponding first data source object in the data source with the debugging data, and loading the current data source to update the application interface.
[0377] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The 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 thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable 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 thereof.
[0378] like Fig.13 As shown, a program product 130 for dynamic data debugging according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a server device. However, the program product of the present invention is not limited to this. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, an apparatus or a device or used in combination with it.
[0379] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein readable program code is carried. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium other than a readable storage medium, which may transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0380] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0381] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0382] It should be noted that although several modules or submodules of the system are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules to be embodied.
[0383] In addition, although the operations of the modules of the system of the present invention are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some operations may be omitted, multiple operations may be combined into one operation, and / or one operation may be decomposed into multiple operations.
[0384] Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
Claims
1. A dynamic data debugging method, applied to a client device, characterized in that: include: Obtain a data source from a server, and parse the data source to obtain a data source object to be debugged; In response to the instruction for displaying the data to be debugged, outputting a first interface for displaying the data source object; In response to the data debugging instruction, determining a first data source object to be selected for modification, and outputting a second interface showing the modification of the first data source object; Acquire modification information of the first data source object through the second interface, modify the first data source object according to the modification information to obtain debugging data, and cache the debugging data; Using the debugging data to replace the corresponding first data source object in the data source, and loading the current data source to update the application program interface; After parsing the data source to obtain the data source object to be debugged, the method further includes: Determine that the data source object includes a second data source object, where the second data source object is a data source object having corresponding debugging data cached locally; The second data source object is replaced with debug data corresponding to the second data source.
2. The method according to claim 1, characterized in that In response to the instruction for displaying data to be debugged, outputting a first interface for displaying the data source object includes: Outputting and displaying a trigger icon on the current application interface, and outputting and displaying a first interface of the data source object according to a display instruction to be debugged generated by a user clicking the trigger icon; or According to the to-be-debugged data display instruction generated by the user's hardware operation, a first interface of the data source object is output and displayed.
3. The method according to claim 1, characterized in that In response to the data debugging instruction, before determining to select the first data source object to be modified, the method further includes: When the query information input by the user on the first interface is monitored, a data source object matching the query information is obtained, and output and displayed through a third interface; The data debugging instruction is generated according to the user's selection operation on the data source object on the third interface.
4. The method according to claim 3, characterized in that Acquiring a data source object that matches the query information and outputting and displaying it through a third interface includes: Matching the query information with the data source object to be debugged, and searching for a data source object whose object identifier is consistent with the query information; When a data source object consistent with the query information is found, the found data source object is output and displayed through a third interface; Otherwise, the query information is used as a keyword to search for data source objects whose object identifiers include part of the keyword, and the found data source objects are output and displayed through the third interface.
5. The method according to claim 1, characterized in that The data source is parsed to obtain a data source object to be debugged, including: Parsing the data source to determine the value object in the data source; Parse the attribute information of the value object, and use the fields information of the value object obtained by parsing as the data source object to be debugged; Modifying the first data source object according to the modification information to obtain debugging data includes: The fields information corresponding to the first data source object is modified according to the modification information, and the modified fields information is assigned to the corresponding value object through instantiation to obtain debugging data.
6. The method according to claim 5, characterized in that After obtaining the data source from the server and before parsing the data source, the following steps are also included: Cache the fields information corresponding to the value object in the data source as the original data source in the first local list; The debugging data is cached, including: Cache the fields information corresponding to the value object in the debugging data in the second list; Replacing the corresponding first data source object in the data source with the debugging data and loading the current data source includes: When it is determined that the same value object in the data source has corresponding field information in both the first list and the second list, the value object corresponding to the field information in the second list is loaded.
7. The method according to claim 1, characterized in that Replacing the corresponding first data source object in the data source with the debugging data includes: When it is determined that the debugging data is effective, replacing the corresponding first data source object in the data source with the debugging data; Wherein, when the debugging data is an uninitialized non-global variable, the debugging data takes effect in real time; When the debugging data is a global variable / initialized variable, the debugging data takes effect after the application is restarted.
8. The method according to claim 7, characterized in that After loading the current data source and updating the application interface, it also includes: When it is determined that there is effective debugging data in the local cache, obtaining the effective debugging data; After the effective debugging data is converted into a string format that is not lost when power is off, a prompt message that the debugging data in the string format has taken effect is output through a user prompt control.
9. The method according to claim 1, characterized in that: Also includes: According to the configuration data of the persistence option, when it is determined that the persistent storage function is currently enabled, the currently cached debugging data is converted into a string format that is not lost when power is off and then stored; When it is determined that the persistent storage function is currently in a disabled state according to the configuration data of the persistence option, the debugging data in the string format stored locally is cleared.
10. The method according to claim 9, characterized in that The cached debugging data is fields information of the value object, and the fields information includes a field identifier and field content. The currently cached debugging data is converted into a string format that is not lost when power is off and then stored. The following also includes: Convert the field content in the fields information of the currently cached value object into a string that will not be lost when the power is off, and establish a mapping relationship between the string and the field identifier; In response to the application restart instruction, when it is determined that the application has completed restarting, the string is converted into field fields information of the corresponding value object according to the mapping relationship.
11. The method according to claim 1, characterized in that: After acquiring the modification information of the first data source object through the second interface, the method further includes: When it is determined that the data type of the modification information is a string, Gson is used to verify whether the string is in JSON format; When it is determined that the string is in JSON format, the verification passes, otherwise an error prompt message is displayed.
12. A dynamic data debugging device, characterized in that: include: A data acquisition unit, used to acquire a data source from a server, and parse the data source to obtain a data source object to be debugged; A first display unit, configured to output and display a first interface of the data source object in response to a display instruction for data to be debugged; A second display unit, configured to determine, in response to the data debugging instruction, a first data source object selected for modification, and output a second interface for displaying the modification of the first data source object; a data debugging unit, configured to obtain modification information of the first data source object through the second interface, modify the first data source object according to the modification information to obtain debugging data, and cache the debugging data; A data loading unit, used to replace the corresponding first data source object in the data source with the debugging data, and load the current data source to update the application program interface; After parsing the data source to obtain the data source object to be debugged, the data loading unit is further used to: Determine that the data source object includes a second data source object, where the second data source object is a data source object having corresponding debugging data cached locally; The second data source object is replaced with debug data corresponding to the second data source.
13. The device according to claim 12, characterized in that The first display unit outputs a first interface of the data source object in response to the to-be-debugged data display instruction, including: Outputting and displaying a trigger icon on the current application interface, and outputting and displaying a first interface of the data source object according to a display instruction to be debugged generated by a user clicking the trigger icon; or According to the to-be-debugged data display instruction generated by the user's hardware operation, a first interface of the data source object is output and displayed.
14. The device according to claim 12, characterized in that In response to the data debugging instruction, before determining to select the first data source object to be modified, the second display unit is further used to: When the query information input by the user on the first interface is monitored, a data source object matching the query information is obtained, and output and displayed through a third interface; The data debugging instruction is generated according to the user's selection operation on the data source object on the third interface.
15. The device according to claim 14, characterized in that The second display unit acquires the data source object matching the query information and outputs and displays it through the third interface, including: Matching the query information with the data source object to be debugged, and searching for a data source object whose object identifier is consistent with the query information; When a data source object consistent with the query information is found, the found data source object is output and displayed through a third interface; Otherwise, the query information is used as a keyword to search for data source objects whose object identifiers include part of the keyword, and the found data source objects are output and displayed through the third interface.
16. The device according to claim 12, characterized in that The data acquisition unit parses the data source to obtain a data source object to be debugged, including: Parsing the data source to determine the value object in the data source; Parse the attribute information of the value object, and use the fields information of the value object obtained by parsing as the data source object to be debugged; The data debugging unit modifies the first data source object according to the modification information to obtain debugging data, including: The fields information corresponding to the first data source object is modified according to the modification information, and the modified fields information is assigned to the corresponding value object through instantiation to obtain debugging data.
17. The device according to claim 16, characterized in that After acquiring the data source from the server and before parsing the data source, the data acquisition unit is further used to: Cache the fields information corresponding to the value object in the data source as the original data source in the first local list; The data debugging unit caches the debugging data, including: Cache the fields information corresponding to the value object in the debugging data in the second list; The data loading unit replaces the corresponding first data source object in the data source with the debugging data and loads the current data source, including: When it is determined that the same value object in the data source has corresponding field information in both the first list and the second list, the value object corresponding to the field information in the second list is loaded.
18. The device according to claim 12, characterized in that The data loading unit replaces the corresponding first data source object in the data source with the debugging data, including: When it is determined that the debugging data is effective, replacing the corresponding first data source object in the data source with the debugging data; Wherein, when the debugging data is an uninitialized non-global variable, the debugging data takes effect in real time; When the debugging data is a global variable / initialized variable, the debugging data takes effect after the application is restarted.
19. The device according to claim 18, characterized in that After loading the current data source to update the application program interface, the data loading unit is further used to: When it is determined that there is effective debugging data in the local cache, obtaining the effective debugging data; After the effective debugging data is converted into a string format that is not lost when power is off, a prompt message that the debugging data in the string format has taken effect is output through a user prompt control.
20. The device according to claim 12, characterized in that Also includes: The persistence unit is used to convert the currently cached debugging data into a string format that will not be lost upon power failure and then store it when the persistent storage function is currently enabled according to the configuration data of the persistence option; When it is determined that the persistent storage function is currently in a disabled state according to the configuration data of the persistence option, the debugging data in the string format stored locally is cleared.
21. The device according to claim 20, characterized in that The cached debugging data is fields information of the value object, and the fields information includes field identifier and field content. The currently cached debugging data is converted into a string format that is not lost when power is off and then stored. The persistence unit is also used for: Convert the field content in the fields information of the currently cached value object into a string that will not be lost when the power is off, and establish a mapping relationship between the string and the field identifier; In response to the application restart instruction, when it is determined that the application has completed restarting, the string is converted into field fields information of the corresponding value object according to the mapping relationship.
22. The device according to claim 12, characterized in that After acquiring the modification information of the first data source object through the second interface, the data debugging unit is further used to: When it is determined that the data type of the modification information is a string, Gson is used to verify whether the string is in JSON format; When it is determined that the string is in JSON format, the verification passes, otherwise an error prompt message is displayed.
23. A dynamic data debugging device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the dynamic data debugging method according to any one of claims 1 to 11 are implemented.
24. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the steps of the dynamic data debugging method described in any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Entity object relevance based automatic human-computer interface generating method
CN106227527A
Application program debugging method and system, electronic equipment and computer readable storage medium
CN111078530A