Mini Program Testing Method, Apparatus, System, Electronic Device, and Storage Medium

By building an independent interface environment and simulated applet basic library interface, the problem of time-consuming and unstable applet testing is solved, and an efficient and low-cost testing method is realized, which is suitable for automated testing of instant messaging software applets.

CN111338925BActive Publication Date: 2025-07-18BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN201811550092.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-12-18
Publication Date
2025-07-18
Estimated Expiration
2038-12-18

AI Technical Summary

Technical Problem

The existing technology of small and medium-sized small programs test methods are time-consuming, unstable, and high maintenance costs, especially in the frequent maintenance use cases in the UI automation testing of instant messaging software applets, which lead to increased costs.

Method used

Build an interface environment independent of the native running environment of the applet, simulate the applet basic library interface, intercept the setData interface for testing, use the JavaScript environment to drive the applet, control component synchronization using two-way data binding method, and execute the business logic of the test cases.

Benefits of technology

Improves the stability and efficiency of test cases, reduces the cost of writing and maintenance of test cases, and can execute multiple test cases in parallel on the PC side, reduces runtime, and reduces dependence on native environments and devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111338925B_ABST
    Figure CN111338925B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a mini-program testing method, apparatus, system, electronic device, and storage medium, and pertains to the technical field of software engineering, and can be applied to application scenarios for testing mini-programs of instant messaging software. The mini-program testing method includes constructing an interface environment that supports the operation of the mini-program; wherein, the interface environment exists independently of the native operating environment of the mini-program; in response to a test instruction of the mini-program, determining a test case corresponding to the test instruction; and executing the business logic of the test case based on the interface environment to test the mini-program. The present disclosure can shorten the running time of test cases, improve the stability of test case execution, reduce the costs of test case writing and maintenance, and conveniently embed mini-program automated testing into the software R & D process.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] In recent years, more and more mini-programs have been embedded in mobile applications (APPs). For example, instant messaging software mini-programs (hereinafter referred to as mini-programs). Before the instant messaging software mini-programs are launched, they need to be tested.

[0003] Currently, the mini-program test method mainly adopts the user interface (UI) automation solution of mobile APPs. For example, the open-source mini-program test tool Appium can be executed cross-platform (iOS and Android) and is suitable for testing instant messaging software mini-programs.

[0004] However, when Appium drives instant messaging software mini-programs and runs test cases, it takes a long time and runs unstably. In addition, in the case of rapid business iteration, it is inevitable to frequently maintain and refresh test cases to match new UI elements, resulting in high costs for test case writing and maintenance.

[0005] It should be noted that the information disclosed in the above background art section is only used to enhance the understanding of the background of the present disclosure. Therefore, it may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention

[0006] The purpose of the present disclosure is to provide a mini-program test method, a mini-program test device, an electronic device, and a computer-readable storage medium, so as to at least to some extent overcome the problems of serious time consumption, unstable operation, and high maintenance costs when running mini-program test cases.

[0007] According to the first aspect of the present disclosure, a mini-program test method is provided, including: constructing an interface environment that supports the operation of the mini-program; wherein, the interface environment exists independently of the native operation environment of the mini-program; responding to the test instruction of the mini-program, determining the test case corresponding to the test instruction; and executing the business logic of the test case based on the interface environment to test the mini-program.

[0008] Optionally, constructing an interface environment that supports the operation of the mini-program includes: determining the mini-program basic library in the native operation environment of the mini-program; creating interfaces identical to the interfaces included in the mini-program basic library to construct the interface environment.

[0009] Optionally, before executing the business logic of the test case based on the interface environment, determining the program entry of the mini-program; and determining the page corresponding to the test case based on the program entry to determine the business logic of the test case.

[0010] Optionally, determining the business logic of the test case includes: determining the program entry of the applet as the first entry; determining the entry of the first page corresponding to the applet as the second entry; determining one or more components in the first page based on the first entry and the second entry; if there are multiple components in the first page, determining the call relationship between the components; wherein the call relationship is included in the business logic.

[0011] Optionally, determining the business logic of the test case further includes: determining one or more components in the first page as the first components; determining whether the first components include sub-components, if the first components include sub-components, then taking one or more sub-components included in the first components as the second components; determining the business logic based on the call relationship between the first components and the second components.

[0012] Optionally, after determining one or more components in the first page, the applet testing method further includes: determining a first target component in the first page; determining a second target component from a second page, wherein the attributes and / or events included in the second target component are synchronized with the attributes and / or events included in the first target component; controlling the data synchronization between the first target component and the second target component by using a two-way data binding method.

[0013] According to a second aspect of the present disclosure, there is provided an applet testing device, including: an interface environment construction module, configured to construct an interface environment that supports the operation of the applet; wherein the interface environment exists independently of the native operating environment of the applet; a test case determination module, configured to respond to a test instruction of the applet and determine a test case corresponding to the test instruction; a test case execution module, configured to execute the business logic corresponding to the test case based on the interface environment to test the applet.

[0014] Optionally, the interface environment construction module includes an interface environment construction unit, configured to determine the applet basic library in the native operating environment of the applet; create interfaces identical to the interfaces included in the applet basic library to construct the interface environment.

[0015] Optionally, the test case determination module includes a page determination unit, configured to determine the program entry of the applet before executing the business logic of the test case based on the interface environment; determine the page corresponding to the test case based on the program entry to determine the business logic of the test case.

[0016] Optionally, the applet testing device further includes a first business logic determination module, configured to determine the program entry of the applet as the first entry; determine the entry of the first page corresponding to the applet as the second entry; determine one or more components in the first page based on the first entry and the second entry; if there are multiple components in the first page, determine the call relationship between the components; wherein the call relationship is included in the business logic.

[0017] Optionally, the mini-program test device further includes a second service logic determination module, configured to determine one or more components in the first page as the first component; determine whether the first component includes sub-components, and if the first component includes sub-components, use one or more sub-components included in the first component as the second component; determine the service logic based on the call relationship between the first component and the second component.

[0018] Optionally, the test case execution module further includes a data synchronization unit. After determining one or more components in the first page, the mini-program test method further includes: determining a first target component in the first page; determining a second target component from the second page, where the attributes and / or events included in the second target component are synchronized with the attributes and / or events included in the first target component; controlling the data synchronization between the first target component and the second target component in a two-way data binding manner.

[0019] According to a third aspect of the present disclosure, there is provided a mini-program test system, including: an interface simulation layer, configured to determine a plurality of interfaces for driving a mini-program based on the native running environment of the mini-program, and construct an interface environment for supporting the running of the mini-program to support the running of test cases corresponding to the mini-program; a sandbox layer, configured to run the mini-program based on the interface environment provided by the interface simulation layer and according to the service logic of the test case; a process control layer, configured to extract the results after the test case runs through the sandbox layer; a test case layer, configured to write and maintain test cases of the mini-program.

[0020] According to a fourth aspect of the present disclosure, there is provided an electronic device, including: a processor; and a memory, where computer-readable instructions are stored on the memory, and when the computer-readable instructions are executed by the processor, the mini-program test method according to any one of the above is implemented.

[0021] According to a fifth aspect of the present disclosure, there is provided a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the mini-program test method according to any one of the above is implemented.

[0022] The mini-program testing method in the exemplary embodiments of the present disclosure, first, constructs an interface environment that supports the operation of the mini-program, and the interface environment exists independently of the native operating environment of the mini-program; second, in response to the test instruction of the mini-program, determines the test case corresponding to the test instruction; third, executes the business logic of the test case based on the interface environment to test the mini-program. On the one hand, by simulating the same interfaces in the native operating environment required when the mini-program runs, the mini-program is separated from the instant messaging software environment in which it runs natively and runs in a common scripting language JavaScript environment, completing the operation of the mini-program outside the instant messaging software environment. On the other hand, a corresponding process is created for each test case when it is executed, and multiple test cases can be run simultaneously, reducing the time required for the test cases to run.

[0023] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. Brief Description of the Drawings

[0024] The drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts. In the drawings:

[0025] Figure 1 Schematically shows a flowchart of the mini-program testing method according to an exemplary embodiment of the present disclosure;

[0026] Figure 2 Schematically shows a mini-program system structure diagram of the mini-program in the instant messaging software environment according to the prior art;

[0027] Figure 3 Shows a code screenshot of a mini-program test case according to some exemplary embodiments of the present disclosure;

[0028] Figure 4 Schematically shows a business logic implementation flowchart of the mini-program testing method according to an exemplary embodiment of the present disclosure;

[0029] Figure 5 Schematically shows an interface screenshot of components in a page of a mini-program according to some exemplary embodiments of the present disclosure;

[0030] Figure 6 Schematically shows a data synchronization diagram between components of two pages according to some exemplary embodiments of the present disclosure;

[0031] Figure 7Schematically shows a block diagram of a mini-program testing device according to some exemplary embodiments of the present disclosure;

[0032] Figure 8 Schematically shows a block diagram of an interface environment construction module according to some exemplary embodiments of the present disclosure;

[0033] Figure 9 Schematically shows a block diagram of a test case determination module according to some exemplary embodiments of the present disclosure;

[0034] Figure 10 Schematically shows a block diagram of a mini-program testing device according to another exemplary embodiment of the present disclosure;

[0035] Figure 11 Schematically shows a block diagram of a mini-program testing device according to yet another exemplary embodiment of the present disclosure;

[0036] Figure 12 Schematically shows a block diagram of a test case execution module according to some exemplary embodiments of the present disclosure;

[0037] Figure 13 Schematically shows a structural diagram of a mini-program testing system according to an exemplary embodiment of the present disclosure;

[0038] Figure 14 Schematically shows a block diagram of an electronic device according to an exemplary embodiment of the present disclosure; and

[0039] Figure 15 Schematically shows a schematic diagram of a computer-readable storage medium according to an exemplary embodiment of the present disclosure. Detailed implementation manners

[0040] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. Like reference numerals in the figures denote like or similar parts, and thus their repetitive description will be omitted.

[0041] In addition, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present disclosure. However, those skilled in the art will realize that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be employed. In other cases, well-known structures, methods, devices, implementations, materials, or operations are not shown or described in detail to avoid obscuring aspects of the present disclosure.

[0042] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more software-hardened modules, or in different networks and / or processor devices and / or microcontroller devices.

[0043] Currently, testing instant messaging software mini-programs usually adopts the method of UI automated testing, such as an automated solution based on UI, using Appium to drive instant messaging software mini-programs. However, when using frameworks such as Appium to drive instant messaging software mini-programs, it will cause problems such as serious time consumption for running test cases and unstable operation of test cases; in addition, in the UI automated solution, in the case of rapid business iteration, it is inevitable to frequently maintain test cases, resulting in a high maintenance cost.

[0044] Based on this, in the exemplary embodiment of the present example, first, a mini-program testing method is provided. The method of testing the mini-program of the present disclosure can be implemented by using a server, or can be implemented by using a terminal device. Among them, the terminal device can be various electronic devices such as a computer. Refer to Figure 1 , the mini-program testing method may include the following steps:

[0045] S110. Construct an interface environment that supports the operation of the mini-program; wherein, the interface environment exists independently of the native operating environment of the mini-program.

[0046] According to some exemplary embodiments of the present disclosure, the instant messaging software may be a native instant messaging software APP running on a terminal device. The mini-program is an instant messaging software mini-program, which is an application that can be used without downloading and installing. Users can open the application by scanning or searching. The mini-program can be any mini-program that can run in the instant messaging software APP. The native operating environment of the mini-program may be based on the operating environment of the instant messaging software APP, and may include, for example, but not limited to, the mobile phone side, developer tools (i.e., official simulators), etc.

[0047] Take the "Online Shopping" applet as an example, Figure 2 The "online shopping" applet 240 can run in a relatively independent environment, and the native application layer 210 can be an instant messaging software APP environment. In the instant messaging software environment, the "online shopping" applet calls the applet basic library 220 to obtain the components and application programming interface (Application Programming Interface, API) provided by the applet basic library 220, and then passes the data to the rendering layer 230 for interface rendering and display by calling the setData interface to realize the operation of the applet. Among them, the setData interface can be used to change the page information after clicking or interact with the background after refreshing to obtain the latest data; the applet basic library 220 is similar to the software development kit (Software Development Kit, SDK) of the applet. The "online shopping" applet 240 can exchange data with the native instant messaging software application 210 through the applet basic library 220, and the instant messaging software can achieve the purpose of upgrading the applet by updating the basic library.

[0048] According to some exemplary embodiments of the present disclosure, the applet basic library in the native running environment of the applet is determined; an interface identical to the interface contained in the applet basic library is created to construct an interface environment. First, the interface provided by the applet basic library 220 is determined, and secondly, an interface identical to the interface provided by the determined applet basic library 220 is created, and all interfaces that can drive the applet to run are created by simulating the applet basic library 220. In addition, the applet running result is verified by intercepting the setData interface to achieve the purpose of supporting the running of the applet test case. The interface environment constructed to support the running of the applet exists independently of the native running environment of the applet, runs in a common JavaScript environment, and realizes the driving of the applet running out of the instant messaging software environment. By intercepting the setData interface, the running result of the test case can be directly obtained without rendering the X5 rendering layer. Compared with the Appium automated testing solution, the applet testing method disclosed in the present disclosure skips the page element positioning process and the switching process of the running context (i.e., Context) in Appium, so the stability of the test case is very good. Generally, there will be no situation where a certain case sometimes succeeds and sometimes fails.

[0049] Furthermore, when using the mini-program testing method of the present disclosure, there is no need to repeatedly locate elements when writing test cases. Therefore, the cost of writing test cases is relatively low. Moreover, since it is detached from UI element positioning, when software developers perform module iteration, the impact on the test cases of the present disclosure is limited. Therefore, compared with the UI automation testing method, the cost of writing and maintaining test cases is greatly reduced.

[0050] When performing mini-program UI automation testing using automation tools such as Appium, it is necessary to run an instant messaging software APP on the mobile device and test the "online shopping" mini-program on the mobile device, and only one test case can be run on one mobile device. By using the mini-program testing method of the present disclosure, the running device of the mini-program can be transferred from the mobile device to a personal computer (PC). When executing a test case, each time a test case is run, a new process can be created to support the running of the mini-program. When executing a test case, a process for calling the interface in the simulated interface environment can be created, and then a process for controlling the business logic of the test case and a process for providing the mini-program running interface can be created. The processes between different test cases are independent of each other, and the execution of one test case does not affect the execution of another test case. Therefore, when multiple test cases need to be run, processes can be created for multiple test cases on the same computer. One test case corresponds to the corresponding process of the test case, and different test cases can be run in parallel at the same time, improving the efficiency of running mini-program test cases. For example, in the actual process of running test cases, when using the mini-program testing method of the present disclosure to run about 40 test cases, the total running time is about 6 minutes, which is much lower than the running time of UI automation test cases in the UI automation testing method (about 6 hours are required for 80 UI automation test cases).

[0051] In addition, since the UI automation testing method requires a dedicated PC and device during operation, the costs of running test cases and device maintenance are relatively high. Compared with UI automation, the mini-program testing method of the present disclosure can be run with only one command and is completely independent of the environment or mobile device. Therefore, it can be very conveniently integrated into the R & D process, greatly reducing the usage threshold and maximizing the effectiveness of automation.

[0052] S120. In response to the test instruction of the mini-program, determine the test case corresponding to the test instruction.

[0053] According to some exemplary embodiments of the present disclosure, the test instruction of the mini program can be an instruction for controlling the mini program to execute test cases. The test cases corresponding to the test instruction are determined based on the test instruction of the mini program. A test case can be a set of test inputs, execution conditions, and expected results prepared for a specific goal. When writing test cases for the "online shopping" mini program, a code segment can be used to represent the running logic of a test case. Refer to Figure 3 , Figure 3 a code segment for implementing the "group purchase" function, and the "group purchase" function can be a function that allows multiple people, each with a quantity of two or more, to purchase the same commodity separately.

[0054] According to some exemplary embodiments of the present disclosure, the program entry of the mini program is determined; based on the program entry, the page corresponding to the test case is determined to determine the business logic of the test case. Since this mini program test method does not need to pass the results obtained in the logic layer to the rendering layer for rendering, only the program entry of the mini program needs to be determined in the logic layer.

[0055] For example, during the process of running the test case, refer to Figure 4 , first, load the simulated mini program basic library API and inject these simulated mini program basic library APIs into the current running environment. Secondly, implement the App() function and the Page() function. Among them, the App() function can represent the entry of the mini program, and the Page() function can represent the entry of each Page involved in this test case. Through these App() functions and Page() functions, all the pages corresponding to this test case can be determined to determine the business logic in all the pages. By intercepting the setData interface, the runtime data in each page can be obtained and provided for the test case to use.

[0056] According to another exemplary embodiment of the present disclosure, the program entry of the mini program is determined as the first entry; the entry of the first page corresponding to the mini program is determined as the second entry; one or more components in the first page are determined based on the first entry and the second entry; if there are multiple components in the first page, the call relationship between the components is determined; among them, the call relationship is included in the business logic. The first entry can be the entry of the mini program corresponding to the test case determined by using the App() function, and the second entry can be the entry of all the pages involved in the test case determined by using the Page() function. After determining all the pages, the components included in all the pages can be further determined. A page may include one or more components. Among them, a component can be a code segment for implementing a specific function. Refer to Figure 5 , the order component 510 can be a component representing the list of commodities selected by the user. After determining all the components in each page, the business logic between these components can be further determined.

[0057] According to another exemplary embodiment of the present disclosure, one or more components in the first page are determined as the first components; it is determined whether the first components include sub-components. If the first components include sub-components, then one or more sub-components included in the first components are used as the second components; the business logic is determined based on the call relationship between the first components and the second components. If the page corresponding to the test case contains components, the components in the page are determined as the first components. The first components can be understood as the top-level components in the page. Refer to Figure 5 , the component 510 can be the first component. After determining all the first components in the page, it is further determined whether the first components include sub-components. If the first components contain sub-components, it is necessary to further determine that the sub-components included in the first components are the second components. The "View Similar" component 520 and the "Repurchase" component 530 can be the second components. After determining the sub-components in the first components, it is continued to determine whether the second components still contain sub-components. If the sub-components still contain sub-components, these new sub-components are also used as the second components. Repeat the above steps until all the components included in the page are found.

[0058] After determining the first components of the page, the first components can be parsed and configured and the component code can be loaded. After the code in the components is loaded, it is necessary to implement data synchronization between the components to execute the life cycle of the components.

[0059] It should be noted that the terms "first", "second", etc. used in the present disclosure are only for distinguishing different components on the same page and should not impose any limitation on the present disclosure.

[0060] S130. Execute the business logic of the test case based on the interface environment to test the applet.

[0061] According to some exemplary embodiments of the present disclosure, the business logic of the test case can be the business logic between pages, the business logic between components, the business logic of data call between pages, etc. Executing these business logics can implement the testing of the test cases of the applet.

[0062] According to some exemplary embodiments of the present disclosure, determine a first target component in a first page; determine a second target component from a second page, wherein attributes and / or events included in the second target component are synchronized with attributes and / or events included in the first target component; control data synchronization between the first target component and the second target component by using a two-way data binding method. During the execution of a test case, each component in a mini-program is isolated from each other, that is, each component cannot access resources of other components such as attributes and methods. However, data exchange is required between components, and components implementing the same function may exist on multiple pages. Therefore, data synchronization needs to be performed between these components.

[0063] The target component may be a component that implements a certain function on a page and requires data synchronization. The first target component and the second target component may be components that need to perform data synchronization with each other and are in different pages. Refer to Figure 6 , determine component 610 in page 1 as the first component, and determine component 620 in page 2 as the second component. Data synchronization needs to be implemented between the first component 610 and the second component 620. Attributes and methods in the first component can be synchronized with attributes and methods in the second component by using the binding methods of prop and Bind.

[0064] For example, the first component 610 has an attribute "order.sku" and a function "update()", and the second component 620 has an attribute "sku" and an event "change". The "order.sku" of the first component 610 can be bound to the "sku" of the second component 620, and at the same time, the event "change" of the second component 620 can be bound to the function "update()" of the first component 610. Then, if the "order.sku" of the first component 610 changes, the "sku" of the second component 620 will change accordingly to achieve synchronization of attributes, that is, attribute binding. In addition, if the event "change" is triggered in the second component 620, the function "update()" of the first component 610 will be called. This method can achieve synchronization between events, that is, event binding. The above methods of attribute binding and event binding are technical means provided by the instant messaging software mini-program for communication between components.

[0065] It should be noted that the terms "first", "second", etc. used in the present disclosure are only for distinguishing different components on different pages or components that need to perform data exchange on different pages, and should not cause any limitation to the present disclosure.

[0066] In summary, for the mini-program testing method of the present disclosure, first, an interface environment that supports the operation of the mini-program is constructed; wherein, the interface environment exists independently of the native operating environment of the mini-program. Second, in response to the test instruction of the mini-program, a test case corresponding to the test instruction is determined. Third, based on the interface environment, the business logic of the test case is executed to test the mini-program. On the one hand, by using the mini-program testing method of the present disclosure, the mini-program can be separated from the native instant messaging software operating environment, so that the mini-program can be tested without relying on the mobile device. When driving the mini-program test cases on the PC side, multiple test cases can be run simultaneously, and each test case does not affect each other, reducing the time-consuming of the mini-program test cases. Moreover, the mini-program does not need to depend on the native environment or mobile device and can be very conveniently integrated into the software development process to maximize the utility of automated testing. On the other hand, the mini-program testing method of the present disclosure does not need to render the page. Therefore, it is not necessary to locate page elements, making the operation of the mini-program more stable. On the further hand, by using the mini-program testing method of the present disclosure, it is not necessary to repeatedly locate page elements when writing test cases, greatly reducing the writing cost and maintenance cost of the test cases.

[0067] In addition, according to some exemplary embodiments of the present disclosure, a mini-program testing apparatus is also provided. Refer to Figure 7 , the mini-program testing apparatus 700 may include an interface environment construction module 710, a test case determination module 720, and a test case execution module 730.

[0068] Specifically, the interface environment construction module 710 may be used to construct an interface environment that supports the operation of the mini-program; wherein, the interface environment exists independently of the native operating environment of the mini-program; the test case determination module 720 may be used to respond to the test instruction of the mini-program and determine a test case corresponding to the test instruction; the test case execution module 730 may be used to execute the business logic corresponding to the test case based on the interface environment to test the mini-program.

[0069] The mini-program testing apparatus 700 can separate the mini-program from the native instant messaging software operating environment and implement the operation of the mini-program by simulating the mini-program base library. Therefore, when executing the test cases of the mini-program, it can be performed not only on the mobile device, and moreover, multiple test cases can be executed concurrently each time, greatly reducing the time required for running the test cases. It is an effective mini-program testing apparatus.

[0070] According to some exemplary embodiments of the present disclosure, refer to Figure 8 , the interface environment construction module 710 includes an interface environment construction unit 810.

[0071] Specifically, the interface environment construction unit 810 can be used to determine the applet basic library in the native running environment of the applet; create interfaces identical to the interfaces included in the applet basic library to construct an interface environment.

[0072] The interface environment construction unit 810 can simulate the applet basic library in the native running environment of the applet and construct an interface environment that supports the running of the applet based on the applet basic library, enabling the applet to run independently of the instant messaging software environment.

[0073] According to another exemplary embodiment of the present disclosure, referring to Figure 9 , the test case determination module 720 includes a page determination unit 910.

[0074] Specifically, the page determination unit 910 can be used to determine the program entry of the applet before executing the business logic of the test case based on the interface environment; determine the page corresponding to the test case based on the program entry to determine the business logic of the test case.

[0075] The page determination unit 910 can determine the pages involved in each test case. After all these pages are determined, the business logic of the test case can be determined based on these pages.

[0076] In another exemplary embodiment of the present disclosure, an applet testing device 1000 is further provided. Referring to Figure 10 , compared with the applet testing device 700, the applet testing device 1000 may further include a first business logic determination module 1010 in addition to the interface environment construction module 710, the test case determination module 720, and the test case execution module 730.

[0077] Specifically, the first business logic determination module 1010 can be used to determine the program entry of the applet as the first entry; determine the entry of the first page corresponding to the applet as the second entry; determine one or more components in the first page based on the first entry and the second entry; if there are multiple components in the first page, determine the call relationship between the components; where the call relationship is included in the business logic.

[0078] The first business logic determination module 1010 can determine the components in all the pages corresponding to the test case based on the program entry of the applet and the entry of the page corresponding to the test case, and then determine the business logic between the components.

[0079] In yet another exemplary embodiment of the present disclosure, an applet testing device 1100 is further provided. Referring to Figure 11, compared with the mini-program testing device 1000, the mini-program testing device 1100 may further include a second business logic determination module 1110 in addition to the interface environment construction module 710, the test case determination module 720, the test case execution module 730, and the first business logic determination module 1010.

[0080] Specifically, the second business logic determination module 1110 may be configured to determine one or more components in the first page as the first components; determine whether the first components include sub-components, and if the first components include sub-components, use one or more sub-components included in the first components as the second components; determine the business logic based on the call relationship between the first components and the second components.

[0081] When the components in the page include sub-components, the second business logic determination module 1110 may determine all sub-components included in the components, as well as sub-components included in the sub-components. After determining all components, the business logic during the execution of the test case may be determined based on the call relationship between the components.

[0082] According to some exemplary embodiments of the present disclosure, refer to Figure 12 , the test case execution module 730 further includes a data synchronization unit 1210.

[0083] Specifically, the data synchronization unit 1210 may be configured to determine a first target component in the first page; determine a second target component from the second page, where the attributes and / or events included in the second target component are synchronized with the attributes and / or events included in the first target component; control the data synchronization between the first target component and the second target component in a two-way data binding manner.

[0084] The data synchronization unit 1210 may keep the data synchronized between two components that need to synchronize data in different pages to ensure the correctness of the test case execution.

[0085] The specific details of each virtual mini-program testing device module described above have been described in detail in the corresponding mini-program testing method, so they will not be elaborated here.

[0086] It should be noted that although several modules or units of the mini-program testing device are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above may be embodied in one module or unit. Conversely, the features and functions of one module or unit described above may be further divided and embodied by multiple modules or units.

[0087] Further, in an exemplary embodiment of the present disclosure, a mini-program test system capable of implementing the above mini-program test method is also provided. Refer to Figure 13 , the mini-program test system 1300 may include an interface simulation layer 1340, a sandbox layer 1330, a process control layer 1320, and a test case layer 1310.

[0088] Specifically, the interface simulation layer 1340 may be used to determine multiple interfaces for driving the mini-program based on the native operating environment of the mini-program, and construct an interface environment that supports the operation of the mini-program to support the operation of the test cases corresponding to the mini-program; the sandbox layer 1330 may be used to run the mini-program based on the interface environment provided by the interface simulation layer and according to the business logic of the test cases; the process control layer 1320 may be used to extract the results after the test cases are run through the sandbox layer; the test case layer 1310 may be used to write and maintain the test cases of the mini-program.

[0089] The mini-program test system 1300 provides a system structure for implementing the mini-program test method, divides the functions of each virtual layer of the mini-program test system, and clarifies the calling relationships between the various virtual layers. Based on the mutual calls of the various virtual layers, the test cases are executed to complete the mini-program test. It is a mini-program test system with clear levels.

[0090] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.

[0091] Those skilled in the art can understand that various aspects of the present invention can be implemented as a system, a method, or a program product. Therefore, various aspects of the present invention can be specifically implemented in the following forms, namely: a complete hardware embodiment, a complete software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects, which can be collectively referred to as "circuit", "module", or "system" here.

[0092] Next, refer to Figure 14 to describe the electronic device 1400 according to this embodiment of the present invention. Figure 14 The electronic device 1400 shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.

[0093] As Figure 14 shown, the electronic device 1400 is presented in the form of a general computing device. The components of the electronic device 1400 may include but are not limited to: at least one of the above processing units 1410, at least one of the above storage units 1420, a bus 1430 connecting different system components (including the storage unit 1420 and the processing unit 1410), and a display unit 1440.

[0094] Wherein, the storage unit stores program code, and the program code can be executed by the processing unit 1410, so that the processing unit 1410 executes the steps according to various exemplary embodiments of the present invention described in the "Exemplary Method" section of this specification.

[0095] The storage unit 1420 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 1421 and / or a cache storage unit 1422, and may further include a read-only storage unit (ROM) 1423.

[0096] The storage unit 1420 may further include a program / utilities 1424 having a set (at least one) of program modules 1425. Such program modules 1425 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include the implementation of a network environment.

[0097] The bus 1430 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus structures.

[0098] The electronic device 1400 may also communicate with one or more external devices 1470 (such as a keyboard, a pointing device, a Bluetooth device, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1400, and / or communicate with any device that enables the electronic device 1400 to communicate with one or more other computing devices (such as a router, a modem, etc.). Such communication may be carried out through the input / output (I / O) interface 1450. And, the electronic device 1400 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 1460. As shown in the figure, the network adapter 1460 communicates with other modules of the electronic device 1400 through the bus 1430. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in combination with the electronic device 1400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0099] Through the description of the above embodiments, those skilled in the art can easily understand that the exemplary embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (such as a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.

[0100] In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having a program product capable of implementing the above method of this specification. In some possible embodiments, various aspects of the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification.

[0101] Refer to Figure 15 As shown, a program product 1500 for implementing the above method according to an embodiment of the present invention is described. It can use a portable compact disc read-only memory (CD-ROM) and include program code, and can run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited to this. In this document, a readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or combined with an instruction execution system, device, or component.

[0102] The program product can adopt any combination of one or more readable media. A readable medium can be a readable signal medium or a readable storage medium. A readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples (non-exhaustive list) of a readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0103] A computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The readable signal medium may also be any readable medium other than a readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device.

[0104] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0105] The program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and also including conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's device, executed as a stand-alone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., by connecting through the Internet using an Internet service provider).

[0106] In addition, the above-mentioned drawings are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present invention, and are not for limiting purposes. It is easy to understand that the processes shown in the above-mentioned drawings do not indicate or limit the chronological order of these processes. Additionally, it is also easy to understand that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0107] Those skilled in the art will readily think of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include well-known common general knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the claims.

[0108] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.

Claims

1. A small program testing method, characterized in that, Including: Construct an interface environment that supports the operation of the mini-program; wherein, the interface environment exists independently of the native operating environment of the mini-program; Respond to the test instruction of the mini-program and determine the test case corresponding to the test instruction; Execute the business logic of the test case based on the interface environment to test the mini-program; The constructing the interface environment that supports the operation of the mini-program includes: Determine the mini-program base library in the native operating environment of the mini-program; Create interfaces identical to the interfaces included in the mini-program base library to construct the interface environment.

2. The small program testing method according to claim 1, wherein Before executing the business logic of the test case based on the interface environment, the mini-program testing method further includes: Determine the program entry of the mini-program; Based on the program entry, determine the page corresponding to the test case to determine the business logic of the test case.

3. The small program testing method according to claim 2, characterized in that Determining the business logic of the test case includes: Determine the program entry of the mini-program as the first entry; Determine the entry of the first page corresponding to the mini-program as the second entry; Based on the first entry and the second entry, determine one or more components in the first page; If there are multiple components in the first page, determine the call relationship between the components; wherein, the call relationship is included in the business logic.

4. The mini-program testing method according to claim 3, wherein Determining the business logic of the test case further includes: Determine one or more components in the first page as the first components; Judge whether the first component includes sub-components. If the first component includes sub-components, then use one or more sub-components included in the first component as the second components; Based on the call relationship between the first component and the second component, determine the business logic.

5. The small program testing method according to claim 4, wherein After determining one or more components in the first page, the mini-program testing method further includes: Determine the first target component in the first page; Determine the second target component from the second page, wherein the attributes and / or events included in the second target component are synchronized with the attributes and / or events included in the first target component; Control the data synchronization between the first target component and the second target component by using the two-way data binding method.

6. A mini-program testing device, characterized in that, Including: An interface environment construction module, configured to construct an interface environment that supports the operation of the mini-program; wherein, the interface environment exists independently of the native operating environment of the mini-program; A test case determination module, configured to respond to the test instruction of the mini-program and determine the test case corresponding to the test instruction; A test case execution module, configured to execute the business logic corresponding to the test case based on the interface environment to test the mini-program; The interface environment construction module is further configured to determine the mini-program base library in the native operating environment of the mini-program; create interfaces identical to the interfaces included in the mini-program base library to construct the interface environment.

7. A mini-program testing system, characterized in that Including: An interface simulation layer, configured to determine multiple interfaces for driving the mini-program based on the native operating environment of the mini-program, construct an interface environment that supports the operation of the mini-program to support the operation of the test case corresponding to the mini-program; A sandbox layer, which is used to simulate an interface environment based on the interfaces provided by the interface simulation layer and run the applet according to the business logic of the test case; A process control layer, which is used to extract the results after the test case runs through the sandbox layer; A test case layer, which is used to write and maintain the test cases of the applet; The interface simulation layer is further used to determine the applet basic library in the native running environment of the applet; create interfaces identical to the interfaces included in the applet basic library to construct the interface environment.

8. An electronic device, characterized in that, It includes: A processor; And A memory, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by the processor, the applet testing method according to any one of claims 1 to 5 is implemented.

9. A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the applet testing method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Interface testing and test data generation method and device, terminal and storage medium

    CN107861870A