Execution method and device of test case generation task, storage medium and electronic equipment

By training the initial generative model and utilizing input samples of entity features and test case labels, a target generative model capable of identifying target entities and logical relationships in the requirement data is generated. This solves the problem of test case generation relying on insufficient requirement data quality and improves the reliability and accuracy of test cases.

CN121833490APending Publication Date: 2026-04-10CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2025-12-08
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing automated test case generation technologies rely on the quality of requirement data, resulting in insufficient accuracy and reliability of the generated test cases. This is especially true when requirement data is incomplete or non-standardized, making it difficult to cover key business logic and scenarios.

Method used

By creating requirement input samples containing entity feature labels and test case labels, the initial generation model is trained to generate a reference generation model. The target generation model is then trained using a second input sample, which can identify the target entities and logical relationships in the requirement input and generate target test cases.

Benefits of technology

It enables in-depth mining of the implicit business logic in the requirement data, improves the reliability of test case generation, and avoids test case deviation and logic omission problems caused by insufficient requirement data quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833490A_ABST
    Figure CN121833490A_ABST
Patent Text Reader

Abstract

The invention discloses an execution method and device of a test case generation task, a storage medium and electronic equipment. The execution method of the test case generation task comprises the steps of creating a demand input sample comprising a first input sample and a second input sample; the first input sample is used for training the initial generation model, a reference generation model is obtained, and the reference generation model is used for recognizing the target entities and the target logic relation between the target entities from the demand input; the second input sample is used for training the reference generation model to obtain a target generation model, the target generation model can generate a target test case corresponding to the demand input, and the target test case can describe a test task indicated by the demand input by using the target entity and the target logic relationship. The technical problem that the reliability is insufficient due to the fact that the test case generation quality depends on the demand data quality in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of financial technology, and more specifically, to a method and apparatus for executing test case generation tasks, a storage medium, and an electronic device. Background Technology

[0002] Existing automated test case generation technologies typically rely on the quality of requirement data as the foundation for test case generation, outputting test cases through pattern matching or rule mapping. However, these methods have significant drawbacks: firstly, the accuracy of the generated results heavily depends on the completeness and standardization of the requirement data. Ambiguity, omissions, or non-standardized expressions in the requirement data can directly lead to deviations or errors in the generated test cases; secondly, they can only directly convert the surface semantics of the requirement data, failing to effectively identify the complex business logic and inherent relationships hidden within the requirement data. This results in generated test cases that are difficult to cover key business scenarios, leading to low reliability of the test cases.

[0003] There is currently no effective solution to the problem that the quality of test case generation depends on the quality of the requirement data, which leads to insufficient reliability in related technologies. Summary of the Invention

[0004] This application provides a method and apparatus for executing a test case generation task, a storage medium, and an electronic device, to at least solve the technical problem in the related art where the quality of test case generation depends on the quality of the requirement data, resulting in insufficient reliability.

[0005] According to one embodiment of this application, a method for executing a test case generation task is provided, comprising: creating a requirement input sample, wherein the requirement input sample includes a first input sample and a second input sample, the first input sample includes input data labeled with entity feature tags, the second input sample includes the input data labeled with test case tags, the entity feature tags being used to indicate reference entities included in the input data and reference logical relationships between the reference entities, and the test case tags being used to describe the test task indicated by the input data using the entity feature tags; training an initial generation model using the first input sample to obtain a reference generation model, wherein the initial generation model is an artificial intelligence-generated content model, and the reference generation model being used to identify target entities and target logical relationships between the target entities from the requirement input; and training the reference generation model using the second input sample to obtain a target generation model, wherein the target generation model is used to generate target test cases corresponding to the requirement input, and the target test cases being used to describe the test task indicated by the requirement input using the target entities and the target logical relationships.

[0006] Optionally, creating the requirement input sample includes: identifying the entities included in the input data and the logical relationships between the entities to obtain the reference entities and the reference logical relationships; labeling the reference entities and the reference logical relationships to obtain the entity feature tags, and determining the input data labeled with the entity feature tags as the first input sample; obtaining test cases corresponding to the test task indicated by the input data; labeling the test cases to form the test case tags, and using the input data labeled with the test case tags as the second input sample.

[0007] Optionally, the step of identifying the entities included in the input data and the logical relationships between them to obtain the reference entity and the reference logical relationship includes: acquiring business constraint information, business process information, and defect information, wherein the business constraint information records business nodes, constraint conditions, business scenarios, and abnormal results with constraint relationships, the business process information records multiple business nodes with sequential relationships, and the defect information records business nodes, defect events, and business scenarios with causal relationships; extracting an initial entity from the input data, wherein the initial entity is an entity included in the input data; extracting constraint-related entities with constraint relationships with the initial entity from the business constraint information; extracting process-related entities with sequential relationships with the initial entity from the business process information; extracting defect-related entities with causal relationships with the initial entity from the defect information; merging the initial entity, the constraint-related entity, the process-related entity, and the defect-related entity into the reference entity; and determining the reference logical relationship between the reference entities based on the constraint relationships, sequential relationships, and causal relationships corresponding to the reference entities in the business constraint information, the business process information, and the defect information.

[0008] Optionally, after training the reference generation model using the second input sample to obtain the target generation model, the method further includes: receiving a test case generation request carrying target requirement data; responding to the test case generation request, inputting the target requirement data into the target generation model to obtain initial test cases; detecting the coverage parameter of the initial test cases on the reference entity and the reference logical relationship, wherein the coverage parameter is used to indicate the degree of coverage of the initial test cases on the reference entity and the reference logical relationship; if the coverage parameter indicates that the degree of coverage of the initial test cases on the reference entity and the reference logical relationship is greater than or equal to a preset threshold, determining the initial test cases as candidate test cases; if the coverage parameter indicates that the degree of coverage of the initial test cases on the reference entity and the reference logical relationship is less than the preset threshold, adjusting the generation parameters of the target generation model according to the coverage parameter, and inputting the target requirement data into the target generation model until the test cases output by the target generation model have a coverage of the reference entity and the reference logical relationship greater than or equal to the preset threshold; and determining the test cases output by the target generation model as candidate test cases.

[0009] Optionally, detecting the coverage parameters of the initial test cases to the reference entity and the reference logical relationship includes: identifying candidate entities and candidate logical relationships between the candidate entities from the initial test cases; detecting a first coverage of the candidate entities to the reference entity, and detecting a second coverage of the candidate logical relationship to the reference logical relationship, wherein the first coverage is used to indicate the degree of coverage of the candidate entities to the reference entity, and the second coverage is used to indicate the degree of coverage of the candidate logical relationship to the reference logical relationship; and calculating the coverage parameters based on the first coverage and the second coverage.

[0010] Optionally, after training the reference generation model using the second input sample to obtain the target generation model, the method further includes: receiving a test case generation request carrying target requirement data; responding to the test case generation request by inputting the target requirement data into the target generation model to obtain candidate test cases; obtaining a target test case obtained after the candidate test cases have been edited, wherein the target test case is used to execute the test task indicated by the target requirement data; obtaining an initial input template used to construct the target requirement data; adjusting the initial input template according to the candidate test cases, the target test case, and preset conditions until the initial input template meets the preset conditions to obtain a target input template, wherein the target generation model outputs the target test case when it receives the target requirement data constructed from the input template that meets the preset conditions.

[0011] Optionally, adjusting the initial input template based on the candidate test cases, the target test cases, and preset conditions until the initial input template meets the preset conditions to obtain the target input template includes: calculating the semantic similarity between the candidate test cases and the target test cases; detecting the parameter relationship between the semantic similarity and a similarity threshold; adjusting the prompt words in the initial input template when the semantic similarity is less than the similarity threshold until the semantic similarity between the test cases output by the target generation model after receiving the target requirement data constructed from the adjusted input template and the target test cases is greater than or equal to the similarity threshold, and determining the adjusted input template as the target input template; and determining the initial input template as the target input template when the semantic similarity is greater than or equal to the similarity threshold.

[0012] According to another embodiment of this application, an execution device for a test case generation task is also provided, comprising: a creation module, configured to create a requirement input sample, wherein the requirement input sample includes a first input sample and a second input sample, the first input sample includes input data labeled with entity feature tags, the second input sample includes the input data labeled with test case tags, the entity feature tags are used to indicate reference entities included in the input data and reference logical relationships between the reference entities, and the test case tags are used to describe the test task indicated by the input data using the entity feature tags; a first training module, configured to train an initial generation model using the first input sample to obtain a reference generation model, wherein the initial generation model is an artificial intelligence generated content model, and the reference generation model is used to identify target entities and target logical relationships between the target entities from the requirement input; and a second training module, configured to train the reference generation model using the second input sample to obtain a target generation model, wherein the target generation model is used to generate target test cases corresponding to the requirement input, and the target test cases are used to describe the test task indicated by the requirement input using the target entities and the target logical relationships.

[0013] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, and the computer program is configured to execute the above-described test case generation task execution method at runtime.

[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the execution method of the test case generation task through the computer program.

[0015] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program, wherein when the computer program is executed by a processor, it implements the execution method of the test case generation task.

[0016] In this embodiment, a requirement input sample containing a first input sample and a second input sample is created. The initial generation model is then trained using the first input sample to obtain a reference generation model capable of identifying target entities and their logical relationships from the requirement input. The reference generation model is then trained using the second input sample to obtain a target generation model capable of generating target test cases. These target test cases can describe the test tasks indicated by the requirement input using target entities and their logical relationships. This allows the target generation model to generate test cases based on the entities and their logical relationships contained in the requirement data, achieving a deep understanding of the implicit business logic within the requirement data, rather than relying solely on the surface semantics. This avoids the problems of test case deviation, logical gaps, and insufficient reliability caused by over-reliance on the quality of the requirement text in related technologies. By adopting the above technical solution, the technical problem of insufficient reliability caused by the dependence of test case generation quality on the quality of requirement data in related technologies is solved, achieving the technical effect of improving the reliability of test case generation. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

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

[0019] Figure 1 This is a schematic diagram of the hardware environment for executing a test case generation task according to an embodiment of this application;

[0020] Figure 2 This is a flowchart of a test case generation task execution method according to an embodiment of this application;

[0021] Figure 3 This is a schematic diagram of a test case generation task execution flow according to an embodiment of this application;

[0022] Figure 4 This is a structural block diagram of an execution device for generating test cases according to an embodiment of this application;

[0023] Figure 5 This is a schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0025] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent from the aforementioned user or organization.

[0026] The information collected in this disclosure is information and data authorized by the user or fully authorized by all parties. The collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions, and shall not violate public order and good morals. Corresponding operation portals shall be provided for users to choose to authorize or refuse.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] The methods and embodiments provided in this application can be executed on a computer terminal, device terminal, or similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a schematic diagram of the hardware environment for executing a test case generation task according to an embodiment of this application. Figure 1 As shown, a computer terminal may include one or more ( Figure 1Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. In one exemplary embodiment, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 Equivalent functions or ratios shown Figure 1 The functions shown have more different configurations.

[0029] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the test case generation task execution method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0030] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0031] This embodiment provides a method for executing a test case generation task, applied to the aforementioned computer terminal. Figure 2 This is a flowchart of a test case generation task execution method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:

[0032] Step S202: Create a requirement input sample, wherein the requirement input sample includes a first input sample and a second input sample. The first input sample includes input data labeled with entity feature tags, and the second input sample includes the input data labeled with test case tags. The entity feature tags are used to indicate the reference entities included in the input data and the reference logical relationships between the reference entities. The test case tags are used to describe the test task indicated by the input data using the entity feature tags.

[0033] Step S204: Train the initial generation model using the first input sample to obtain a reference generation model, wherein the initial generation model is an artificial intelligence content generation model, and the reference generation model is used to identify target entities and target logical relationships between target entities from the demand input.

[0034] Step S206: Train the reference generation model using the second input sample to obtain a target generation model, wherein the target generation model is used to generate target test cases corresponding to the requirement input, and the target test cases are used to describe the test task indicated by the requirement input using the target entity and the target logical relationship.

[0035] Through the above steps, a requirement input sample containing a first input sample and a second input sample is first created. Then, the initial generative model is trained using the first input sample to obtain a reference generative model capable of identifying target entities and the target logical relationships between them from the requirement input. Next, the reference generative model is trained using the second input sample to obtain a target generative model capable of generating target test cases. Target test cases can use target entities and target logical relationships to describe the test task indicated by the requirement input. This allows the target generative model to generate test cases based on the entities contained in the requirement data and the logical relationships between them, achieving deep mining of the implicit business logic in the requirement data, rather than relying solely on the surface semantics of the requirement data. This avoids the problems of test case deviation, logical omissions, and insufficient reliability caused by over-reliance on the quality of the requirement text in related technologies. By adopting the above technical solution, the technical problem of insufficient reliability caused by the dependence of test case generation quality on the quality of requirement data in related technologies is solved, achieving the technical effect of improving the reliability of test case generation.

[0036] Optionally, in this embodiment, the input data may be, but is not limited to, raw text information obtained from sources such as requirements documents, user stories, interface specifications, or defect reports, used to describe software functions or business rules. The requirements input samples are structured datasets constructed based on this input data for model training. This solution does not limit the specific source and format of the input data.

[0037] Optionally, in this embodiment, the first input sample is sample data annotated with entities and logical relationships. Entities can be, but are not limited to, key business objects (such as "user" and "order"), operational actions (such as "submit" and "pay"), or system components (such as "database" and "interface") in the requirement description. Logical relationships can be, but are not limited to, business associations (such as "dependency" and "trigger"), temporal sequences (such as "login before query"), or conditional constraints (such as "fail if balance is insufficient"). Entity feature tags are structured identifiers of these reference entities and reference logical relationships. For example, for the input data "user logs in successfully and then queries orders," its entity feature tags can identify the reference entities "user" and "order," as well as the reference logical relationship "login successful" before "querying." This solution does not limit the specific format of the entity feature tags (such as Extensible Markup Language (XML), JavaScript Object Notation (JSON), or BIO (Beginning, Inside, Outside)).

[0038] Optionally, in this embodiment, the second input sample is sample data that has been labeled with the final output target. Test case tags can be, but are not limited to, structured test case descriptions corresponding to the input data, constructed based on the elements defined by the entity feature tags. For example, for the aforementioned input data, the test case tag may describe a test task, including test steps (such as "1. Enter user credentials to log in; 2. Perform order query operation"), expected results (such as "1. Login successful; 2. Return correct order information"), etc., thus fully defining the test task indicated by the input data. This solution does not limit the specific format of the test case tags (such as XML, JSON, or BIO).

[0039] Optionally, in this embodiment, the test task may be, but is not limited to, a specific business function, scenario, or process that the input data is expected to verify. For example, it may be "verifying user login function", "testing the integrity of payment process", or "checking the handling of abnormal input", etc.

[0040] In the technical solution provided in step S202 above, requirement input samples can be created in, but are not limited to, the following ways: Method 1: Using natural language processing tools or scripts, entity recognition and relation extraction are performed on the input data to automatically or assistedly generate entity feature labels; and corresponding test case text is matched or generated from the test management system or historical data as test case labels. Method 2: Test engineers or domain experts manually label the input data with entities and relationships based on business knowledge to form the first input sample, and write or specify corresponding test cases to form the second input sample.

[0041] Optionally, in this embodiment, the initial generation model can be, but is not limited to, a large-scale pre-trained Artificial Intelligence Generated Content (AIGC) model with strong natural language understanding capabilities, such as the Qwen series models (e.g., qwen3-32B), GPT series models, LLaMA series models, etc. The qwen3-32B model is adapted to the business logic understanding requirements of the vertical test domain and is the preferred model in this solution. The reference generation model is an intermediate state model obtained after the initial generation model has been trained with the first input sample, possessing the ability to accurately identify business entities and their logical relationships.

[0042] In the technical solution provided in step S204 above, the reference generative model is obtained by training the initial generative model using the first input sample. This can be achieved, but is not limited to, in the following ways: Method 1: Using the input data as the model input and the entity feature labels as the training target, the model parameters are updated by minimizing the loss between the model prediction and the true labels (such as cross-entropy loss). Method 2: Employing cue learning or adapter fine-tuning methods, while freezing most of the model parameters, only a small number of newly added parameters or cue vectors are trained to enable the model to recognize entity relationships. For example, specific cue templates such as "Please find the entities and relationships in the following text: [Input Data]" can be designed to guide the model's learning.

[0043] Optionally, in this embodiment, the target generation model is a final model with test case generation capability obtained by training the reference generation model with a second input sample. The target generation model can receive requirement input (such as requirement text) and generate target test cases corresponding to the requirement input. For example, when a new requirement is input (such as "the user should receive a confirmation SMS after submitting an order"), the target generation model can identify the target entities ("user", "order", "confirmation SMS") and the target logical relationship (the order relationship between "submit" and "receive"), and generate target test cases (including specific test steps, test data, and expected results) that use these elements to describe the test task.

[0044] In the technical solution provided in step S206 above, the operation of training the reference generation model using the second input sample to obtain the target generation model can be implemented, but is not limited to, in the following ways: Method 1: Using a sequence-to-sequence training paradigm, the requirement input is used as the encoder input, and the corresponding target test case text is used as the decoder output target, training the model's ability to generate complete test cases. Method 2: Using a conditional generation method, the target entities and target logical relationships identified by the reference generation model are used as conditional information and fed into the model along with the requirement input, guiding the model to generate test cases that conform to the specified logical structure. This solution does not limit the specific generation training strategy.

[0045] Optionally, in this embodiment, after training the reference generative model using the second input sample to obtain the target generative model, the knowledge base of the target generative model can be updated in real time or periodically to ensure that the generated test cases always reflect the latest business rules. This update process mainly includes: connecting to the enterprise business change system to automatically monitor updates to business rules; automatically extracting the changed content and processing it into incremental training data when a change is detected; and periodically using the incremental training data to incrementally train the target generative model. In this way, the target generative model can continuously absorb new business knowledge, ensuring that the target test cases it generates remain synchronized with the current real business logic, thereby effectively responding to the rapid iteration of business requirements.

[0046] In an exemplary embodiment, creating a requirement input sample includes: identifying entities and logical relationships included in the input data to obtain reference entities and reference logical relationships; labeling the reference entities and reference logical relationships to obtain entity feature tags, and determining the input data labeled with the entity feature tags as the first input sample; obtaining test cases corresponding to the test task indicated by the input data; labeling the test cases to form test case tags, and using the input data labeled with the test case tags as the second input sample.

[0047] Optionally, in this embodiment, entities included in the input data and the logical relationships between entities can be identified in the following ways, but are not limited to: Method 1: Matching and extracting from the input text based on a predefined entity dictionary and relation patterns. Method 2: Automating the analysis of the input data using a pre-trained named entity recognition and relation extraction model to identify entities and their relationships. For example, entities can be identified by matching specific keywords using regular expressions, or relational triples between entities can be automatically extracted using a task processing flow composed of models such as Bidirectional Encoder Representations from Transformers (BERT).

[0048] Optionally, in this embodiment, reference entities and reference logical relationships can be labeled in, but are not limited to, the following ways: Method 1: Using automated labeling tools or scripts, the identified entities and relationships are automatically labeled onto the original input data according to a predefined labeling system (such as BIO, BILOU, etc.). For example, automatic labeling can be achieved, but is not limited to, using the Python Natural Language Toolkit (NLTK) library. Method 2: Using a manual labeling platform, labelers manually label and proofread the input data based on the identification results and labeling specifications. For example, manual labeling can be performed using labeling platforms such as LabelStudio.

[0049] Optionally, in this embodiment, test cases can be obtained, but are not limited to, by retrieving and exporting relevant test cases from the enterprise's test management system or historical test archives based on requirement numbers or test business keywords. For example, existing test cases can be obtained from systems such as TestRail and Zephyr through application programming interfaces (APIs).

[0050] Optionally, in this embodiment, test cases can be labeled to form test case tags in the following ways, but not limited to: Method 1: Associating the test case text with its corresponding input data and using the entire test case text as a tag for the input data. For example, the test case can be directly paired with the input data as a piece of text. Method 2: Performing structured parsing on the test cases, extracting key components such as test steps and expected results, and using them as tags in a structured format (such as JSON). For example, parsing the obtained test cases into a sequence of "step-expected result" pairs and using them as tags. This solution does not limit the specific composition of the test case tags.

[0051] In an exemplary embodiment, the step of identifying the entities included in the input data and the logical relationships between the entities to obtain the reference entity and the reference logical relationship includes: acquiring business constraint information, business process information, and defect information, wherein the business constraint information records business nodes, constraint conditions, business scenarios, and abnormal results with constraint relationships, the business process information records multiple business nodes with sequential relationships, and the defect information records business nodes, defect events, and business scenarios with causal relationships; extracting an initial entity from the input data, wherein the initial entity is an entity included in the input data; extracting constraint-related entities with constraint relationships with the initial entity from the business constraint information; extracting process-related entities with sequential relationships with the initial entity from the business process information; extracting defect-related entities with causal relationships with the initial entity from the defect information; merging the initial entity, the constraint-related entities, the process-related entities, and the defect-related entities into the reference entity; and determining the reference logical relationship between the reference entities based on the constraint relationships, sequential relationships, and causal relationships corresponding to the reference entities in the business constraint information, the business process information, and the defect information.

[0052] Optionally, in this embodiment, the business constraint information may be, but is not limited to, structured data that records restrictive conditions in business rules. For example, it may be information extracted from business rule documents, system configuration tables, or user manuals, recording rules such as "a single payment amount shall not exceed 5,000 yuan" or "the transaction fails when the account balance is insufficient." It records the rules that must be followed or the abnormal results that may be triggered in a specific business scenario.

[0053] Optionally, in this embodiment, the business process information may be, but is not limited to, structured data that records the execution order of business activities. For example, it may be information extracted from business process modeling diagrams, user manuals, or system design documents, recording sequential business steps such as "user login -> select product -> pay -> generate order".

[0054] Optionally, in this embodiment, the defect information may be, but is not limited to, structured data that records historical abnormal events of the system and their causes of failure. For example, it may be case data extracted from the defect management system, test reports, or fault logs, recording causal relationships such as "in a concurrent payment scenario, the balance calculation was incorrect due to the lack of locking."

[0055] Optionally, in this embodiment, a business node may be, but is not limited to, an entity subclass that constitutes a business constraint, process, or defect, representing a specific operation, state, or judgment point in the process, and is an important component of the reference entity, such as 'user submits application' (operation entity), 'risk control review' (process entity), 'payment processing' (operation entity), etc. This solution does not limit the specific granularity of the business node.

[0056] Optionally, in this embodiment, the initial entity refers to a key business object, operation action, or system component directly identified from the input data. The constraint-related entity, process-related entity, and defect-related entity are extended entities mined from business constraint information, business process information, and defect information, respectively, based on specific relationships (constraints, sequences, causality) with the initial entity. For example, for the input data "user payment order," its initial entity could be "user," "payment," or "order"; through association extraction, the process-related entity "balance query" might be obtained from the business process information, and the constraint-related entity "payment limit" might be obtained from the business constraint information.

[0057] Optionally, in this embodiment, business constraint information, business process information, and defect information can be obtained through, but not limited to, the following methods: Method 1: Automatically connect to the enterprise's business rule base, process management platform, and defect tracking system via API interface to periodically pull or query relevant structured information in real time. Method 2: Convert business constraints, processes, and defect cases recorded in various documents into structured database records through manual collection, organization, and input.

[0058] Optionally, in this embodiment, the operation of extracting associated entities with specific relationships to the initial entity from various types of information can be implemented, but is not limited to, the following methods: Method 1: Based on graph database query, the initial entity is used as a node, and the adjacent nodes with constraints, sequences, or causal relationships are traversed and queried in the constructed business knowledge graph, and these adjacent nodes are used as associated entities. Method 2: Based on relational database query, other entities with logical relationships to the initial entity are found from the business information table by executing a predefined Structured Query Language (SQL) join query statement. For example, it can be, but is not limited to, querying "all nodes with a 'NEXT_STEP' relationship to the 'payment' node" in Neo4j using Cypher statements, or querying "all steps in the same business process as the 'payment' operation" in MySQL. This solution does not limit the specific association extraction algorithm.

[0059] Optionally, in this embodiment, the reference entity is a set of entities that comprehensively reflects the business logic, formed by merging the initial entity with various related entities. The merging operation aims to ensure that all business elements related to the test scenario are covered.

[0060] Optionally, in this embodiment, various entities can be merged into a reference entity in the following ways, but not limited to: Method 1: Using the union operation of sets, merge lists of entities from different sources into one set and remove duplicate entities. Method 2: During the merging process, append source information (such as from constraints, processes, or defects) to each entity to preserve its original semantic context. For example, merging and deduplication can be performed using Python list operations, or the entities can be stored as a list of entity objects with metadata. This solution does not limit the specific data structure and algorithm used for merging.

[0061] Optionally, in this embodiment, the reference logical relationship is determined based on the inherent relationships between reference entities in business constraints, processes, and defect information. The reference logical relationship integrates the constraints, order, and causal relationships between entities, thereby constructing a relational network that can completely describe the business logic.

[0062] Optionally, in this embodiment, the operation of determining the reference logical relationship based on the corresponding relationship of the reference entity in various types of information can be implemented, but is not limited to, in the following ways: Method 1: Directly extract the constraints, order, and causal relationships explicitly recorded by the reference entity in each information source to jointly constitute a set of reference logical relationships. For example, this can be, but is not limited to, directly collecting the constraint relationship between "payment" and "payment limit," or the order relationship between "payment" and "generate order." Method 2: Based on the existing logical relationships, use simple reasoning rules to complete the implicit indirect logical relationships between entities. For example, based on "A depends on B" and "B precedes C," deduce the relationship "A is indirectly limited by C."

[0063] In an exemplary embodiment, after training the reference generation model using the second input sample to obtain the target generation model, the method further includes: receiving a use case generation request carrying target requirement data; responding to the use case generation request, inputting the target requirement data into the target generation model to obtain initial test cases; detecting a coverage parameter of the initial test cases on the reference entity and the reference logical relationship, wherein the coverage parameter is used to indicate the degree of coverage of the initial test cases on the reference entity and the reference logical relationship; if the coverage parameter indicates that the degree of coverage of the initial test cases on the reference entity and the reference logical relationship is greater than or equal to a preset threshold, determining the initial test cases as candidate test cases; if the coverage parameter indicates that the degree of coverage of the initial test cases on the reference entity and the reference logical relationship is less than the preset threshold, adjusting the generation parameters of the target generation model according to the coverage parameter, and inputting the target requirement data into the target generation model until the test cases output by the target generation model have a coverage degree of greater than or equal to the preset threshold on the reference entity and the reference logical relationship; and determining the test cases output by the target generation model as candidate test cases.

[0064] Optionally, in this embodiment, the target requirement data may be, but is not limited to, new requirement description text to be used to generate test cases. For example, it may be a description of a new feature proposed in actual application after the model training is completed, such as "adding a function for users to quickly register via mobile phone number".

[0065] Optionally, in this embodiment, the test case generation request may be, but is not limited to, an instruction or call signal that triggers the test case generation process. For example, it may be an API call request containing target requirement data issued by the continuous integration platform, or an operation triggered by a tester clicking the "Generate Test Case" button on the interface.

[0066] Optionally, in this embodiment, the operation of receiving a test case generation request and responding to obtain initial test cases can be implemented, but is not limited to, in the following ways: Method 1: By deploying an API service interface provided for the target generation model, receiving an external Hypertext Transfer Protocol (HTTP) request, with the request body carrying the target requirement data, the service calls the model and returns the generated initial test case text. Method 2: By using a plugin in the integrated development environment or test management platform, when the user performs the generation operation, calling the target generation model on a local or intranet service and obtaining the result.

[0067] Optionally, in this embodiment, the initial test cases may be, but are not limited to, a set of test cases that have not been covered and generated for the first time by the target generation model based on the target requirement data. Its content may contain some test logic, but its completeness and accuracy need to be verified.

[0068] Optionally, in this embodiment, the coverage parameter and coverage level can be, but are not limited to, metrics used to quantitatively evaluate the quality of test cases. The coverage parameter is a specific calculated value, while the coverage level is the coverage level reflected by that value. For example, the coverage parameter can be a value between 0 and 1, used to comprehensively represent the proportion of test cases that include the necessary business entities and logical relationships.

[0069] Optionally, in this embodiment, the operation of detecting the coverage parameters of the initial test cases can be implemented in, but is not limited to, the following ways: Method 1: Based on rule matching, compare the initial test case text with a predefined list of reference entities and logical relationships, count the number of mentioned entities and relationships, and calculate their proportion relative to the total as the coverage parameter. Method 2: Based on semantic similarity calculation, use an embedding model to vectorize the initial test cases and the list of reference entities / relationships respectively, and comprehensively evaluate the coverage by calculating indicators such as the cosine similarity between vectors.

[0070] Optionally, in this embodiment, the preset threshold can be, but is not limited to, a pre-set standard line for judging whether the quality of test cases is qualified. For example, it can be set to 0.8 (i.e., 80%). When the coverage calculated by the coverage parameter reaches or exceeds this threshold, the quality of the generated test cases is considered to be qualified.

[0071] Optionally, in this embodiment, candidate test cases can be, but are not limited to, test cases that have been assessed for quality, deemed usable, or further optimized.

[0072] Optionally, in this embodiment, the generation parameters may be, but are not limited to, internally adjustable parameters that affect the output of the target generation model, and may be, but are not limited to, used to control the diversity, accuracy, and creativity of the generated text.

[0073] Optionally, in this embodiment, the operation of adjusting the generation parameters and regenerating test cases based on the coverage parameters can be implemented, but is not limited to, in the following ways: Method 1: Policy-based adjustment. For example, when the coverage is low, reduce the model's generation parameters to make the output more focused and deterministic, reducing randomness; or adjust the prompt engineering template to more explicitly emphasize missing entities or relationships in the input. Method 2: Algorithm-based adjustment. For example, use the coverage parameters as a reward signal and employ a reinforcement learning algorithm to fine-tune the model's generation strategy to directly optimize the coverage target.

[0074] In an exemplary embodiment, detecting the coverage parameters of the initial test cases to the reference entity and the reference logical relationship includes: identifying candidate entities and candidate logical relationships between the candidate entities from the initial test cases; detecting a first coverage of the candidate entities to the reference entity, and detecting a second coverage of the candidate logical relationship to the reference logical relationship, wherein the first coverage indicates the degree of coverage of the candidate entities to the reference entity, and the second coverage indicates the degree of coverage of the candidate logical relationship to the reference logical relationship; and calculating the coverage parameters based on the first coverage and the second coverage.

[0075] Optionally, in this embodiment, candidate entities and candidate logical relationships can be, but are not limited to, key information units parsed from the initial test case text and the logical relationships between key information units. For example, from the test case "Enter the correct username and password, click the login button, and verify whether to jump to the homepage", candidate entities "username", "password", "login button", and "homepage" can be identified, as well as candidate logical relationships "enter" associated with "username" and "password", "click" associated with "login button", and "verify" associated with "jump to homepage".

[0076] Optionally, in this embodiment, the first coverage may be, but is not limited to, a metric used to quantitatively evaluate the coverage ratio of the candidate entity set to the reference entity set, reflecting whether the generated test cases cover all the key business objects required by the requirements. For example, if the reference entities include {user, order, account}, and the candidate entities are {user, order}, then the first coverage may be 2 / 3 (approximately 66.7%).

[0077] Optionally, in this embodiment, the second coverage may be, but is not limited to, an indicator used to quantitatively evaluate the coverage ratio of the candidate logical relationship set to the reference logical relationship set, reflecting whether the logical scenarios of the test cases fully reproduce the business rule interactions defined in the requirements. For example, if the reference logical relationship includes {submit order, deduct inventory} and {payment successful, update status}, while the candidate logical relationship only includes {submit order, deduct inventory}, then the second coverage can be 1 / 2 (50%).

[0078] Optionally, in this embodiment, the coverage parameters can be calculated using, but not limited to, the following steps: Weights are assigned to the first coverage (entity coverage) and the second coverage (logical relationship coverage) based on the priority of the vertical business scenario. For example, in scenarios with complex business rules (such as credit approval), logical relationships have a greater impact on the effectiveness of test cases, so the logical relationship coverage weight can be set to 0.6 and the entity coverage weight to 0.4. In scenarios with dense business objects (such as e-commerce product management), the entity coverage weight can be adjusted to 0.5 and the logical relationship coverage weight to 0.5. The final coverage parameters are calculated through weighted summation, and the weights can be dynamically adjusted according to actual business needs.

[0079] Optionally, in this embodiment, the above solution can be explained using, but is not limited to, the following scenario: In the "credit approval system," the target generation model has been trained and deployed:

[0080] In step S301, the system receives a use case generation request, which carries target requirement data, such as a requirement document named "Automatic Approval Rules for Personal Credit Loans V2.1", which describes new approval rules, such as "For applicants with an annual income of more than 300,000 yuan and a credit score of more than 700, the system should automatically approve them."

[0081] In step S302, the system responds to the request by inputting the requirements document into the deployed target generation model. The model generates an initial test case, which may include steps to verify whether users with "high income" or "high credit score" can be successfully approved, but may omit boundary scenarios implicit in the requirements, such as boundary value verification for "income exactly 300,000 yuan" or "credit score exactly 700 points".

[0082] In step S303, the system detects the coverage parameters of the initial test case for predefined reference entities (such as "applicant", "annual income", "credit score", "approval result") and reference logical relationships (such as "greater than", "equal to", and "and" relationships). Calculations determine that the test case does not adequately cover the "equal to" logical relationship and its corresponding boundary value entity; the calculated coverage parameter shows a coverage level of 0.75.

[0083] In step S304, the system determines that the coverage level (0.75) is less than the preset acceptable threshold (e.g., 0.85). Therefore, based on the analysis results of the coverage parameters (indicating missing "equal to" relationships and boundary value entities), the system adjusts the generation parameters of the target generation model or optimizes the target requirement data of the input model (e.g., prompt words), explicitly requiring that "boundary condition testing must be included." Subsequently, the system re-inputs the original target requirement data into the adjusted model.

[0084] In step S305, based on the optimized prompts, the model outputs new test cases. The system repeats the detection process of step 303, detecting new test cases that improve the coverage of boundary conditions, increasing the coverage to 0.9, which is greater than the preset threshold of 0.85;

[0085] In step S306, the system determines the test cases generated in this round that meet the coverage requirements as the final candidate test cases, which can be used directly by testers or further refined.

[0086] In an exemplary embodiment, after training the reference generation model using the second input sample to obtain the target generation model, the method further includes: receiving a test case generation request carrying target requirement data; responding to the test case generation request by inputting the target requirement data into the target generation model to obtain candidate test cases; obtaining a target test case obtained after the candidate test cases have been edited, wherein the target test case is used to execute the test task indicated by the target requirement data; obtaining an initial input template used to construct the target requirement data; adjusting the initial input template according to the candidate test cases, the target test case, and preset conditions until the initial input template meets the preset conditions to obtain a target input template, wherein the target generation model outputs the target test case when it receives the target requirement data constructed from the input template that meets the preset conditions.

[0087] Optionally, in this embodiment, the editing operation can be, but is not limited to, manual optimization and correction of candidate test cases by test engineers or domain experts. For example, correcting inaccurate test steps, supplementing missing abnormal scenarios, and adjusting the test case format to conform to company specifications, aiming to improve the accuracy and usability of test cases.

[0088] Optionally, in this embodiment, the operation of obtaining candidate test cases and then editing them to obtain target test cases can be implemented in, but is not limited to, the following ways: Method 1: The user manually modifies the candidate test cases and saves them as a new version through the editing interface provided by the integrated development environment or test management platform. Method 2: The version control system records the differences in changes to the candidate test cases and uses the final confirmed version as the target test case.

[0089] Optionally, in this embodiment, the target test case may be, but is not limited to, the final test case obtained by manually editing and optimizing the candidate test cases (such as correcting steps and adding abnormal scenarios) and can be directly used to execute the test task, and it must be ensured that it complies with business rules and test specifications.

[0090] Optionally, in this embodiment, the initial input template and the target input template can be, but are not limited to, a framework or prompt structure used to construct and format the target requirement data. The initial input template is the version before adjustment, and the target input template is the optimized version that makes the model output closer to the target test cases. For example, the template can contain instructional prompts, such as "Please generate test cases to verify [functional point], which must include the normal process and at least two abnormal scenarios."

[0091] Optionally, in this embodiment, the operation of obtaining the initial input template can be implemented in, but is not limited to, the following ways: Method 1: Call a baseline template matching the current test task type from a preset template library. Method 2: Record the actual requirement data construction method used when generating candidate test cases and abstract it into a template.

[0092] In an exemplary embodiment, adjusting the initial input template according to the candidate test cases, the target test cases, and preset conditions until the initial input template meets the preset conditions to obtain the target input template includes: calculating the semantic similarity between the candidate test cases and the target test cases; detecting the parameter relationship between the semantic similarity and a similarity threshold; if the semantic similarity is less than the similarity threshold, adjusting the prompt words in the initial input template until the semantic similarity between the test cases output by the target generation model after receiving the target requirement data constructed from the adjusted input template and the target test cases is greater than or equal to the similarity threshold, and determining the adjusted input template as the target input template; if the semantic similarity is greater than or equal to the similarity threshold, determining the initial input template as the target input template.

[0093] Optionally, in this embodiment, the preset condition is specified as a parameter relationship between semantic similarity and a similarity threshold. Semantic similarity can be, but is not limited to, a numerical indicator used to quantify the semantic similarity between the text of a candidate test case and a target test case. The similarity threshold is a pre-set minimum standard value used to determine whether the similarity is acceptable. For example, the threshold can be set to 0.8, indicating that template optimization is considered successful when the semantic similarity reaches 80%.

[0094] Optionally, in this embodiment, the prompt words may be, but are not limited to, natural language instructions or keywords embedded in the input template to guide the generation direction of the target generative model. By adjusting the prompt words, the model's generation strategy and output focus can be changed.

[0095] Optionally, in this embodiment, semantic similarity can be calculated in, but is not limited to, the following ways: Method 1: Using a sentence embedding model, the two test case texts are converted into high-dimensional vectors, and then the cosine similarity between their vectors is calculated as the semantic similarity. Method 2: Based on the scoring function of a large language model, the two texts are directly input into the model, and the similarity score output by the model is obtained through specific prompts (such as "Please judge the semantic similarity between the following two test cases and output a score between 0 and 1").

[0096] Optionally, in this embodiment, the prompt words in the initial input template can be adjusted in the following ways, but not limited to: Method 1: Based on the semantic similarity analysis results, perform targeted heuristic modifications. For example, if it is found that the generated test cases omit abnormal scenarios, explicitly add instructions such as "Please be sure to include abnormal scenario testing" or "Boundary conditions need to be considered" to the prompt words. Method 2: Employ automated prompt engineering optimization algorithms. For example, using semantic similarity as the optimization objective, fine-tune the embedding representation of the prompt words using gradient descent, reinforcement learning (such as Proximal Policy Optimization (PPO) algorithms), or genetic algorithms, or iteratively search and replace the keyword combinations of the prompt words to systematically improve similarity.

[0097] Optionally, in this embodiment, the termination condition of the semantic similarity iterative optimization process can be controlled in the following ways, but not limited to: first, setting a maximum number of iterations (e.g., 10 times) to avoid infinite loops; second, setting a minimum step size for similarity improvement (e.g., each optimization improvement is not less than 0.05), and terminating the iteration in advance when the similarity improvement of two consecutive iterations is less than the minimum step size and the optimization effect tends to stabilize.

[0098] Optionally, in this embodiment, the iterative optimization process based on the semantic similarity comparison result can be controlled, but is not limited to, by setting a loop termination condition, i.e., the loop terminates when "semantic similarity is greater than or equal to the similarity threshold", or by setting a maximum number of iterations, and terminating when the maximum number of iterations is reached.

[0099] To better understand the execution process of the above test case generation task, the flow of the execution method of the above test case generation task will be described below in conjunction with optional embodiments, but it is not intended to limit the technical solution of the embodiments of this application.

[0100] This embodiment provides a method for executing a test case generation task. Figure 3 This is a schematic diagram of a test case generation task execution flow according to an embodiment of this application, such as... Figure 3As shown, this process mainly includes five core steps: building a test domain-specific knowledge base, training a large test domain-specific model in multiple stages, generating vertical domain test cases, performance analysis, feedback and optimization, and real-time updating of model knowledge. These form a closed-loop continuous optimization system. The method by which this system executes the test case generation task mainly includes the following steps:

[0101] S401: Build a test domain-specific knowledge base, including:

[0102] Data collection: Collect the application's vertical domain business testing standards (corresponding to business constraint information), business process diagrams (corresponding to business process information), and historical defect data (corresponding to defect information).

[0103] Data structuring: The collected data is structuring, and reference entities and the reference logical relationships between them are identified and extracted from the above information.

[0104] Data format conversion: Converting structured data into a format suitable for model training.

[0105] Constructing a test knowledge graph: Based on the transformed data, establish the relationships between entities, relations, and attributes using knowledge graph tools to form a test knowledge graph.

[0106] S402: A large model specifically designed for multi-stage training and testing domains, including:

[0107] Test domain pre-training: A general large language model is used as the initial generative model. The test knowledge graph (i.e., the first input sample) constructed in step S401 is input into the model for pre-training, enabling the model to learn general test rules and business logic. After training, a reference generative model is obtained, which has the ability to identify target entities and target logical relationships from requirements.

[0108] Vertical domain fine-tuning: For a specific vertical domain, domain-specific test cases and defect cases are prepared as second input samples. The reference generative model is then fine-tuned using these second input samples to adapt it to the specific scenarios of the vertical domain. After training, the target generative model is obtained, which can generate target test cases corresponding to the required input.

[0109] S403: Generate vertical domain test cases, including:

[0110] Obtain and parse the target requirements document: Receive a use case generation request that carries the target requirements data.

[0111] Vertical domain test case generation: In response to the request, the target requirement data is input into the target generation model obtained in step S402 to obtain the initial test cases.

[0112] Test Case Validation and Optimization: The coverage parameters of the generated initial test cases are verified using the test knowledge graph constructed in step S401. If the coverage does not reach the preset threshold, the model parameters are adjusted and the test cases are regenerated until the threshold is met, thus obtaining candidate test cases.

[0113] Formatted output of test cases: Output the qualified candidate test cases in a predetermined format (such as Excel).

[0114] S404: Performance analysis, feedback, and optimization, including:

[0115] Test case validation: Testers edit the generated candidate test cases, check the format and content, and form the final target test cases.

[0116] Test case accuracy check: Calculate the semantic similarity between candidate test cases and target test cases, and quantitatively evaluate the generation effect.

[0117] Evaluation feedback: Based on the semantic similarity evaluation results, the initial input template (especially the prompt words) used to construct the requirement data is adjusted and optimized to obtain the target input template, in order to generate more accurate test cases in the future.

[0118] S405: Real-time updates of model knowledge, including:

[0119] Connect to the requirements management system of vertical business sectors: Connect to the enterprise business change system and automatically monitor business rule updates.

[0120] Generate incremental training data: When changes are detected, the changed content is automatically extracted and processed into incremental training data.

[0121] Regular incremental training: Regularly use incremental training data to incrementally train the target generation model to ensure that its knowledge is updated in sync with business rules.

[0122] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0123] Figure 4 This is a structural block diagram of an execution device for generating test cases according to an embodiment of this application; as shown below. Figure 4 As shown, it includes:

[0124] A creation module 402 is used to create a requirement input sample, wherein the requirement input sample includes a first input sample and a second input sample. The first input sample includes input data labeled with entity feature tags, and the second input sample includes the input data labeled with test case tags. The entity feature tags are used to indicate the reference entities included in the input data and the reference logical relationships between the reference entities. The test case tags are used to describe the test task indicated by the input data using the entity feature tags.

[0125] The first training module 404 is used to train the initial generation model using the first input sample to obtain a reference generation model, wherein the initial generation model is an artificial intelligence generated content model, and the reference generation model is used to identify target entities and target logical relationships between target entities from the demand input.

[0126] The second training module 406 is used to train the reference generation model using the second input sample to obtain a target generation model, wherein the target generation model is used to generate target test cases corresponding to the requirement input, and the target test cases are used to describe the test task indicated by the requirement input using the target entity and the target logical relationship.

[0127] In one exemplary embodiment, the creation module includes:

[0128] The identification unit is used to identify the entities included in the input data and the logical relationships between the entities to obtain the reference entity and the reference logical relationship;

[0129] The first annotation unit is used to annotate the reference entity and the reference logical relationship to obtain the entity feature label, and to determine the input data annotated with the entity feature label as the first input sample;

[0130] The acquisition unit is used to acquire test cases corresponding to the test task indicated by the input data;

[0131] The second annotation unit is used to annotate the test cases to form test case labels, and to use the input data annotated with the test case labels as the second input sample.

[0132] In one exemplary embodiment, the identification unit is further configured to:

[0133] Obtain business constraint information, business process information, and defect information. The business constraint information records business nodes, constraint conditions, business scenarios, and abnormal results that have a constraint relationship. The business process information records multiple business nodes that have a sequential relationship. The defect information records business nodes, defect events, and business scenarios that have a causal relationship.

[0134] Extract initial entities from the input data, wherein the initial entities are the entities included in the input data;

[0135] Extract constraint-related entities that have a constraint relationship with the initial entity from the business constraint information; extract process-related entities that have a sequential relationship with the initial entity from the business process information; extract defect-related entities that have a causal relationship with the initial entity from the defect information;

[0136] The initial entity, the constraint-related entity, the process-related entity, and the defect-related entity are merged into the reference entity.

[0137] Based on the constraint relationships, sequence relationships, and causal relationships corresponding to the reference entities in the business constraint information, the business process information, and the defect information, the reference logical relationships between the reference entities are determined.

[0138] In one exemplary embodiment, the apparatus further includes:

[0139] The first receiving module is configured to receive a use case generation request carrying target requirement data after the target generation model is obtained by training the reference generation model using the second input sample.

[0140] The first response module is used to respond to the test case generation request, input the target requirement data into the target generation model, and obtain the initial test cases;

[0141] A detection module is used to detect the coverage parameters of the initial test cases on the reference entity and the reference logical relationship, wherein the coverage parameters are used to indicate the degree of coverage of the initial test cases on the reference entity and the reference logical relationship;

[0142] The determination module is configured to determine the initial test case as a candidate test case when the coverage parameter indicates that the coverage of the initial test case to the reference entity and the reference logical relationship is greater than or equal to a preset threshold.

[0143] The first adjustment module is used to adjust the generation parameters of the target generation model according to the coverage parameter when the coverage parameter indicates that the coverage of the initial test cases to the reference entity and the reference logical relationship is less than the preset threshold, and input the target requirement data into the target generation model until the coverage of the test cases output by the target generation model to the reference entity and the reference logical relationship is greater than or equal to the preset threshold; and determine the test cases output by the target generation model as the candidate test cases.

[0144] In one exemplary embodiment, the detection module includes:

[0145] The third identification unit is used to identify candidate entities and candidate logical relationships between the candidate entities from the initial test cases;

[0146] A first detection unit is configured to detect a first coverage of the candidate entity to the reference entity and a second coverage of the candidate logical relation to the reference logical relation, wherein the first coverage is used to indicate the degree of coverage of the candidate entity to the reference entity and the second coverage is used to indicate the degree of coverage of the candidate logical relation to the reference logical relation.

[0147] The first calculation unit is used to calculate the coverage parameters based on the first coverage and the second coverage.

[0148] In one exemplary embodiment, the apparatus further includes:

[0149] The second receiving module is used to receive a use case generation request carrying target requirement data after the target generation model is obtained by training the reference generation model using the second input sample.

[0150] The second response module is used to respond to the test case generation request, input the target requirement data into the target generation model, and obtain candidate test cases;

[0151] The first acquisition module is used to acquire the target test case obtained after the candidate test case has been edited, wherein the target test case is used to execute the test task indicated by the target requirement data;

[0152] The second acquisition module is used to acquire the initial input template used to construct the target requirement data;

[0153] The second adjustment module is used to adjust the initial input template according to the candidate test cases, the target test cases, and preset conditions until the initial input template meets the preset conditions to obtain the target input template. The target generation model outputs the target test cases when it receives the target requirement data constructed from the input template that meets the preset conditions.

[0154] In one exemplary embodiment, the second adjustment module includes:

[0155] The second calculation unit is used to calculate the semantic similarity between the candidate test cases and the target test cases;

[0156] The second detection unit is used to detect the parameter relationship between the semantic similarity and the similarity threshold;

[0157] An adjustment unit is configured to adjust the prompt words in the initial input template when the semantic similarity is less than the similarity threshold, until the semantic similarity between the test case output by the target generation model after receiving the target requirement data constructed from the adjusted input template and the target test case is greater than or equal to the similarity threshold, and then determine the adjusted input template as the target input template.

[0158] The determining unit is configured to determine the initial input template as the target input template when the semantic similarity is greater than or equal to the similarity threshold.

[0159] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in the execution method embodiment of any of the above-described test case generation tasks at runtime.

[0160] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0161] Embodiments of this application also provide an electronic device. Figure 5 This is a schematic diagram of an electronic device according to an embodiment of this application, such as... Figure 5 As shown, it includes a memory and a processor, the memory storing a computer program, and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0162] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0163] Embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the methods described in various embodiments of this application; the computer program product further includes a non-volatile computer-readable storage medium storing the computer program, which, when executed by a processor, implements the steps of the test case generation task execution method described in various embodiments of this application.

[0164] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0165] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0166] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for executing a test case generation task, characterized in that, include: Create a requirement input sample, wherein the requirement input sample includes a first input sample and a second input sample, the first input sample includes input data labeled with entity feature tags, the second input sample includes the input data labeled with test case tags, the entity feature tags are used to indicate the reference entities included in the input data and the reference logical relationships between the reference entities, and the test case tags are used to describe the test task indicated by the input data using the entity feature tags; The initial generation model is trained using the first input sample to obtain a reference generation model, wherein the initial generation model is an artificial intelligence-generated content model, and the reference generation model is used to identify target entities and target logical relationships between target entities from the demand input. The reference generation model is trained using the second input sample to obtain a target generation model, wherein the target generation model is used to generate target test cases corresponding to the requirement input, and the target test cases are used to describe the test task indicated by the requirement input using the target entity and the target logical relationship.

2. The method according to claim 1, characterized in that, The creation requirement input sample includes: The entities included in the input data and the logical relationships between the entities are identified to obtain the reference entity and the reference logical relationship; The reference entity and the reference logical relationship are labeled to obtain the entity feature label, and the input data labeled with the entity feature label is determined as the first input sample; Obtain the test cases corresponding to the test task indicated by the input data; The test cases are labeled to form test case tags, and the input data labeled with the test case tags is used as the second input sample.

3. The method according to claim 2, characterized in that, The step of identifying the entities included in the input data and the logical relationships between them to obtain the reference entity and the reference logical relationship includes: Obtain business constraint information, business process information, and defect information. The business constraint information records business nodes, constraint conditions, business scenarios, and abnormal results that have a constraint relationship. The business process information records multiple business nodes that have a sequential relationship. The defect information records business nodes, defect events, and business scenarios that have a causal relationship. Extract initial entities from the input data, wherein the initial entities are the entities included in the input data; Extract constraint-related entities that have a constraint relationship with the initial entity from the business constraint information; extract process-related entities that have a sequential relationship with the initial entity from the business process information; extract defect-related entities that have a causal relationship with the initial entity from the defect information; The initial entity, the constraint-related entity, the process-related entity, and the defect-related entity are merged into the reference entity. Based on the constraint relationships, sequence relationships, and causal relationships corresponding to the reference entities in the business constraint information, the business process information, and the defect information, the reference logical relationships between the reference entities are determined.

4. The method according to claim 1, characterized in that, After training the reference generative model using the second input sample to obtain the target generative model, the method further includes: Receive a use case generation request carrying target requirement data; In response to the test case generation request, the target requirement data is input into the target generation model to obtain initial test cases; The coverage parameter of the initial test case to the reference entity and the reference logical relationship is detected, wherein the coverage parameter is used to indicate the degree of coverage of the initial test case to the reference entity and the reference logical relationship; If the coverage parameter indicates that the coverage of the initial test case to the reference entity and the reference logical relationship is greater than or equal to a preset threshold, the initial test case is determined as a candidate test case. If the coverage parameter, which indicates that the initial test case covers the reference entity and the reference logical relationship to a degree less than the preset threshold, is used to adjust the generation parameters of the target generation model according to the coverage parameter, and input the target requirement data into the target generation model until the test case output by the target generation model covers the reference entity and the reference logical relationship to a degree greater than or equal to the preset threshold; the test case output by the target generation model is then determined as the candidate test case.

5. The method according to claim 4, characterized in that, The detection of the coverage parameters of the initial test case for the reference entity and the reference logical relationship includes: Identify candidate entities and candidate logical relationships between them from the initial test cases; The first coverage of the candidate entity to the reference entity is detected, and the second coverage of the candidate logical relation to the reference logical relation is detected, wherein the first coverage is used to indicate the degree of coverage of the candidate entity to the reference entity, and the second coverage is used to indicate the degree of coverage of the candidate logical relation to the reference logical relation; The coverage parameters are calculated based on the first coverage and the second coverage.

6. The method according to claim 1, characterized in that, After training the reference generative model using the second input sample to obtain the target generative model, the method further includes: Receive a use case generation request carrying target requirement data; In response to the test case generation request, the target requirement data is input into the target generation model to obtain candidate test cases; Obtain the target test case after the candidate test case has been edited, wherein the target test case is used to execute the test task indicated by the target requirement data; Obtain the initial input template used to construct the target requirement data; The initial input template is adjusted according to the candidate test cases, the target test cases, and the preset conditions until the initial input template meets the preset conditions to obtain the target input template. The target generation model outputs the target test cases when it receives the target requirement data constructed from the input template that meets the preset conditions.

7. The method according to claim 6, characterized in that, The step of adjusting the initial input template according to the candidate test cases, the target test cases, and preset conditions until the initial input template meets the preset conditions to obtain the target input template includes: Calculate the semantic similarity between the candidate test cases and the target test cases; Detect the parameter relationship between the semantic similarity and the similarity threshold; If the semantic similarity is less than the similarity threshold, the prompt words in the initial input template are adjusted until the semantic similarity between the test case output by the target generation model and the target test case is greater than or equal to the similarity threshold when the target requirement data constructed by the adjusted input template is received is received. The adjusted input template is then determined as the target input template. If the semantic similarity is greater than or equal to the similarity threshold, the initial input template is determined as the target input template.

8. An execution device for a test case generation task, characterized in that, include: A creation module is used to create requirement input samples, wherein the requirement input samples include a first input sample and a second input sample. The first input sample includes input data labeled with entity feature tags, and the second input sample includes the input data labeled with test case tags. The entity feature tags are used to indicate the reference entities included in the input data and the reference logical relationships between the reference entities. The test case tags are used to describe the test tasks indicated by the input data using the entity feature tags. The first training module is used to train the initial generation model using the first input sample to obtain a reference generation model, wherein the initial generation model is an artificial intelligence-generated content model, and the reference generation model is used to identify target entities and target logical relationships between target entities from the demand input. The second training module is used to train the reference generation model using the second input sample to obtain a target generation model, wherein the target generation model is used to generate target test cases corresponding to the requirement input, and the target test cases are used to describe the test task indicated by the requirement input using the target entity and the target logical relationship.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 through the computer program.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.