Small program simulation debugging method and device, equipment, storage medium and product
By judging the running environment of the applet and obtaining the simulation data in the preset applet simulator, the problem that the existing applet simulation and debugging methods are difficult to adapt to development needs is solved, and the accuracy and efficiency of debugging are improved.
Patent Information
- Application Number
- CN202510279473.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-03-10
AI Technical Summary
The existing mini program simulation and debugging methods are difficult to adapt to different development needs, and the debugging accuracy and efficiency are inefficient.
When receiving the user's debugging request, determine whether the running environment where the applet is located is a computer browser environment; if it is a computer browser environment, the simulation data in the preset applet emulator will be obtained based on the debugging request, and simulate and debug through the applet based on the simulation data.
This method can better adapt to different development needs, reduce debugging errors caused by environmental differences through flexible simulation data configuration, and improve debugging accuracy and efficiency.
Smart Images

Figure CN120216341A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of software development, and in particular, to a method, device, equipment, storage medium and product for simulating and debugging mini-programs. Background Technique
[0002] The architecture of mobile applications (APPs) is transforming towards mini-programs, that is, the functional modules in the application also support being presented in the form of mini-programs without the need to jump to mini-programs on other platforms. Each mini-program application is a relatively independent functional module. For example: finance, insurance, etc. The mini-programs running in the APP are relatively independent, can be iterated and released independently, and can be put on and taken off the shelves without being affected by the mobile APP. Some are even mini-program applications of other platform entities running in the mobile APP.
[0003] The existing debugging method builds an emulator with the same communication architecture as the running environment of the real client, compiles the mini-program in the emulator, and simulates the running of the mini-program in the emulator based on the communication architecture and the compilation result, so as to simulate the running effect on the real client. However, this debugging method depends on the communication architecture and memory cache inside the emulator, the debugging environment is relatively closed, it is difficult to quickly adjust the debugging conditions, and it is difficult to meet the different development needs of developers, resulting in problems of low accuracy and efficiency in developer debugging. Summary of the Invention
[0004] The main purpose of this application is to provide a method, device, equipment, storage medium and product for simulating and debugging mini-programs, aiming to solve the technical problems that the existing mini-program emulator is difficult to adapt to different development needs and has low accuracy and efficiency in debugging.
[0005] To achieve the above object, this application proposes a method for simulating and debugging mini-programs, and the method includes:
[0006] When receiving a debugging request from a user, determine whether the running environment where the mini-program is located is a computer browser environment;
[0007] If it is a computer browser environment, obtain the simulation data in the preset mini-program emulator according to the debugging request, and the simulation data is data configured according to the debugging requirements;
[0008] Perform simulation debugging through the mini-program according to the simulation data.
[0009] In one embodiment, the step of determining whether the running environment where the mini-program is located is a computer browser environment when receiving a debugging request from a user includes:
[0010] When receiving a debugging request from a user, parse the debugging request to obtain running environment identification information, where the running environment identification information includes a user agent string and / or a device screen size;
[0011] Call a preset device control interface to obtain a call feedback result;
[0012] Determine whether the running environment where the applet is located is a computer browser environment based on the running environment identification information and the call feedback result.
[0013] In one embodiment, before the step of determining whether the running environment where the applet is located is a computer browser environment when receiving a debugging request from a user, the method further includes:
[0014] Set a debugging button on the page of the computer browser;
[0015] When detecting that the user clicks the debugging button, display a debugging function list, where the debugging function list includes a simulated shake function, a simulated Wi-Fi signal, and / or a simulated mobile physical back key;
[0016] Configure simulation data in a preset applet simulator, where the simulation data includes multi-dimensional parameter values of the shake function, network data, and / or target page parameters, the multi-dimensional parameter values of the shake function include intensity, amplitude, and direction, and the network data includes a network signal environment, a network signal strength, a signal fluctuation range, and a network type.
[0017] In one embodiment, the step of, if it is a computer browser environment, obtaining the simulation data in the preset applet simulator according to the debugging request includes:
[0018] If it is a computer browser environment, when the debugging request includes a click on the simulated shake function request and a shake function requirement, determine a target shake parameter from the multi-dimensional parameter values of the shake function in the preset applet simulator according to the shake function requirement, where the shake function requirement includes any one of an intensity requirement, an amplitude requirement, and a direction requirement;
[0019] When the debugging request includes a click on the simulated Wi-Fi signal and a simulation network requirement, determine target network data from the network data in the preset applet simulator according to the simulation network requirement, where the simulation network requirement includes any one of a network signal environment requirement, a network signal strength requirement, a signal stability requirement, and a network type requirement;
[0020] When the debugging request is a click on the simulated mobile physical back key, obtain the target page parameters in the preset applet simulator.
[0021] In one embodiment, before the step of determining whether the running environment where the applet is located is a computer browser environment when receiving a debugging request from a user, the following steps are further included:
[0022] Configure the simulation data in the JSON configuration file corresponding to the preset applet simulator, where the simulation data includes at least one of an interface name, an interface description, simulation parameters, and a simulation return value.
[0023] In one embodiment, the step of, if it is a computer browser environment, obtaining the simulation data in the preset applet simulator according to the debugging request includes:
[0024] If it is a computer browser environment, determine the simulation data in the JSON configuration file according to the debugging request, the interface name, and the interface description, and obtain the simulation parameters and the simulation return value in the simulation data.
[0025] In addition, to achieve the above object, the present application further provides an applet simulation debugging device, where the applet simulation debugging device includes:
[0026] A running environment judgment module, configured to determine whether the running environment where the applet is located is a computer browser environment when receiving a debugging request from a user;
[0027] A simulation data acquisition module, configured to, if it is a computer browser environment, obtain the simulation data in the preset applet simulator according to the debugging request, where the simulation data is data configured according to debugging requirements;
[0028] A simulation debugging module, configured to perform simulation debugging through the applet according to the simulation data.
[0029] In addition, to achieve the above object, the present application further provides an applet simulation debugging device, where the device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the applet simulation debugging method as described above.
[0030] In addition, to achieve the above object, the present application further provides a storage medium, where the storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of the applet simulation debugging method as described above are implemented.
[0031] In addition, to achieve the above object, the present application further provides a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the applet simulation debugging method as described above are implemented.
[0032] The present application provides a method for simulating and debugging applets. When a debugging request from a user is received, it is determined whether the operating environment where the applet is located is a computer browser environment. If it is a computer browser environment, simulation data configured according to debugging requirements is obtained from a preset applet simulator based on the debugging request. The applet performs simulation debugging based on the simulation data. Since the present application determines the operating environment where the applet is located, when it is determined to be a browser environment, a preset applet simulator is called, and simulation data configured according to debugging requirements is obtained from the simulator based on the debugging request. By obtaining simulation data corresponding to debugging requirements, it can better adapt to different development requirements. Flexible simulation data configuration reduces debugging errors caused by environmental differences and improves the accuracy and efficiency of debugging. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings herein are incorporated into and constitute a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0035] Figure 1 It is a schematic flowchart provided for Embodiment 1 of the method for simulating and debugging applets of the present application;
[0036] Figure 2 It is a schematic overall flowchart of the method for simulating and debugging applets of the present application;
[0037] Figure 3 It is a schematic flowchart provided for Embodiment 2 of the method for simulating and debugging applets of the present application;
[0038] Figure 4 It is a schematic module structure diagram of the applet simulation debugging device for the embodiments of the present application;
[0039] Figure 5 It is a schematic device structure diagram of the hardware operating environment involved in the method for simulating and debugging applets for the embodiments of the present application.
[0040] The implementation, functional features, and advantages of the objectives of the present application will be further described in conjunction with the embodiments with reference to the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0041] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0042] To better understand the technical solution of this application, the following will be described in detail in conjunction with the accompanying drawings of the specification and specific embodiments.
[0043] The main solution of the embodiment of this application is: when receiving a user's debugging request, determine whether the running environment where the applet is located is a computer browser environment; if it is a computer browser environment, obtain simulation data in a preset applet simulator according to the debugging request; and perform simulation debugging by the applet according to the simulation data.
[0044] Since the existing debugging method builds a simulator with the same communication architecture as the running environment of the real client, compiles the applet in the simulator, and simulates the running of the applet in the simulator based on the communication architecture and the compilation result, so as to simulate the running effect on the real client. However, this debugging method depends on the communication architecture and memory cache inside the simulator, the debugging environment is relatively closed, it is difficult to quickly adjust the debugging conditions, and it is difficult to meet the different development needs of developers, resulting in problems of low accuracy and efficiency in developer debugging.
[0045] This application provides a solution. When receiving a user's debugging request, determine whether the running environment where the applet is located is a computer browser environment; if it is a computer browser environment, obtain the simulation data configured according to the debugging requirements in a preset applet simulator according to the debugging request; and perform simulation debugging by the applet according to the simulation data. Since this application determines the running environment where the applet is located, when it is determined to be a browser environment, it calls a preset applet simulator configured in advance, obtains the simulation data configured according to the debugging requirements from the simulator according to the debugging request, and by obtaining the simulation data corresponding to the debugging requirements, it can better meet different development needs, and the flexible simulation data configuration reduces debugging errors caused by environmental differences and improves the accuracy and efficiency of debugging.
[0046] It should be noted that the execution subject of the method in this embodiment can be a computing service device with functions of applet simulation debugging, network communication, and program running, such as a tablet computer or a personal computer, and an applet is installed in the computing service device; it can also be an applet simulation debugging device with the same or similar functions. This embodiment and the following embodiments will be described by taking the applet simulation debugging device as an example.
[0047] Based on this, the embodiment of this application provides a method for applet simulation debugging, referring to Figure 1 , Figure 1 which is a schematic flowchart of the first embodiment of the method for applet simulation debugging of this application.
[0048] In this embodiment, the method for applet simulation debugging includes steps S10 to S30:
[0049] Step S10, when receiving a debugging request from a user, determine whether the running environment where the mini-program is located is a computer browser environment.
[0050] It should be noted that the mini-program can be a program that can run independently in an application, such as a mini-program in a mobile banking APP or a mini-program in a housing transaction APP on a mobile phone, etc., without limitation here. During the process of developing the functions in the mini-program, after the code modification is completed, debugging is required to verify the implementation of the functions. When developers need to debug the code, they make a debugging request, which can be a debugging request corresponding to operations such as obtaining location information, performing vibrations, or viewing the photo album. In the underlying code of the mini-program API, the API corresponding to the debugging request is called.
[0051] It can be understood that an error will occur if the code is directly compiled and run in a computer browser. Usually, page preview debugging is performed on the APP of a real mobile phone device. However, it is rather cumbersome to open the mobile phone APP for preview every time the code is modified. Therefore, a mini-program simulator can be built in a computer browser to first determine whether the current running environment of the mini-program is a computer browser environment.
[0052] In a feasible implementation manner, in step S10, the mini-program simulation debugging method further includes steps S101 to S103:
[0053] Step S101, when receiving a debugging request from a user, parse the debugging request to obtain running environment identification information, where the running environment identification information includes a user agent string and / or a device screen size.
[0054] It should be noted that determining whether the running environment is a PC browser or a real mobile phone environment can be achieved in various ways. When generating a debugging request from a user, the running environment identification information will be carried in it. The running environment identification information can include information such as a user agent string (User-Agent string) or a device screen size. By parsing the debugging request, the above-mentioned identification information for distinguishing between a mobile phone and a computer can be obtained.
[0055] It can be understood that the User-Agent string contains information such as the client's operating system, browser type, and browser version. By parsing the User-Agent string, it can be determined whether the request comes from a PC browser or a mobile device. For example, the User-Agent of a PC browser usually contains words such as "Windows" and "Macintosh", while the User-Agent of a real mobile phone will contain words such as "Android" and "iPhone".
[0056] It should be understood that the operating environment can also be determined by the screen size characteristics of the device. Obtain information such as the screen width and height of the device. For example, the screen size of a PC browser is usually large, while the screen size of a mobile device is small. It can be determined whether it is a mobile device by detecting whether the screen width and height are less than a certain threshold (such as the width is less than 768px).
[0057] Step S102, call the preset device control interface to obtain the call feedback result.
[0058] It can be understood that considering that in the real device environment, some APIs (such as location, vibration, camera, etc.) are available, while these APIs are not available in the PC browser. Therefore, it is possible to try to call the above-mentioned APIs that are only available in the real device environment. If the call is successful, it is determined as the real device environment; if the call fails or an error is returned, it is determined as the PC browser environment.
[0059] Step S103, determine whether the operating environment where the applet is located is the PC browser environment based on the operating environment identification information and the call feedback result.
[0060] It should be noted that considering that the call feedback result cannot fully and accurately ensure accurate environment identification, and there are cases where API calls in the real device environment are abnormal, it cannot be directly determined that it is the PC browser environment. Therefore, here the operating environment identification information and the call feedback result are combined for judgment. Only when both parties determine that it is the PC browser environment, is it determined whether the operating environment where the applet is located is the PC browser environment, which can improve the accuracy of operating environment determination and thus improve the efficiency of developer function debugging.
[0061] It can be understood that since page preview is involved in applet development to view the page effect, it is possible to connect to the APP of a real mobile device (such as a mobile phone) for page preview debugging, directly call the applet API capabilities of the real device for debugging, making the debugging results more accurate. The overall process of the applet simulation debugging method in this embodiment can be referred to Figure 2 as shown. When the user needs to debug, if it is determined that the operating environment is the real device environment of the mobile terminal, the debugging interface of the mobile terminal can be directly called, and the mobile terminal can feedback real and diverse real device debugging data, which can make the debugging results more accurate.
[0062] Step S20, if it is the PC browser environment, obtain the simulation data in the preset applet simulator according to the debugging request, and the simulation data is data configured according to the debugging requirements.
[0063] It is understandable that a mini-program can directly preview pages in a Personal Computer (PC) browser, simulate the real device environment, and improve development efficiency. A mini-program simulator environment based on the PC browser can be pre-constructed. By embedding a set of mini-program interface simulation (API Mock) capabilities at the code bottom layer. When running a project, if it is determined that the running environment of the mini-program under current development and debugging is the PC browser environment, the relevant mini-program API for debugging requests will not pass the API parameters to the mobile real device APP, but directly call the Mock interface to obtain the pre-configured Mock simulation data, and the mini-program API will return the obtained simulation data to the mini-program for debugging. Among them, the Mock simulation data is the simulation data pre-configured according to the developer's debugging requirements. The developer can flexibly configure the simulation data according to different debugging requirements (such as different network states, user behaviors, device parameters, etc.), so as to achieve more flexible debugging. This flexibility enables developers to better simulate various real scenarios and improve the accuracy and efficiency of debugging.
[0064] It should be noted that the preset mini-program simulator in this embodiment not only simulates the built-in mini-program API, but also supports simulating and configuring custom APIs.
[0065] Step S30, the mini-program performs simulation debugging according to the simulation data.
[0066] It should be understood that if the mini-program is running in the PC browser, the mini-program API directly calls Mock to obtain the pre-configured simulation data, and then the mini-program performs real device simulation testing through the obtained simulation data. Similarly, debugging work similar to the real device environment can be achieved on the browser side, helping developers improve the debugging and development efficiency.
[0067] This embodiment provides a mini-program simulation debugging method. When receiving a user's debugging request, it is determined whether the running environment where the mini-program is located is the PC browser environment; if it is the PC browser environment, the simulation data configured according to the debugging requirements in the preset mini-program simulator is obtained according to the debugging request; the mini-program performs simulation debugging according to the simulation data. Since this embodiment determines the running environment where the mini-program is located, when it is determined to be the browser environment, the pre-configured preset mini-program simulator is called, and the simulation data configured according to the debugging requirements is obtained from the simulator according to the debugging request. By obtaining the simulation data corresponding to the debugging requirements, it can better adapt to different development requirements. The flexible simulation data configuration reduces debugging errors caused by environmental differences and improves the accuracy and efficiency of debugging.
[0068] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar content as in the above-mentioned first embodiment can be referred to the above introduction and will not be repeated hereinafter. On this basis, please refer to Figure 3 , the simulation data includes at least one of an interface name, an interface description, simulation parameters, and a simulation return value; before step S10, the mini-program simulation debugging method further includes step S01:
[0069] Step S01, configure the simulation data in a JSON configuration file corresponding to a preset mini-program simulator.
[0070] It can be understood that a set of mini-program API Mock capabilities can be placed at the code bottom layer. A mock data JSON file of a mini-program API can be configured in advance, and the content of the JSON file is as follows: The main information includes the API name, description, parameters and return values of the API Mock. JSON (JavaScript Object Notation) is a lightweight data exchange format with a concise syntax, easy for humans to read and write. It can be directly parsed and generated by front-end scripting languages, which greatly simplifies the data interaction between the front end and the back end. And the JSON format supports multiple programming languages, which enables seamless transmission and sharing of data between different development environments and platforms.
[0071] It should be understood that when the mini-program runs on a PC simulator, the simulation data of various APIs can be flexibly configured in the configuration panel, and the simulator supports the Mock configuration of network request interfaces and uniformly returns the configured interface data. For example, the simulation data can be the longitude and latitude of simulated positioning, the frequency of mobile phone vibration, the pictures returned by the camera / photo album, the strength of the network signal, memory warning, screenshot, switching to the background, simulation of user login data, etc.
[0072] In a feasible implementation manner, before step S10, the mini-program simulation debugging method further includes steps S02 to S04:
[0073] Step S02, set a debug button on the page of the computer browser.
[0074] It should be noted that in addition to configuring the simulation data in the JSON file, in the PC browser environment, a debug button is also preset and displayed on the page in this embodiment for interacting with the user.
[0075] Step S03, when it is detected that the user clicks the debug button, display a debug function list, and the debug function list includes a simulated shake function, a simulated wireless local area network signal, and / or a simulated mobile physical return key.
[0076] It can be understood that when it is detected that the user clicks the debug button, a function list for simulating a real device can be brought up, and the list can include functions such as simulating the shake function, simulating the wireless local area network signal, and / or simulating the physical back button of the mobile terminal.
[0077] Step S04, configure simulation data in a preset mini-program simulator, where the simulation data includes multi-dimensional parameter values of the shake function, network data, and / or target page parameters. The multi-dimensional parameter values of the shake function include intensity, amplitude, and direction, and the network data includes network signal environment, network signal strength, signal fluctuation range, and network type.
[0078] It should be understood that after setting the debug function list, the parameters to be returned for each function can be set accordingly. For example, the multi-dimensional parameter values of the shake function corresponding to the simulated shake function, the network data corresponding to the simulated wireless local area network signal, and the target page parameters corresponding to the simulated physical back button of the mobile terminal, etc. Among them, the multi-dimensional parameter values of the shake function can include intensity, amplitude, and direction, and the network data can include network signal environment, network signal strength, signal fluctuation range, and network type.
[0079] In a feasible implementation manner, step S20 may include step S201:
[0080] Step S201, if it is a computer browser environment, determine the simulation data in the JSON configuration file according to the debug request, the interface name, and the interface description, and obtain the simulation parameters and the simulation return value in the simulation data.
[0081] It can be understood that when developers need to debug code, in the underlying code of the mini-program API, they call the API corresponding to the debug request to detect and judge the current running environment. If it is a PC browser environment, they follow the API Mock logic to obtain the Mock data configured in the JSON configuration file in advance. When searching, to improve accuracy and efficiency, the function to be debugged can be determined through the debug request, and then the corresponding interface name and interface description can be found in the configuration file according to the function, and then the corresponding simulation parameters and simulation return value can be determined and returned to the mini-program for debugging.
[0082] In this implementation manner, the function to be debugged can be determined through the debug request, and then the corresponding interface name and interface description can be found in the configuration file according to the function, so that the simulation data required by the user can be more accurately matched. Then, the simulation parameters and the simulation return value in the simulation data are returned to the mini-program, and the mini-program performs simulation debugging through the simulation parameters and the simulation return value.
[0083] In a feasible implementation manner, step S20 may include steps S202 to S204:
[0084] Step S202, if it is a computer browser environment, when the debugging request includes a click on the simulated shake function request and the shake function requirements, determine the target shake parameters from the shake multi-dimensional parameter values in the preset applet simulator, where the shake function requirements include any one of intensity requirements, amplitude requirements, and direction requirements.
[0085] It should be noted that the debugging request can carry the function requests and function requirements that the developer needs to debug. If the developer wants to test the shake function, the debugging request includes a click on the simulated shake function request and the shake function requirements. Then, the target shake parameters can be determined from the shake multi-dimensional parameter values in the preset applet simulator.
[0086] It can be understood that the shake multi-dimensional parameter values include multiple dimensions, and the process of determining the target shake parameters is as follows. For example, by analyzing the shake function requirements, determine the frequency range of different shake operations. For example, rapid shaking, slow shaking, etc. correspond to different frequency intervals. A configurable frequency parameter can be determined based on the requirements analysis, and this parameter can be adjusted within a certain reasonable range to simulate the frequency of the shake operation corresponding to the requirement. For example, the frequency corresponding to rapid shaking may be set to 2 - 3 Hz, and the frequency corresponding to slow shaking may be set to 0.5 - 1 Hz.
[0087] It can be understood that if the function requirement is to consider the influence of the amplitude of the shake on triggering. On a real device, shakes with different amplitudes may produce different effects or trigger different functions. In the simulator, an amplitude threshold parameter can be determined. When the amplitude of the simulated shake exceeds this threshold, it is regarded as a valid shake operation. This threshold can be determined according to the actual requirements of the applet APP and the sensing sensitivity of common devices.
[0088] It should be understood that if the direction parameter of the shake is clearly defined in the function requirement, such as horizontal direction, vertical direction, or mixed direction. On the computer side, different directions of shaking are simulated through mouse or keyboard events, and it is determined whether the trigger condition of the shake is met according to the determined direction parameter.
[0089] It can be understood that by the above method, the parameters of shaking can be controlled more precisely, which is convenient for testing various boundary conditions and abnormal scenarios. For example, during the development process, a very weak shaking signal can be simulated to see whether the APP can correctly handle such a situation close to the critical value, so as to optimize the stability and reliability of the function. This helps to unify the shaking experience among different devices. There may be differences in the shaking induction of different real devices. By uniformly simulating parameters in the emulator, the consistency of the function can be ensured during the development and testing stages, and problems caused by device differences can be reduced.
[0090] Step S203: When the debugging request includes clicking the simulated Wi-Fi signal and the simulated network requirements, determine the target network data from the network data in the preset mini-program emulator according to the simulated network requirements, where the simulated network requirements include any one of network signal environment requirements, network signal strength requirements, signal stability requirements, and network type requirements.
[0091] It should be noted that if the developer wants to simulate the network, the debugging request can include clicking the simulated Wi-Fi signal and the simulated network requirements. Then the target network data can be determined from the network data in the preset mini-program emulator according to the simulated network requirements.
[0092] It should be understood that the network signal environment can represent the strength of the signal environment, and there are significant differences in terms of speed, latency, application scenarios, network architecture, etc. For example, 3G, 4G, or 5G, etc., represent different network signal environments.
[0093] It can be understood that in the real device environment, the Wi-Fi signal strength is usually expressed in dBm (decibel milliwatt). In the emulator, the network signal strength is pre-configured as a variable signal strength parameter, and its value range should cover the common signal strength intervals from weak to strong. For example, from -90dBm to -40dBm, where -90dBm represents a very weak signal and -40dBm represents a relatively strong signal. This parameter can be adjusted according to the actual test requirements to simulate different network environments.
[0094] It should be understood that the impact of signal stability on the functions of the mobile banking APP is considered. The signal fluctuation range is pre-configured as a fluctuation parameter to simulate the instability degree of the signal, such as randomly fluctuating the signal strength within a certain range. The frequency and amplitude of the fluctuation can also be used as configurable parameters.
[0095] It can be understood that the network type parameter can clearly distinguish different wireless local area network types, such as the 2.4GHz frequency band and the 5GHz frequency band. There are differences in transmission speed, penetration, etc. between these two frequency bands, which may affect the network function of the APP. In the simulator, by setting the network type parameter, the performance of the APP under different frequency band networks can be simulated.
[0096] It can be understood that if the simulated network requirement is to support a high-intensity and stable network, the network signal environment can be determined as the highest-level environment (for example, the current highest-level 5G network), a relatively high value can be set for the network signal strength (this value can be flexibly set according to the actual situation), the fluctuation range of the signal can be set (for example, it fluctuates 1-2 times per second, and the fluctuation amplitude is ±5dBm), and by setting the network type parameter, the performance of the APP under different frequency band networks can be simulated, improving the accuracy and comprehensiveness of debugging.
[0097] Step S204, when the debugging request is to click the simulated physical back key of the mobile terminal, obtain the target page parameter in the preset applet simulator.
[0098] It should be understood that when the user clicks the simulated physical back key of the mobile terminal, the target page parameter can be returned. For example, it can return to the previous page, the home page, or exit the applet, etc.
[0099] In this embodiment, in the interface configuration, the user can send a debugging request by clicking the corresponding function button. Multiple function buttons are configured, and each function button returns the corresponding parameter data when clicked, making the configuration more flexible and improving the debugging efficiency of developers.
[0100] In this embodiment, by pre-configuring the JSON file corresponding to the applet simulator, simulation data such as interface names, interface descriptions, simulation parameters, and simulation return values are configured in the configuration file. Thus, when the simulator is called, the simulated data can be returned for the simulation debugging of the applet. And in the form of a JSON file, it is easy to read, write, and parse, which can improve the efficiency of code maintenance and debugging.
[0101] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the applet simulation debugging method of this application. Based on this technical concept, more forms of simple transformations are within the protection scope of this application.
[0102] This application also provides an applet simulation debugging device. Please refer to Figure 4 , the applet simulation debugging device includes:
[0103] The running environment judgment module 10 is configured to judge whether the running environment where the applet is located is a computer browser environment when receiving a debugging request from a user;
[0104] The simulated data acquisition module 20 is configured to, if it is a computer browser environment, acquire simulated data in a preset applet simulator according to the debugging request, where the simulated data is data configured according to debugging requirements;
[0105] The simulated debugging module 30 is configured to perform simulated debugging through the applet according to the simulated data.
[0106] The applet simulated debugging device provided by the present application adopts the applet simulated debugging method in the above embodiment, and can solve technical problems. Compared with the prior art, the beneficial effects of the applet simulated debugging device provided by the present application are the same as those of the applet simulated debugging method provided by the above embodiment, and other technical features in the applet simulated debugging device are the same as the features disclosed in the above embodiment method, and will not be elaborated herein.
[0107] The present application provides an applet simulated debugging device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the applet simulated debugging method in the first embodiment above.
[0108] Next, refer to Figure 5 , which shows a schematic structural diagram of an applet simulated debugging device suitable for implementing the embodiments of the present application. The applet simulated debugging device in the embodiments of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The applet simulated debugging device shown is only an example, and should not impose any limitations on the functions and usage scopes of the embodiments of the present application.
[0109] As Figure 5As shown in the figure, the mini-program simulation debugging device may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can execute various appropriate actions and processes according to the program stored in the read-only memory (ROM: Read Only Memory) 1002 or the program loaded from the storage device 1003 into the random access memory (RAM: Random Access Memory) 1004. In the RAM 1004, various programs and data required for the operation of the mini-program simulation debugging device are also stored. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other through a bus 1005. The input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the mini-program simulation debugging device to communicate with other devices wirelessly or wiredly to exchange data. Although the figure shows a mini-program simulation debugging device with various systems, it should be understood that it is not required to implement or have all the shown systems. Instead, more or fewer systems can be implemented or had.
[0110] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowchart can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for executing the methods shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device, or installed from the storage device 1003, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above functions defined in the methods of the embodiments disclosed in the present application are executed.
[0111] The mini-program simulation debugging device provided by the present application adopts the mini-program simulation debugging method in the above embodiments and can solve the technical problems of mini-program simulation debugging. Compared with the prior art, the beneficial effects of the mini-program simulation debugging device provided by the present application are the same as those of the mini-program simulation debugging method provided by the above embodiments, and the other technical features in the mini-program simulation debugging device are the same as the features disclosed in the method of the previous embodiment, which will not be elaborated here.
[0112] It should be understood that each part disclosed in this application can be implemented by hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in a suitable manner in any one or more embodiments or examples.
[0113] As described above, the above are only specific embodiments of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
[0114] This application provides a computer-readable storage medium with computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the small program simulation debugging method in the above embodiments.
[0115] The computer-readable storage medium provided by this application can be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or combined with an instruction execution system, device, or device. The program code contained on the computer-readable storage medium can be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0116] The above computer-readable storage medium can be included in the small program simulation debugging device; it can also exist alone without being assembled into the small program simulation debugging device.
[0117] The above computer-readable storage medium carries one or more programs, which, when executed by the applet simulation debugging device, cause the applet simulation debugging device to: when receiving a debugging request from a user, determine whether the running environment where the applet is located is a computer browser environment; if it is a computer browser environment, obtain simulation data in a preset applet simulator according to the debugging request, where the simulation data is data configured according to debugging requirements; and perform simulation debugging by the applet according to the simulation data.
[0118] Computer program code for performing the operations of the present application may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0119] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that, in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.
[0120] The modules described in the embodiments of the present application may be implemented in software or in hardware. Wherein, the name of the module does not, in some cases, constitute a limitation on the unit itself.
[0121] The readable storage medium provided by this application is a computer-readable storage medium. The computer-readable storage medium stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned small program simulation debugging method, and can solve technical problems. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by this application are the same as those of the small program simulation debugging method provided by the above embodiments, and will not be elaborated here.
[0122] This application also provides a computer program product, including a computer program, and the steps of the small program simulation debugging method as described above are implemented when the computer program is executed by a processor.
[0123] The computer program product provided by this application can solve technical problems. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as those of the small program simulation debugging method provided by the above embodiments, and will not be elaborated here.
[0124] The above are only partial embodiments of this application, and do not limit the patent scope of this application accordingly. Any equivalent structural transformation made by using the content of the specification and drawings of this application under the technical concept of this application, or any direct / indirect application in other related technical fields, is included in the patent protection scope of this application.
Claims
1. A small program simulation debugging method, characterized in that: The method includes: Upon receiving a debugging request from the user, determine whether the running environment of the mini program is a computer browser environment; If it is a computer browser environment, then the simulation data in the preset applet simulator is obtained according to the debugging request, and the simulation data is data configured according to the debugging requirements; The applet is used to perform simulation debugging according to the simulation data.
2. The method according to claim 1, characterized in that The step of determining whether the running environment of the mini program is a computer browser environment upon receiving a debugging request from the user comprises: When receiving a debugging request from a user, parsing the debugging request to obtain operating environment identification information, wherein the operating environment identification information includes a user agent string and / or a device screen size; Call the preset device control interface and obtain the call feedback result; It is determined whether the running environment of the mini program is a computer browser environment through the running environment identification information and the call feedback result.
3. The method according to claim 1, characterized in that Before the step of determining whether the running environment of the mini program is a computer browser environment upon receiving the debugging request from the user, the method further includes: Set the debug button in the browser page on the computer; When it is detected that the user clicks the debugging button, a debugging function list is displayed, wherein the debugging function list includes a simulated shake function, a simulated wireless LAN signal, and / or a simulated mobile terminal physical return key; Configure simulation data in the preset mini-program simulator, the simulation data including shake multi-dimensional parameter values, network data and / or target page parameters, the shake multi-dimensional parameter values including strength, amplitude and direction, the network data including network signal environment, network signal strength, signal fluctuation range and network type.
4. The method according to claim 3, characterized in that If the environment is a computer browser, the step of obtaining simulation data in a preset applet simulator according to the debugging request includes: If it is a computer browser environment, when the debugging request includes clicking the simulated shake function request and the shake function requirement, the target shake parameter is determined in the shake multi-dimensional parameter value in the preset applet simulator according to the shake function requirement, wherein the shake function requirement includes any one of intensity requirement, amplitude requirement, and direction requirement; When the debugging request includes clicking the simulated wireless LAN signal and the simulated network requirement, determining the target network data in the network data in the preset applet simulator according to the simulated network requirement, wherein the simulated network requirement includes any one of a network signal environment requirement, a network signal strength requirement, a signal stability requirement, and a network type requirement; When the debugging request is to click the simulated mobile terminal physical return key, the target page parameters in the preset mini-program simulator are obtained.
5. The method according to claim 1, characterized in that Before the step of determining whether the running environment of the mini program is a computer browser environment upon receiving the user's debugging request, the method further includes: The simulation data is configured in a JSON configuration file corresponding to a preset applet simulator, wherein the simulation data includes at least one of an interface name, an interface description, simulation parameters, and a simulation return value.
6. The method according to claim 5, characterized in that If the environment is a computer browser, the step of obtaining simulation data in a preset applet simulator according to the debugging request includes: If it is a computer browser environment, the simulation data is determined in the JSON configuration file according to the debugging request, the interface name and the interface description, and the simulation parameters and the simulation return value in the simulation data are obtained.
7. A small program simulation debugging device, characterized in that: The mini-program simulation debugging device comprises: The operating environment judgment module is used to judge whether the operating environment of the mini program is a computer browser environment when receiving a debugging request from the user; A simulation data acquisition module is used to obtain simulation data in a preset applet simulator according to the debugging request if it is a computer browser environment, and the simulation data is data configured according to the debugging requirements; A simulation debugging module is used to perform simulation debugging according to the simulation data through the applet.
8. A small program simulation debugging device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the applet simulation debugging method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is 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 mini-program simulation debugging method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the applet simulation debugging method as claimed in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Cloud function debugging method and device, computer device and storage medium
CN110032519A
Equipment debugging method, device, equipment and system
CN110750437A
Applet running environment simulation method, electronic equipment and storage medium
CN113760762A
Webpage debugging method and debugging environment simulator
CN114064514A
Browser testing method and device, electronic equipment and storage medium
CN115344472A