Automatic testing method and system based on dubbo generalization calling

Through the automated testing method combined with Logstash and ElasticSearch, the problem of insufficient interface testing coverage in the dubbo microservice framework is solved, and efficient and accurate automated testing is achieved to ensure code quality and system stability.

CN120256306APending Publication Date: 2025-07-04BEIJING BAIJU YIXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510356846.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The existing automated testing solutions lack sufficient support for data modification and complex business logic interfaces in the dubbo microservice framework, especially in the interfaces of data modification and complex business logic, resulting in insufficient test coverage and increasing the risk of online service failure.

Method used

By deploying the Logstash log collection system, the business logs and Dubbo interface call parameters are captured in real time, and stored in ElasticSearch. It combines with an automated test platform to load configuration data, simulate actual business requests, call new and old interfaces for comparison, and identify inconsistent test cases.

Benefits of technology

It improves the authenticity and accuracy of the test, significantly shortens the test cycle, reduces the risk of missed tests and miscalculation, reduces the workload of manual testing, and improves test coverage and code quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256306A_ABST
    Figure CN120256306A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic testing method and system based on dubbo generalization calling. The invention relates to the technical field of dubbo micro-services. The Logstash log acquisition system is automatically started on each business server cluster node, and business logs and Dubbo interface calling parameters are acquired in real time. Collected log data are formatted into a json format, different indexes are created according to dates, and then the log data are output to an ElasticSearch distributed search server to be stored. The automatic regression test interface management platform loads preset configuration data, including a Dubbo service registration center address; according to the automatic test, a large number of test cases can be quickly executed, the test period is remarkably shortened, and product iteration is accelerated. By accurately simulating the actual service request, the authenticity and accuracy of the test are ensured, and the risks of missed test and false test are reduced. The workload of manual testing is reduced through automatic testing, and testing personnel can focus on design and optimization of test cases more.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Dubbo microservices, specifically to the technical fields of automated regression testing and Dubbo microservices, and particularly to an automated testing method and system based on Dubbo generalization invocation. Background Art

[0002] In today's rapidly evolving software development environment, server-side microservice projects, with their highly modular and flexible deployment characteristics, have greatly promoted the rapid iteration and innovation of businesses. However, as the number of system iterations increases, the number of microservice interfaces also surges, posing a severe challenge to software quality assurance. Specifically, traditional manual testing methods are no longer sufficient to handle this increased complexity, and the implementation of automated regression testing has become particularly urgent but also full of difficulties.

[0003] Under the microservice architecture, the dependencies between interfaces are intricate, making the design and implementation of automated regression testing extremely complex. In addition, the limited and inefficient utilization of test human resources further exacerbates this dilemma, making comprehensive and efficient test coverage an unattainable goal. Therefore, insufficient test case coverage has become the norm, increasing the risk of online service failures and posing a potential threat to system stability and user experience.

[0004] In response to the above problems, existing automated testing solutions have shown certain limitations. Specifically, current technical practices mainly focus on the automated regression testing of Dubbo microservice interfaces. Although this framework performs well in distributed service governance, its automated testing capabilities are limited to specific business scenarios - mainly concentrated on the testing of query-type interfaces. These interfaces involve data reading operations and have relatively simple logic, while interfaces involving data modification, transaction processing, or complex business logics lack sufficient automated testing support.

[0005] Therefore, the present invention proposes an automated testing method and system based on Dubbo generalization invocation. Summary of the Invention

[0006] In view of this, the present invention aims to provide an automated testing method and system based on Dubbo generalization invocation to solve or alleviate the technical problems existing in the prior art, that is, how to solve the automated testing problem of server-side projects with the Dubbo microservice framework as the core, achieve the technical ability of automated testing regression for Dubbo interfaces, and provide at least one beneficial option for this; the technical solution of the present invention is implemented as follows:

[0007] In a first aspect, an automated testing method based on Dubbo generalization invocation:

[0008] (1) Overview:

[0009] The present invention aims to utilize automated testing technology, combined with log collection and analysis, to achieve efficient regression testing for Dubbo interfaces. By deploying the Logstash log collection system, business logs and Dubbo interface call parameters are captured in real time, and these data are formatted and stored in the ElasticSearch distributed search server. Subsequently, the automated testing platform loads preset configurations, including Dubbo service registration information, details of the interfaces to be tested, and log retrieval keywords, etc., to prepare the test environment. In the testing phase, the platform calls the Dubbo interfaces of the online old version and the new version in the gray environment respectively, uses zero-width assertion technology to accurately extract parameters and compare the execution results, and identifies inconsistent cases. Finally, the pass rate is calculated based on the comparison results, the inconsistent cases are displayed, and a warning is triggered if the preset percentage is not reached.

[0010] (2) Technical Solution:

[0011] To achieve the above technical objectives, when receiving the automated testing start instruction input by the user, the following operation steps are executed in this solution.

[0012] 2.1 Step S1, Start the Logstash Log Collection System:

[0013] The Logstash log collection system is automatically started on each node of the business server cluster to collect business logs and Dubbo interface call parameters in real time.

[0014] The collected log data is formatted into json format, different indexes are created according to the date, and then output to the ElasticSearch distributed search server for storage.

[0015] 2.1.1 Step S100, Automatically Start the Logstash Log Collection System:

[0016] On each node of the business server cluster, configure the Logstash log collection system to start automatically when the system boots, or start it automatically as needed through scripts / scheduled tasks, etc.

[0017] 2.1.2 Step S101, Collect Logs in Real Time:

[0018] Through the configured input plugin (such as the file input plugin), log data generated on the business server is collected in real time, including records of business operations, exception information, and Dubbo interface call parameters.

[0019] 2.1.3 Step S102, Format Log Data:

[0020] Use a filter (grok filter plugin) to format the collected log data and convert it into JSON format. During the formatting process, extract the key fields in the log, including the timestamp, log level, caller, callee, and / or parameter list, to construct structured log data.

[0021] 2.1.4 Step S103, Create an index and output to ElasticSearch:

[0022] Output the formatted log data to the ElasticSearch distributed search server according to the configured output plugin (such as the elasticsearch output plugin);

[0023] Before output, create different indexes for the log data according to the date condition.

[0024] 2.2 Step S2, Load the configuration of the automated testing platform:

[0025] The automated regression testing interface management platform loads the preset configuration data, including the address of the Dubbo service registry, the fully qualified class name and method name of the interface to be tested, and the log retrieval keywords.

[0026] The platform also loads the specified test environment machine IP, the number of test cases, and the regression test pass rate percentage parameter.

[0027] 2.2.1 Step S200, Load the preset configuration data:

[0028] Load the configuration data, including the address of the Dubbo service registry.

[0029] Load the fully qualified class name and method name of the interface to be tested. These information are necessary when the testing platform executes the test to determine which interface and method to specifically test.

[0030] Load the log retrieval keywords, which are used to retrieve the test-related log data in ElasticSearch.

[0031] 2.2.2 Step S201, Load the test environment information:

[0032] The platform loads the specified test environment machine IP; this is to be able to deploy the test to the correct server and ensure the isolation of the test environment from the production environment;

[0033] At the same time, load the number of test cases; this is to control the scope and scale of the test and ensure that the test can be completed within a reasonable time;

[0034] 2.2.3 Step S202, Loading the Pass Rate Parameter of Regression Testing:

[0035] The platform loads the pass rate percentage parameter of regression testing to set the standard for passing the test. If the pass rate of the test is lower than this percentage, the platform issues a warning or blocks the code merge.

[0036] 2.3 Step S3, Loading the Test Environment:

[0037] The new interface code is deployed to the gray environment machine with the specified IP address configured in the automated regression testing platform; the old code in the formal environment remains running to facilitate the comparison of the execution results of the new and old codes.

[0038] 2.3.1 Step S300, Preparing the Gray Environment:

[0039] According to the specified IP address configured in the automated regression testing platform, prepare the corresponding gray environment machine and isolate it from the formal environment to ensure that the test will not affect the formal environment.

[0040] 2.3.2 Step S301, Deploying the New Interface Code:

[0041] Pack and transfer the code to the gray environment machine, decompress and configure it in this environment, and then deploy the newly developed interface code to the gray environment machine and communicate with the Dubbo service registry.

[0042] 2.3.3 Step S302, Keeping the Old Code in the Formal Environment Running:

[0043] While testing the new code, keep the old code in the formal environment still running. This is to be able to compare the execution results of the new and old codes during the test;

[0044] Collect the running data of the old code in the formal environment and store it in the log system or database for subsequent analysis.

[0045] 2.3.4 Step S303, Configuring the Test Environment Parameters:

[0046] Configure the necessary test environment parameters in the gray environment and the formal environment, including database connection information and cache configuration. Ensure that these parameters match the test requirements and do not affect the accuracy of the test results.

[0047] 2.4 Step S4, Log Retrieval and Parameter Acquisition:

[0048] The automated regression testing platform retrieves and obtains the call parameter content of the online Dubbo interface in the ElasticSearch distributed search server through the configured log retrieval keywords; and uses zero-width assertion technology to intercept the interface call parameters from the logs.

[0049] 2.4.1 Step S400, Configure log retrieval keywords:

[0050] In the automated regression testing platform, configure the keywords related to the call of the Dubbo interface for log retrieval, including the interface name, method name, and specific parameter values.

[0051] 2.4.2 Step S401, Retrieve logs in ElasticSearch:

[0052] Use the configured log retrieval keywords to match the log data in the ElasticSearch distributed search server according to the keywords, and return the log records that meet the conditions to perform the retrieval operation.

[0053] 2.4.3 Step S402, Obtain Dubbo interface call parameters:

[0054] Extract the call parameter content of the Dubbo interface from the retrieved log records;

[0055] Use a parsing tool or regular expression to parse the parameter values from the logs;

[0056] 2.4.4 Step S403, Use zero-width assertion technology to intercept parameters:

[0057] In some cases, the parameters in the logs may be closely adjacent to other text and are difficult to extract directly.

[0058] At this time, use zero-width assertion technology (lookahead and lookbehind in regular expressions) to intercept the parameters. Zero-width assertions allow not to consume characters during the matching process and are only used to locate the target string, thus achieving precise extraction of the parameters.

[0059] 2.5 Step S5, Interface call and result comparison:

[0060] The automated regression testing platform calls the Dubbo interfaces of the old code in the online environment and the Dubbo interfaces of the new code in the gray environment respectively, and obtains the execution results of both. Compare the execution results of the old and new codes to identify the inconsistent cases and their quantities.

[0061] 2.5.1 Step S500, Call the Dubbo interface of the old code in the online environment:

[0062] The automated regression testing platform sends requests to the Dubbo service registry, invokes the Dubbo interfaces of the old code in the online environment, and specifies the interface name, method name, and parameters to be invoked. The platform records the execution results of the old code interface calls, including return values and exception information.

[0063] 2.5.2 Step S501, Invoke the Dubbo interface of the new code in the gray environment:

[0064] By sending requests to the Dubbo service registry and specifying the gray environment where the new code is located, as well as the interface name, method name, and parameters to be invoked, the Dubbo interface of the new code in the gray environment is invoked. The platform records the execution results of the new code interface calls and compares them with the execution results of the old code.

[0065] 2.5.3 Step S502, Compare the execution result content:

[0066] Compare the content of the execution results of the new and old codes, that is, identify the cases where there are inconsistencies between the two by comparing the return values, exception information, and execution times;

[0067] If the execution results of the new and old codes are exactly the same, it is considered that the case passes the test; if they are inconsistent, it is recorded as an inconsistent case, and the number is counted.

[0068] 2.5.4 Step S503, Process inconsistent cases:

[0069] For inconsistent cases, view the logs and debug the code to determine the reasons for the inconsistencies;

[0070] Generate a test report, including the test overview, the number of passed cases, the number and details of inconsistent cases, and the test time.

[0071] 2.6 Step S6, Result analysis and display:

[0072] Calculate the proportion of cases with inconsistent content in the overall test cases;

[0073] Display the inconsistent test cases and their execution results on the automated regression testing platform;

[0074] If the passing rate does not reach the preset percentage, trigger a warning or notify the administrator for further troubleshooting.

[0075] (III) Mechanism for solving technical problems:

[0076] 3.1 Log-driven testing:

[0077] By collecting Dubbo interface call parameters in business logs in real time and simulating actual business requests to test the interface, the authenticity and accuracy of the test are improved. Utilizing the powerful search and analysis capabilities of ElasticSearch, key log data can be quickly retrieved and located, supporting efficient automated test execution.

[0078] 3.2 Automated Testing Framework:

[0079] A complete automated testing framework is constructed, including multiple links such as log collection, test configuration loading, test environment preparation, interface call, result comparison and display, etc. Guided by preset configuration data and parameters, the execution and result evaluation of automated tests are carried out, reducing the risk of human intervention and errors.

[0080] 3.3 Gray Environment Verification:

[0081] Deploy new code in the gray environment and conduct tests, isolated from the formal environment, to ensure that the new code is verified without affecting the existing business. By comparing the execution results of the new and old codes, the impact of the new code on the interface function can be quickly identified, providing an important basis for subsequent troubleshooting and repair.

[0082] 3.4 Continuous Integration and Feedback:

[0083] Integrate automated test cases into the continuous integration process to ensure that each code submission can automatically trigger test execution. Through timely feedback of test results, problems can be quickly discovered and fixed, improving code quality and project iteration speed.

[0084] In the second aspect, an automated testing system based on Dubbo generalization call:

[0085] This system is used to implement the automated testing method described above, and it includes:

[0086] (1) Components:

[0087] (1) Logstash Log Collection System for Real-time Collecting Log Data on Business Servers: Provide raw data support for subsequent automated testing processes to ensure the authenticity and accuracy of the tests.

[0088] Format the collected log data into JSON format and output it to the ElasticSearch distributed search server for storage.

[0089] (2) ElasticSearch Distributed Search Server for Storing Log Data Collected by Logstash: Support the automated testing platform to quickly retrieve and locate key log data, improving test efficiency.

[0090] Interact with the Logstash log collection system to receive and store formatted log data; interact with the automated testing platform to respond to log retrieval requests.

[0091] (3) An automated testing platform that loads preset configurations, prepares the test environment, invokes Dubbo interfaces, compares results, and displays test results: It realizes the core functions of automated regression testing for Dubbo interfaces, ensuring the automation and efficiency of the testing process.

[0092] Interact with the configuration management system to load preset configuration data; interact with the ElasticSearch distributed search server to retrieve and obtain log data; interact with the test environment to deploy new code and invoke Dubbo interfaces; interact with the result display system (which may be built-in to the platform or an independent module) to display test results.

[0093] (4) A test environment that deploys new code and simulates the actual running environment for the automated testing platform to invoke Dubbo interfaces: It isolates new code from the production environment, ensuring that the testing process does not affect existing business.

[0094] Interact with the automated testing platform to receive new code deployment requests and interface invocation requests; interact with the Dubbo service registry (indirectly) to discover services through the registry and invoke Dubbo interfaces.

[0095] (5) A configuration management system that manages the preset configuration data required by the automated testing platform: including the Dubbo service registry address and information about the interfaces to be tested. It provides necessary configuration support for the automated testing platform to ensure the smooth execution of the testing process.

[0096] Interact with the automated testing platform to provide preset configuration data.

[0097] (II) Details:

[0098] (1) Logstash log collection system and ElasticSearch distributed search server: The Logstash log collection system collects log data in real-time and outputs it to the ElasticSearch distributed search server for storage. The ElasticSearch distributed search server provides efficient search and analysis capabilities to support the automated testing platform in quickly retrieving log data.

[0099] (2) Automated testing platform and ElasticSearch distributed search server: The automated testing platform retrieves and obtains log data through the ElasticSearch distributed search server and tests Dubbo interfaces by simulating actual business requests.

[0100] (3) Automated testing platform and testing environment: The automated testing platform deploys new code to the testing environment and invokes Dubbo interfaces for testing. The testing environment simulates the actual operating environment to provide interface call responses.

[0101] (4) Automated testing platform and configuration management system: The automated testing platform loads the preset configuration data provided by the configuration management system to guide the execution of the testing process and the evaluation of results.

[0102] (5) Testing environment and Dubbo service registry (indirectly): The testing environment discovers services through the Dubbo service registry and invokes Dubbo interfaces to achieve isolated testing from the production environment.

[0103] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0104] I. Improve testing efficiency and accuracy: The automated testing of the present invention can quickly execute a large number of test cases, significantly shorten the testing cycle, and accelerate product iteration. By accurately simulating actual business requests, it ensures the authenticity and accuracy of testing, reducing the risk of missed testing and false positives. Automated testing reduces the workload of manual testing, enabling testers to focus more on the design and optimization of test cases.

[0105] II. Reduce testing costs: The automated testing of the present invention reduces the workload of manual testing and lowers labor costs. By reusing test cases and test scripts, it improves the utilization rate of testing resources and further reduces costs.

[0106] III. Enhance code quality and stability: The automated testing of the present invention can continuously monitor code quality, promptly detect and fix problems, and ensure code stability. Through regression testing, it ensures that no new problems are introduced with each code modification, guaranteeing the continuous and stable operation of the system.

[0107] IV. Increase testing coverage: The automated testing of the present invention can cover more testing scenarios and boundary conditions, improving testing coverage. Especially for complex and difficult-to-manually-test scenarios, automated testing can provide more effective solutions. BRIEF DESCRIPTION OF THE DRAWINGS

[0108] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0109] Figure 1 It is a schematic flowchart of the method of the present invention;

[0110] Figure 2 Schematic diagram of the ELK log collection system of the present invention;

[0111] Figure 3 Schematic diagram of the automated regression testing platform of the present invention;

[0112] Figure 4 Schematic diagram of the overall components of the system of the present invention. Detailed implementation manners

[0113] To make the above objects, features and advantages of the present invention more obvious and understandable, the following will describe the detailed implementation manners of the present invention in conjunction with the accompanying drawings. Many specific details are set forth in the following description in order to fully understand the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below;

[0114] It should be noted that the various embodiments in this specification are described in a progressive manner, and the key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.

[0115] Explanation of related terms:

[0116] (1) Logstash log collection system: A tool used to collect and format business logs in real time and then output them to a storage system. It is a completely open-source tool that can collect, filter, and analyze logs, supports a large number of data acquisition methods, and stores them for later use (such as searching). Speaking of searching, Logstash comes with a web interface to search and display all logs. Generally, it works in a C / S architecture. The client is installed on the host that needs to collect logs, and the server is responsible for filtering, modifying, etc. the logs received from each node and sending them to Elasticsearch.

[0117] (2) ElasticSearch distributed search server: An open-source distributed search server based on Lucene. Its features include: distributed, zero configuration, automatic discovery, automatic sharding of indexes, index replication mechanism, RESTful-style interfaces, multiple data sources, automatic search load balancing, etc. It provides a full-text search engine with distributed multi-user capabilities, and based on the RESTful web interface, it provides rich log query APIs.

[0118] (3) Dubbo interface call parameters: Specific parameter information passed to the interface when using the Dubbo framework for service calls.

[0119] (4) Dubbo service registry address: In the Dubbo service framework, the central address for service registration and discovery. Service providers and consumers interact through this address.

[0120] (5) Fully qualified class name and method name of the interface to be tested: Specifies the unique identifier of the interface to be tested, including the full class name and method name of the interface.

[0121] (6) Log retrieval keyword: A keyword or condition used to search for specific log records in ElasticSearch.

[0122] (7) Gray environment machine: An environment used to deploy new code and conduct tests, isolated from the production environment to reduce risks.

[0123] (8) Zero-width assertion technology: A regular expression technology used to precisely match and extract specific parts in a string without consuming characters.

[0124] (9) Case: In the field of testing, refers to a specific test instance or test case.

[0125] (10) Preset percentage: In automated testing, a pre-set pass rate threshold used to determine whether the test is successful.

[0126] Example 1: As Figures 1-2 shown, this example discloses the application of the automated testing method based on Dubbo generic call in the online car-hailing platform.

[0127] In the online car-hailing platform, it is necessary to conduct automated regression testing on newly developed Dubbo interfaces to ensure their functional consistency with the old interfaces. This example will combine the Logstash log collection system, ElasticSearch distributed search server, and Dubbo microservice framework to achieve this goal.

[0128] In this example, regarding the startup and log processing of the Logstash log collection system (Steps S1 / S100 - S103):

[0129] (1) Start Logstash: Automatically start the Logstash log collection system on each business server cluster node of the online car-hailing platform. This can be achieved by configuring the system service or a scheduled task.

[0130] After Logstash is started, it will collect business logs and Dubbo interface call parameters in real-time.

[0131] (2) Real-time log collection: Use the file input plugin of Logstash to collect log data generated on the business server in real time. These log data include user ride records, order status changes, payment information, etc., as well as the call parameters of Dubbo interfaces.

[0132] (3) Log data formatting: Through the grok filter plugin, format the collected log data and convert it to the json format. The log data processed in this way is easier to store and retrieve. During the formatting process, extract key fields in the log, such as timestamp, log level, caller, callee, and parameter list, to construct structured log data.

[0133] (4) Create an index and output to ElasticSearch: Use the elasticsearch output plugin to output the formatted log data to the ElasticSearch distributed search server. Before outputting, create different indexes for the log data according to date conditions for subsequent rapid retrieval.

[0134] It can be understood that through the Logstash log collection system, we can collect business logs and Dubbo interface call parameters in the online car-hailing platform in real time and comprehensively, providing data support for subsequent automated tests.

[0135] In this embodiment, regarding the configuration loading of the automated test platform (steps S2 / S200 - S202):

[0136] (1) Load preset configuration data: On the automated regression test platform, load the preset configuration data. These data include the address of the Dubbo service registry, the fully qualified class name and method name of the interface to be tested, and the log retrieval keywords. These configuration data are necessary for the test platform to execute tests, and they determine the specific goals and scopes of the tests.

[0137] (2) Load test environment information: Load the specified IP of the test environment machine to ensure that the test can be carried out on the correct server and isolated from the formal environment. Load the number of test cases to control the scope and scale of the test.

[0138] (3) Load the regression test pass rate parameter: Load the regression test pass rate percentage parameter to set the standard for passing the test. If the test pass rate is lower than this percentage, the platform will issue a warning or prevent the code merge.

[0139] It is understandable that by loading the preset configuration data, the automated testing platform can quickly and accurately locate the Dubbo interfaces to be tested, and perform effective regression testing according to the configured test environment information and passing rate parameters.

[0140] In this embodiment, regarding loading the test environment (Steps S3 / S300 - S303):

[0141] (1) Prepare the gray environment: According to the specified IP address configured in the automated regression testing platform, prepare the corresponding gray environment machines and isolate them from the production environment. The gray environment is used to deploy the newly developed Dubbo interface code for testing.

[0142] (2) Deploy the new interface code: Package and transfer the newly developed Dubbo interface code to the gray environment machines, and then decompress and configure it. Deploy the configured new interface code to the gray environment machines and communicate with the Dubbo service registry.

[0143] (3) Keep the old code in the production environment running: While testing the new code, keep the old code in the production environment running. Collect the running data of the old code and store it in the logging system or database for subsequent comparison with the execution results of the new code.

[0144] (4) Configure the test environment parameters: Configure the necessary test environment parameters in the gray environment and the production environment, such as database connection information and cache configuration. Ensure that these parameters match the test requirements and do not affect the accuracy of the test results.

[0145] It is understandable that by loading the test environment, we can deploy the newly developed Dubbo interface code in the isolated gray environment and perform effective regression testing on it without affecting the production environment.

[0146] In this embodiment, regarding log retrieval and parameter acquisition (Steps S4 / S400 - S403):

[0147] (1) Configure the log retrieval keywords: In the automated regression testing platform, configure the keywords related to Dubbo interface calls as the log retrieval keywords. These keywords include interface names, method names, and specific parameter values, etc., for accurately retrieving the test - related log data in ElasticSearch.

[0148] (2) Retrieve logs in ElasticSearch: Use the configured log retrieval keywords to perform retrieval operations in the ElasticSearch distributed search server. ElasticSearch will match the log data according to the keywords and return the qualified log records.

[0149] (3) Obtain Dubbo interface call parameters: From the retrieved log records, extract the call parameter content of the Dubbo interface. This parameter content is stored in the log in JSON format. Use parsing tools or regular expressions and other methods to parse the parameter values from the log.

[0150] (4) Use zero-width assertion technology to intercept parameters: In some cases, the parameters in the log may be closely adjacent to other text, making it difficult to directly extract. At this time, use zero-width assertion technology (such as lookahead and lookbehind in regular expressions) to accurately intercept the parameters. Zero-width assertions allow not to consume characters during the matching process and are only used to locate the target string, thus achieving accurate parameter extraction.

[0151] It can be understood that through the log retrieval and parameter acquisition steps, we can quickly and accurately obtain the Dubbo interface call parameters related to testing from ElasticSearch, providing data support for the subsequent comparison of execution results.

[0152] In this embodiment, regarding interface call and result comparison (steps S5 / S500 - S503):

[0153] (1) Call the Dubbo interface of the old code in the online environment: The automated regression testing platform sends a request to the Dubbo service registry to call the Dubbo interface of the old code in the online environment. Specify the interface name, method name, and parameters to be called, and record the execution results of the old code interface call, including return values and exception information.

[0154] (2) Call the Dubbo interface of the new code in the gray environment: Similarly, send a request to the Dubbo service registry, specify the gray environment where the new code is located, as well as the interface name, method name, and parameters to be called, and call the Dubbo interface of the new code in the gray environment.

[0155] Record the execution results of the new code interface call and compare them with the execution results of the old code.

[0156] (3) Compare the execution result content: Compare the execution results of the old and new codes, that is, by comparing indicators such as return values, exception information, and execution time. If the execution results of the old and new codes are exactly the same, it is considered that this case passes the test; if they are inconsistent, record it as an inconsistent case and count its quantity.

[0157] (4) Process inconsistent cases: For inconsistent cases, perform operations such as viewing logs and debugging code to determine the cause of the inconsistency.

[0158] Generate test reports, including information such as test overview, the number of passed cases, the number of inconsistent cases and details, and test time. These reports help developers quickly locate problems and fix them.

[0159] It can be understood that through the interface call and result comparison steps, we can accurately identify the inconsistent cases between the new and old codes, and provide detailed test reports and debugging information for developers, which is equivalent to quickly solving problems and improving code quality. At the same time, this step also achieves the effect of "solving the automated test problem of the server-side project with the dubbo microservice framework as the core and realizing the technical ability of dubbo interface automated test regression".

[0160] In this embodiment, regarding result analysis and display (step S6):

[0161] (1) Calculate the proportion of cases with inconsistent content: According to the number of inconsistent cases and the total number of test cases, calculate the proportion of cases with inconsistent content in the overall test cases.

[0162] (2) Display the inconsistent test cases and their execution results: On the automated regression test platform, display the inconsistent test cases and their execution results. This helps developers quickly understand the test situation and locate problems.

[0163] (3) Trigger a warning or notify the administrator: If the test pass rate does not reach the preset percentage parameter, trigger a warning or notify the administrator for further troubleshooting. This is equivalent to ensuring code quality and reducing potential production environment problems.

[0164] It can be understood that through the result analysis and display steps, we can comprehensively and intuitively understand the test situation, and provide timely feedback and warning information for developers and administrators. This is equivalent to improving code quality, reducing production environment problems, and enhancing the stability and reliability of the entire online car-hailing platform.

[0165] Embodiment 2: As Figure 2 shown, this embodiment further illustrates the specific implementation manner of the ELK log collection system in Embodiment 1: It is used to collect, store, retrieve, and display the log data of Dubbo interface services, especially interface call parameters. Through this system, we can achieve the playback of online traffic, and then conduct automated regression tests in the gray environment to ensure the correctness and stability of the new version functions. The implementation steps include:

[0166] P1. Deployment and configuration of Logstash:

[0167] Deploy Logstash: Install and configure the Logstash component on all service nodes where the business code (Dubbo interface) is deployed.

[0168] Log reading: Configure the input plugin of Logstash to read the log files printed during the execution of the business code. This is usually achieved by specifying parameters such as the file path and file format.

[0169] Data parsing: Use the filter plugin of Logstash to parse and format the read log data. This includes extracting Dubbo interface call parameters, converting data types, and assembling them into json format, etc.

[0170] Data output: Configure the output plugin of Logstash to write the parsed json data into the Elasticsearch cluster. This usually includes specifying parameters such as the Elasticsearch address, index name, authentication information, etc.

[0171] P2. Elasticsearch cluster configuration:

[0172] Cluster deployment: Deploy the Elasticsearch cluster to ensure the high availability and data security of the cluster. This includes configuring cluster nodes, setting the number of shards, the number of replicas, etc.

[0173] Index creation: Create an index in Elasticsearch for storing log data. The creation of the index should consider factors such as query performance, data compression, index sharding, etc.

[0174] Data reception and storage: The Elasticsearch cluster receives and stores the log data sent from Logstash. By optimizing the storage structure and index strategy, improve the query performance of the data.

[0175] P3. Kibana deployment and configuration:

[0176] Deploy Kibana: Install and configure the Kibana component to provide a graphical interface for querying and displaying data in Elasticsearch.

[0177] Data source configuration: Configure the data source in Kibana to specify the address and index name of the Elasticsearch cluster.

[0178] Visualization configuration: Use the visualization function of Kibana to create display forms such as charts and tables for easy user querying and analysis of log data.

[0179] P4, Log Collection and Replay: Through continuous collection by Logstash, a large amount of Dubbo interface call parameter log data will accumulate in the Elasticsearch cluster. Based on the log data stored in Elasticsearch, the online interface call parameters can be extracted for automated regression testing in the gray environment. This is usually achieved by writing test scripts or using test tools.

[0180] In the gray environment, use the extracted parameter values to make interface calls and compare whether the returned results are consistent with the production environment. Through automated testing tools, large-scale and efficient regression testing can be achieved.

[0181] It can be understood that by leveraging the powerful log processing capabilities of Logstash, the reading, parsing, and formatting of log data are realized. By configuring different plugins and filters, various formats of log data can be flexibly processed. By utilizing the distributed search and analysis engine functions of Elasticsearch, the efficient storage and retrieval of log data are achieved. By optimizing the index strategy and query performance, the processing requirements of large-scale log data can be met.

[0182] By using the graphical interface and visualization functions of Kibana, an intuitive log data query and analysis experience is provided. By configuring different visualization elements and query conditions, the query needs of different users can be met. Combined with automated testing tools (such as JMeter, Postman, etc.), automated regression testing of Dubbo interfaces is realized. By writing test scripts or using the functions of the tools, the online interface call scenarios can be simulated and the consistency of the returned results can be compared.

[0183] Embodiment 3: As Figure 3 shown, this embodiment further illustrates the specific implementation manner of the automated regression testing platform in Embodiment 1:

[0184] P1, Configuration Information Entry: R & D personnel enter the Dubbo interface service information to be automatically tested in the platform, including but not limited to service name, method name, parameter type, log content retrieval method, etc.

[0185] P2, Environment Configuration: Set the access configuration for the test target environments (gray environment and production environment) to ensure that the platform can correctly connect to and call the Dubbo interfaces in the corresponding environments.

[0186] P3, Log Retrieval: The platform retrieves the log data of the production environment from Elasticsearch (ES) according to the configured log content retrieval method. Parse the retrieved log content to extract the actual parameter values of the online interface calls as the input data for subsequent tests.

[0187] P4. Generalized call: Using Dubbo's generalized call technology, the platform constructs a call request based on the extracted parameter values. It sends call requests to the grayscale environment and the formal environment respectively, executes the same interface method, and obtains their respective return results.

[0188] P5. Result comparison and analysis: Compare the results returned by the two environments item by item to check whether the data content is consistent. The comparison items may include return values, status codes, exception information, etc. If data inconsistency is found, the platform automatically records it as an abnormal case and outputs the parameter content, execution results and differences in detail to facilitate subsequent troubleshooting and repair. For cases with consistent data, the platform will continue to use other extracted parameters for the next round of verification until all parameter tests are completed.

[0189] P6. Report generation and feedback: Based on the test results, the platform generates a detailed test report, including a test overview, a list of abnormal cases, and data comparison details. The test report is fed back to relevant personnel in a timely manner so that they can quickly understand the test status and take corresponding measures.

[0190] All the above embodiments only express the implementation methods of the relevant practical applications of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be based on the attached claims.

[0191] For those skilled in the art, it can be further appreciated that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0192] Meanwhile, those skilled in the art can understand that all or part of the processes in the methods of all the above embodiments can be completed by instructing 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 methods. Among them, any reference to a memory, storage, database, or other medium provided in this application and used in the embodiments can include non-volatile and / or volatile memories. 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 (SSRSDRAM), 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), etc.

Claims

1. An automated testing method based on Dubbo generic invocation, characterized in that, After receiving the automated test start instruction input by the user, perform the following operation steps. S1. The Logstash log collection system is automatically started on each business server cluster node to collect business logs and Dubbo interface call parameters in real time, and create different indexes according to the date and output them to the ElasticSearch distributed search server for storage. S2. The automated regression test interface management platform loads the preset configuration data, and at the same time loads the specified test environment machine IP, the number of test cases, and the regression test pass rate percentage parameter. S3. Deploy the new interface code to the gray environment machine with the specified IP address configured in the automated regression test platform. S4. Retrieve and obtain the call parameter content of the online Dubbo interface in the ElasticSearch distributed search server through the configured log retrieval keyword; intercept the interface call parameters from the log. S5. Call the Dubbo interfaces of the old code in the online environment and the new code in the gray environment respectively to obtain their execution results; compare the content of the execution results of the old and new codes to identify the inconsistent cases and their quantities.

2. The automated testing method according to claim 1, wherein: The implementation method of S1 includes: S100. On each node of each business server cluster, configure the Logstash log collection system to start automatically when the system boots. S101. Collect the log data generated on the business server through the configured input plugin, including records of business operations, exception information, and Dubbo interface call parameters. S102. Use a filter to format the collected log data, extract the key fields in the log, including timestamp, log level, caller, callee, and / or parameter list, to construct structured log data. S103. Output the formatted log data to the ElasticSearch distributed search server according to the configured output plugin.

3. The automated testing method according to claim 1, wherein: In S2, the configuration data includes the Dubbo service registry address, the fully qualified class name and method name of the interface to be tested, and the log retrieval keyword.

4. The automated test method according to claim 1, wherein: The implementation method of S2 includes: S200. Load the configuration data, including the address of the Dubbo service registry. Load the fully qualified class name and method name of the interface to be tested. Load the log retrieval keyword. S201. Load the specified test environment machine IP and the number of test cases. S202. Load the regression test pass rate percentage parameter; if the test pass rate is lower than this percentage, issue a warning or prevent the code merge.

5. The automated test method according to claim 1, 2 or 4, characterized in that: The implementation method of S3 includes: S300. Isolate the gray environment machine from the formal environment according to the specified IP address configured in the automated regression test platform. S301. Package and transfer the code to the gray environment machine, decompress and configure it in this environment, and then deploy the newly developed interface code to the gray environment machine and communicate with the Dubbo service registry.

6. The automated testing method according to claim 5, wherein: In S3, while the new code is being tested, the old code in the production environment remains running; the running data of the old code is collected in the production environment and stored in a logging system or a database.

7. The automated test method according to claim 5, characterized in that: The implementation method of S4 includes: S400, in the automated regression testing platform, configure keywords related to the invocation of Dubbo interfaces for log retrieval, including interface names, method names, and specific parameter values; S401, using the configured log retrieval keywords, in the ElasticSearch distributed search server, match the log data according to the keywords and return the qualified log records to perform the retrieval operation; S402, extract the invocation parameter content of the Dubbo interface from the retrieved log records; use a parsing tool or regular expressions to parse the parameter values from the logs; S403, use the zero-width assertion technique to locate the target string and intercept the parameters.

8. The automated testing method according to claim 1, 2 or 4, characterized in that: It also includes S6, result analysis and display: Calculate the proportion of cases with inconsistent content in the overall test cases; On the automated regression testing platform, display the test cases with inconsistencies and their execution results; If the passing rate does not reach the preset percentage, trigger a warning or notify the administrator to conduct troubleshooting.

9. A system for implementing the automated test method according to any one of claims 1 to 8, characterized in that, The system includes: The Logstash log collection system that collects log data on the business server in real time; The ElasticSearch distributed search server that stores the log data collected by Logstash; The automated testing platform that loads preset configurations, prepares the test environment, invokes Dubbo interfaces, compares results, and displays test results; The test environment that deploys new code and simulates the actual running environment for the automated testing platform to invoke Dubbo interfaces; The configuration management system that manages the preset configuration data required by the automated testing platform.

10. The system according to claim 9, wherein: The Logstash log collection system collects log data in real time and outputs it to the ElasticSearch distributed search server for storage; The automated testing platform and the ElasticSearch distributed search server; The automated testing platform and the test environment; The automated testing platform and the configuration management system; The test environment and the Dubbo service registry.