Service interface test method and device, electronic equipment and storage medium

By utilizing reinforcement learning agents in the DevOps pipeline to determine the target test case set, the problem of inappropriate test case set selection in microservice architecture is solved, improving the accuracy and timeliness of testing.

CN116149978BActive Publication Date: 2026-06-02DOUYIN VISION CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DOUYIN VISION CO LTD
Filing Date
2021-11-22
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In a DevOps pipeline within a microservice architecture, inappropriate test case set selection can lead to poor test performance, low code coverage, and affect the timeliness and accuracy of checkpoint testing.

Method used

By determining the mapping relationship between the interface and function of the service under test, a target test case set is determined using a reinforcement learning-based agent. The interface is then tested based on the target test case set, and test results are generated.

Benefits of technology

This improved the matching between the test case set and the service interface under test, enhancing the accuracy and timeliness of the test.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116149978B_ABST
    Figure CN116149978B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a service interface test method and device, electronic equipment and a storage medium. The method determines a to-be-tested service, and obtains a first mapping relationship corresponding to the to-be-tested service. The first mapping relationship represents the correspondence between the interface of the to-be-tested service and a to-be-tested function. The to-be-tested function is a function required to implement the interface of the to-be-tested service. According to the first mapping relationship, the action space of an agent based on reinforcement learning is determined. Based on the action space, the agent determines a target test case set. The target test case set is used for interface testing of the to-be-tested service. The action space represents all possible permutations and combinations between each test case in the target test case set in the process of the agent determining the target test case set. The interface of a target test point is tested based on the target test case set, and a test result is generated. The accuracy and timeliness of testing services under a micro-service system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a service interface testing method, apparatus, electronic device, and storage medium. Background Technology

[0002] Continuous Development and Operations, also known as DevOps, is a combination of Development and Operations. It's a collective term for processes, methods, and systems used for communication, collaboration, and integration between development, operations, and quality assurance departments. DevOps pipelines are automated process tools used to implement DevOps processes. By building and using pipelines, management of various environments, including development, testing, integration, and deployment, can be achieved.

[0003] In a DevOps pipeline within a microservices architecture, whenever application code changes, checkpoint testing of service interfaces is necessary to identify and eliminate program errors. Current techniques typically involve selecting a test case set containing multiple test cases from a database to test the interfaces. However, as applications are continuously updated and iterated, the number of test cases stored in the database also increases. Inappropriate selection of the test case set can lead to poor test results and low code coverage, thus affecting the timeliness and accuracy of checkpoint testing. Summary of the Invention

[0004] This disclosure provides a service interface testing method, apparatus, electronic device, and storage medium to overcome the problem of inappropriate test case set selection in the service testing process under a microservice architecture in the prior art.

[0005] In a first aspect, embodiments of this disclosure provide a service interface testing method, including:

[0006] The process involves identifying a service to be tested and obtaining a first mapping relationship corresponding to that service. This first mapping relationship represents the correspondence between the interface of the service to be tested and the function to be tested, where the function to be tested is the function required to implement the interface of the service to be tested. Based on the first mapping relationship, an action space for a reinforcement learning-based agent is determined. Based on the action space, a target test case set is determined by the agent. This target test case set is used to test the interface of the service to be tested. The action space represents all possible permutations and combinations among the test cases in the target test case set during the process of the agent determining the target test case set. The interface of the target test point is tested based on the target test case set, and test results are generated.

[0007] Secondly, embodiments of this disclosure provide a service interface testing apparatus, comprising:

[0008] The configuration module is used to determine the service to be tested and obtain the first mapping relationship corresponding to the service to be tested. The first mapping relationship represents the correspondence between the interface of the service to be tested and the function to be tested, wherein the function to be tested is the function required to implement the interface of the service to be tested.

[0009] The first determining module is used to determine the action space of the reinforcement learning-based agent based on the first mapping relationship;

[0010] The second determining module is used to determine a target test case set by the agent based on the action space, wherein the target test case set is used to test the interface of the service under test, and the action space represents all possible permutations and combinations among the test cases in the target test case set during the process of the agent determining the target test case set;

[0011] The testing module is used to test the interface of the target test point based on the target test case set and generate test results.

[0012] Thirdly, embodiments of this disclosure provide an electronic device, including:

[0013] A processor, and a memory communicatively connected to the processor;

[0014] The memory stores computer-executed instructions;

[0015] The processor executes computer execution instructions stored in the memory to implement the service interface testing method described in the first aspect and various possible designs of the first aspect.

[0016] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the service interface testing method described in the first aspect and various possible designs of the first aspect.

[0017] Fifthly, embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements the service interface testing method described in the first aspect and various possible designs of the first aspect.

[0018] This embodiment provides a service interface testing method, apparatus, electronic device, and storage medium. The method involves determining a service to be tested and obtaining a first mapping relationship corresponding to the service. This first mapping relationship represents the correspondence between the interface of the service to be tested and the function to be tested, where the function to be tested is the function required to implement the interface of the service to be tested. Based on the first mapping relationship, an action space for a reinforcement learning-based agent is determined. Based on the action space, the agent determines a target test case set, where the target test case set is used to test the interface of the service to be tested. The action space represents all possible permutations and combinations among the test cases in the target test case set during the process of the agent determining the target test case set. The interface of the target test point is tested based on the target test case set, generating test results. Determining the target test case set using a reinforcement learning-based agent can improve the matching between the test case set and the service interface under test during the testing of service interfaces in a microservice architecture, improve the testing effect of each test case in the test case set, and thus improve the accuracy and timeliness of service testing in a microservice architecture. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is an application scenario diagram of a service interface testing method provided in an embodiment of the present disclosure;

[0021] Figure 2 Flowchart of the service interface testing method provided in the embodiments of this disclosure Figure 1 ;

[0022] Figure 3 for Figure 2 The flowchart of the implementation method of step S102 in the embodiment shown;

[0023] Figure 4 This is a schematic diagram illustrating an intelligent agent interacting and learning with its environment, as provided in an embodiment of this disclosure.

[0024] Figure 5 Flowchart of the service interface testing method provided in the embodiments of this disclosure Figure 2 ;

[0025] Figure 6 Flowchart of the service interface testing method provided in the embodiments of this disclosure Figure 3 ;

[0026] Figure 7 A schematic diagram illustrating a process for determining an action space, provided in an embodiment of this disclosure;

[0027] Figure 8 A structural block diagram of the service interface testing apparatus provided in the embodiments of this disclosure;

[0028] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;

[0029] Figure 10 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0031] The application scenarios of the embodiments of this disclosure are explained below:

[0032] Figure 1 This diagram illustrates an application scenario of a service interface testing method provided in this embodiment of the disclosure. The service interface testing method provided in this embodiment can be applied to testing bottleneck scenarios in the Continuous Integration phase of a DevOps process. Specifically, as shown... Figure 1 As shown in the embodiments of this disclosure, the method can be applied to a server. After a developer modifies the application code through a development terminal device, the modified application code is synchronized to a test server. The test server tests the interfaces of various services related to the application based on the code uploaded by the development terminal device and generates test results. Then, on the one hand, the test server returns the test results to the development terminal device to inform the developer; on the other hand, if the test results are normal, the test server continues to update the application code to the corresponding code repository and executes subsequent automatic application deployment steps through the application server.

[0033] In existing technologies, within a microservices-based DevOps pipeline, application functionality is decomposed into multiple smaller functional blocks, each corresponding to a service, achieving functional decoupling. These services communicate with each other through APIs (Application Programming Interfaces). Whenever the application code changes, checkpoint testing of the service interfaces is required—that is, setting checkpoints to test specific services under test to discover and eliminate program errors. Current technologies typically select a test case set containing multiple test cases from a database to test the interfaces. While executing all test cases stored in the database during checkpoint testing can effectively improve interface test case coverage, this method has the highest runtime and resource consumption and cannot detect problems in a timely manner. Furthermore, with continuous updates and iterations of the software system, the number of test cases and testing time constantly increase. Conversely, for DevOps pipeline checkpoints, the goal is to discover problems in the shortest possible time; however, inappropriate test case set selection can lead to poor testing results and low code coverage.

[0034] Therefore, there is an urgent need for a method that can better balance test case coverage and timeliness of checkpoints, improve test case efficiency, and discover errors in application code earlier. Therefore, this disclosure provides a service interface testing method to solve the above problems.

[0035] Figure 2 Flowchart of the service interface testing method provided in the embodiments of this disclosure Figure 1 The method described in this embodiment can be applied to a server. This service interface testing method includes:

[0036] Step S101: Determine the service to be tested and obtain the first mapping relationship corresponding to the service to be tested. The first mapping relationship represents the correspondence between the interface of the service to be tested and the function to be tested, wherein the function to be tested is the function required to implement the interface of the service to be tested.

[0037] For example, a DevOps pipeline is an automated process tool for implementing DevOps processes. A DevOps pipeline can be software-based or program-based, and can be built using tools such as Jenkins. After the DevOps pipeline is built, applications are deployed on it to achieve DevOps process management for the applications. The specific implementation and operation methods are existing technologies known to those skilled in the art and will not be elaborated here.

[0038] Identifying the service to be tested can be achieved by setting target test points in the DevOps pipeline. This involves performing checkpoint testing on the DevOps pipeline. The service to be tested can correspond to a node in the DevOps pipeline or a specific service within the application. The specific implementation of setting the service to be tested in the DevOps pipeline can be based on user instructions or configuration information; there are no specific restrictions here, and it can be set according to specific needs.

[0039] Furthermore, the functionality of the service under test is implemented based on the interface of the function under test. Other microservices invoke the service under test by accessing its interface. Each interface of the service under test corresponds to at least one function under test, which is a function required to implement the interface, such as read / write functions, file open and close functions, and other specific functional functions. The mapping relationship between the interface of the service under test and the function under test is the first mapping relationship.

[0040] Among all the functions to be tested, the functions corresponding to the interfaces of the service under test can be identified. For example, if the service under test is service A, its corresponding interface is the interface corresponding to service A. The functions to be tested corresponding to the interface of service A are the functions related to service A among all the functions to be tested. Then, based on the correspondence between services and functions, a first mapping relationship is constructed. This first mapping relationship can be used to characterize the correspondence between the interface of the service under test and the functions to be tested. Based on the first mapping relationship, the test cases required to test the interface of the service under test can be determined in subsequent steps.

[0041] Step S102: Determine the action space of the reinforcement learning-based agent according to the first mapping relationship.

[0042] First, a brief introduction to the reinforcement learning-based agent used in this embodiment:

[0043] A reinforcement learning-based agent is a model generated through reinforcement learning training. After convergence, this agent can be used to solve problems such as sequence decision-making and automated control. For example, in this embodiment, the agent is a model obtained through interaction and training with historical test records of test cases. The reinforcement learning-based agent can evaluate the testing effectiveness of test cases and test case sets composed of multiple test cases, thereby determining the most suitable set of test cases for testing the interface of the service under test, i.e., the target test case set. Because the agent learns from the historical test records of test cases, testing the interface of the service under test based on the target test case set determined by the agent has better testing results compared to a randomly selected set of test cases. At the same time, it reduces the number of test cases required, thus reducing the time spent executing test cases and improving the timeliness of testing the interface of the service under test.

[0044] For example, before acquiring a reinforcement learning-based agent and determining the target test case set for the service under test based on the agent, the agent needs to be trained, wherein, optionally, as... Figure 3 As shown, the process of training an agent includes:

[0045] Step S1021: Obtain test case history. Test case history is used to characterize the probability and / or number of times that test cases have found problems during previous interface testing.

[0046] Step S1022: Set the reward value based on the use case history.

[0047] Step S1023: Train the agent based on the reward value to generate an agent-based test case ranking strategy. The test case ranking strategy is used to characterize the test ranking of test cases in the target test case set.

[0048] For example, test case history is data generated based on test results during previous testing tasks. Specifically, for instance, if test case A detected an error (BUG) in a previous testing task based on historical test results, then test case A is also highly likely to detect the BUG in subsequent tests. Therefore, a reward value can be set based on the test case history, and the agent can be trained using this reward value to generate a test case ranking strategy. The test case ranking strategy guides the agent to rank test cases, resulting in a test case set generated from multiple ranked test cases that has better testing efficiency and effectiveness.

[0049] For example, the test case history includes test performance information corresponding to test case sets generated through different test case ranking strategies. This test performance information characterizes the probability and / or number of issues discovered during interface testing of the test case sets, and / or the code coverage of test case sets using different ranking strategies. Based on the test case history, a reward value is set, including setting a reward value based on the test performance information corresponding to the test case set. A higher probability and greater number of issues discovered through this test case set, along with higher code coverage, indicates better testing efficiency and effectiveness. During agent training based on reward values, using test case sets with good testing efficiency and effectiveness as rewards can further improve the agent's training efficiency and the effectiveness of agent-based test case ranking strategies.

[0050] Furthermore, exemplarily, the action space of an agent is a set that includes all possible permutations and combinations of use cases. Figure 4 This is a schematic diagram illustrating an intelligent agent interacting and learning with its environment, as provided in an embodiment of this disclosure. Figure 4 As shown, the environment represents the service under test (DevOps pipeline checkpoint) in the DevOps pipeline. The agent, based on the action space, selects an action (e.g., action a) each time, generating a sorted test case set A. Then, based on the execution of the test case set, the DevOps pipeline checkpoint environment returns an immediate reward (the reward of A) to the agent, used to evaluate the performance of the currently selected action a (i.e., test case set A). Each pipeline checkpoint is considered a cycle. Across multiple pipeline checkpoint cycles, the agent optimizes the sorting strategy by accumulating the maximum immediate reward. This strategy can be understood as choosing the action that yields the highest immediate reward in the current state. The state space in the diagram refers to the set of test cases. Furthermore, based on the correspondence between the interface of the service under test and the function under test represented by the first mapping relationship, the permutations and combinations of test cases applicable to the interface of the service under test can be determined, i.e., the agent's action space.

[0051] Step S103: Based on the action space, determine the target test case set through the agent. The target test case set is used to test the interface of the service under test. The action space represents all possible permutations and combinations among the test cases in the target test case set during the process of the agent determining the target test case set.

[0052] For example, after determining the action space, the agent evaluates each subset of test cases included in the action space (i.e., sorted combinations of different test cases), for example, by assigning a score, and determines the set of test cases with the highest score in the action space as the target test case set. This scoring process is performed by the agent. Since the agent has been trained and learned based on historical test case records, it can achieve the purpose of scoring the test performance of each set of test cases. The specific implementation principles and methods are existing technologies known to those skilled in the art and will not be elaborated here.

[0053] In this embodiment, to reduce the time it takes for the agent to learn the test case ranking strategy, the present invention starts with the code repository. By analyzing which functions are affected by code changes, and optionally combining static analysis, code coverage analysis, and other methods, the relationship mapping between interfaces and functions, i.e., the first mapping relationship, is obtained. The test case set selection strategy is completed in a full set of test cases, narrowing the agent's action space and thus reducing the time it takes for the agent to learn the test case optimization ranking strategy.

[0054] Step S104: Test the interface of the service under test based on the target test case set and generate test results.

[0055] For example, after determining the target test case set, the interface is tested using the sorted test cases in the target test case set, thereby generating test results. After generating the test results, the test results are saved as a test case history, and the agent is updated based on the test case history, thereby improving the accuracy of the agent in determining the target test case set for the service under test.

[0056] In this embodiment, the service to be tested in the DevOps pipeline is set up; a reinforcement learning-based agent is obtained, and based on the agent, a target test case set for the service to be tested is determined. This target test case set is used for interface testing of the service to be tested. The interfaces of the service to be tested are then tested based on the target test case set, and test results are generated. Determining the target test case set using a reinforcement learning-based agent improves the matching between the test case set and the service interface being tested during checkpoint testing in the DevOps pipeline, improves the testing effectiveness of each test case in the test case set, and thus improves the accuracy and timeliness of checkpoint testing in the DevOps pipeline.

[0057] Figure 5 Flowchart of the service interface testing method provided in the embodiments of this disclosure Figure 2 This embodiment is in Figure 2 Based on the illustrated embodiment, the implementation process of steps S101-S102 is refined. This service interface testing method includes:

[0058] Step S201: Obtain code change information, which is used to indicate the functions in the code repository affected by code changes.

[0059] Step S202: Based on the code change information, determine the function to be tested corresponding to the interface of the service to be tested from the functions affected by the code change. The function to be tested is the function required to implement the interface of the service to be tested.

[0060] In a code repository, when the application's code changes, the service interfaces need to be tested. Code change information represents the location of the code change and the location of the corresponding affected functions. Based on this information, the affected functions can be located, and thus, these functions can be identified as the functions to be tested. For example, in a microservice architecture, an application uses a large number of services and corresponding functions, while the amount of code modification during upgrades or updates is relatively small. Therefore, identifying the functions corresponding to the code changes as the functions to be tested, and determining subsequent test cases based on these functions, allows for targeted testing of the application's code change locations, improving testing effectiveness and reducing the action space required for intelligent agents, thus increasing testing efficiency.

[0061] Step S203: Generate a first mapping relationship based on the interface of the service under test and the function under test corresponding to the interface of the service under test, wherein the first mapping relationship represents the correspondence between the interface of the service under test and the function under test.

[0062] For example, among all the functions to be tested, the function to be tested corresponding to the interface of the target test point is determined. For example, if the target test point is service A, its corresponding interface is the interface corresponding to service A. The function to be tested corresponding to the interface of service A is the function related to service A among all the functions to be tested. Then, based on the correspondence between services and functions, a first mapping relationship is constructed. This first mapping relationship can be used to characterize the correspondence between the interface of the target test point and the function to be tested. Based on the first mapping relationship, the test cases required to test the interface of the target test point can be determined in subsequent steps.

[0063] Step S204: Based on the first mapping relationship, determine the function to be tested corresponding to the interface of the service to be tested.

[0064] Step S205: Based on the function to be tested corresponding to the interface of the service under test, determine the relevant test cases. The relevant test cases are test cases used to test the function to be tested corresponding to the interface of the service under test.

[0065] For example, based on the first mapping relationship, the function to be tested corresponding to the interface of the service under test can be determined, wherein the function to be tested may include one or more. For each function to be tested, there are corresponding test cases, i.e., relevant test cases, which are predicted in advance in the database and can be invoked as needed. In one possible implementation, determining the corresponding relevant test cases based on the function to be tested corresponding to the interface of the service under test includes: determining at least two alternative relevant test cases based on the function to be tested corresponding to the interface of the service under test; and determining the relevant test cases based on the code coverage of each alternative relevant test case.

[0066] For example, the function to be tested corresponding to the interface can correspond to one or more test cases at the same time. Different test cases have different code coverage. In a microservice system, due to the correlation between services, test cases with higher code coverage can effectively improve the test results.

[0067] Step S206: Determine the action space of the agent based on relevant test cases and the agent-based test case sorting strategy.

[0068] For example, further, after determining the relevant test cases, the ordering of different relevant test cases will also affect the testing effect of the resulting test case set. During the interaction and learning process with the environment (DevOps pipeline bottlenecks), the agent acquires a test case sorting strategy for determining the ordering of test cases. Therefore, based on the agent's test case sorting strategy, the ordering of each relevant test case is determined, thus forming an action space composed of different test case sortings. Each set of test case sortings in the action space is equivalent to a subset of a test case set. In this embodiment, by using the agent's test case sorting strategy, the number of subsets in the action space is reduced. This allows the agent to reduce computation time while maintaining testing effectiveness when subsequently determining the target test case set based on the action space, as the number of test case sets within the action space that need to be calculated is reduced. This improves the timeliness of testing the service under test.

[0069] Step S207: Based on the action space, determine the target test case set through the intelligent agent.

[0070] Step S208: Test the interface of the service under test based on the target test case set and generate test results.

[0071] In this embodiment, the action space of the intelligent agent is determined through the first mapping relationship, which reduces the number of test cases to be analyzed in the action space, thereby shortening the time spent in determining the target test case set and improving the timeliness of testing the interface of the service under test.

[0072] Figure 6 Flowchart of the service interface testing method provided in the embodiments of this disclosure Figure 3 This embodiment is in Figure 5 Based on the illustrated embodiment, a microservice link is added as an influencing factor on the action space, along with a step to determine the agent's action space based on the microservice link. This service interface testing method includes:

[0073] Step S301: Obtain code change information. This code change information is used to indicate the functions in the code repository affected by the code changes.

[0074] Step S302: Based on the code change information, determine the function to be tested corresponding to the interface of the service to be tested from the functions affected by the code change. The function to be tested is the function required to implement the interface of the service to be tested.

[0075] Step S303: Generate a first mapping relationship based on the interface of the service under test and the function under test corresponding to the interface of the service under test, wherein the first mapping relationship represents the correspondence between the interface of the service under test and the function under test.

[0076] Step S304: Obtain the microservice link identifier. The microservice link identifier is used to characterize the microservice link corresponding to the interface of the service under test. The microservice link includes at least one service.

[0077] Step S305: Generate a second mapping relationship based on the microservice link identifier and the first mapping relationship. The second mapping relationship represents the correspondence between the interface of the service under test and the corresponding microservice link and function under test.

[0078] Step S306: Determine the action space of the agent according to the second mapping relationship.

[0079] For example, in a DevOps pipeline testing scenario, traditional interface testing only triggers testing of the deployed service. However, in a microservice architecture, code modifications to one service may also affect its upstream and downstream services. In this embodiment, based on the characteristics of microservice track IDs, a second mapping relationship representing the mapping relationship between services, interfaces, and functions is obtained. The action space of the intelligent agent is then determined based on this second mapping relationship. This not only ensures a more comprehensive evaluation of the ranking weights of test cases but also allows for the simultaneous triggering of interface tests on its upstream and downstream services when the current service is deployed.

[0080] Step S307: Based on the action space, determine the target test case set through the intelligent agent.

[0081] Step S308: Test the interface of the service under test based on the target test case set and generate test results.

[0082] In this embodiment, based on Figure 5 Based on the illustrated embodiment, the characteristics of microservice track IDs are utilized to obtain the various services and functions that the interface passes through during the request process for different interface use cases. The mapping relationship between services, interfaces, and functions is then abstracted to ensure that the agent provides a more comprehensive evaluation when optimizing the sorting strategy. Furthermore, during task scheduling and execution, in addition to initiating interface requests to the current low-traffic machine, interface requests to upstream and downstream services are also triggered simultaneously, effectively improving test coverage.

[0083] Figure 7 This is a schematic diagram illustrating a process for determining the action space provided in an embodiment of the present disclosure, with reference to... Figure 7 In this embodiment, the DevOps pipeline operates sequentially as follows: development terminal device, code repository, compilation, deployment, low-traffic machine, and full-traffic machine. The method provided in this embodiment performs a DevOps pipeline test checkpoint after deploying to the low-traffic machine, avoiding the sending of all unordered test cases to the low-traffic machine. After the test checkpoint begins, a persistent set of test cases, i.e., service interface test cases, is retrieved from the database. This invention is based on reinforcement learning, constructing an agent through test case history records to learn test case sorting strategies. The learning process is based on test case history records, primarily considering test cases where bugs have been found in the past. These test cases are likely to discover new bugs in subsequent tests, and a reward function is designed based on this. The reward function design, besides using problem discovery as the reward value, also considers that test cases receive different reward values ​​depending on their sorting order, ensuring that the agent can better learn how to optimize the sorting strategy. Based on the modified code in the code repository, the code change information representing the functions affected by the code changes is determined. Then, based on the mapping relationship between interfaces and functions, and the mapping relationship between interfaces, functions, and services, the first mapping relationship and the second mapping relationship are determined sequentially, thereby determining the relevant test cases. Based on the relevant test cases and the test case sorting strategy generated during the agent-based test checkpoint process, the action space of the agent is determined. Finally, based on the action space, the target test case set is determined.

[0084] In this embodiment, the implementation methods of steps S301-S303 and S307-S308 are the same as those of this disclosure. Figure 4 The corresponding steps in the illustrated embodiments are implemented in the same way, and will not be described in detail here.

[0085] Corresponding to the service interface testing method in the above embodiment, Figure 8 This is a structural block diagram of a service interface testing apparatus provided in an embodiment of this disclosure. For ease of explanation, only the parts relevant to the embodiments of this disclosure are shown. (Refer to...) Figure 8The service interface testing device 4 includes:

[0086] The setting module 41 is used to determine the service to be tested and obtain the first mapping relationship corresponding to the service to be tested. The first mapping relationship represents the correspondence between the interface of the service to be tested and the function to be tested, wherein the function to be tested is the function required to implement the interface of the service to be tested.

[0087] The first determining module 42 is used to determine the action space of the reinforcement learning-based agent according to the first mapping relationship;

[0088] The second determining module 43 is used to determine the target test case set by an intelligent agent based on the action space. The target test case set is used to test the interface of the service under test. The action space represents all possible permutations and combinations between the test cases in the target test case set during the process of the intelligent agent determining the target test case set.

[0089] Test module 44 is used to test the interface of the target test point based on the target test case set and generate test results.

[0090] In one embodiment of this disclosure, the first determining module 42 is specifically configured to: determine the function to be tested corresponding to the interface of the service to be tested according to the first mapping relationship; determine the corresponding related test cases according to the function to be tested corresponding to the interface of the service to be tested, wherein the related test cases are test cases used to test the function to be tested corresponding to the interface of the service to be tested; and determine the action space of the agent based on the related test cases and the test case sorting strategy based on the agent.

[0091] In one embodiment of this disclosure, when the first determining module 42 determines the corresponding relevant test cases based on the function under test corresponding to the interface of the service under test, it is specifically used to: determine at least two alternative relevant test cases based on the function under test corresponding to the interface of the service under test; and determine the relevant test cases based on the code coverage of each alternative relevant test case.

[0092] In one embodiment of this disclosure, before obtaining the first mapping relationship corresponding to the service under test, the setting module 41 is further configured to: obtain code change information, the code change information being used to indicate functions in the code repository affected by code changes; determine the function under test corresponding to the interface of the service under test from the functions affected by code changes based on the code change information; and generate the first mapping relationship based on the interface of the service under test and the function under test corresponding to the interface of the service under test.

[0093] In one embodiment of this disclosure, after obtaining the first mapping relationship corresponding to the service under test, the setting module 41 is further configured to: obtain a microservice link identifier, which is used to characterize the microservice link corresponding to the interface of the service under test, and the microservice link includes at least one service; the first determining module 42 is specifically configured to: generate a second mapping relationship according to the microservice link identifier and the first mapping relationship, which characterizes the correspondence between the interface of the service under test and the corresponding microservice link and the function under test; and determine the action space of the reinforcement learning-based agent according to the second mapping relationship.

[0094] In one embodiment of this disclosure, when the first determining module 42 determines the action space of the reinforcement learning-based agent according to the second mapping relationship, it is specifically used to: determine the function to be tested and the microservice link corresponding to the interface of the service to be tested according to the second mapping relationship; determine the corresponding relevant test cases according to the function to be tested corresponding to the interface of the service to be tested and each service in the microservice link, wherein the relevant test cases are test cases used to test the function to be tested corresponding to the interface of the service to be tested and each service in the microservice link; and determine the action space of the agent based on the relevant test cases and the test case sorting strategy based on the agent.

[0095] In one embodiment of this disclosure, the first determining module 42 is further configured to: acquire test case history records, which characterize the probability and / or number of times a test case discovers a problem during previous interface testing; set a reward value based on the test case history records, and train the agent based on the reward value to generate an agent-based test case ranking strategy, which characterizes the test ranking of test cases in the target test case set; the first determining module 42 is specifically configured to: determine the test cases in the target test case set and the test ranking of each test case based on the first mapping relationship and the agent-based test case ranking strategy; and determine the action space of the agent based on the test cases in the target test case set and the test ranking of each test case.

[0096] In one embodiment of this disclosure, the test case history includes test effect information corresponding to test case sets generated through different test case sorting strategies. The test effect information is used to characterize the probability and / or number of problems found during the interface testing of the test case sets, and / or the code coverage of test case sets with different sorting strategies. When the first determining module 42 sets the reward value according to the test case history, it is specifically used to: set the reward value according to the test effect information corresponding to the test case sets.

[0097] The setting module 41, the first determining module 42, the second determining module 43, and the testing module 44 are connected sequentially. The service interface testing device 4 provided in this embodiment can execute the technical solution of the above method embodiment, and its implementation principle and technical effect are similar, so it will not be described again here.

[0098] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure, such as... Figure 9 As shown, the electronic device 5 includes

[0099] Processor 51, and memory 52 communicatively connected to processor 51;

[0100] Memory 52 stores instructions executed by the computer;

[0101] The processor 51 executes computer-executable instructions stored in the memory 52 to achieve, for example, Figures 2-8 The service interface testing method in the illustrated embodiment.

[0102] Optionally, the processor 51 and the memory 52 are connected via a bus 53.

[0103] For relevant instructions, please refer to the corresponding text. Figures 2-7 The relevant descriptions and effects of the steps in the corresponding embodiments are understood, and will not be elaborated on here.

[0104] refer to Figure 10 The diagram illustrates a structural schematic of an electronic device 900 suitable for implementing embodiments of the present disclosure. The electronic device 900 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, personal digital assistants (PDAs), portable Android devices (PADs), portable media players (PMPs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 10 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0105] like Figure 10As shown, the electronic device 900 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device 900. The processing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0106] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 10 An electronic device 900 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0107] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by a processing device 901, it performs the functions defined in the methods of embodiments of this disclosure.

[0108] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0109] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0110] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.

[0111] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0112] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0113] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".

[0114] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0115] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0116] In a first aspect, according to one or more embodiments of this disclosure, a service interface testing method is provided, comprising:

[0117] The process involves identifying a service to be tested and obtaining a first mapping relationship corresponding to that service. This first mapping relationship represents the correspondence between the interface of the service to be tested and the function to be tested, where the function to be tested is the function required to implement the interface of the service to be tested. Based on the first mapping relationship, an action space for a reinforcement learning-based agent is determined. Based on the action space, a target test case set is determined by the agent. This target test case set is used to test the interface of the service to be tested. The action space represents all possible permutations and combinations among the test cases in the target test case set during the process of the agent determining the target test case set. The interface of the target test point is tested based on the target test case set, and test results are generated.

[0118] According to one or more embodiments of this disclosure, determining the action space of a reinforcement learning-based agent based on the first mapping relationship includes: determining a function to be tested corresponding to the interface of the service under test based on the first mapping relationship; determining corresponding relevant test cases based on the function to be tested corresponding to the interface of the service under test, wherein the relevant test cases are test cases used to test the function to be tested corresponding to the interface of the service under test; and determining the action space of the agent based on the relevant test cases and the test case ranking strategy of the agent.

[0119] According to one or more embodiments of this disclosure, determining corresponding relevant test cases based on the function under test corresponding to the interface of the service under test includes: determining at least two alternative relevant test cases based on the function under test corresponding to the interface of the service under test; and determining the relevant test cases based on the code coverage of each of the alternative relevant test cases.

[0120] According to one or more embodiments of this disclosure, before obtaining the first mapping relationship corresponding to the service under test, the method further includes: obtaining code change information, wherein the code change information is used to indicate functions in the code repository affected by code changes; determining the function under test corresponding to the interface of the service under test from the functions affected by code changes based on the code change information; and generating the first mapping relationship based on the interface of the service under test and the function under test corresponding to the interface of the service under test.

[0121] According to one or more embodiments of this disclosure, after obtaining the first mapping relationship corresponding to the service under test, the method further includes: obtaining a microservice link identifier, wherein the microservice link identifier is used to characterize the microservice link corresponding to the interface of the service under test, and the microservice link includes at least one service; determining the action space of the reinforcement learning-based agent according to the first mapping relationship, including: generating a second mapping relationship according to the microservice link identifier and the first mapping relationship, wherein the second mapping relationship characterizes the correspondence between the interface of the service under test and the corresponding microservice link and the function under test; and determining the action space of the reinforcement learning-based agent according to the second mapping relationship.

[0122] According to one or more embodiments of this disclosure, determining the action space of a reinforcement learning-based agent based on the second mapping relationship includes: determining, based on the second mapping relationship, the function to be tested and the microservice link corresponding to the interface of the service under test; determining corresponding relevant test cases based on the function to be tested corresponding to the interface of the service under test and each service in the microservice link, wherein the relevant test cases are test cases used to test the function to be tested corresponding to the interface of the service under test and each service in the microservice link; and determining the action space of the agent based on the relevant test cases and the test case ranking strategy of the agent.

[0123] According to one or more embodiments of this disclosure, the method further includes: acquiring a test case history record, the test case history record being used to characterize the probability and / or number of times a test case discovers a problem during previous interface testing; setting a reward value based on the test case history record, and training the agent based on the reward value to generate an agent-based test case ranking strategy, the test case ranking strategy being used to characterize the test ranking of test cases in the target test case set; determining the action space of the reinforcement learning-based agent according to the first mapping relationship includes: determining the test cases in the target test case set and the test ranking of each of the test cases according to the first mapping relationship and the agent-based test case ranking strategy; determining the action space of the agent according to the test cases in the target test case set and the test ranking of each of the test cases.

[0124] According to one or more embodiments of this disclosure, the test case history includes test effect information corresponding to test case sets generated through different test case sorting strategies. The test effect information is used to characterize the probability and / or number of problems found during interface testing of the test case sets, and / or the code coverage of test case sets with different sorting strategies. Setting a reward value based on the test case history includes setting a reward value based on the test effect information corresponding to the test case sets.

[0125] Secondly, according to one or more embodiments of this disclosure, a service interface testing apparatus is provided, comprising:

[0126] The configuration module is used to determine the service to be tested and obtain the first mapping relationship corresponding to the service to be tested. The first mapping relationship represents the correspondence between the interface of the service to be tested and the function to be tested, wherein the function to be tested is the function required to implement the interface of the service to be tested.

[0127] The first determining module is used to determine the action space of the reinforcement learning-based agent based on the first mapping relationship;

[0128] The second determining module is used to determine a target test case set by the agent based on the action space, wherein the target test case set is used to test the interface of the service under test, and the action space represents all possible permutations and combinations among the test cases in the target test case set during the process of the agent determining the target test case set;

[0129] The testing module is used to test the interface of the target test point based on the target test case set and generate test results.

[0130] According to one or more embodiments of this disclosure, the first determining module is specifically configured to: determine the function to be tested corresponding to the interface of the service to be tested based on the first mapping relationship; determine the corresponding relevant test cases based on the function to be tested corresponding to the interface of the service to be tested, wherein the relevant test cases are test cases used to test the function to be tested corresponding to the interface of the service to be tested; and determine the action space of the agent based on the relevant test cases and the test case sorting strategy of the agent.

[0131] According to one or more embodiments of this disclosure, when the first determining module determines the corresponding relevant test cases based on the function under test corresponding to the interface of the service under test, it is specifically used to: determine at least two candidate relevant test cases based on the function under test corresponding to the interface of the service under test; and determine the relevant test cases based on the code coverage of each candidate relevant test case.

[0132] According to one or more embodiments of this disclosure, before obtaining the first mapping relationship corresponding to the service under test, the setting module is further configured to: obtain code change information, the code change information being used to indicate functions in the code repository affected by code changes; determine the function under test corresponding to the interface of the service under test from the functions affected by code changes based on the code change information; and generate the first mapping relationship based on the interface of the service under test and the function under test corresponding to the interface of the service under test.

[0133] According to one or more embodiments of this disclosure, after obtaining the first mapping relationship corresponding to the service under test, the setting module is further configured to: obtain a microservice link identifier, the microservice link identifier being used to characterize the microservice link corresponding to the interface of the service under test, the microservice link including at least one service; the first determining module is specifically configured to: generate a second mapping relationship based on the microservice link identifier and the first mapping relationship, the second mapping relationship characterizing the correspondence between the interface of the service under test and the corresponding microservice link and the function under test; and determine the action space of the reinforcement learning-based agent based on the second mapping relationship.

[0134] According to one or more embodiments of this disclosure, when the first determining module determines the action space of the reinforcement learning-based agent based on the second mapping relationship, it is specifically configured to: determine the function to be tested and the microservice link corresponding to the interface of the service to be tested based on the second mapping relationship; determine the corresponding relevant test cases based on the function to be tested corresponding to the interface of the service to be tested and each service in the microservice link, wherein the relevant test cases are test cases used to test the function to be tested corresponding to the interface of the service to be tested and each service in the microservice link; and determine the action space of the agent based on the relevant test cases and the test case sorting strategy of the agent.

[0135] According to one or more embodiments of this disclosure, the first determining module is further configured to: acquire a test case history record, the test case history record being used to characterize the probability and / or number of times a test case discovers a problem during previous interface testing; set a reward value based on the test case history record, and train the agent based on the reward value to generate an agent-based test case ranking strategy, the test case ranking strategy being used to characterize the test ranking of test cases in the target test case set; the first determining module is specifically configured to: determine the test cases in the target test case set and the test ranking of each test case based on the first mapping relationship and the agent-based test case ranking strategy; and determine the action space of the agent based on the test cases in the target test case set and the test ranking of each test case.

[0136] According to one or more embodiments of this disclosure, the test case history includes test effect information corresponding to test case sets generated through different test case sorting strategies. The test effect information is used to characterize the probability and / or number of problems found during interface testing of the test case sets, and / or the code coverage of test case sets with different sorting strategies. When the first determining module sets a reward value based on the test case history, it is specifically used to: set a reward value based on the test effect information corresponding to the test case sets.

[0137] Thirdly, according to one or more embodiments of the present disclosure, an electronic device is provided, including: a processor, and a memory communicatively connected to the processor;

[0138] The memory stores computer-executed instructions;

[0139] The processor executes computer execution instructions stored in the memory to implement the service interface testing method described in the first aspect and various possible designs of the first aspect.

[0140] Fourthly, according to one or more embodiments of this disclosure, a computer-readable storage medium is provided, wherein computer-executable instructions are stored therein, and when a processor executes the computer-executable instructions, the service interface testing method described in the first aspect and various possible designs of the first aspect is implemented.

[0141] Fifthly, embodiments of this disclosure provide a computer program product, including a computer program that, when executed by a processor, implements the service interface testing method described in the first aspect and various possible designs of the first aspect.

[0142] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0143] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0144] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A service interface testing method, characterized in that, include: Identify the service to be tested and obtain the first mapping relationship corresponding to the service to be tested. The first mapping relationship represents the correspondence between the interface of the service to be tested and the function to be tested, wherein the function to be tested is the function required to implement the interface of the service to be tested. Based on the first mapping relationship, the action space of the reinforcement learning-based agent is determined; Based on the action space, the agent determines a target test case set, wherein the target test case set is used to test the interface of the service under test, and the action space represents all possible permutations and combinations among the test cases in the target test case set during the process of the agent determining the target test case set; The interfaces of the service under test are tested based on the target test case set, and test results are generated. After obtaining the first mapping relationship corresponding to the service under test, the process also includes: Obtain the microservice link identifier, which is used to characterize the microservice link corresponding to the interface of the service under test, and the microservice link includes at least one service. Based on the first mapping relationship, the action space of the reinforcement learning-based agent is determined, including: Based on the microservice link identifier and the first mapping relationship, a second mapping relationship is generated. The second mapping relationship represents the correspondence between the interface of the service under test and the corresponding microservice link and function under test. Based on the second mapping relationship, the action space of the reinforcement learning-based agent is determined.

2. The method according to claim 1, characterized in that, Based on the first mapping relationship, the action space of the reinforcement learning-based agent is determined, including: Based on the first mapping relationship, determine the function to be tested corresponding to the interface of the service to be tested; Based on the function to be tested corresponding to the interface of the service under test, determine the corresponding relevant test cases. The relevant test cases are test cases used to test the function to be tested corresponding to the interface of the service under test. Based on the relevant test cases and the test case ranking strategy of the agent, the action space of the agent is determined.

3. The method according to claim 2, characterized in that, Based on the function to be tested corresponding to the interface of the service under test, determine the corresponding test cases, including: Based on the function to be tested corresponding to the interface of the service to be tested, at least two alternative relevant test cases are determined; The relevant test cases are determined based on the code coverage of each of the candidate relevant test cases.

4. The method according to claim 2, characterized in that, Before obtaining the first mapping relationship corresponding to the service under test, the process also includes: Obtain code change information, which is used to indicate functions in the code repository affected by code changes; Based on the code change information, determine the function to be tested corresponding to the interface of the service to be tested from the functions affected by the code change; The first mapping relationship is generated based on the interface of the service under test and the function under test corresponding to the interface of the service under test.

5. The method according to claim 1, characterized in that, Based on the second mapping relationship, the action space of the reinforcement learning-based agent is determined, including: Based on the second mapping relationship, determine the function to be tested and the microservice link corresponding to the interface of the service to be tested; Based on the function to be tested corresponding to the interface of the service under test, and each service in the microservice chain, determine the corresponding relevant test cases. The relevant test cases are test cases used to test the function to be tested corresponding to the interface of the service under test, and each service in the microservice chain. Based on the relevant test cases and the test case ranking strategy of the agent, the action space of the agent is determined.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: Obtain test case history, which is used to characterize the probability and / or number of times that a test case found a problem during previous interface testing; Based on the test case history, a reward value is set, and the agent is trained based on the reward value to generate an agent-based test case ranking strategy. The test case ranking strategy is used to characterize the test ranking of test cases in the target test case set. Determining the action space of the reinforcement learning-based agent based on the first mapping relationship includes: Based on the first mapping relationship and the agent-based test case sorting strategy, determine the test cases in the target test case set, and the test sorting of each test case; The action space of the agent is determined based on the test cases in the target test case set and the test order of each test case.

7. The method according to claim 6, characterized in that, The test case history includes test effect information corresponding to test case sets generated through different test case sorting strategies. The test effect information is used to characterize the probability and / or number of problems found during the interface testing of the test case sets, and / or the code coverage of test case sets with different sorting strategies. Based on the use case history, set reward values, including: Set reward values ​​based on the test performance information corresponding to the test case set.

8. A service interface testing device, characterized in that, include: The configuration module is used to determine the service to be tested and obtain the first mapping relationship corresponding to the service to be tested. The first mapping relationship represents the correspondence between the interface of the service to be tested and the function to be tested, wherein the function to be tested is the function required to implement the interface of the service to be tested. The first determining module is used to determine the action space of the reinforcement learning-based agent based on the first mapping relationship; The second determining module is used to determine a target test case set by the agent based on the action space, wherein the target test case set is used to test the interface of the service under test, and the action space represents all possible permutations and combinations among the test cases in the target test case set during the process of the agent determining the target test case set; The testing module is used to test the interface of the service under test based on the target test case set and generate test results; After obtaining the first mapping relationship corresponding to the service under test, the setting module is also used to obtain the microservice link identifier. The microservice link identifier is used to characterize the microservice link corresponding to the interface of the service under test. The microservice link includes at least one service. The first determining module is specifically used to generate a second mapping relationship based on the microservice link identifier and the first mapping relationship, wherein the second mapping relationship represents the correspondence between the interface of the service under test and the corresponding microservice link and the function under test; and to determine the action space of the reinforcement learning-based agent based on the second mapping relationship.

9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the service interface testing method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by the processor, implement the service interface testing method as described in any one of claims 1 to 7.

11. A computer program product comprising a computer program that, when executed by a processor, implements the service interface testing method according to any one of claims 1 to 7.