Test case generation method and device, equipment, storage medium and program product

By building a business knowledge base and parameter dependency graph, the problems of missing information and inaccurate matching of interface parameters in automated test code generation are solved, and efficient and accurate back-end automated test code generation is achieved, which improves software testing efficiency and accuracy.

CN120336172APending Publication Date: 2025-07-18BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510392601.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-31
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

During the existing automated test code generation process, the test case document information is missing, and other required parameters required for the backend interface are not covered, resulting in low generation efficiency, poor integrity and effectiveness. The test case association accuracy between the backend interface and the backend interface is low, making it difficult to accurately match the backend interface parameters.

Method used

By building a business knowledge base and big models, we can deeply understand the test case documents, combine the parameter dependency graph, automatically capture the transfer relationship between back-end interface parameters, and generate complete and executable automated test code.

Benefits of technology

It improves the generation efficiency and integrity of automated test codes, reduces software testing costs, improves test accuracy and coverage, adapts to the diverse needs of different business scenarios, and enhances the maintainability and scalability of test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336172A_ABST
    Figure CN120336172A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a test case generation method and device, equipment, a storage medium and a program product. The method comprises the steps that a target test case document is analyzed, and interface calling description and an interface calling sequence are determined; based on the interface calling description, determining a target request method and a target request parameter corresponding to the interface calling description from the candidate interface information; performing parameter value extraction on the interface calling description based on each target request parameter, and determining a first request parameter and a first parameter value; based on the target request method and a second request parameter in the target request parameters, querying a parameter dependency relationship graph obtained based on historical test data, and determining a parameter value of a dependency parameter having a parameter transmission relationship with the second request parameter as a second parameter value; and based on the target request method, the first parameter value and the second parameter value, generating an automatic test code according to the interface calling sequence. In this way, the generation efficiency, integrity and performability of the automatic test code are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of software testing, and in particular, to a test case generation method, apparatus, device, storage medium, and program product. Background Art

[0002] In the software development process, the testing phase is crucial for ensuring software quality, and a major part of the testing phase is the design and generation of test cases. To improve the efficiency of test case generation, automated test code has emerged, which is test cases in the form of code automatically generated according to test requirements to optimize the testing process.

[0003] During the generation of automated test code, it is necessary to automatically match the backend interfaces involved in the test requirements and complete the interface parameters of the matched backend interfaces. However, test requirements mostly focus on the description of key parameters in the current scenario to be tested, but do not cover other required parameters of the backend interface, which may lead to the lack of some necessary interface parameters, resulting in low generation efficiency, poor integrity, and poor effectiveness of the automated test code. Summary of the Invention

[0004] To solve the above technical problems, embodiments of the present disclosure provide a test case generation method, apparatus, device, storage medium, and program product.

[0005] In a first aspect, embodiments of the present disclosure provide a test case generation method, the method including:

[0006] Analyze the target test case document of the object to be tested, and determine at least one interface call description and the interface call order;

[0007] Based on the interface call description, determine the target interface information corresponding to the interface call description from the respective candidate interface information corresponding to the object to be tested; wherein, the target interface information includes a target request method and at least one target request parameter;

[0008] Based on each of the target request parameters, perform parameter value extraction on the interface call description to determine a first request parameter and a first parameter value; wherein, the first request parameter is the target request parameter included in the interface call description;

[0009] Based on the target request method and each of the target request parameters, query a parameter dependency graph to determine a second request parameter and a dependency parameter having a parameter transfer relationship with the second request parameter, and determine a second parameter value of the second request parameter based on the parameter value of the dependency parameter; wherein, the parameter dependency graph records the parameter transfer relationships between the interface parameters in the respective candidate interface information in historical test data;

[0010] Generate the automated test code for the object to be tested according to the interface call sequence based on the target request method, the first parameter value, and the second parameter value.

[0011] In a second aspect, an embodiment of the present disclosure further provides a test case generation device, which includes:

[0012] An interface call description determination module, configured to analyze the target test case document of the object to be tested, and determine at least one interface call description and an interface call sequence;

[0013] A target interface information determination module, configured to determine the target interface information corresponding to the interface call description from the respective candidate interface information corresponding to the object to be tested based on the interface call description; wherein, the target interface information includes a target request method and at least one target request parameter;

[0014] A first parameter value determination module, configured to extract parameter values from the interface call description based on the respective target request parameters, and determine a first request parameter and a first parameter value; wherein, the first request parameter is the target request parameter included in the interface call description;

[0015] A second parameter value determination module, configured to query a parameter dependency relationship graph based on the target request method and the respective target request parameters, determine a second request parameter and a dependency parameter having a parameter transmission relationship with the second request parameter, and determine a second parameter value of the second request parameter based on the parameter values of the dependency parameters; wherein, the parameter dependency relationship graph records the parameter transmission relationships between the interface parameters in the respective candidate interface information in historical test data;

[0016] An automated test code generation module, configured to generate the automated test code for the object to be tested according to the interface call sequence based on the target request method, the first parameter value, and the second parameter value.

[0017] In a third aspect, an embodiment of the present disclosure further provides an electronic device, which includes:

[0018] A processor;

[0019] A memory, configured to store executable instructions;

[0020] Wherein, the processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the test case generation method described in any embodiment of the present disclosure.

[0021] Fourthly, embodiments of the present disclosure further provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the test case generation method described in any embodiment of the present disclosure.

[0022] Fifthly, embodiments of the present disclosure further provide a computer program product for executing the test case generation method described in any embodiment of the present disclosure.

[0023] The test case generation method, apparatus, device, storage medium, and program product according to the embodiments of the present disclosure can analyze the target test case document of the object to be tested, and determine at least one interface call description and interface call order; based on the interface call description, determine the target interface information corresponding to the interface call description from the respective candidate interface information corresponding to the object to be tested; the target interface information includes a target request method and at least one target request parameter; based on each target request parameter, extract parameter values from the interface call description to determine a first request parameter and a first parameter value; based on the target request method and a second request parameter among each target request parameter, query a parameter dependency relationship graph to determine a dependency parameter having a parameter transfer relationship with the second request parameter, and determine a second parameter value of the second request parameter based on the parameter value of the dependency parameter; the parameter dependency relationship graph records the parameter transfer relationships between interface parameters in each candidate interface information in historical test data; based on the target request method, the first parameter value, and the second parameter value, generate automated test code for the object to be tested in accordance with the interface call order; it realizes automatically capturing the parameter transfer relationships between the interface parameters of each backend interface by using the historical test data of the object to be tested, improves the accuracy and integrity of the parameter dependency relationship graph, ensures the accurate transfer and assignment of parameters between steps, thereby improving the integrity and accuracy of each second parameter value determined accordingly, and largely avoiding the problem of missing interface parameters of backend interfaces not involved in the target test case document; and combined with each first parameter value extracted from the target test case document, it can largely ensure the integrity and executability of the generated automated test code, thereby improving the generation efficiency of the automated test code, further reducing the cost of software testing, and improving the software testing efficiency; in addition, the various methods for determining the parameter values of multiple backend interfaces can meet the diverse test data requirements in different business scenarios, and improve the generality and scalability of the automated test code generation method.

[0024] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the embodiments of the present disclosure are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or reject. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In combination with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages, and aspects of the embodiments of the present disclosure will become more obvious. Throughout the accompanying drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the elements and elements are not necessarily drawn to scale.

[0026] Figure 1 It is a schematic flowchart of a test case generation method provided by an embodiment of the present disclosure;

[0027] Figure 2 It is a schematic diagram of a code example of an interface transfer relationship provided by an embodiment of the present disclosure;

[0028] Figure 3 It is a schematic flowchart of another test case generation method provided by an embodiment of the present disclosure;

[0029] Figure 4 It is a schematic structural diagram of a test case generation device provided by an embodiment of the present disclosure;

[0030] Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0031] The embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

[0032] It should be understood that the various steps recorded in the method embodiments of the present disclosure can be executed in different orders and / or executed in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.

[0033] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the following description.

[0034] It should be noted that the concepts such as "first", "second", etc. mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0035] It should be noted that the modifications of "one" and "a plurality of" mentioned in this disclosure are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise clearly specified in the context, it should be understood as "one or more".

[0036] The names of the messages or information exchanged between multiple devices in the embodiments of this disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.

[0037] During the software testing (also known as program testing) process, relevant personnel can create test case documents according to test requirements. A test case document is a text-based record of the task description for testing a software product, and its content includes test objectives, test environment, input data, test steps, expected results, etc. The process of using test case documents for software testing requires manual execution of test cases, which is time-consuming and laborious, resulting in low testing efficiency. Therefore, a testing method of automated test code has emerged. It converts test case documents into code form in a certain way to automate the test case execution part, saving the labor consumption in the testing process and improving testing efficiency. For example, in related technologies, a generative model of a certain scale (abbreviated as a large model) can be used to understand test case documents, and through its learning of the conversion relationship between source code and test case documents, automated test code can be automatically generated. However, there are the following problems in the generation process of these automated test codes: (1) Missing information in test case documents. Many test cases rely on pre-data preparation, but it is not clearly reflected in the test case documents. For example, for the test case of "The invoice only matches 1 payment application form and cancels the matching relationship", it does not elaborate on how to create the payment application form that matches the invoice, resulting in the lack of key steps. At the same time, test cases often contain subjectively understood statements, such as "Pass in a correct code", where the meaning of "correct" is unclear and it is difficult for external personnel to understand its exact meaning. In addition, the use of business knowledge also increases the difficulty of understanding. For example, "Create a 1:1 ticket form matching", which involves complex backend interface combination logic behind it and is difficult for those unfamiliar with the business to interpret. (2) Low accuracy of the association between test cases and backend interfaces. For the text test cases of the rich front-end system, the scenarios are mostly described from the user's perspective. Without additional information assistance, it is difficult for the large model to understand the underlying interface implementation logic, resulting in the difficulty of directly and accurately matching each step in the test case with the backend interface. (3) Difficulty in assembling all interface parameters of the backend interface. The test requirements mostly focus on the description of key parameters in the current scenario to be tested, but do not cover other required parameters of the corresponding backend interface. For example, "The third-party service fee for department A subjects, medium risk, amount 10 million", which includes key parameters such as subject A, risk level, and amount, but does not cover other required parameters for constructing this interface, such as supplier entity information, entity number, etc. Moreover, there are some parameters passed between steps among the above missing necessary interface parameters. The accurate acquisition of these passed parameters depends on the large model's understanding of the test case context, but the capabilities of many large models for automatically generating test code in related technologies are limited and it is difficult to accurately capture the passed parameters between steps. This will lead to the lack of some necessary interface parameters. Without additional means to supplement these necessary interface parameters, it will affect the generation efficiency, integrity, and effectiveness of the automated test code.

[0038] Based on the above situation, the embodiments of the present disclosure provide a test case generation solution to solve the above technical problems to a certain extent through the following various methods: (1) For the problem of missing information in the test case document, a business knowledge base is constructed to record the execution steps corresponding to business terms, and combined with a pre-trained large model, a more in-depth natural language understanding and processing of the test case document is carried out. Thus, accurate step splitting, key parameter extraction, clarification of fuzzy descriptions, business knowledge interpretation, and completion of missing steps of the test case document can be performed, etc., realizing the efficient conversion from natural language to a structured test case document and optimizing the specification degree of the test case document. (2) For the problem of low association accuracy between test cases and backend interfaces, by combining the interface matching method of keyword matching and the interface matching method of another pre-trained large model, the high efficiency of traditional search and the semantic understanding ability of the large model can be fully utilized to improve the accuracy of the association between the test case document and the backend interface. (3) For the problem of difficult assembly of all interface parameters of the backend interface, the key parameters of the backend interface included in the test case document can be accurately extracted by another pre-trained large model; at the same time, the transfer logic between steps in different test scenarios can be deeply understood by another pre-trained large model, so as to generate a parameter dependency relationship graph between each backend interface. Therefore, the parameter dependency relationship graph can be queried according to the matched backend interface to obtain more accurate transfer parameters between steps, realizing the completion processing of each interface parameter of the backend interface, ensuring the integrity and accuracy of the interface parameters, and ensuring that the generated automated test cases are complete and can be effectively executed.

[0039] Therefore, the technical solution for test case generation provided by the embodiments of the present disclosure can achieve the generation of efficient and accurate back-end automated test code by combining at least one improvement in test case document optimization, back-end interface matching, and interface parameter completion. In the first aspect, it can significantly reduce the manual test workload, automate the parts of generating automated test code and executing test cases that originally consumed a large amount of manpower, reduce the labor cost, save the test time, and improve the overall test efficiency, thereby effectively improving the software development and delivery speed. In the second aspect, it reduces the error costs caused by manual testing and case writing and maintenance (such as errors introduced by human factors like fatigue and negligence), improves the test accuracy, reduces the product defect repair costs caused by insufficient or incorrect testing, and enhances the product quality and user satisfaction. In the third aspect, through the in-depth understanding and processing of text cases by the large model, more comprehensive and accurate automated test code can be generated, covering more business scenarios and function points, thereby improving the accuracy and coverage rate of test cases and effectively discovering more potential software defects. For example, when processing test cases with complex business logic, it can accurately identify various situations and generate corresponding automated test code to ensure the correctness of the software in various scenarios. In the fourth aspect, it can enhance the maintainability of test cases. Based on the structured case information and flexible parameter configuration method, it is convenient to modify and update test cases to adapt to the changes in business requirements, ensure that the test cases are always synchronized with the product functions, and improve the sustainability of the test work. When the business mode changes, only by adjusting the corresponding parameter configuration or modifying some case information, new effective automated test code can be quickly generated.

[0040] The test case generation method provided by the embodiments of the present disclosure is applicable to software test scenarios. This method can be executed by a test case generation device, which can be implemented in a software and / or hardware manner, and the device can be integrated in an electronic device with certain data processing capabilities. The electronic device can include but is not limited to smartphones, personal digital assistants (PDAs), tablet personal computers (Tablet PCs), laptop computers, desktop computers, or servers, etc.

[0041] Figure 1 The flowchart of a test case generation method provided by the embodiments of the present disclosure is shown. As Figure 1 shown, the test case generation method may include the following steps:

[0042] S110. Analyze the target test case document of the object to be tested, and determine at least one interface call description and interface call order.

[0043] Among them, the object to be tested is software or a program waiting to be tested, such as an application, a web page, a mini-program, etc. The target test case document is a test case in text form corresponding to the test requirements of the business scenario to be tested in this time (i.e., the test case document), which is a standardized / structured document. In it, the steps to be executed successively are strictly distinguished, the specification of the steps is expressed as "verb + noun without attributive", the formats of the input parameters and output parameters are clearly defined, etc. For example, for a use case like "create an invoice (invoice type = general VAT invoice, medium = paper)", the document can accurately record the execution step of "create invoice", and record "invoice type" and "medium" as key parameters, and their parameter values are "general VAT invoice" and "paper" respectively. The interface call description is the relevant content of the steps or operations related to the backend interface in the test case document, which may contain keywords related to interface calls, such as "call the xxx interface", "access the xxx interface address", "send a request to the xxx service endpoint", etc. The interface call order is the order of successive calls between the backend interfaces to be called.

[0044] Specifically, the electronic device can first obtain the target test case document of the object to be tested. For example, if relevant personnel submit / upload the target test case document in accordance with the specification requirements of the test case document, the electronic device can directly obtain it. Another example is that when the test case document submitted by relevant personnel is a document with poor standardization (referred to as the initial test case document), the electronic device can perform text processing on the initial test case document according to the requirements of the standardized document to generate the target test case document. Then, the electronic device can extract the interface call description corresponding to the backend interface from the target test case document. For example, the electronic device can use a text matching algorithm to search for keywords related to interface calls in the target test case document, such as the above-mentioned "call the xxx interface", "access the xxx interface address", "send a request to the xxx service endpoint", etc. If at least one of the above keywords is included in a certain step or operation, it is considered that the step or operation involves a backend interface call, and it is determined as the interface call description. After that, the electronic device can determine the interface call order of each interface call description through the order of appearance of each interface call description in the target test case document, or the business logic corresponding to the target test case document.

[0045] S120. Based on the interface call description, determine the target interface information corresponding to the interface call description from each candidate interface information corresponding to the object to be tested. The target interface information includes at least a target request method and at least one target request parameter.

[0046] Among them, the candidate interface information is the relevant information of the backend interface predefined by the object under test during the development stage. For example, it can at least include the access path of the interface for locating a specific service or resource, the interface function description, the interface request method, and the interface parameters including interface request parameters and interface response parameters. The target interface information is the candidate interface information matched by the interface call description. Correspondingly, the target interface information can at least include the access path of the interface (referred to as the target interface path), the interface function description (referred to as the target interface description), the interface request method (referred to as the target request method), and the interface request parameters (referred to as the target request parameters).

[0047] Specifically, the electronic device can match each interface call description with the candidate interface information corresponding to the object under test to determine the target interface information of the backend interface corresponding to each interface call description.

[0048] S130. Extract parameter values from the interface call description based on each target request parameter to determine the first request parameter and the first parameter value.

[0049] Among them, the first request parameter is the target request parameter included in the interface call description.

[0050] Specifically, in addition to including the backend interface it needs to call, the interface call description also includes the key parameters and their parameter values in the backend interface under the business scenario of this test. Therefore, the electronic device can perform extraction processing on the target request parameters and their parameter values for the interface call description that can match the target interface information, and obtain the first request parameter and its first parameter value in the target interface information mentioned in this interface call description. This process can be implemented using information extraction algorithms in related technologies, or can be implemented through a large generative model (such as a language model) with stronger language understanding and processing capabilities.

[0051] For example, for the interface call description of "create an invoice (invoice type = ordinary VAT invoice, medium = paper)", it includes the target interface corresponding to "create invoice", and includes two first request parameters, "invoice type" and "medium", and their corresponding first parameter values are "ordinary VAT invoice" and "paper" respectively.

[0052] S140. Query the parameter dependency graph based on the target request method and each target request parameter to determine the second request parameter and the dependent parameters having a parameter transfer relationship with the second request parameter, and determine the second parameter value of the second request parameter based on the parameter values of the dependent parameters.

[0053] Among them, the parameter dependency graph records the parameter passing relationships between the interface parameters of each interface in the form of a topological relationship graph. For example, in the scenario of invoice creation and invoice query, the response parameter value or the interface return value of the create invoice interface is the unique invoice identifier, and the interface request parameters of the query invoice interface contain the invoice identifier. Then, in the parameter dependency graph, the parameter passing relationship between the response parameter of the create invoice interface - invoice identifier and the request parameter of the query invoice interface - invoice identifier is recorded in the form of a topological relationship graph.

[0054] In view of the fact that the interface parameters of different interfaces may have inconsistent parameter names, in the embodiments of the present disclosure, the parameter dependency graph is not constructed by using the same parameter names. Instead, from the historical test data corresponding to the object to be tested, the interface parameters that actually generate parameter passing between interfaces and their parameter passing relationships during the historical test process are extracted, and the parameter dependency graph is constructed accordingly, so as to avoid errors or omissions in the parameter dependency graph caused by inconsistent parameter names, and greatly improve the accuracy of the parameter dependency graph. Therefore, the parameter dependency graph in the embodiments of the present disclosure records the parameter passing relationships between the interface parameters in each candidate interface information in the historical test data. The parameter dependency graph can be constructed manually, or by using algorithms for information extraction and collation in related technologies, or by using a pre-trained generative model of a certain scale.

[0055] Specifically, since the interface call description only contains some key parameters in the test scenario, only the first request parameter and the first parameter value can be extracted from each target request parameter, and there are still some request parameters with missing parameter values, which will cause the target request method to not be executed correctly. Therefore, in the embodiments of the present disclosure, after the target interface information is matched, the parameter dependency graph constructed in advance can be queried with the target request method and each target request parameter (or each target request parameter except the first request parameter) as the index, so as to find the interface parameters of other interfaces that have an interface parameter passing relationship with the target request parameters in the target request method (which can be called dependent parameters). The dependent parameter can be the response parameter, request parameter or internal parameter used in the internal data calculation process of the above other interfaces. The target request parameter for which the dependent parameter is successfully queried during this process can be called the second request parameter. Then, the electronic device can assign the parameter value of the dependent parameter to the corresponding second request parameter as the second parameter value. In this way, the electronic device can achieve accurate transfer and assignment of parameter values between steps through a more accurate parameter dependency graph, and to a great extent ensure that each target request parameter in the target interface information can accurately and comprehensively obtain its parameter value, thereby ensuring the integrity and executability of the subsequent generated automated test code.

[0056] In some embodiments, the parameter dependency graph is constructed in advance in the following manner: Obtain the historical test data of the object to be tested; Based on the historical test data, call the first generative model to extract the parameter passing relationships between the interface parameters in each candidate interface information in the historical test data, and generate the current dependency graph; Merge the current dependency graph and the historical dependency graph to generate the parameter dependency graph.

[0057] Among them, the historical test data includes historical test case documents, each candidate interface information, and historical interface call logs in the test scenarios (i.e., historical test scenarios) of the object to be tested during the period before the generation of the current test case code. The first generative model is a pre-trained generative model with a certain model scale. For example, it can be a large language model, which can be pre-trained through the collected training samples. The training samples can include test case document samples, candidate interface information samples, interface call log samples, and reference samples of each interface parameter with actual interface parameter passing relationships, etc. The historical relationship graph is the parameter dependency graph generated before the extraction of the current parameter passing relationship.

[0058] Specifically, according to the foregoing description, when constructing the parameter dependency graph by using the same parameter names in the related art, it is very easy to cause errors or omissions in the parameter passing relationship due to inconsistent parameter names between different interfaces. Therefore, in the embodiments of the present disclosure, the first generative model with powerful language understanding and processing capabilities can be used to extract and generate the parameter passing relationships between interfaces, so as to avoid the problems of errors or omissions in the parameter passing relationship caused by inconsistent parameter names, and improve the accuracy and comprehensiveness of the passing relationship between the interface parameters of each interface.

[0059] First, the electronic device can obtain the historical test data of the object to be tested. The historical test data can include a historical test case document for extracting the interface call order between the interfaces involved in the historical test scenario; it can also include the candidate interface information of the object to be tested for matching the interfaces and interface parameters involved in the historical test case document; it can further include the historical interface call log, which records the data of actual interface calls, including request parameters, response results, timestamps, etc., and is used to provide actual interface call examples for the model to help understand the specific situation of parameter passing. Then, the electronic device can input the historical test data and the pre-constructed model prompt words for generating the graph according to the model input requirements into the first generative model, so that the model can extract the transfer relationship between the interface parameters of each interface corresponding to the historical test case document from the historical test data according to the constraints of the model prompt words, and generate a parameter dependency graph corresponding to the historical test data, that is, the current dependency graph. After that, considering that each historical test data may only cover some of the backend interfaces and interface parameters in the software / program corresponding to the object to be tested, the electronic device can merge the current dependency graph with the already generated historical dependency graph corresponding to the object to be tested to continuously update the parameter dependency graph of the object to be tested, thereby further improving the accuracy and integrity of the parameter dependency graph.

[0060] For example, referring to Figure 2 , taking the scenario of creating an invoice and editing an invoice in a certain business line as an example, the parameter dependency relationship in the second request parameter obtained through the parameter passing relationship can be reflected as shown in the bold part in the figure. The request parameters of this part of the invoice editing interface are directly inferred from the structure of the invoice creation interface without the need to modify the secondary test case document or configure the parameter method.

[0061] S150. Generate the automated test code of the object to be tested according to the target request method, the first parameter value, and the second parameter value in the order of interface calls.

[0062] Specifically, the electronic device can use the algorithm for generating structured code in the large model or related technologies to assemble the target request method, the first parameter value, and the second parameter value in each target interface information to generate a complete interface call code segment corresponding to each target interface information. Then, organize the interface call code segments in the order of interface calls to generate the structured automated test code corresponding to the target test case document. The automated test code can be a test script or a configuration file in the form of code stored in a data structure with characteristics such as high readability, high structure, cross-platform, and cross-language. In this way, test cases can be automatically generated and the test cases can be automatically executed.

[0063] The test case generation method provided by the embodiments of the present disclosure can analyze the target test case document of the object to be tested, and determine at least one interface call description and the interface call order; based on the interface call description, determine the target interface information corresponding to the interface call description from each candidate interface information corresponding to the object to be tested; the target interface information includes the target request method and at least one target request parameter; based on each target request parameter, extract parameter values from the interface call description to determine the first request parameter and the first parameter value; based on the target request method and the second request parameter in each target request parameter, query the parameter dependency graph to determine the dependent parameter having a parameter passing relationship with the second request parameter, and determine the second parameter value of the second request parameter based on the parameter value of the dependent parameter; the parameter dependency graph records the parameter passing relationship between the interface parameters in each candidate interface information in the historical test data; based on the target request method, the first parameter value, and the second parameter value, generate the automated test code of the object to be tested according to the interface call order; it realizes automatically capturing the parameter passing relationship between the interface parameters of each backend interface by using the historical test data of the object to be tested, improves the accuracy and integrity of the parameter dependency graph, ensures the accurate passing and assignment of parameters between steps, thereby improving the integrity and accuracy of each second parameter value determined accordingly, and largely avoiding the problem of missing interface parameters of the backend interface not involved in the target test case document; and combined with each first parameter value extracted from the target test case document, it can largely ensure the integrity and executability of the generated automated test code, thereby improving the generation efficiency of the automated test code, further reducing the cost of software testing, and improving the software testing efficiency; in addition, the determination methods of the parameter values of multiple backend interfaces can meet the diverse test data requirements in different business scenarios, and improve the versatility and scalability of the automated test code generation method.

[0064] Figure 3 It is a flowchart of another test case generation method provided by the embodiments of the present disclosure. Based on the above embodiments, the test case generation method can add the related step of "generating a structured target test case document". On this basis, the related step of "determining the third parameter value" can also be further added. On the above basis, the step of "based on the interface call description, determine the target interface information corresponding to the interface call description from each candidate interface information corresponding to the object to be tested" can also be further refined.

[0065] See Figure 3 , the test case generation method specifically includes the following steps:

[0066] S310. Obtain the initial test case document of the object to be tested.

[0067] Specifically, the embodiments of the present disclosure can process an initial test case document that is not highly standardized to achieve automatic generation of the corresponding test case code. Therefore, the electronic device can obtain the initial test case document submitted by relevant personnel through a network or a human-computer interaction interface. Alternatively, the electronic device can read the initially submitted test case document from a local or external storage medium to enhance the compatibility of the testing process for historical test cases.

[0068] S320. Based on the initial test case document and the business knowledge base, call the third generative model to preprocess the test steps in the initial test case document and generate a structured target test case document.

[0069] Among them, the business knowledge base is pre-constructed according to the business domain of the object to be tested and is used to record each business term and the corresponding execution steps in the business scenarios applicable to the object to be tested. That is to say, the business knowledge base details the pre-data construction steps and domain knowledge detail steps. Taking "create a 1:1 ticket match" as an example, the business knowledge base will elaborate on the specific steps of "first create an application document with a specific amount, and then search for a matching invoice and perform a binding and matching operation", thereby supplementing the missing execution steps of the business terms in the test case document. This execution step is used for preprocessing to complete the steps of the business terms in the initial test case document. The third generative model is another pre-trained generative model of a certain scale, such as a large language model.

[0070] Specifically, given that the initial test case document is not standardized enough and may have various problems such as missing steps, unclear step division, difficult-to-interpret business terms, and non-standard interface parameter formats, the embodiments of the present disclosure can pre-design model prompt words to constrain the internal steps of the document, such as step splitting, differentiating different conditional steps, standardizing the execution step expression as "verb + noun without attributive", step completion, and clarifying the input and output parameter formats. Then, the electronic device can input the model prompt words and the initial test case document into the third generative model to perform preprocessing such as splitting, completing, and structuring the test steps in the initial test case document inside the model, and finally output a structured target test case document.

[0071] S330. Analyze the target test case document of the object to be tested to determine at least one interface call description and the interface call order.

[0072] S340. Use the target keyword matching method and / or the second generative model to perform interface matching on the interface call description and each candidate interface information, and determine the target interface information corresponding to the interface call description.

[0073] Among them, the keyword matching method is a keyword matching method related to the interface set in advance, which can be set according to the function of the backend interface and the matching business scenario. For example, if the matching business scenario is a rough matching scenario, then the keyword matching method can be implemented as a keyword matching method related to the backend interface with relatively weak matching constraints (i.e., the first keyword matching method). Another example is that if the matching business scenario is an exact matching scenario, then the keyword matching method can be implemented as a keyword matching method related to the backend interface with relatively strong matching constraints (i.e., the second keyword matching method). The second generative model is a pre-trained language model, and its function is to perform interface call description and candidate interface matching by understanding the interface function and related steps.

[0074] Specifically, the electronic device can use methods such as the keyword matching method, the second generative model, the combination of the keyword matching method and the second generative model, etc., to perform interface matching on the interface call description and each candidate interface information, so as to determine the target interface information that is more matching the interface call description.

[0075] In some examples, the keyword matching method is used to perform interface matching on the interface call description and each candidate interface information, and the target interface information corresponding to the interface call description is determined. The electronic device can use the pre-defined keyword matching method to perform keyword matching on the interface function descriptions in the interface call description and each candidate interface information, and determine the candidate interface information with successful matching as the target interface information. In this way, the relatively simple keyword matching method can be used for interface matching, which can reduce the implementation cost of interface matching to a certain extent.

[0076] In other examples, the second generative model is used to perform interface matching on the interface call description and each candidate interface information, and the target interface information corresponding to the interface call description is determined. The electronic device can input the interface call description, each candidate interface information and related model prompt words into the second generative model together to trigger the operation of the model, and finally output the target interface information that is successfully matched with the interface call description (such as the matching degree meets a certain threshold or the matching degree is the highest). In this way, the powerful language understanding ability of the second generative model can be used to improve the accuracy of the target interface information.

[0077] In still other examples, using the keyword matching method and the second generative model to perform interface matching on the interface call description and each candidate interface information to determine the target interface information corresponding to the interface call description can be implemented as: using the first keyword matching method to perform keyword matching on the interface function descriptions in the interface call description and each candidate interface information to determine multiple initial interface information corresponding to the interface call description; based on the interface call description and each initial interface information, calling the second generative model to determine the target interface information corresponding to the interface call description.

[0078] Among them, the initial interface information is candidate interface information obtained by rough matching and matching the interface call description.

[0079] Specifically, the electronic device can first use the first keyword matching method with relatively low matching accuracy to perform keyword matching on the interface call description and the interface function descriptions in each candidate interface information. In order to recall as many initial interface information as possible, the matching degree threshold corresponding to the first keyword matching method can be set to a relatively low matching degree, so that multiple initial interface information can be obtained. Then, the interface call description, each initial interface information, and relevant model prompt words can be input into the second generative model together, so that the model can accurately match the interface function descriptions in each initial interface information and the step / operation intention corresponding to the interface call description, and obtain at least one target interface information that better matches the interface call description. In this way, the range of each initial interface information adapted to the interface call description can be narrowed by the first keyword matching method, the amount of data input into the second generative model can be reduced, thereby improving the model processing efficiency to a certain extent, and further reducing the resource consumption of interface matching, improving the interface matching efficiency, and using the interface matching ability of the large model to further improve the accuracy of the target interface information.

[0080] In some other examples, using the keyword matching method and the second generative model to perform interface matching on the interface call description and each candidate interface information to determine the target interface information corresponding to the interface call description can be implemented as follows: based on the interface call description and each candidate interface information, call the second generative model to determine at least one initial interface information corresponding to the interface call description; use the second keyword matching method to perform keyword matching on the interface call description and the interface function descriptions in the initial interface information to determine the target interface information corresponding to the interface call description.

[0081] Specifically, considering that the interface matching accuracy of the second generative model is higher than that of the first keyword matching method, but it will also have a certain matching error due to various reasons such as insufficient training and model hallucinations. In this embodiment, the interface call description, each candidate interface information, and relevant model prompt words can be input into the second generative model together to output at least one initial interface information. If there is only one initial interface information, it is directly determined as the target interface information. If there are multiple initial interface information, the second keyword matching method can be further used to perform more strict keyword matching on the interface call description and each initial interface information to output the final target interface information. This can further improve the accuracy of interface matching.

[0082] S350. Extract parameter values from the interface call description based on each target request parameter to determine the first request parameter and the first parameter value.

[0083] S360. Query the parameter dependency graph based on the target request method and each target request parameter, determine the second request parameter and the dependent parameters having a parameter passing relationship with the second request parameter, and determine the second parameter value of the second request parameter based on the parameter values of the dependent parameters.

[0084] S370. Determine the third parameter value of the third request parameter among each target request parameter based on the preset parameter value or the preset parameter value generation method.

[0085] Among them, the threshold parameter value is the default value preset for each interface parameter according to each candidate interface information. The threshold parameter value generation method is the generation method of the preset parameter value, which can be, for example, at least one of the preset regular expressions, enumeration values, data pools, range values, and preset numerical selection methods, etc. The third request parameter is the remaining request parameters among each target request parameter except the first request parameter and the second request parameter.

[0086] Specifically, following the processing methods of the above first parameter value and second parameter value, there may still be a situation where some request parameters among each target request parameter have not obtained parameter values. At this time, the target request parameters that have not obtained parameter values can be determined as the third request parameter. Then, according to the preset parameter value or the preset parameter value generation method, determine the corresponding parameter value for the third request parameter, that is, the third parameter value, to ensure the integrity of the parameter values of each target request parameter, thereby further ensuring the integrity and effectiveness of the subsequent generated automated test code.

[0087] S380. Generate the automated test code of the object to be tested according to the interface call order based on the target request method, the first parameter value, the second parameter value, and the third parameter value.

[0088] Specifically, the electronic device can use the algorithm for generating structured code in the large model or related technologies to assemble the target request method, the first parameter value, the second parameter value, and the third parameter value in each target interface information to generate a complete interface call code segment corresponding to each target interface information.

[0089] The test case generation method provided in each of the above embodiments of the present disclosure uses a business knowledge base and a third generative model to accurately parse the business logic, operation steps, and parameter information in the initial test case document, effectively handle various complex descriptions such as business knowledge and ambiguous expressions in the initial test case document, and improve the generation accuracy and efficiency of the target test case document. Moreover, the corresponding business knowledge base can be maintained for various business scenarios, so that the third generative model can better understand and process the initial test case document in complex business scenarios, not only improving the accuracy and integrity of the target test case document in various scenarios, but also enhancing the applicability of test case code generation to various business scenarios. By using the target keyword matching method and / or the second generative model to perform interface matching on the interface call description and each candidate interface information, the implementation cost and matching efficiency of interface matching can be balanced, and the accuracy of interface matching can be further improved. By using the preset parameter value or the preset parameter value generation method to determine the third parameter value of the third request parameter in each target request parameter, the integrity of the parameter values of each target request parameter can be ensured, thereby further ensuring the integrity and effectiveness of the subsequent generated automated test code.

[0090] The following are embodiments of a test case generation device provided by embodiments of the present invention. This device and the test case generation methods of the above embodiments belong to the same inventive concept. For the details not described in detail in the embodiments of the test case generation device, reference can be made to the embodiments of the above test case generation method.

[0091] Figure 4 The structural schematic diagram of a test case generation device provided by an embodiment of the present disclosure is shown. As Figure 4 shown, the test case generation device 400 may include:

[0092] An interface call description determination module 410, configured to analyze the target test case document of the object to be tested, and determine at least one interface call description and the interface call order;

[0093] A target interface information determination module 420, configured to determine the target interface information corresponding to the interface call description from each candidate interface information corresponding to the object to be tested based on the interface call description; wherein, the target interface information includes a target request method and at least one target request parameter;

[0094] A first parameter value determination module 430, configured to perform parameter value extraction on the interface call description based on each target request parameter, and determine a first request parameter and a first parameter value; wherein, the first request parameter is a target request parameter included in the interface call description;

[0095] The second parameter value determination module 440 is configured to query a parameter dependency graph based on the target request method and each target request parameter, determine a second request parameter and dependent parameters having a parameter passing relationship with the second request parameter, and determine a second parameter value of the second request parameter based on the parameter values of the dependent parameters; wherein, the parameter dependency graph records the parameter passing relationships between interface parameters in each candidate interface information in historical test data;

[0096] The automated test code generation module 450 is configured to generate automated test code for the object to be tested in accordance with the interface call order based on the target request method, the first parameter value, and the second parameter value.

[0097] The test case generation device provided by the embodiments of the present disclosure can analyze the target test case document of the object to be tested, determine at least one interface call description and the interface call order; based on the interface call description, determine the target interface information corresponding to the interface call description from each candidate interface information corresponding to the object to be tested; the target interface information includes a target request method and at least one target request parameter; extract parameter values from the interface call description based on each target request parameter to determine a first request parameter and a first parameter value; query a parameter dependency graph based on the target request method and a second request parameter among each target request parameter, determine dependent parameters having a parameter passing relationship with the second request parameter, and determine a second parameter value of the second request parameter based on the parameter values of the dependent parameters; the parameter dependency graph records the parameter passing relationships between interface parameters in each candidate interface information in historical test data; generate automated test code for the object to be tested in accordance with the interface call order based on the target request method, the first parameter value, and the second parameter value; realizes automatically capturing the parameter passing relationships between the interface parameters of each backend interface by using the historical test data of the object to be tested, improves the accuracy and integrity of the parameter dependency graph, ensures the accurate passing and assignment of parameters between steps, thereby improving the integrity and accuracy of each determined second parameter value, and largely avoiding the problem of missing interface parameters of backend interfaces not involved in the target test case document; and in combination with each first parameter value extracted from the target test case document, can largely ensure the integrity and executability of the generated automated test code, thereby improving the generation efficiency of the automated test code, further reducing the cost of software testing, and improving the software testing efficiency; in addition, the determination methods of parameter values of multiple backend interfaces can meet the diverse test data requirements in different business scenarios, and improve the versatility and scalability of the automated test code generation method.

[0098] In some embodiments, the test case generation device 400 further includes a relationship graph construction module, which is configured to construct a parameter dependency graph in the following manner in advance:

[0099] Obtain the historical test data of the object to be tested; wherein, the historical test data includes the historical test case documents of the object to be tested in historical test scenarios, information of each candidate interface, and historical interface call logs;

[0100] Based on the historical test data, call the first generative model to extract the parameter passing relationships between the interface parameters in each candidate interface information in the historical test data, and generate the current dependency graph;

[0101] Merge the current dependency graph and the historical dependency graph to generate a parameter dependency graph.

[0102] In some embodiments, the target interface information determination module 420 is specifically configured to:

[0103] Use the target keyword matching method and / or the second generative model to perform interface matching on the interface call description and information of each candidate interface, and determine the target interface information corresponding to the interface call description; wherein, the second generative model is a pre-trained language model.

[0104] Further, in one example, the target interface information determination module 420 is specifically configured to:

[0105] Use the first keyword matching method to perform keyword matching on the interface call description and the interface function descriptions in each candidate interface information, and determine multiple initial interface information corresponding to the interface call description;

[0106] Based on the interface call description and each initial interface information, call the second generative model to determine the target interface information corresponding to the interface call description.

[0107] Further, in another example, the target interface information determination module 420 is specifically configured to:

[0108] Based on the interface call description and information of each candidate interface, call the second generative model to determine at least one initial interface information corresponding to the interface call description;

[0109] Use the second keyword matching method to perform keyword matching on the interface call description and the interface function descriptions in the initial interface information, and determine the target interface information corresponding to the interface call description.

[0110] In some embodiments, the test case generation device 400 further includes a target test case document generation module, which is used to:

[0111] Before analyzing the target test case document of the object to be tested to determine at least one interface call description and interface call order, obtain the initial test case document of the object to be tested;

[0112] Based on the initial test case document and the business knowledge base, call the third generative model to preprocess the test steps in the initial test case document and generate a structured target test case document; wherein, the business knowledge base is used to record each business term and the corresponding execution steps in the business scenarios applicable to the object to be tested; the execution steps are used to preprocess the business terms in the initial test case document by completing the steps.

[0113] In some embodiments, the test case generation device 400 further includes a third parameter value determination module for:

[0114] After determining the target interface information adapted to the interface call description from each candidate interface information corresponding to the object to be tested based on the interface call description, determine the third parameter value of the third request parameter among each target request parameter based on a preset parameter value or a preset parameter value generation method; wherein, the third request parameter is the remaining request parameters among each target request parameter except the first request parameter and the second request parameter.

[0115] The test case generation device provided by the embodiments of the present invention can execute the test case generation method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0116] It should be noted that in the embodiments of the above test case generation device, the included units and modules are only divided according to the functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of mutual distinction and do not limit the protection scope of the present disclosure.

[0117] The embodiments of the present disclosure also provide an electronic device, which may include a processor and a memory, and the memory may be used to store executable instructions. Among them, the processor may be used to read the executable instructions from the memory and execute the executable instructions to implement the test case generation method in the above embodiments.

[0118] Figure 5 Shows a schematic structural diagram of an electronic device provided by the embodiments of the present disclosure.

[0119] Such as Figure 5As shown, the electronic device 500 may include a processing device 501 (such as a central processing unit, a graphics processing unit, etc.), which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output interface (I / O interface) 505 is also connected to the bus 504.

[0120] Generally, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or wiredly to exchange data.

[0121] It should be noted that Figure 5 the illustrated electronic device 500 is merely an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure. That is, although Figure 5 the electronic device 500 with various devices is illustrated, it should be understood that it is not required to implement or possess all the illustrated devices. Instead, more or fewer devices may be implemented or possessed.

[0122] Specifically, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above functions defined in the network isolation policy management method of any embodiment of the present disclosure are executed.

[0123] The embodiments of the present disclosure also provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor is caused to implement the network isolation policy management method in any embodiment of the present disclosure.

[0124] It should be noted that the computer-readable medium described above in this disclosure can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. And in this disclosure, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also 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 conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, radio frequency (RF), etc., or any suitable combination of the above.

[0125] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as the Hypertext Transfer Protocol (HTTP), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), the Internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future-developed network.

[0126] The above computer-readable medium may be included in the above electronic device; or may exist separately without being assembled into the electronic device.

[0127] The above computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to execute the network isolation policy management method described in any embodiment of the present disclosure.

[0128] In the embodiments of the present disclosure, computer program code for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof. The above programming languages include, but are not limited to, object-oriented programming languages - such as Java, Smalltalk, C++; and also include conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network - including a local area network (LAN) or a wide area network (WAN) - or may be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).

[0129] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of devices, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.

[0130] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, without limitation, the exemplary types of hardware logic components that can be used include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), and so on.

[0131] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present disclosure.

[0132] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although a number of specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features described in the context of separate embodiments may also be implemented in combination in a single embodiment. Conversely, the various features described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.

[0133] Although the subject matter has been described in language specific to structural features and / or method logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. On the contrary, the specific features and acts described above are merely example forms for implementing the claims.

Claims

1. A test case generation method, characterized in that, Including: Analyze the target test case document of the object to be tested, and determine at least one interface call description and the interface call order; Based on the interface call description, determine the target interface information corresponding to the interface call description from each candidate interface information corresponding to the object to be tested; wherein, the target interface information includes a target request method and at least one target request parameter; Extract parameter values for the interface call description based on each of the target request parameters to determine a first request parameter and a first parameter value; wherein, the first request parameter is the target request parameter included in the interface call description; Based on the target request method and each of the target request parameters, query the parameter dependency graph to determine a second request parameter and a dependency parameter having a parameter transfer relationship with the second request parameter, and determine a second parameter value of the second request parameter based on the parameter value of the dependency parameter; wherein, the parameter dependency graph records the parameter transfer relationships between interface parameters in each of the candidate interface information in historical test data; Generate automated test code for the object to be tested according to the interface call order based on the target request method, the first parameter value, and the second parameter value.

2. The method according to claim 1, wherein The parameter dependency graph is constructed in advance by the following method: Obtain the historical test data of the object to be tested; wherein, the historical test data includes historical test case documents of the object to be tested in historical test scenarios, each of the candidate interface information, and historical interface call logs; Based on the historical test data, call a first generative model to extract the parameter transfer relationships between interface parameters in each of the candidate interface information in the historical test data, and generate a current dependency graph; Merge the current dependency graph and the historical dependency graph to generate the parameter dependency graph.

3. The method according to claim 1, wherein The determining the target interface information corresponding to the interface call description from each candidate interface information corresponding to the object to be tested based on the interface call description includes: Use a target keyword matching method and / or a second generative model to perform interface matching on the interface call description and each of the candidate interface information to determine the target interface information corresponding to the interface call description; wherein, the second generative model is a pre-trained language model.

4. The method according to claim 3, characterized in that Using a target keyword matching method and a second generative model to perform interface matching on the interface call description and each of the candidate interface information to determine the target interface information corresponding to the interface call description includes: Use a first keyword matching method to perform keyword matching on the interface call description and the interface function descriptions in each of the candidate interface information to determine multiple initial interface information corresponding to the interface call description; Based on the interface call description and each of the initial interface information, call the second generative model to determine the target interface information corresponding to the interface call description.

5. The method according to claim 3, characterized in that Using the target keyword matching method and the second generative model, perform interface matching on the interface call description and each candidate interface information to determine the target interface information corresponding to the interface call description, including: Based on the interface call description and each candidate interface information, call the second generative model to determine at least one initial interface information corresponding to the interface call description; Use the second keyword matching method to perform keyword matching on the interface call description and the interface function description in the initial interface information to determine the target interface information corresponding to the interface call description.

6. The method according to claim 1, wherein Before analyzing the target test case document of the object to be tested to determine at least one interface call description and interface call order, the method further includes: Obtain the initial test case document of the object to be tested; Based on the initial test case document and the business knowledge base, call the third generative model to preprocess the test steps in the initial test case document to generate the structured target test case document; wherein, the business knowledge base is used to record each business term in the business scenarios applicable to the object to be tested and the execution steps corresponding to the business terms; the execution steps are used to preprocess the business terms in the initial test case document by completing the steps.

7. The method according to claim 1, wherein After determining the target interface information adapted to the interface call description from each candidate interface information corresponding to the object to be tested based on the interface call description, the method further includes: Based on the preset parameter value or preset parameter value generation method, determine the third parameter value of the third request parameter among each target request parameter; wherein, the third request parameter is the remaining request parameters among each target request parameter except the first request parameter and the second request parameter.

8. A test case generation device, characterized in that, Including: An interface call description determination module, configured to analyze the target test case document of the object to be tested to determine at least one interface call description and interface call order; A target interface information determination module, configured to determine the target interface information corresponding to the interface call description from each candidate interface information corresponding to the object to be tested based on the interface call description; wherein, the target interface information includes a target request method and at least one target request parameter; A first parameter value determination module, configured to extract parameter values from the interface call description based on each target request parameter to determine a first request parameter and a first parameter value; wherein, the first request parameter is the target request parameter included in the interface call description; A second parameter value determination module, configured to query the parameter dependency graph based on the target request method and each target request parameter to determine a second request parameter and dependent parameters having a parameter transfer relationship with the second request parameter, and determine the second parameter value of the second request parameter based on the parameter values of the dependent parameters; wherein, the parameter dependency graph records the parameter transfer relationships between the interface parameters in each candidate interface information in historical test data. An automated test code generation module, configured to generate automated test code for the object to be tested according to the interface call sequence based on the target request method, the first parameter value, and the second parameter value.

9. An electronic device, characterized in that, It includes: A processor; A memory for storing executable instructions; Wherein, the processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the test case generation method according to any one of claims 1-7 above.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, causes the processor to implement the test case generation method according to any one of claims 1-7 above.

11. A computer program product, characterized in that, The computer program product is used to implement the test case generation method according to any one of claims 1-7 above.

Citation Information

Cited By

  • Information extraction method for equipment configuration page and electronic equipment

    CN120892110A

  • Information extraction method of device configuration page and electronic device

    CN120892110B