A testing method, device, and storage medium for a component of database sharding and table partitioning

By deploying test instances on computer devices, simulating request messages and service response messages, the method of testing the library and subtable components is solved, and the problem of inefficient testing in the prior art is achieved and a faster testing process is achieved.

CN113986744BActive Publication Date: 2025-05-23BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111290610.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-02
Publication Date
2025-05-23
Estimated Expiration
2041-11-02

AI Technical Summary

Technical Problem

The prior art is less efficient when testing the library and table components, and takes a lot of time to integrate the components into project applications for testing.

Method used

By deploying a test instance on a computer device, receiving a mock request message and calling the sub-store to be tested to process the target service, a service response message is generated to indicate whether the call is successful. The complexity of this test instance is less than the preset complexity threshold, reducing development time.

Benefits of technology

There is no need to integrate the sub-store and table components to be tested in project applications. Just integrate them into test cases to improve testing efficiency and shorten development time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986744B_ABST
    Figure CN113986744B_ABST
Patent Text Reader

Abstract

The present application provides a testing method, device and storage medium for sub-library and sub-table components, which relate to the field of software testing technology and can improve the efficiency of testing sub-library and sub-table components. The method includes: receiving a simulation request message through a test instance, the simulation request message is used to indicate the processing of a target business, the test instance can call the sub-library and sub-table component to be tested to process the target business, and the complexity of the test instance is less than a preset complexity threshold. According to the simulation request message, the test instance is called to process the target business. A business response message is generated through the test instance, and the business response message is used to indicate whether the call to the sub-library and sub-table component to be tested is successful.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing, and in particular to a testing method, device and storage medium for a sub-library and sub-table component. Background Art

[0002] As software functions become increasingly rich, developers need to call software development kits (SDKs) to implement relevant functional requirements during the software development process. For example, the library and table sharding components, as basic SDK components, are usually integrated into the developed project applications.

[0003] At present, after the development of the sharding component is completed, it is necessary to integrate the sharding component into the developed project application to test the function of the sharding component. However, the current testing method is inefficient in testing the sharding component because it takes a lot of time to develop the project application. Summary of the invention

[0004] The present application provides a testing method, device and storage medium for a sub-library and sub-table component, which can improve the efficiency of testing the sub-library and sub-table component.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] In a first aspect, the present application provides a method for testing a sub-library and sub-table component. The method is applied to a computer device, where a test instance is deployed on the computer device, and the test instance integrates a sub-library and sub-table component to be tested.

[0007] In the method, a simulation request message is received through a test instance, and the simulation request message is used to indicate the processing of a target business. The test instance can call the sub-library and sub-table component to be tested to process the target business, and the complexity of the test instance is less than a preset complexity threshold. According to the simulation request message, the test instance is called to process the target business. A business response message is generated through the test instance, and the business response message is used to indicate whether the call to the sub-library and sub-table component to be tested is successful.

[0008] Based on the above technical solution, based on the above technical solution, there is no need to integrate the sub-library and sub-table components to be tested into the project application, and it is only necessary to integrate the sub-library and sub-table components to be tested into the test case. Afterwards, a simulation request message is received through the test instance, and the simulation request message is used to indicate the processing of the target business. The test instance can call the sub-library and sub-table components to be tested to process the target business, and the complexity of the test instance is less than the preset complexity threshold. Then, according to the simulation request message, the test instance is called to process the target business. Then, a business response message is generated through the test instance, and the business response message is used to indicate whether the call to the sub-library and sub-table components to be tested is successful. In this way, since the complexity of the test instance is less than the preset complexity threshold, the time spent on developing the test instance is shorter, which can improve the efficiency of testing the sub-library and sub-table components.

[0009] In a possible design, the test instance includes a control module, and the simulation request message is received by the control module.

[0010] In a possible design, the test instance also includes: a service module, a mapping module, and the control module includes a target interface, and the target interface is used to call the service module to process the target business. The control module calls the target interface according to the simulated request message and sends the simulated request message to the service module. The service module determines the target operation according to the simulated request message, and the target operation is the method for processing the target business. The service module sends the target operation to the mapping module. The mapping module calls the target processing statement according to the target operation to perform the target operation on the target data table, and the target processing statement can call the sub-library and sub-table components to be tested to determine the target data table, and the target data table corresponds to the target business.

[0011] In a possible design, the simulation request message also includes a data table identifier, and a table partitioning strategy is configured in the test instance, and the table partitioning strategy is used to indicate the correspondence between the data table identifier and the data table. The mapping module calls the database and table partitioning component to determine the target data table according to the data table identifier and the table partitioning strategy.

[0012] In a possible design, the test instance also includes an entity module, and the business response message includes a first identifier or a second identifier, the first identifier is used to indicate that the call to the sub-library and sub-table component to be tested is successful, and the second identifier is used to indicate that the call to the sub-library and sub-table component to be tested fails. If the mapping module successfully calls the target processing statement, the first identifier is generated by the entity module. If the mapping module fails to call the target processing statement, the second identifier is generated by the entity module.

[0013] In a second aspect, the present application provides a test device for a sub-library and sub-table component, the device is applied to a computer device, the computer device is deployed with a test instance, and the test instance integrates a sub-library and sub-table component to be tested. The device includes a receiving unit and a processing unit.

[0014] The receiving unit is used to receive a simulation request message through a test instance, the simulation request message is used to indicate the processing of a target business, the test instance can call the sub-library and sub-table component to be tested to process the target business, and the complexity of the test instance is less than a preset complexity threshold. The processing unit is used to call the test instance to process the target business according to the simulation request message. The processing unit is also used to generate a business response message through the test instance, and the business response message is used to indicate whether the calling of the sub-library and sub-table component to be tested is successful.

[0015] In a possible design, the test instance includes: a control module and a receiving unit, which is specifically used to receive a simulation request message through the control module.

[0016] In a possible design, the test instance also includes: a service module, a mapping module, the control module includes a target interface, and the target interface is used to call the service module to process the target business; the device also includes a sending unit. The sending unit is used to call the target interface according to the simulated request message through the control module, and send the simulated request message to the service module. The processing unit is used to determine the target operation according to the simulated request message through the service module, and the target operation is a method for processing the target business. The sending unit is also used to send the target operation to the mapping module through the service module. The processing unit is also used to call the target processing statement to perform the target operation on the target data table according to the target operation through the mapping module, and the target processing statement can call the sub-library and sub-table components to be tested to determine the target data table, and the target data table corresponds to the target business.

[0017] In a possible design, the simulation request message also includes a data table identifier, and a table partitioning strategy is configured in the test instance, and the table partitioning strategy is used to indicate the corresponding relationship between the data table identifier and the data table. The processing unit is also used to call the database and table partitioning component to determine the target data table according to the data table identifier and the table partitioning strategy through the mapping module.

[0018] In a possible design, the test instance also includes an entity module, and the business response message includes a first identifier or a second identifier, the first identifier is used to indicate that the call to the sub-library and sub-table component to be tested is successful, and the second identifier is used to indicate that the call to the sub-library and sub-table component to be tested fails. The processing unit is also used to generate the first identifier through the entity module if the mapping module successfully calls the target processing statement. The processing unit is also used to generate the second identifier through the entity module if the mapping module fails to call the target processing statement.

[0019] In a third aspect, the present application provides a testing device for a sub-library and sub-table component, the device comprising: a processor and a memory; the processor and the memory are coupled; the memory is used to store one or more programs, the one or more programs comprising computer execution instructions, when the testing device for the sub-library and sub-table component is running, the processor executes the computer execution instructions stored in the memory to implement the testing method for the sub-library and sub-table component as described in the first aspect and any possible implementation method of the first aspect.

[0020] In a fourth aspect, the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the testing method of the sub-library and sub-table components described in the above-mentioned first aspect and any possible implementation method of the first aspect.

[0021] In a fifth aspect, the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run a computer program or instructions to implement a testing method for a sub-library and sub-table component as described in the first aspect and any possible implementation method of the first aspect.

[0022] In the above scheme, the technical problems that can be solved and the technical effects achieved by the testing device, computer equipment, computer storage medium or chip of the sub-library and sub-table components can be referred to the technical problems and technical effects solved by the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 A flowchart of a testing method for a sub-library and sub-table component provided in an embodiment of the present application;

[0024] Figure 2 A flowchart of another method for testing a sub-library and sub-table component provided in an embodiment of the present application;

[0025] Figure 3 A schematic diagram of the structure of a test device for a sub-library and sub-table component provided in an embodiment of the present application;

[0026] Figure 4 A schematic diagram of the structure of another testing device for a sub-library and sub-table component provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0028] In this article, the character " / " generally indicates that the objects before and after are in an "or" relationship. For example, A / B can be understood as A or B.

[0029] The terms “first” and “second” in the description and claims of the present application are used to distinguish different objects rather than to describe a specific order of the objects.

[0030] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but may optionally include other steps or modules that are not listed, or may optionally include other steps or modules that are inherent to these processes, methods, products or devices.

[0031] In addition, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present concepts in a specific way.

[0032] Before introducing in detail the testing method of the sub-library and sub-table components of the embodiment of the present application, the implementation environment and application scenarios of the embodiment of the present application are first introduced.

[0033] The technical solution provided in the embodiment of the present application can be executed by a computer device. The computer device is a device equipped with a programming tool, and the programming tool supports programming using a programming language (such as Java language, Python language). For example, the programming tool can be IntelliJ IDEA, eclipse. The computer device can store script codes written by developers, or automatically generate script codes generated by script software. Wherein, the computer device can be a tablet computer, a laptop computer, a desktop computer, a portable computer, etc., and the embodiment of the present application does not limit this.

[0034] In an embodiment of the present application, a test instance is deployed in a computer device. The test instance integrates a sub-library and sub-table component to be tested, and the sub-library and sub-table component to be tested is used to determine a data table in a database. Exemplarily, data table a in database A can be determined by the sub-library and sub-table component to be tested. For another example, data table b in database B can be determined by the sub-library and sub-table component to be tested.

[0035] It should be noted that the method for generating the test instance is not limited in the embodiments of the present application. For example, the test instance can be generated by the programming tool through a programming language (such as Java). For another example, a computer device can automatically generate the test instance.

[0036] The embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0037] like Figure 1 As shown, a test method for a sub-library and sub-table component provided in an embodiment of the present application includes:

[0038] S101. Receive a simulation request message through a test instance.

[0039] The simulation request message is used to instruct the processing of the target service.

[0040] It should be noted that the target business is not limited in the embodiment of the present application. For example, the target business may be an account opening business. For another example, the target business may be a deposit business. For another example, the target business may be a withdrawal business.

[0041] Optionally, the simulation request message may be a Hypertext Transfer Protocol (HTTP) message.

[0042] As a possible implementation, a simulation request message is generated by a preset simulation tool, wherein the simulation tool is used to generate the simulation request message. Afterwards, the simulation request message from the simulation tool is received by the test instance.

[0043] It should be noted that the embodiment of the present application does not limit the simulation tool. For example, the simulation tool may be a postman tool.

[0044] S102: According to the simulation request message, call the test instance to process the target business.

[0045] Among them, the test instance can call the sub-library and sub-table components to be tested to process the target business.

[0046] It should be noted that each target business corresponds to a data table in a database. The test case can call the sub-library and sub-table component to be tested to determine the data table of the target business and operate on the data table to process the target business.

[0047] In the embodiment of the present application, the complexity of the test instance is less than a preset complexity threshold.

[0048] It should be noted that in the embodiments of the present application, the complexity of the test instance is used to characterize the complexity of the test instance. The complexity of the test instance is determined by the compilation length of the test instance, the time to compile the test instance, the conditions (or indexes) in the test instance, and the logic of the test instance.

[0049] For example, if the length of test case a is 10, there are 2 conditions in test case a, and the time to compile the test case is 10 seconds. If the length of the project application is 3000, there are 300 conditions in the project application, and the time of the project application is 20 days, then the complexity of the test case is less than the complexity of the project application, and the complexity of the test case is less than the complexity of the project application.

[0050] It is understandable that the complexity of the test instance is lower than the complexity of the project application. In other words, it takes less time to develop the test instance. In this way, by testing the sub-library and sub-table components to be tested through the test instance, the efficiency of testing the sub-library and sub-table components to be tested can be improved.

[0051] S103: Generate a service response message through the test instance.

[0052] The business response message is used to indicate whether the call to the sub-library and sub-table component to be tested is successful.

[0053] In a possible implementation, after the target processing statement is called to process the target service, a service response message may be generated.

[0054] For example, the business response message may be "the call to the sub-library and sub-table component is successful, and the business processing is successful. For another example, the business response message may be "the call to the sub-library and sub-table component fails, and the business processing fails."

[0055] Based on the above technical solution, there is no need to integrate the sub-library and sub-table components to be tested into the project application, but only needs to be integrated into the test case. Afterwards, a simulation request message is received through the test instance, and the simulation request message is used to indicate the processing of the target business. The test instance can call the sub-library and sub-table components to be tested to process the target business, and the complexity of the test instance is less than the preset complexity threshold. Then, according to the simulation request message, the test instance is called to process the target business. Then, a business response message is generated through the test instance, and the business response message is used to indicate whether the call to the sub-library and sub-table components to be tested is successful. In this way, since the complexity of the test instance is less than the preset complexity threshold, the time spent on developing the test instance is shorter, which can improve the efficiency of testing the sub-library and sub-table components.

[0056] In some embodiments, the test instance includes a control module. Receiving a simulation request message through the test instance (ie S101) includes: receiving the simulation request message through the control module.

[0057] In some embodiments, the test instance further includes: a service module, a mapping module, and the control module includes a target interface. Figure 2 As shown, according to the simulation request message, calling the test instance to process the target business (ie S102) includes:

[0058] S201. The control module calls the target interface according to the simulation request message and sends the simulation request message to the service module.

[0059] In a possible design, the control module includes at least one interface, each of which is used to process at least one service. At least one interface includes a target interface, which is used to call the service module to process the target service.

[0060] In one possible design, the simulation request message includes a service identifier, which corresponds to an interface.

[0061] In a possible implementation, the control module determines the target interface according to the service identifier, and then calls the target interface to send a simulation request message to the service module.

[0062] Exemplarily, the simulation request message includes a service identifier A, and the service identifier A corresponds to the interface A. The control module may call the interface A according to the service identifier A and send the simulation request message to the service module.

[0063] Correspondingly, the service module receives the simulation request message from the control module.

[0064] S202: The service module determines a target operation according to the simulation request message.

[0065] In a possible design, the service module includes at least one operation, and the at least one operation includes a target operation. The target operation is a method for processing a target business.

[0066] It should be noted that the target operation in the embodiment of the present application is used to operate the data table. The embodiment of the present application does not limit the target operation. For example, the target operation can be to add data in the data table. For another example, the target operation can be to delete data in the data table. For example, the target operation can be to search for data in the data table.

[0067] In a possible implementation, the service module determines the target operation according to the service identifier, wherein the service identifier corresponds to the target operation.

[0068] For example, if the business identifier is an account opening identifier, the corresponding target operation is an account opening operation (such as adding data in a data table). For another example, if the business identifier is a withdrawal identifier, the corresponding target operation is a withdrawal operation (such as modifying data in a data table).

[0069] S203: The service module sends the target operation to the mapping module.

[0070] Accordingly, the mapping module receives the target operation from the service module.

[0071] Optionally, the service module sends a simulation request message to the mapping module.

[0072] S204: The mapping module calls the target processing statement to perform the target operation on the target data table according to the target operation.

[0073] Among them, the target processing statement can call the sub-library and sub-table components to be tested to determine the target data table, and the target data table corresponds to the target business.

[0074] It should be noted that the target processing statement is a statement for operating a database. For example, the target processing statement may be a structured query language (SQL).

[0075] In a possible implementation, the mapping module determines a target processing statement according to the target operation, and then calls the target processing statement to perform the target operation on the target data table.

[0076] For example, if the target operation is an account opening operation (i.e., an operation of adding an account), the target processing statement is a statement for adding an account (e.g., an "add" statement). For another example, if the target operation is an account closing operation, the target processing statement is an operation for deleting an account (e.g., a "delete" statement).

[0077] In some embodiments, the simulation request message also includes a data table identifier, and a table partitioning strategy is configured in the test instance, and the table partitioning strategy is used to indicate the correspondence between the data table identifier and the data table. Before the mapping module calls the target processing statement to perform the target operation on the target data table according to the target operation, the mapping module calls the library and table partitioning component to determine the target data table according to the data table identifier and the table partitioning strategy.

[0078] It should be noted that the table partitioning strategy can be pre-configured by developers during the development process.

[0079] Exemplarily, if data table identifier A corresponds to data table A, data table identifier B corresponds to data table B, and data table identifier C corresponds to data table C. When the simulation request message includes data table identifier A, it can be determined that the target data table is data table A.

[0080] It can be understood that by calling the sharding component through a test instance in combination with the data table identifier and the sharding strategy, the target data table can be determined. In this way, it is possible to test whether the sharding component can operate normally, and the complexity of the test instance is relatively low, the development time is short, and the efficiency of testing the sharding component is improved.

[0081] In some embodiments, the test instance further includes an entity module, and the service response message includes a first identifier or a second identifier. The first identifier is used to indicate that the call to the sharding component to be tested is successful, and the second identifier is used to indicate that the call to the sharding component to be tested fails. Generating a service response message through the test instance (i.e., S103) includes: if the mapping module successfully calls the target processing statement, the entity module generates the first identifier. If the mapping module fails to call the target processing statement, the entity module generates the second identifier.

[0082] Exemplarily, if the target service is an account opening service and the account opening is successful, a "true" identifier (i.e., the first identifier) can be generated. If the account opening fails, a "fail" identifier (i.e., the second identifier) is generated.

[0083] It can be understood that by generating the first identifier or the second identifier, developers can understand the test results, thereby improving the test cases and the sharding component.

[0084] In some embodiments, after generating the service response message, the service response message can be sent to the simulation tool.

[0085] The above mainly introduces the solution provided by the embodiments of the present application from the perspective of computer devices. It can be understood that in order for a computer device to implement the above functions, it includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that in combination with the test method steps of the sharding component of each example described in the embodiments disclosed in the present application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0086] The embodiments of the present application further provide a test device for a sharding component. The test device for the sharding component can be a computer device, or the CPU in the above computer device, or the processing module in the above computer device for determining the test of the sharding component, or the client in the above computer device for the test of the sharding component.

[0087] The embodiment of the present application can divide the test of the sub-library and sub-table components into functional modules or functional units according to the above method example. For example, each functional module or functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules or functional units. Among them, the division of modules or units in the embodiment of the present application is schematic, which is only a logical function division. There may be other division methods in actual implementation.

[0088] like Figure 3 The figure is a schematic diagram of the structure of a test device for a sub-library and sub-table component provided in an embodiment of the present application. The test device for a sub-library and sub-table component is used to perform Figure 1 or Figure 2 The testing method of the sub-library and sub-table component shown in the figure. The testing device of the sub-library and sub-table component may include a receiving unit 301 , a processing unit 302 and a sending unit 303 .

[0089] The receiving unit 301 is used to receive a simulation request message through a test instance, the simulation request message is used to indicate the processing of a target business, the test instance can call the sub-library and sub-table component to be tested to process the target business, and the complexity of the test instance is less than a preset complexity threshold. The processing unit 302 is used to call the test instance to process the target business according to the simulation request message. The processing unit 302 is also used to generate a business response message through the test instance, and the business response message is used to indicate whether the call to the sub-library and sub-table component to be tested is successful.

[0090] Optionally, the test instance includes: a control module. A receiving unit 301 is specifically configured to receive a simulation request message through the control module.

[0091] Optionally, the test instance also includes: a service module, a mapping module, the control module includes a target interface, and the target interface is used to call the service module to process the target business; the device also includes a sending unit 303. The sending unit 303 is used to call the target interface according to the simulated request message through the control module, and send the simulated request message to the service module. The processing unit 302 is used to determine the target operation according to the simulated request message through the service module, and the target operation is a method for processing the target business. The sending unit 303 is also used to send the target operation to the mapping module through the service module. The processing unit 302 is also used to call the target processing statement to perform the target operation on the target data table according to the target operation through the mapping module. The target processing statement can call the sub-library and sub-table components to be tested to determine the target data table, and the target data table corresponds to the target business.

[0092] Optionally, the simulation request message also includes a data table identifier, and a table partitioning strategy is configured in the test instance, and the table partitioning strategy is used to indicate the corresponding relationship between the data table identifier and the data table. The processing unit 302 is also used to call the database and table partitioning component to determine the target data table according to the data table identifier and the table partitioning strategy through the mapping module.

[0093] Optionally, the test instance also includes an entity module, and the business response message includes a first identifier or a second identifier, the first identifier is used to indicate that the call to the sub-library and sub-table component to be tested is successful, and the second identifier is used to indicate that the call to the sub-library and sub-table component to be tested fails. The processing unit 302 is also used to generate a first identifier through the entity module if the mapping module successfully calls the target processing statement. The processing unit 302 is also used to generate a second identifier through the entity module if the mapping module fails to call the target processing statement.

[0094] Figure 4 Another possible structure of the test device of the sub-library and sub-table component involved in the above-mentioned embodiment is shown. The test device of the sub-library and sub-table component includes: a processor 401 and a communication interface 402. The processor 401 is used to control and manage the actions of the device, for example, to execute the various steps in the method flow shown in the above-mentioned method embodiment, and / or to execute other processes of the technology described in this article. The communication interface 402 is used to support the communication between the test device of the sub-library and sub-table component and other network entities. The test device of the sub-library and sub-table component may also include a memory 403 and a bus 404, and the memory 403 is used to store the program code and data of the device.

[0095] Among them, the above-mentioned processor 401 can implement or execute various exemplary logic blocks, units and circuits described in conjunction with the disclosure of the present invention. The processor can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, units and circuits described in conjunction with the disclosure of the present invention. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of DSP and microprocessors, etc.

[0096] The memory 403 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above types of memory.

[0097] The bus 404 may be an Extended Industry Standard Architecture (EISA) bus, etc. The bus 404 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0098] In actual implementation, the receiving unit 301 may be composed of Figure 4 The communication interface 402 shown in FIG. 1 is implemented by the processing unit 302. Figure 4 The processor 401 shown calls the program code in the memory 403 to implement. The specific execution process can be referred to Figure 1 or Figure 2 The description of the test method part of the sub-library and sub-table components shown will not be repeated here.

[0099] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0100] An embodiment of the present application provides a computer program product including instructions. When the computer program product is run on a computer, the computer is enabled to execute the testing method of the sub-library and sub-table components in the above method embodiment.

[0101] An embodiment of the present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a computer, the computer executes the testing method of the sub-library and sub-table components in the method flow shown in the above method embodiment.

[0102] Among them, the computer readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a register, a hard disk, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above, or any other form of computer readable storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application-specific integrated circuit (ASIC). In the embodiments of the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program, which may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0103] Since the test device, computer-readable storage medium, and computer program product of the sub-library and sub-table components in the embodiments of the present invention can be applied to the above method, the technical effects that can be obtained can also refer to the above method embodiments, and the embodiments of the present invention will not be repeated here.

[0104] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A testing method for sub-library and sub-table components. It is characterized in that Applied to a computer device, the computer device is deployed with a test instance, the test instance integrates a sub-library and sub-table component to be tested, the test instance includes: a control module, a service module, and a mapping module, the control module includes a target interface, and the target interface is used to call the service module to process a target business; the method includes: The control module receives a simulation request message, the simulation request message is used to instruct the processing of the target business, the test instance can call the sub-library and sub-table components to be tested to process the target business, and the complexity of the test instance is less than a preset complexity threshold; the simulation request message also includes a data table identifier, and a sub-table strategy is configured in the test instance, and the sub-table strategy is used to indicate the corresponding relationship between the data table identifier and the data table; Calling the target interface according to the simulation request message by the control module, and sending the simulation request message to the service module; Determining, by the service module, a target operation according to the simulated request message, wherein the target operation is a method for processing the target service; Sending the target operation to the mapping module through the service module; According to the target operation, the mapping module calls a target processing statement to perform the target operation on the target data table, wherein the target processing statement can call the sub-library and sub-table component to be tested to determine the target data table, and the target data table corresponds to the target business; A business response message is generated through the test instance, and the business response message is used to indicate whether the call of the sub-library and sub-table component to be tested is successful.

2. The method according to claim 1, It is characterized in that Before calling a target processing statement to perform the target operation on a target data table according to the target operation through the mapping module, the method further includes: The mapping module calls the database and table subdivision component to determine the target data table according to the data table identifier and the table subdivision strategy.

3. The method according to claim 1 or 2, It is characterized in that The test instance further includes an entity module, and the service response message includes a first identifier or a second identifier, wherein the first identifier is used to indicate that the calling of the sub-library and sub-table component to be tested is successful, and the second identifier is used to indicate that the calling of the sub-library and sub-table component to be tested fails; The generating a service response message through the test instance includes: If the mapping module successfully calls the target processing statement, the first identifier is generated by the entity module; If the mapping module fails to call the target processing statement, the second identifier is generated by the entity module.

4. A test device for sub-library and sub-table components, It is characterized in that Applied to a computer device, the computer device is deployed with a test instance, the test instance integrates a sub-library and sub-table component to be tested, the test instance includes: a control module, a service module, and a mapping module, the control module includes a target interface, and the target interface is used to call the service module to process a target business; the device includes: A receiving unit, configured to receive a simulation request message through the control module, wherein the simulation request message is used to indicate processing of the target business, the test instance is capable of invoking a sub-library and sub-table component to be tested to process the target business, and the complexity of the test instance is less than a preset complexity threshold; the simulation request message also includes a data table identifier, a sub-table strategy is configured in the test instance, and the sub-table strategy is used to indicate a corresponding relationship between the data table identifier and the data table; A sending unit, configured to call the target interface according to the simulation request message through the control module, and send the simulation request message to the service module; A processing unit, configured to determine a target operation according to the simulation request message through the service module, wherein the target operation is a method for processing the target service; The sending unit is further used to send the target operation to the mapping module through the service module; The processing unit is further used to call a target processing statement to perform the target operation on a target data table according to the target operation through the mapping module, wherein the target processing statement can call the sub-library and sub-table component to be tested to determine the target data table, and the target data table corresponds to the target business; The processing unit is further used to generate a business response message through the test instance, and the business response message is used to indicate whether the calling of the sub-library and sub-table component to be tested is successful.

5. The device according to claim 4, It is characterized in that The processing unit is further configured to call the database and table sharding component to determine the target data table according to the data table identifier and the table sharding strategy through the mapping module.

6. The device according to claim 4 or 5, It is characterized in that The test instance further includes an entity module, and the service response message includes a first identifier or a second identifier, wherein the first identifier is used to indicate that the calling of the sub-library and sub-table component to be tested is successful, and the second identifier is used to indicate that the calling of the sub-library and sub-table component to be tested fails; The processing unit is further configured to generate the first identifier through the entity module if the mapping module successfully calls the target processing statement; The processing unit is further configured to generate the second identifier through the entity module if the mapping module fails to call the target processing statement.

7. A test device for a sub-library and sub-table component, It is characterized in that include: Processor and memory; The processor is coupled to the memory; The memory is used to store one or more programs, which include computer execution instructions. When the test device of the sub-library and sub-table component is running, the processor executes the computer execution instructions stored in the memory to enable the test device of the sub-library and sub-table component to perform the method as described in any one of claims 1-3.

8. A computer-readable storage medium having stored therein instructions, It is characterized in that When a computer executes the instruction, the computer performs the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Application full-link automatic testing method and device, electronic equipment and storage medium

    CN113535538A