Cross-platform Application Debugging Method, Device, Electronic Device and Storage Medium

By introducing simulation interceptors and simulators in cross-platform applications, the problems of poor reusability, poor scalability, poor ease of use and low development efficiency in the existing technology are solved, and efficient debugging and development of cross-platform applications are achieved.

CN115098392BActive Publication Date: 2025-08-05BEIJING HUITONG TIANXIA LOGISTIC CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210817490.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-12
Publication Date
2025-08-05
Estimated Expiration
2042-07-12

AI Technical Summary

Technical Problem

The existing cross-platform development technology has shortcomings in reusability, scalability, ease of use and development efficiency, especially in the implementation of the communication interface between Flutter and the host platform, resulting in low development efficiency.

Method used

By introducing simulation interceptors and simulators, debugging requests are intercepted, and the simulation is determined based on business debugging parameters, debugging simulation data is generated, and the requesting party is returned to the debugging method for cross-platform applications is realized, and the service and the requesting party's development process is decoupled.

Benefits of technology

It improves the reusability, ease of use and development efficiency of cross-platform applications, allowing developers to develop independently without the host side, simplifying the debugging process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115098392B_ABST
    Figure CN115098392B_ABST
Patent Text Reader

Abstract

The present application provides a cross-platform application debugging method, device, electronic device and storage medium, which relate to the field of program development technology. The cross-platform application debugging method includes: if a debugging request for a preset cross-platform application from a debugging requester is intercepted, determining whether the debugging request is to be simulated; if simulation is to be performed, simulating the business debugging parameters of the debugging service party, obtaining the first debugging simulation data of the debugging service party, and returning the first debugging simulation data for the preset cross-platform application to the debugging requester. The present application realizes the simulation of the service party through a simulator, thereby, the requester can develop independently of the host side, thereby greatly improving development efficiency. In addition, the design of the interceptor can conveniently print logs or perform other interception operations required by the business.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of program development, and in particular to a cross-platform application debugging method, device, electronic device and storage medium. Background Art

[0002] In order to unify the visuals, save development costs, and enable the same user interface to be used on multiple platforms, more and more developers are choosing cross-platform development technology.

[0003] However, the cross-platform development technology currently used is mainly based on the communication interface between Flutter (a set of open source cross-platform technologies) and the host platform, which has poor reusability, poor scalability and low development efficiency. Summary of the Invention

[0004] The purpose of the present invention is to provide a cross-platform application debugging method, device, electronic device and storage medium to address the deficiencies in the above-mentioned prior art, so as to provide a cross-platform application debugging method with strong reusability, ease of use and high efficiency.

[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present application are as follows:

[0006] In a first aspect, an embodiment of the present application provides a cross-platform application debugging method, the method comprising:

[0007] If a debugging request for a preset cross-platform application from a debugging requester is intercepted, determining whether the debugging request is to be simulated, wherein the debugging request includes: business debugging parameters;

[0008] If simulation is performed, the service debugging parameter is simulated by the debugging service party to obtain first debugging simulation data of the debugging service party;

[0009] Returning first debugging simulation data for the preset cross-platform application to the debugging requester.

[0010] Optionally, the debugging request further includes: instruction information, wherein if simulation is performed, simulation of the debugging service provider is performed on the service debugging parameter to obtain first debugging simulation data of the debugging service provider, including:

[0011] If simulation is performed, a simulation interceptor is used to simulate the debugging service side on the business debugging parameters to obtain first debugging simulation data of the debugging service side.

[0012] Optionally, the service debugging parameters include: a debugging path, a request type, and debugging parameters; and simulating the debugging service provider on the service debugging parameters to obtain first debugging simulation data of the debugging service provider includes:

[0013] A simulation interceptor is used to simulate the debugging service side on the debugging parameters based on the simulation method corresponding to the debugging path, and debugging simulation data corresponding to the request type is obtained as first debugging simulation data of the debugging service side.

[0014] Optionally, the method further includes:

[0015] If no simulation is performed, the debugging service method is called based on the debugging request, and the debugging service provider generates a service debugging result based on the debugging request;

[0016] If the service debugging result from the debugging service provider is intercepted, the service debugging result is returned to the debugging requester.

[0017] Optionally, the generating of a service debugging result by the debugging service provider based on the debugging request includes:

[0018] The debugging service provider processes the debugging request based on the debugging parameters and the debugging path, and obtains a service debugging result corresponding to the request type.

[0019] Optionally, returning the service debugging result to the debugging requester includes:

[0020] If the service debugging result indicates that the service debugging is successful, the service debugging result is returned to the debugging requester.

[0021] Optionally, the method further includes:

[0022] If the service debugging result indicates that the debugging requester does not have a matching service logic, simulating the debugging service provider on the service debugging parameter to obtain second debugging simulation data of the debugging service provider;

[0023] Returning second debugging simulation data for the preset cross-platform application to the debugging requester.

[0024] In a second aspect, an embodiment of the present application further provides a cross-platform application debugging device, comprising a judgment module, a simulation module, and a return module;

[0025] The judgment module is configured to, if a debugging request for a preset cross-platform application from a debugging requester is intercepted, determine whether the debugging request is to be simulated, wherein the debugging request includes: business debugging parameters;

[0026] The simulation module is configured to simulate the debugging service provider on the service debugging parameters to obtain first debugging simulation data of the debugging service provider;

[0027] The returning module is configured to return first debugging simulation data for the preset cross-platform application to the debugging requester.

[0028] In a third aspect, an embodiment of the present application further provides an electronic device comprising: a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the program instructions to perform the steps of the cross-platform application debugging method as described in any one of the first aspects.

[0029] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the cross-platform application debugging method as described in any one of the first aspects are executed.

[0030] The beneficial effects of the present application are as follows: an embodiment of the present application provides a cross-platform application debugging method. If a debugging request for a preset cross-platform application from a debugging requester is intercepted, it is determined whether the debugging request is to be simulated; if it is to be simulated, the debugging service party is simulated for the business debugging parameters to obtain the first debugging simulation data of the debugging service party, and the first debugging simulation data for the preset cross-platform application is returned to the debugging requester. The present application simulates the service party through a simulator, thereby allowing the requester to develop independently of the host side, thereby greatly improving development efficiency. In addition, the interceptor design can conveniently print logs or perform other interception operations required by the business. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0032] Figure 1 A flowchart of a cross-platform application debugging method provided in one embodiment of the present application;

[0033] Figure 2 A flowchart of a cross-platform application debugging method provided in another embodiment of the present application;

[0034] Figure 3 A flowchart of a cross-platform application debugging method provided in another embodiment of the present application;

[0035] Figure 4 A flowchart of a cross-platform application debugging method provided in one embodiment of the present application;

[0036] Figure 5 A calling sequence diagram of a cross-platform application debugging method provided in one embodiment of the present application;

[0037] Figure 6 A schematic diagram of a cross-platform application debugging device provided in one embodiment of the present application;

[0038] Figure 7 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0040] In this application, unless otherwise expressly specified and limited, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one feature. In the description of the present invention, the meaning of "multiple" is at least two, such as two or three, unless otherwise clearly and specifically limited. The terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the sentence "comprise a..." do not exclude the presence of other identical elements in the process, method, article or equipment including the elements.

[0041] FLutter is a cross-platform technology that enables cross-platform development for Android, i0S, macOS, Windows, Linux, and the web. This allows the same UI to run on multiple platforms, resulting in a unified visual experience and reduced development costs. However, the underlying implementations of different platforms vary. This is especially true when Flutter's host platform (i.e., the platform on which Flutter runs) and native platforms (e.g., the specific runtime platforms or implementation platforms of programs such as Android, i0S, macOS, Windows, Linux, and the web) are mixed together for development (Flutter's host platform and native platforms are mixed together in the same project, often with calls between the host and native platforms). Therefore, a communication mechanism is required between FLutter and the host platform (e.g., the MethodChannel provided by the official Flutter SDK).

[0042] Currently, communication between Flutter and the host platform is implemented based on MethodChannel, a communication interface (API) between Flutter and the host platform. The communication is divided into the Flutter side and the host side, and mainly includes the following components:

[0043] On the Flutter side:

[0044] First, the name of the MethodChannel must match the name of the MethodChannel on the host side, with a one-to-one correspondence. MethodChannels with different names are independent of each other and do not interfere with each other.

[0045] Second, the invokeMethod method of MethodChannel is used to initiate communication. This method contains two parameters: method, which is used as a communication identifier to distinguish different communication contents; and params, which are the parameters carried by the method during communication.

[0046] Third, the return value of invokeMethod: the result returned by the host.

[0047] Host side:

[0048] First, the name of the MethodChannel: It must match the name of the MethodChannel on the FLutter side, one-to-one. MethodChannels with different names are independent of each other and do not interfere with each other.

[0049] Second, the MethodCallHandler interface: This interface contains an onMethodCall method. When Flutter initiates communication, this method will be called back. This method contains two parameters:

[0050] MethodCall: contains the method and parameters sent from the Flutter side;

[0051] ResuLt: Use the success or failure method (success or fail) of the result return (Result) to return the processing result to the Flutter side.

[0052] When using, Flutter and the host side need to complete the following operations

[0053] 1. Flutter and the host platform simultaneously create a MethodChannel with the same name. At this point, the matching of the MethodChannel is completed, and Flutter and the host platform have the basis for communication.

[0054] 2. Take FLutter requesting communication with the host platform as an example:

[0055] a. FLutter calls the invokeMethod method of MethodChannel and passes in the method and parameters to initiate communication with the host platform.

[0056] b. The host platform implements the event dispatching (onMethodCall) method of the method call hander (MethodCallHandler, for example, the interface for the Java layer to process the Dart layer event, which belongs to the upper-layer interface in the communication protocol), receives the method (method) and parameters (params), and processes them.

[0057] c. After the host platform completes the processing, use the success or error method of the result return method (MethodChannel.ResuLt) to notify Flutter of the processing result.

[0058] d. The return (invokeMethod) method returns the result to the host platform.

[0059] It's important to note that MethodChannel communication is bidirectional. Flutter can proactively initiate communication with the host, and the host can also proactively initiate communication with Flutter. Therefore, the functions of Flutter and the host platform are interchangeable.

[0060] As can be seen from the above description, the current use of MethodChannel has the following disadvantages:

[0061] 1. Poor reusability. Existing solutions usually use one-to-one encapsulation, meaning that one MethodChannel corresponds to only one group of communications, making it difficult to reuse between different projects.

[0062] 2. Poor scalability. Existing solutions usually have corresponding communication method names hard-coded in the code, which cannot be dynamically added or deleted, and cannot be expanded.

[0063] 3. Poor usability. Existing solutions usually lack protocols, making them difficult to quickly promote and implement.

[0064] 4. Low development efficiency and unfriendly debugging. Existing solutions must rely on the host platform to function properly. However, developers are usually divided into Flutter developers and native platform developers. Ideally, the two should develop separately and then debug together after completion. However, the current solution couples Flutter and the native platform together, resulting in low efficiency.

[0065] To address the existing issues of poor reusability, poor scalability, poor usability, low development efficiency, and unfriendly debugging, the present invention provides multiple possible implementations to achieve a highly reusable, usable, and efficient cross-platform application debugging method. This is explained below using multiple examples with reference to the accompanying figures. Figure 1 This is a flow chart of a cross-platform application debugging method provided by an embodiment of the present application. The method can be implemented by an electronic device running the cross-platform application debugging method. The electronic device can be, for example, a terminal device or a server. Figure 1 As shown, the method includes:

[0066] Step 101: If a debugging request for a preset cross-platform application from a debugging requester is intercepted, determine whether to simulate the debugging request, wherein the debugging request includes: business debugging parameters.

[0067] In one possible implementation, in order to improve the reusability of MethodChannel, this application encapsulates MethodChannel. For the convenience of subsequent explanation, the encapsulation of this MethodChannel is named FlutterBridge. Among them, FlutterBridge is an encapsulated MethodChannel. When used, the requester and the service provider can first be connected to FlutterBridge, so that the service provider and the requester can implement data interaction based on FlutterBridge. Therefore, as long as the service provider and the requester are configured, cross-platform application debugging can be completed by calling FlutterBridge, so that the MethodChannel is unbound from the specific application project, thereby improving reusability.

[0068] For FlutterBridge, the following design is performed:

[0069] First of all, in order to facilitate understanding and improve the usability of the cross-platform application debugging method of this application, this application introduces the concept of network request in cross-platform application debugging, and divides the communication into the requester (Client side) and the service side (Server side), corresponding to ChannelCLient and ChannelServer respectively.

[0070] It should be noted that the requester (Client side, ChannelCLient) is similar to the client in the network request, and is the sender of the call request. It can be Flutter or the host platform. This application does not limit this; the service party (Server side, ChannelServer), similar to the server in the network request, is the processor (or indirect processor) of the call request. Generally, the setting of the service party corresponds to the requester. If the requester is Flutter, the server is the host platform; if the requester is the host platform, the service party is Flutter. The above is only an example. In actual implementation, there may be other settings, and this application does not limit this.

[0071] If the simulator intercepts a debugging request for a preset cross-platform application from a debugging requester, it determines whether to simulate the debugging request according to the service debugging parameters in the debugging request.

[0072] Optionally, the present application also provides a possible implementation of a cross-platform application debugging method. In one possible implementation, the debugging request also includes: indication information, which determines whether the debugging request is simulated based on the indication information in the business debugging parameters (for example, it can be indication information pre-set by the developer). If it is determined that the debugging request is simulated, a simulation interceptor is used to simulate the business debugging parameters of the debugging service party to obtain the first debugging simulation data of the debugging service party.

[0073] In another possible implementation, default parameters may be set in the service debugging parameters (ie, the debugging method corresponding to the default parameters is used without modification).

[0074] The above is only an example. In specific implementations, there may be other implementation methods. For example, the indication parameters of the debugging method may not be set in the debugging request, but the user may manually configure the debugging method before each debugging begins. This application does not limit this, as long as the debugging method can be determined.

[0075] Step 102: If simulation is performed, the service debugging parameters are simulated by the debugging service party to obtain first debugging simulation data of the debugging service party.

[0076] If it is determined that the debugging request needs to be simulated, the debugging service provider is simulated on the service debugging parameters by using a simulator to obtain first debugging simulation data of the debugging service provider.

[0077] It should be noted that the interceptor in this application can be, for example, a simulation interceptor, which is used to simulate the service provider through a program. However, the interceptor can also have other forms, which are not limited in this application.

[0078] It should also be noted that the interceptor for intercepting the debugging request in step 101 and the interceptor for performing service party simulation in step 102 and subsequent embodiments can be the same interceptor or different interceptors, and this application does not limit this.

[0079] In a specific implementation, the above interceptor function can be implemented based on the MockInterceptor class to improve development efficiency. The configuration method can be, for example:

[0080] First, a list (denoted as List1) is maintained in ChannelClient. List1 is used to uniformly intercept requests and responses and can be added through registration. In addition, List1 can also (or by default) add a message interceptor (such as a mock interceptor - LogInterceptor) to print request logs.

[0081] Second, ChannelClient also maintains a list (denoted as List2), which is used to simulate the data returned by the host (for example, it can simulate the return data in a specified format (such as a lightweight text data exchange format (json format))). List2 can be added through registration.

[0082] Third, the MockInterceptor class can be a subclass of an interceptor interface (such as ChannelInterceptor).

[0083] The above is only an example. In actual implementation, there may be other interceptor settings, which are not limited in this application.

[0084] Step 103: Return first debugging simulation data for the preset cross-platform application to the debugging requester.

[0085] Return first debugging simulation data for the preset cross-platform application to the debugging requester (ie, ChannelCLient).

[0086] In a possible implementation, after the debugging requester receives the first debugging simulation data (this data indicates the execution result of this debugging), the debugging ends.

[0087] In another possible implementation, after receiving the first debugging simulation data (this data includes the execution result data of this debugging), the debugging requester processes the execution result data to obtain the debugging result, and the debugging ends.

[0088] The above is only an example. In actual implementation, there may be other implementation methods, which are not limited in this application.

[0089] In summary, an embodiment of the present application provides a cross-platform application debugging method. If a debugging request for a preset cross-platform application from a debugging requester is intercepted, it is determined whether the debugging request is simulated; if it is simulated, the business debugging parameters of the debugging service are simulated to obtain the first debugging simulation data of the debugging service, and the first debugging simulation data for the preset cross-platform application is returned to the debugging requester. The present application implements the simulation of the service provider through a simulator, thereby allowing the requester to develop independently of the host side, thereby greatly improving development efficiency. In addition, the design of the interceptor can conveniently print logs or perform other interception operations required by the business.

[0090] Optional, in the above Figure 1Based on this, the present application also provides a possible implementation of a cross-platform application debugging method, wherein the business debugging parameters include: a debugging path, a request type, and debugging parameters; the business debugging parameters are simulated by the debugging service party to obtain first debugging simulation data of the debugging service party, including:

[0091] A simulation interceptor is used to simulate the debugging service side on the debugging parameters based on the simulation method corresponding to the debugging path, and debugging simulation data corresponding to the request type is obtained as the first debugging simulation data of the debugging service side.

[0092] In one possible implementation, the service debugging parameters include:

[0093] The debugging path refers to the method parameter used to initiate the communication method call (invokeMethod).

[0094] It should be noted that for debug paths, since this application introduces the concept of network requests, using "path" as the name to represent the method is easier to understand. However, other names for "path" are also possible and are not limited in this application. To further improve program readability, the format of "path" can also be agreed upon, describing the path by module and function, which is clear and understandable, improving readability.

[0095] The request type (header) is used to mark the type of request, such as get (GET), set (SET), etc. It can also be customized to indicate the intention of the request. This application does not limit this.

[0096] Debug parameters (params) refer to the parameters of the actual request method (method).

[0097] In one possible implementation, a mock interceptor may be used to simulate the debugging service provider's debugging parameters (params) based on a simulation method (method) corresponding to a debugging path (path), and obtain debugging simulation data corresponding to a request type (header) as debugging simulation data for the debugging service provider.

[0098] In another possible implementation, a debugging request including a debugging path, a request type, and debugging parameters may be encapsulated, thereby further improving the usability of the cross-platform application debugging method of the present application.

[0099] Optional, in the above Figure 1 Based on this, the present application also provides a possible implementation of a cross-platform application debugging method. Figure 2A flowchart of a cross-platform application debugging method provided in another embodiment of the present application; Figure 2 As shown, the method includes:

[0100] Step 201: If simulation is not performed, a debugging service method is called based on the debugging request, and the debugging service provider generates a business debugging result based on the debugging request.

[0101] In a possible implementation, if simulation is not performed, a debugging service method is called to a debugging service provider (ie, a service provider) according to a debugging request. The debugging service provider generates a service debugging result corresponding to the debugging request based on the debugging request.

[0102] In one possible implementation, service debugging results can be encapsulated using ChannelResponse and ResultHandler. This restricts the return format to JSON, unifies the protocol, and provides data parsing encapsulation. ChannelResponse encapsulates the response, encapsulating the service debugging results returned upon communication completion. ResultHandler encapsulates the Result parameter in onMethodCall and is used for ChannelServer to return data. The data returned in ResultHandler adheres to the JSON format. In other words, ResultHandler assists in encapsulating service debugging results.

[0103] Step 202: If the service debugging result from the debugging service provider is intercepted, the service debugging result is returned to the debugging requester.

[0104] If the interceptor (ie, the simulated interceptor) intercepts the service debugging result from the debugging service provider, it returns the service debugging result to the debugging requester.

[0105] It should be noted that when the interceptor returns the business debugging result to the debugging requester, it can be forwarding the business debugging result or forwarding the business debugging result after processing. This application does not limit this.

[0106] Optional, in the above Figure 2 Based on this, the present application also provides a possible implementation of a cross-platform application debugging method, in which the debugging service provider generates a service debugging result based on the debugging request, including:

[0107] The debugging service provider processes the debugging request based on the debugging parameters and debugging path, and obtains the business debugging result corresponding to the request type.

[0108] The debugging service provider calls the method corresponding to the debugging path and runs the method corresponding to the debugging path based on the debugging parameters to obtain the service debugging result corresponding to the request type. The specific meanings of the debugging parameters (params), debugging path (path), and request type are the same as those of the debugging parameters and debugging path in the above embodiment and are not further described in this application.

[0109] Thereafter, the service debugging result for the preset cross-platform application is returned to the debugging requester.

[0110] The above is only an example. In actual implementation, there may be other implementation methods, which are not limited in this application.

[0111] Optional, in the above Figure 2 Based on this, the present application also provides a possible implementation of a cross-platform application debugging method, which returns the service debugging results to the debugging requester, including:

[0112] If the service debugging result indicates that the service debugging is successful, the service debugging result is returned to the debugging requester.

[0113] In one possible implementation, the interceptor analyzes the service debugging result intercepted from the debugging service provider. If the service debugging result indicates that the service debugging is successful, the service debugging result is returned to the debugging requester. If the service debugging result indicates that the debugging requester does not have a matching service logic, the present application also provides a possible implementation of the cross-platform application debugging method. Figure 3 This is a flowchart of a cross-platform application debugging method provided by another embodiment of the present application; Figure 3 As shown, the method includes:

[0114] Step 301: If the service debugging result indicates that the debugging requester does not have a matching service logic, the service debugging parameter is simulated on the debugging service side to obtain second debugging simulation data of the debugging service side.

[0115] In one possible implementation, if the service debugging result indicates that the debugging requester does not have matching service logic (that is, the service provider does not find a corresponding method based on the debugging path), a simulation interceptor is used to simulate the service provider's debugging parameters to obtain second debugging simulation data for the service provider. The simulation interceptor simulates the service provider's debugging parameters to obtain the second debugging simulation data in a similar manner to the simulation interceptor's acquisition of the first debugging simulation data, and this application will not elaborate on this further.

[0116] Step 302: Return second debugging simulation data for the preset cross-platform application to the debugging requester.

[0117] After the simulation is completed, second debugging simulation data for the preset cross-platform application is returned to the debugging requester.

[0118] Optionally, based on the above embodiments, this application also provides a possible implementation of a cross-platform application debugging method, which binds the debugging path (path) to the request abstract class (RequestHandler) in the debugging request to improve scalability. RequestHandler is an abstract class for processing requests, which is used by the service side (ChannelServer) to process request services:

[0119] For example, a Map can be maintained in the server (ChannelServer)<String, RequestHandLer> String corresponds to the path, and RequestHandLer corresponds to the specific business implementation. By binding the path and RequestHandLer using the registration method, you can dynamically add or delete business processing logic.

[0120] For another example, when the requester (ChannelClient) initiates a request, the corresponding path is passed in as agreed, and the corresponding RequestHandler can be called to implement the corresponding business.

[0121] The above is only an example. In actual implementation, there may be other ways, which are not limited in this application.

[0122] Optionally, based on the above embodiments, this application also provides a possible implementation of a cross-platform application debugging method. Figure 4 A flowchart of a cross-platform application debugging method provided in one embodiment of the present application; Figure 5 This is a call sequence diagram of a cross-platform application debugging method provided by an embodiment of the present application; Figure 4 、 Figure 5 As shown:

[0123] The service provider first registers RequestHandler to handle the request business.

[0124] After the service party initiates a debugging request, the simulator intercepts it according to the debugging request (i.e., executes the business and log interceptors to intercept the request). If the debugging request is simulated, the mock interceptor is matched to simulate the service party's data and returns the simulated data (first debugging simulation data) to the requester.

[0125] If the debugging request is not simulated, the debugging request will be forwarded to the service provider. The service provider will parse the debugging path and match the RequestHandLer according to the debugging path. If a RequestHandLer is matched, the specific business logic of the RequestHandLer will be executed and the business debugging result will be returned.

[0126] If no RequestHandler is matched, a failure message is returned (information indicating that there is no matching business logic for the debug requester). After the interceptor intercepts the failure message, it can be used to simulate the debug request and return the simulated data (second debug simulation data) to the requester. After the interceptor intercepts the failure message, it can also directly return the failure message to the requester.

[0127] The following describes the cross-platform application debugging device, electronic device, storage medium, etc. provided in this application. The specific implementation process and technical effects are described above and will not be repeated below.

[0128] The embodiments of the present application provide a possible implementation example of a cross-platform application debugging device, which can execute the cross-platform application debugging method provided in the above embodiments. Figure 6 This is a schematic diagram of a cross-platform application debugging device provided by an embodiment of the present application. Figure 6 As shown, the cross-platform application debugging device 100 includes: a judgment module 61, a simulation module 63, and a return module 65;

[0129] The judgment module 61 is used to determine whether to simulate the debugging request if a debugging request for a preset cross-platform application from a debugging requester is intercepted, wherein the debugging request includes: business debugging parameters;

[0130] The simulation module 63 is configured to simulate the service debugging parameters of the debugging service party if simulation is performed, and obtain first debugging simulation data of the debugging service party;

[0131] The returning module 65 is configured to return first debugging simulation data for the preset cross-platform application to the debugging requester.

[0132] Optionally, the debugging request further includes: indication information, a simulation module 63, for simulating the debugging service provider by using a simulation interceptor to simulate the service debugging parameters, and obtaining first debugging simulation data of the debugging service provider.

[0133] Optionally, the business debugging parameters include: debugging path, request type and debugging parameters; the simulation module 63 is used to use a simulation interceptor to simulate the debugging service party's debugging parameters based on the simulation method corresponding to the debugging path, and obtain the debugging simulation data corresponding to the request type as the first debugging simulation data of the debugging service party.

[0134] Optionally, the cross-platform application debugging device 100 further includes: a processing module, a return module;

[0135] A processing module, configured to call a debugging service method based on a debugging request if simulation is not performed, and generate a business debugging result based on the debugging request by the debugging service provider;

[0136] The return module is used to return the service debugging result to the debugging requester if the service debugging result from the debugging service provider is intercepted.

[0137] Optionally, a processing module is used for the debugging service provider to process the debugging request based on the debugging parameters and the debugging path, and obtain a business debugging result corresponding to the request type.

[0138] Optionally, the return module is configured to return the service debugging result to the debugging requester if the service debugging result indicates that the service debugging is successful.

[0139] Optionally, a processing module is configured to simulate the debugging service side on the business debugging parameters to obtain second debugging simulation data of the debugging service side if the business debugging result indicates that the debugging request side does not have matching business logic;

[0140] The returning module is configured to return second debugging simulation data for the preset cross-platform application to the debugging requester.

[0141] The above-mentioned device is used to execute the method provided in the above-mentioned embodiment. Its implementation principle and technical effect are similar and will not be repeated here.

[0142] The above modules can be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), one or more digital singnal processors (DSPs), or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented by scheduling program code through a processing element, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0143] An embodiment of the present application provides a possible implementation example of an electronic device that can execute the cross-platform application debugging method provided in the above embodiment. Figure 7 A schematic diagram of an electronic device provided in an embodiment of the present application, which can be integrated into a terminal device or a chip of a terminal device, and the terminal can be a computing device with data processing capabilities.

[0144] The electronic device includes a processor 701, a storage medium 702, and a bus. The storage medium stores program instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the program instructions to perform the steps of the cross-platform application debugging method described above. The specific implementation methods and technical effects are similar and will not be repeated here.

[0145] An embodiment of the present application provides a possible implementation example of a computer-readable storage medium, which can execute the cross-platform application debugging method provided in the above embodiment. The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above cross-platform application debugging method are executed.

[0146] A computer program stored in a storage medium may include instructions for causing a computer device (such as a personal computer, server, or network device) or a processor to perform some of the steps of the methods of various embodiments of the present invention. Such storage media include various media capable of storing program code, such as USB flash drives, removable hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.

[0147] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0148] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0149] In addition, the functional units in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional units.

[0150] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor (English: processor) to perform some steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (English: Read-Only Memory, abbreviated: ROM), a random access memory (English: Random Access Memory, abbreviated: RAM), a magnetic disk or an optical disk, and other media that can store program code.

[0151] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A cross-platform application debugging method, characterized in that: The method comprises: If a debugging request for a preset cross-platform application from a debugging requester is intercepted by a simulation interceptor, determining whether the debugging request is to be simulated, wherein the debugging request includes: a business debugging parameter; If simulation is performed, the service debugging parameter is simulated by the debugging service party to obtain first debugging simulation data of the debugging service party; Returning first debugging simulation data for the preset cross-platform application to the debugging requester; The debugging request further includes: indication information, the indication information being used to determine whether the debugging request is to be simulated. If simulation is to be performed, the service debugging parameter is simulated by the debugging service party to obtain first debugging simulation data of the debugging service party, including: If simulation is performed, the simulation interceptor is used to simulate the debugging service side on the business debugging parameter to obtain first debugging simulation data of the debugging service side; The service debugging parameters include: a debugging path, a request type, and debugging parameters; wherein the debugging path refers to a method parameter for initiating a calling method in a communication method; simulating the debugging service party on the service debugging parameters to obtain first debugging simulation data of the debugging service party includes: The simulation interceptor is used to simulate the debugging service side on the debugging parameters based on the simulation method corresponding to the debugging path, and the debugging simulation data corresponding to the request type is obtained as the first debugging simulation data of the debugging service side.

2. The method according to claim 1, wherein The method further comprises: If no simulation is performed, the debugging service method is called based on the debugging request, and the debugging service provider generates a service debugging result based on the debugging request; If the service debugging result from the debugging service provider is intercepted, the service debugging result is returned to the debugging requester.

3. The method according to claim 2, wherein The debugging service provider generates a service debugging result based on the debugging request, including: The debugging service provider processes the debugging request based on the debugging parameters and the debugging path, and obtains a service debugging result corresponding to the request type.

4. The method according to claim 2, wherein The returning the service debugging result to the debugging requester includes: If the service debugging result indicates that the service debugging is successful, the service debugging result is returned to the debugging requester.

5. The method according to claim 2, wherein The method further comprises: If the service debugging result indicates that the debugging requester does not have a matching service logic, simulating the debugging service provider on the service debugging parameter to obtain second debugging simulation data of the debugging service provider; Returning second debugging simulation data for the preset cross-platform application to the debugging requester.

6. A cross-platform application debugging device, characterized in that: The device includes: a judgment module, a simulation module, and a return module; The judgment module is configured to determine whether to simulate a debugging request for a preset cross-platform application from a debugging requester if a simulation interceptor is used to intercept the debugging request, wherein the debugging request includes: a business debugging parameter; The simulation module is configured to simulate the debugging service provider on the service debugging parameters to obtain first debugging simulation data of the debugging service provider; The returning module is configured to return first debugging simulation data for the preset cross-platform application to the debugging requester; The debugging request further includes: indication information, the indication information being used to determine whether the debugging request is to be simulated; the simulation module being specifically configured to: if simulation is to be performed, simulate the debugging service side on the business debugging parameter using the simulation interceptor to obtain first debugging simulation data of the debugging service side; The business debugging parameters include: a debugging path, a request type, and debugging parameters, wherein the debugging path refers to the method parameters used to initiate the calling method in the communication method; the simulation module is specifically used to: use the simulation interceptor to simulate the debugging service party on the debugging parameters based on the simulation method corresponding to the debugging path, and obtain the debugging simulation data corresponding to the request type as the first debugging simulation data of the debugging service party.

7. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the program instructions to perform the steps of the cross-platform application debugging method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that The storage medium stores a computer program, which, when executed by a processor, executes the steps of the cross-platform application debugging method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Test method and device, electronic equipment and storage medium

    CN112650689A

  • Environment and method for cross-platform development of software applications

    US20130205277A1