Micro-service interface test method and device, computer equipment and storage medium

By determining the correspondence between the native database interface and the microservice interface, obtaining test data and comparing the call results, the problem of low efficiency and poor accuracy of microservice interface testing is solved, and fast and accurate interface function verification is achieved.

CN120448277APending Publication Date: 2025-08-08CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510651801.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-20
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In microservice architecture, the existing technology relies on manual testing to cause low efficiency and poor accuracy of microservice interface testing, especially in the fields of medical health and financial technology, where inconsistency in functions may lead to serious consequences.

Method used

By determining the correspondence between the native interface of the database and the microservice interface, obtaining test data, calling and comparing the interface results respectively, the first and second call results are generated to determine the test results.

Benefits of technology

Improve the efficiency and accuracy of microservice interface testing, ensure the consistency of interface functions, discover potential performance problems, and provide reliable interface services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448277A_ABST
    Figure CN120448277A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of interface testing, can be applied to business system platforms of medical health, financial science and technology and the like, and discloses a micro-service interface testing method and device, computer equipment and a storage medium. A native interface of a database and a micro-service interface corresponding to the function of the native interface are determined; obtaining test data capable of normally calling the native interface and the micro-service interface; respectively calling the native interface and the micro-service interface based on the test data to generate a corresponding first calling result and a corresponding second calling result; comparing the first calling result with the second calling result, and determining a test result of the micro-service interface according to a comparison result; therefore, the micro-service interface testing efficiency and accuracy can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of interface testing technology, and in particular to a microservice interface testing method, device, computer equipment, and computer-readable storage medium. Background Art

[0002] Currently, the traditional financial industry relies heavily on database features to implement system business processes. These features include, but are not limited to, stored procedures and triggers. These features play a crucial role in traditional financial systems. Directly embedded in the database, they efficiently handle complex business logic and data operations, ensuring high system performance and data consistency. However, with the rapid development of information technology, microservices architecture has gradually become the mainstream approach to building modern financial systems. By breaking complex systems into multiple independent, independently deployable service units, microservices architecture improves system maintainability, scalability, and flexibility. In a microservices architecture, business logic is typically exposed to other services through interfaces (APIs). These interfaces are implemented based on network communication protocols and differ significantly from the functional processes implemented by traditional database features. After converting database features in traditional financial systems into interfaces implemented based on a microservices architecture, how to quickly and effectively verify that the functionality of these microservice interfaces is consistent with the original database interfaces has become a pressing issue in existing technologies. Currently, traditional methods often rely on manual testing, resulting in high labor costs and low test accuracy and efficiency in existing microservices interface testing methods. Especially in the healthcare field, the accuracy and reliability of the medical system are crucial, and any functional inconsistency may lead to serious consequences. The same is true in the fintech field. Therefore, it is particularly important to quickly and accurately verify the functional consistency of the microservice interface and the native interface of the database.

[0003] Based on this, how to provide a microservice interface testing method, device, computer equipment and computer-readable storage medium that can effectively improve the efficiency and accuracy of microservice interface testing is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a microservice interface testing method, apparatus, computer equipment and computer-readable storage medium, aiming to solve the problem of how to effectively improve the efficiency and accuracy of microservice interface testing.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] In a first aspect, the present invention provides a microservice interface testing method, which includes:

[0007] Determine the native interface of the database and the microservice interface corresponding to the function of the native interface;

[0008] Obtain test data that can normally call the native interface and the microservice interface;

[0009] Based on the test data, calling the native interface and the microservice interface respectively to generate corresponding first calling results and second calling results;

[0010] The first call result and the second call result are compared, and a test result of the microservice interface is determined according to the comparison result.

[0011] In a second aspect, the present invention provides a microservice interface testing device, comprising:

[0012] A determination module, configured to determine a native interface of the database and a microservice interface corresponding to a function of the native interface;

[0013] An acquisition module is used to obtain test data that can normally call the native interface and the microservice interface;

[0014] A calling module, configured to call the native interface and the microservice interface respectively based on the test data, and generate corresponding first calling results and second calling results;

[0015] A comparison module is used to compare the first call result with the second call result, and determine the test result of the microservice interface according to the comparison result.

[0016] In a third aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the microservice interface testing method as described above when executing the computer program.

[0017] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program implements the microservice interface testing method as described above when executed by a processor.

[0018] Compared with the prior art, the present invention provides a microservice interface testing method, apparatus, computer device and computer-readable storage medium, wherein the method comprises determining a native interface of a database and a microservice interface corresponding to the function of the native interface; obtaining test data that can normally call the native interface and the microservice interface; based on the test data, calling the native interface and the microservice interface respectively to generate corresponding first call results and second call results; comparing the first call result and the second call result, and determining the test result of the microservice interface according to the comparison result; thereby, the present invention can effectively improve the efficiency and accuracy of microservice interface testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 A schematic diagram of an application environment for a microservice interface testing method provided by one embodiment of the present invention.

[0021] Figure 2 A flowchart of a microservice interface testing method provided by one embodiment of the present invention.

[0022] Figure 3 A schematic diagram of program modules of a microservice interface testing device provided by one embodiment of the present invention.

[0023] Figure 4 A schematic diagram of the structure of a computer device provided in one embodiment of the present invention.

[0024] Figure 5 Another structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0026] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0027] It will also be understood that the term "and / or" used in the present description and appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0028] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0029] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0030] References to "one embodiment" or "some embodiments" in the present specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present invention. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0031] It should be understood that the order of execution of the steps in the following embodiments does not necessarily mean the order in which they are executed. The order in which each process is executed should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0032] In order to illustrate the technical solution of the present invention, specific embodiments are provided below.

[0033] An embodiment of the present invention provides a microservice interface testing method that can be applied in Figure 1In the application environment shown, the client and server communicate via a network. The client includes, but is not limited to, PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud computing devices, personal digital assistants (PDAs), and other computer devices. The server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0034] See also Figure 2 An embodiment of the present invention provides a microservice interface testing method, wherein the method includes the following steps:

[0035] S100: Determine a native interface of a database and a microservice interface corresponding to a function of the native interface;

[0036] S200: Acquire test data that can normally call the native interface and the microservice interface;

[0037] S300: Based on the test data, respectively call the native interface and the microservice interface to generate corresponding first call results and second call results;

[0038] S400: Compare the first call result and the second call result, and determine the test result of the microservice interface according to the comparison result.

[0039] During specific implementation, the microservice interface testing method of this embodiment can effectively improve the efficiency and accuracy of the test by comparing the functions of the native interface of the database with the converted microservice interface. First, by clarifying the correspondence between the native interface and the microservice interface, the test objectives are clear and targeted, and the waste of resources caused by blind testing is avoided. Secondly, test data that can call two interfaces at the same time is obtained, which ensures the versatility and effectiveness of the test data and makes the test results more comparable. Then, the native interface and the microservice interface are called respectively and the call results are generated. The output performance of the two interfaces under the same input conditions can be directly compared, so as to accurately find out whether there is a deviation in the function implementation, data processing or performance of the microservice interface. Finally, the test results of the microservice interface are determined by comparing the two call results. This comparative analysis based on actual operation results can quickly and accurately determine whether the microservice interface meets the expected function, significantly improving the efficiency and accuracy of the test.

[0040] It is understandable that the microservice interface testing method provided in the embodiment of the present invention can be applied to microservice interface testing scenarios related to the medical and health field. The following is a specific example:

[0041] Example scenario: Patient information query interface testing in a medical health management system

[0042] In the healthcare management system, there's an interface that allows users to query a patient's detailed information, such as name, age, medical history, and test results, directly from the database. Later, during a system upgrade, a new microservice interface was developed to replace the native interface. The goal was to make patient information querying more efficient and flexible. Now, this new microservice interface needed to be tested to ensure that its functionality was consistent with the native interface.

[0043] Test steps

[0044] 1. Determine the interface

[0045] Native interface: used to query patient information directly from the database.

[0046] New microservice interface: Query patient information through the microservice architecture.

[0047] 2. Obtain test data

[0048] Prepare some patient data for testing, such as:

[0049] Patient 1: The patient number is 12345, his name is Zhang San, he is 30 years old, and he has a history of hypertension.

[0050] Patient 2: The patient number is 67890, his name is Li Si, he is 45 years old, and he has a history of diabetes.

[0051] Patient 3: The patient number is 11111, the name is Wang Wu, the age is 25 years old, and there is no medical history.

[0052] Ensure that this data can call both the native interface and the new microservice interface normally.

[0053] 3. Call the interface and generate the call result

[0054] Use these test data to call the native interface and the new microservice interface respectively.

[0055] Native interface call result (first call result):

[0056] Patient number: "12345", name: "Zhang San", age: "30", medical history: "hypertension".

[0057] New microservice interface call result (second call result):

[0058] Patient number: "12345", name: "Zhang San", age: "30", medical history: "hypertension".

[0059] 4. Compare call results

[0060] Compare the call results of the native interface and the new microservice interface, and check the following:

[0061] Whether the patient number is consistent, and whether the name, age, medical history and other fields are completely matched.

[0062] If all fields are the same, the new microservice interface test has passed; if differences are found, further investigation is required.

[0063] Test results

[0064] This approach allows for rapid verification of the new microservice interface's ability to accurately replace the native interface, ensuring the correctness and stability of patient information query functionality. This approach not only verifies the accuracy of the new microservice interface in data processing but also identifies potential performance issues (such as differences in response time), thereby providing a more reliable interface service for the healthcare management system.

[0065] It is understandable that the microservice interface testing method provided in the embodiment of the present invention can also be applied to microservice interface testing scenarios related to the financial technology field. The following is a specific example:

[0066] Example scenario: Account balance query interface testing in a fintech system

[0067] In a fintech system, there's an API that directly queries a user's account balance from the database, including information such as the account number, current balance, and the most recent transaction amount. As part of a system upgrade, a new microservice API was developed to replace the native API to improve system scalability and efficiency. This new microservice API needs to be tested to ensure its functionality is consistent with the native API.

[0068] Test steps

[0069] 1. Determine the interface

[0070] Native interface: used to query account balance information directly from the database.

[0071] Microservice interface: Query account balance information through the microservice architecture.

[0072] 2. Obtain test data

[0073] Prepare some account data for testing, for example:

[0074] Account 1: Account number is 1001, current balance is 1,000 yuan, and the most recent transaction amount is 200 yuan.

[0075] Account 2: Account number is 1002, current balance is 500 yuan, and the most recent transaction amount is 50 yuan.

[0076] Account 3: Account number is 1003, current balance is 2,000 yuan, and the most recent transaction amount is 1,000 yuan.

[0077] Ensure that this data can call both the native interface and the new microservice interface normally.

[0078] 3. Call the interface and generate the call result

[0079] Use these test data to call the native interface and the new microservice interface respectively.

[0080] Native interface call result (first call result):

[0081] Account number: "1001", current balance: 1000, most recent transaction amount: 200.

[0082] Microservice interface call result (second call result):

[0083] Account number: "1001", current balance: 1000, most recent transaction amount: 200.

[0084] 4. Compare call results

[0085] Compare the call results of the native interface and the microservice interface, and check the following:

[0086] Check whether the account number, current balance, and most recent transaction amount are consistent.

[0087] If all fields are consistent, the new microservice interface test has passed; if differences are found, further troubleshooting is required.

[0088] Test results

[0089] This approach allows for rapid verification of the new microservice interface's ability to accurately replace the native interface, ensuring the correctness and stability of account balance query functionality. This approach not only verifies the accuracy of microservice interface data processing but also identifies potential performance issues (such as response time discrepancies), thereby providing more reliable interface services for FinTech systems.

[0090] Furthermore, in one embodiment, the microservice interface testing method, wherein determining the native interface of the database and the microservice interface corresponding to the function of the native interface, specifically comprises the steps of:

[0091] Analyze the functional characteristics of the database's native interface using database management tools, including the input parameters, output results, and business logic of the native interface;

[0092] According to the functional characteristics of the native interface, match the microservice interface corresponding to the function of the native interface;

[0093] Verify whether the microservice interface can fully cover the functionality of the native interface;

[0094] If it cannot be fully covered, rematch until the functional consistency requirements are met.

[0095] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:

[0096] 1. Connect to the database

[0097] Use database management tools (such as Navicat, DBeaver, etc.) to connect to the target database system to ensure that you can access objects such as table structures, stored procedures, and views in the database, preparing for subsequent analysis of native interfaces.

[0098] 2. Analyze the functional characteristics of the native interface

[0099] In the database management tool, find the definition of the native interface, check the name, type, and purpose of its input parameters, clarify the data structure and field meaning of the output results, and study the business logic of the interface, including data processing methods, associated table structures, and executed SQL statements, to fully understand the working principles of the native interface.

[0100] 3. Extract key information of native interface

[0101] Extract key information (including input parameters, output results, and business logic) from the definition of the native interface, and compile a detailed list of input parameters, including parameter name, type, and whether it is required; sort out the field information of the output results, and clarify the name and data type of each field; summarize the core points of the business logic, such as data source, processing rules, and exception handling mechanism, to form a clear report on the functional characteristics of the native interface.

[0102] 4. Microservice interface corresponding to matching function

[0103] Based on the extracted key information of the native interface, find and match microservice interfaces with the same functions in the microservice architecture, and verify whether the microservice interface can fully cover the functions of the native interface, including comparing the input parameters of the microservice interface with the input parameters of the native interface to ensure parameter consistency or compatibility, checking whether the output result fields of the microservice interface are consistent with the output results of the native interface, and verifying whether the business logic of the microservice interface is consistent with the native interface, focusing on data processing rules and exception handling mechanisms to ensure that the two are functionally interchangeable; if the microservice interface cannot fully cover the functions of the native interface, rematch until the functional consistency requirements are met (specific adjustments can be made according to actual needs), that is, match the microservice interface corresponding to the functions of the native interface.

[0104] Through the above process, this embodiment can accurately determine the functional correspondence between the native interface and the microservice interface, providing a clear basis for subsequent interface testing.

[0105] Furthermore, in one embodiment, the microservice interface testing method, wherein the step of obtaining test data capable of normally calling the native interface and the microservice interface, specifically comprises the steps of:

[0106] Constructing a test data template according to the input parameter requirements of the native interface and the microservice interface;

[0107] generating a plurality of test data instances according to the test data template;

[0108] Integrate all the test data instances to generate test data that can trigger the complete functions of the native interface and the microservice interface.

[0109] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:

[0110] 1. Build a test data template

[0111] Based on the input parameter requirements of native and microservice interfaces, analyze each parameter's type, range, mandatory field, and inter-parameter relationships. Based on this information, design a test data template to clearly define the value rules for each parameter. For example, if a parameter is a date, the template can specify that its value range is within the past year; if a parameter is a user ID, the template can specify that it must be a positive integer with a length of no more than 10 digits.

[0112] 2. Generate multiple test data instances

[0113] Generate multiple specific test data instances based on the test data template. These instances should cover a variety of normal and abnormal situations to ensure the performance of the interface under different inputs. For example:

[0114] Normal situation: Generate test data that meets all parameter requirements, such as legal user ID, valid date, etc.

[0115] Abnormal situations: Generate some test data that does not meet the requirements, such as empty user ID, incorrect date format, etc., to test the fault tolerance and exception handling capabilities of the interface.

[0116] Boundary cases: Generate test data at the boundary values of parameters, such as the user ID is the maximum value, the date is the minimum value, etc., to test the performance of the interface under boundary conditions.

[0117] 3. Integrate test data examples

[0118] Combine all generated test data instances into a complete test dataset. This dataset should be able to trigger the full functionality of both native and microservice interfaces, including normal functionality, exception handling, and edge cases. Ensure that each test data instance is clearly labeled with its expected result to facilitate subsequent test result comparison.

[0119] 4. Verify the validity of test data

[0120] Use a small amount of test data to call both native and microservice interfaces to verify that the data can properly trigger the interface functions. Check that the interface can correctly process the data and return the expected results. If you find that some test data does not trigger the expected functions, adjust the test data template or regenerate the test data instances.

[0121] 5. Optimize the test dataset

[0122] Based on the verification results, optimize the test dataset. Delete redundant test data instances and supplement missing test scenarios to ensure that the test dataset fully covers the interface functionality while not being too large to compromise testing efficiency. The resulting test dataset should be able to efficiently trigger the full functionality of both native and microservice interfaces, providing reliable input for subsequent interface testing.

[0123] Through the above process, this embodiment can generate high-quality test data to ensure the comprehensiveness and effectiveness of microservice interface testing.

[0124] Furthermore, in one embodiment, the microservice interface testing method, wherein the calling of the native interface and the microservice interface based on the test data to generate corresponding first calling results and second calling results, specifically includes the steps of:

[0125] Use the test data to call the native interface and the microservice interface respectively, and record the input data, return results and exception information of the two during the calling process;

[0126] Generate a first call result and a second call result corresponding to the native interface and the microservice interface according to the input data, the return result and the exception information;

[0127] The first call result and the second call result are formatted and saved to a designated storage location.

[0128] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:

[0129] 1. Prepare the calling environment

[0130] Configure the test environment to ensure that both native and microservice interfaces are accessible. Also, prepare the test datasets you generated earlier and ensure that the test tools (such as Postman, JMeter, etc.) or test scripts can read these datasets correctly.

[0131] 2. Call the interface and record information

[0132] Use test data to call the native interface and microservice interface respectively. During the call process, record the following information in detail:

[0133] Input data: records the specific parameter values passed into the interface each time it is called.

[0134] Return result: records the data content returned after the interface is called, including the data returned successfully and the error information returned in failure.

[0135] Exception information: records any exceptions that occur during the call process, such as network errors, timeouts, interface errors, etc.

[0136] These records will constitute the first call result (native interface) and the second call result (microservice interface) respectively.

[0137] 3. Format call results

[0138] Format the first and second call results to ensure they are in a uniform format for easy comparison and analysis. For example, you can format the call results in JSON format, including fields such as input data, return results, and exception information.

[0139] 4. Save the call results

[0140] Save the formatted results of the first and second calls to a specified storage location. You can choose to save them to a local file (such as a JSON file or CSV file), a database table, or a test management tool. Ensure that the save path is clear and unambiguous to facilitate subsequent search and comparison.

[0141] Through the above process, this embodiment can ensure that the call results of the native interface and the microservice interface are accurately recorded, formatted and saved, providing a reliable data basis for subsequent comparison and analysis.

[0142] Furthermore, in one embodiment, the microservice interface testing method, wherein the first call result and the second call result are compared, and the test result of the microservice interface is determined according to the comparison result, specifically comprises the steps of:

[0143] Comparing the first call result and the second call result;

[0144] If the first call result and the second call result are consistent, it is determined that the functions of the microservice interface and the native interface are consistent;

[0145] If the first call result and the second call result are inconsistent, it is determined that the functions of the microservice interface and the native interface are inconsistent.

[0146] Furthermore, the microservice interface testing method further specifically includes the following steps: if the first call result and the second call result are inconsistent, then after determining that the functions of the microservice interface and the native interface are inconsistent,

[0147] Record the difference information between the microservice interface and the native interface functions;

[0148] Analyze the reasons for the difference information;

[0149] Adjust the implementation logic and / or parameter configuration of the microservice interface according to the analysis results;

[0150] Reusing the test data to call the adjusted microservice interface to generate a new call result;

[0151] The new call result is compared with the first call result again to verify the validity of the adjustment.

[0152] Furthermore, the microservice interface testing method, wherein adjusting the implementation logic and / or parameter configuration of the microservice interface according to the analysis results, specifically comprises the steps of:

[0153] Build an adjustment strategy for the microservice interface based on the analysis results, and identify the interface functions and interface parameters that need to be modified;

[0154] Based on the adjustment strategy, the implementation logic and / or parameter configuration of the microservice interface is adjusted.

[0155] During specific implementation, the specific implementation process of the steps in this embodiment is roughly as follows:

[0156] 1. Compare call results

[0157] Compare the first call result (the call result of the native interface) and the second call result (the call result of the microservice interface) item by item. The comparison includes:

[0158] Whether the input data is consistent.

[0159] Returns whether the fields and values of the result match exactly.

[0160] Check whether there is any abnormal information and whether the content of the abnormal information is the same.

[0161] The comparison process can be completed through automated scripts or testing tools to ensure the accuracy and efficiency of the comparison.

[0162] 2. Determine functional consistency

[0163] Determine based on the comparison results:

[0164] If the results of the first call and the second call are exactly the same, it means that the functions of the microservice interface and the native interface are consistent, and the test passes.

[0165] If there are any inconsistencies, it means that the functions of the microservice interface are inconsistent with the native interface and need further processing.

[0166] 3. Record difference information

[0167] In case of functional inconsistency, detailed records of differences are required. The records include:

[0168] Inconsistent field names and values;

[0169] Specific return results of native interfaces and microservice interfaces;

[0170] Exception information (if any);

[0171] Details of the test data instance.

[0172] The recorded difference information should be clear and accurate to facilitate subsequent analysis and adjustment.

[0173] 4. Analyze discrepancies and build adjustment strategies

[0174] Analyze discrepancies: Conduct in-depth analysis of recorded discrepancies to identify the root cause of the inconsistency. For example, this could be a logical error in the microservice interface, a different data processing method, or a difference in the interface definition.

[0175] Build an adjustment strategy: Based on the analysis results, develop a specific adjustment strategy to identify the interface functions and parameters that need to be modified. This adjustment strategy may include modifying the microservice interface code, adjusting data processing logic, and optimizing interface definitions to ensure that the microservice interface functions are consistent with the native interface.

[0176] 5. Adjust the microservice interface and retest

[0177] Adjust the microservice interface: Based on the established adjustment strategy, make actual adjustments to the implementation logic and / or parameter configuration of the microservice interface. After the adjustment is completed, ensure that the code passes compilation and unit testing.

[0178] Retest: Use the same test data to call the adjusted microservice interface again, generate a new call result, and compare the new call result with the first call result of the native interface to verify the effectiveness of the adjustment. Repeat the above steps until the microservice interface and the native interface are fully functional.

[0179] Through the above process, this embodiment can systematically compare the call results of the native interface and the microservice interface, analyze the differences, adjust the microservice interface, and ultimately ensure that its functionality is consistent with the native interface. This process not only improves the accuracy of the test, but also provides a clear direction for optimizing and improving the microservice interface.

[0180] As can be seen from the above method embodiments, the microservice interface testing method provided by the present invention includes: determining a native database interface and a microservice interface corresponding to the functionality of the native interface; obtaining test data that can normally call the native interface and the microservice interface; based on the test data, calling the native interface and the microservice interface, respectively, to generate corresponding first and second call results; comparing the first and second call results, and determining the test result of the microservice interface based on the comparison results. In this way, the method of the present invention can effectively improve the efficiency and accuracy of microservice interface testing.

[0181] It should be understood that although the present application provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative work, and these operation steps are not necessarily performed in the order of the embodiments or flowcharts. The order of steps listed in the embodiments or flowcharts is only one way of executing the steps among many steps and does not represent the only execution order. It should be noted that there is not necessarily a certain order between the above steps. Those of ordinary skill in the art can understand from the description of the embodiments of the present invention that in different embodiments, the above steps may have different execution orders, that is, they may be executed in parallel, or they may be executed in an interchangeable manner, etc. Moreover, at least a portion of the steps in the embodiments or flowcharts may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily to be performed in sequence, but may be executed in turn, alternately or synchronously with other steps or at least a portion of the sub-steps or stages of other steps.

[0182] Based on the above method embodiment, please refer to Figure 3 Another embodiment of the present invention further provides a microservice interface testing device, wherein the device includes:

[0183] Determination module 11, used to determine the native interface of the database and the microservice interface corresponding to the function of the native interface;

[0184] An acquisition module 12 is used to obtain test data that can normally call the native interface and the microservice interface;

[0185] A calling module 13 is configured to call the native interface and the microservice interface respectively based on the test data to generate corresponding first calling results and second calling results;

[0186] The comparison module 14 is configured to compare the first call result with the second call result, and determine a test result of the microservice interface according to the comparison result.

[0187] Furthermore, in one embodiment, the microservice interface testing device, wherein determining the native interface of the database and the microservice interface corresponding to the function of the native interface, specifically includes:

[0188] Analyze the functional characteristics of the database's native interface using database management tools, including the input parameters, output results, and business logic of the native interface;

[0189] According to the functional characteristics of the native interface, match the microservice interface corresponding to the function of the native interface;

[0190] Verify whether the microservice interface can fully cover the functionality of the native interface;

[0191] If it cannot be fully covered, rematch until the functional consistency requirements are met.

[0192] Furthermore, in one embodiment, the microservice interface testing device, wherein the step of obtaining test data capable of normally calling the native interface and the microservice interface, specifically includes:

[0193] Constructing a test data template according to the input parameter requirements of the native interface and the microservice interface;

[0194] generating a plurality of test data instances according to the test data template;

[0195] Integrate all the test data instances to generate test data that can trigger the complete functions of the native interface and the microservice interface.

[0196] Furthermore, in one embodiment, the microservice interface testing device, wherein the calling of the native interface and the microservice interface based on the test data to generate corresponding first calling results and second calling results, specifically includes:

[0197] Use the test data to call the native interface and the microservice interface respectively, and record the input data, return results and exception information of the two during the calling process;

[0198] Generate a first call result and a second call result corresponding to the native interface and the microservice interface according to the input data, the return result and the exception information;

[0199] The first call result and the second call result are formatted and saved to a designated storage location.

[0200] Furthermore, in one embodiment, the microservice interface testing device, wherein the comparing the first call result and the second call result and determining the test result of the microservice interface according to the comparison result, specifically includes:

[0201] Comparing the first call result and the second call result;

[0202] If the first call result and the second call result are consistent, it is determined that the functions of the microservice interface and the native interface are consistent;

[0203] If the first call result and the second call result are inconsistent, it is determined that the functions of the microservice interface and the native interface are inconsistent.

[0204] Furthermore, the microservice interface testing device, wherein if the first call result and the second call result are inconsistent, after determining that the functions of the microservice interface and the native interface are inconsistent, specifically further comprises:

[0205] Record the difference information between the microservice interface and the native interface functions;

[0206] Analyzing the reasons for the generation of the difference information;

[0207] Adjust the implementation logic and / or parameter configuration of the microservice interface according to the analysis results;

[0208] Reusing the test data to call the adjusted microservice interface to generate a new call result;

[0209] The new call result is compared with the first call result again to verify the validity of the adjustment.

[0210] Furthermore, in the microservice interface testing device, adjusting the implementation logic and / or parameter configuration of the microservice interface according to the analysis results specifically includes:

[0211] Build an adjustment strategy for the microservice interface based on the analysis results, and identify the interface functions and interface parameters that need to be modified;

[0212] Based on the adjustment strategy, the implementation logic and / or parameter configuration of the microservice interface is adjusted.

[0213] It should be noted that, in the embodiment of the device of the present invention, the information interaction, execution process and other contents between the above modules are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the aforementioned method embodiment part and will not be repeated here.

[0214] Based on the above method embodiment, another embodiment of the present invention further provides a computer device, which can be a server, and its internal structure diagram can be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the functions or steps on the service side of the microservice interface testing method in any of the above method embodiments are implemented.

[0215] Based on the above method embodiment, another embodiment of the present invention further provides a computer device, which can be a client, and its internal structure diagram can be as follows: Figure 5 As shown. The computer device includes a processor, memory, network interface, display screen and input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the functions or steps of the client side of the microservice interface testing method in any of the above method embodiments are implemented.

[0216] Those skilled in the art will understand that Figure 4 and Figure 5 The structural diagram shown in the figure is only a schematic diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more components than shown in the figure, or combine certain components, or have a different component arrangement.

[0217] The processor referred to herein may be a CPU, other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or any conventional processor, etc.

[0218] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory can be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium can be a hard disk of the computer device, and in other embodiments, it can also be an external storage device of the computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Furthermore, the memory can also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of a computer program. The memory can also be used to temporarily store data that has been output or is about to be output.

[0219] Based on the above method embodiments, another embodiment of the present invention further provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the microservice interface testing method described in any of the above method embodiments. The computer-readable storage medium can be either non-volatile or volatile.

[0220] It should be noted that the above-mentioned functions or steps that can be implemented by computer-readable storage media or computer devices, and the technical effects brought about by the functions / steps, can be found in the relevant descriptions in the aforementioned method embodiments. To avoid repetition, they will not be described one by one here.

[0221] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM). The disclosed memory components or memories of the operating environments described herein are intended to comprise one or more of these and / or any other suitable types of memory.

[0222] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, in the embodiment of the device of the present invention, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual application, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.

[0223] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

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

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

[0226] It should be noted that if software tools or components other than those of the Company appear in the embodiments of this application, they are merely for illustration and do not represent actual use. The above embodiments are intended only to illustrate the technical solutions of the present invention, not to limit them. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some of the technical features therein with equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.

Claims

1. A microservice interface testing method, characterized in that: include: Determine the native interface of the database and the microservice interface corresponding to the function of the native interface; Obtain test data that can normally call the native interface and the microservice interface; Based on the test data, calling the native interface and the microservice interface respectively to generate corresponding first calling results and second calling results; The first call result and the second call result are compared, and a test result of the microservice interface is determined according to the comparison result.

2. The microservice interface testing method according to claim 1, characterized in that: The determining of the native interface of the database and the microservice interface corresponding to the function of the native interface includes: Analyze the functional characteristics of the database's native interface using database management tools, including the input parameters, output results, and business logic of the native interface; According to the functional characteristics of the native interface, match the microservice interface corresponding to the function of the native interface; Verify whether the microservice interface can fully cover the functionality of the native interface; If it cannot be fully covered, rematch until the functional consistency requirements are met.

3. The microservice interface testing method according to claim 1, characterized in that: The obtaining of test data capable of normally calling the native interface and the microservice interface includes: Constructing a test data template according to the input parameter requirements of the native interface and the microservice interface; generating a plurality of test data instances according to the test data template; Integrate all the test data instances to generate test data that can trigger the complete functions of the native interface and the microservice interface.

4. The microservice interface testing method according to claim 1, characterized in that: The calling of the native interface and the microservice interface based on the test data to generate corresponding first calling results and second calling results includes: Use the test data to call the native interface and the microservice interface respectively, and record the input data, return results and exception information of the two during the calling process; Generate a first call result and a second call result corresponding to the native interface and the microservice interface according to the input data, the return result and the exception information; The first call result and the second call result are formatted and saved to a designated storage location.

5. The microservice interface testing method according to claim 1, characterized in that: The comparing the first call result and the second call result, and determining the test result of the microservice interface according to the comparison result, includes: Comparing the first call result and the second call result; If the first call result and the second call result are consistent, it is determined that the functions of the microservice interface and the native interface are consistent; If the first call result and the second call result are inconsistent, it is determined that the functions of the microservice interface and the native interface are inconsistent.

6. The microservice interface testing method according to claim 5, characterized in that: If the first call result and the second call result are inconsistent, then after determining that the functions of the microservice interface and the native interface are inconsistent, the method further includes: Record the difference information between the microservice interface and the native interface functions; Analyze the reasons for the difference information; Adjust the implementation logic and / or parameter configuration of the microservice interface according to the analysis results; Reusing the test data to call the adjusted microservice interface to generate a new call result; The new call result is compared with the first call result again to verify the validity of the adjustment.

7. The microservice interface testing method according to claim 6, characterized in that: The adjusting the implementation logic and / or parameter configuration of the microservice interface according to the analysis results includes: Build an adjustment strategy for the microservice interface based on the analysis results, and identify the interface functions and interface parameters that need to be modified; Based on the adjustment strategy, the implementation logic and / or parameter configuration of the microservice interface is adjusted.

8. A microservice interface testing device, characterized in that: include: A determination module, configured to determine a native interface of the database and a microservice interface corresponding to a function of the native interface; An acquisition module is used to obtain test data that can normally call the native interface and the microservice interface; A calling module, configured to call the native interface and the microservice interface respectively based on the test data, and generate corresponding first calling results and second calling results; A comparison module is used to compare the first call result with the second call result, and determine the test result of the microservice interface according to the comparison result.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the microservice interface testing method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the microservice interface testing method according to any one of claims 1 to 7 is implemented.