Intelligent test case generation method and device, terminal and storage medium
By constructing a domain knowledge graph and dynamically selecting test design methods, the problem of insufficient alignment between test case generation and requirements in existing technologies is solved, achieving efficient and automated test case generation, and improving coverage and domain adaptability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-03-27
AI Technical Summary
Existing technologies cannot effectively uncover the implicit logic in requirements documents when generating test cases, resulting in insufficient alignment between test cases and actual requirements, inadequate test coverage, lack of domain specificity, and lack of end-to-end automation. This makes them prone to test omissions and errors introduced by manual intervention.
By extracting entities and relationships from requirements documents using natural language processing technology, a domain knowledge graph is constructed. Combined with industry knowledge bases and historical test case data, test design methods are dynamically selected, test strategies are generated and optimized, and the entire process is automated.
It improves the alignment between test cases and actual needs, increases test coverage, has stronger domain relevance, and achieves end-to-end automation of test case generation, reducing manual intervention.
Smart Images

Figure CN121743201A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software test automation, and in particular to an intelligent test case generation method and device, a terminal and a storage medium. BACKGROUND
[0002] In the field of software development and testing, test cases are the key to verifying the completeness, stability and reliability of software functions, and the quality and efficiency of their generation directly determine the effectiveness of software testing, and thus affect the online period and market competitiveness of software products.
[0003] Currently, the existing intelligent test case generation technologies in the industry mainly include the following: first, rule or template-based automated tools, which automatically generate test cases by predefining static rules or fixed templates, such as the keyword matching-based requirement analysis tool Qucatext. Second, model-based test generation (MBT) technology, which requires testers to manually construct state machines or flowchart models, and then generates test paths based on the models, such as the IBMRationalRhapsody tool. Third, natural language processing (NLP) driven requirement analysis technology, which uses NLP technology to analyze requirement documents to assist test case generation, such as the requirement management system ReqView.
[0004] However, existing technologies usually only perform surface-level processing on requirement documents, and cannot effectively mine the implicit logic therein, such as the association between business processes and the dependency between entities, and thus cannot convert these key information into effective test scenarios, resulting in insufficient fit between test cases and actual requirements. Second, the problem of insufficient test coverage, rule or template-based automated tools are limited by static design ideas and cannot flexibly adapt to various test design methods such as equivalence class partitioning and boundary value analysis, and thus cannot fully cover all types of scenarios required for software testing, leading to test omissions. Third, the problem of missing domain knowledge, existing technologies do not fully combine industry-specific knowledge such as compliance requirements and typical defect patterns in different fields when generating test cases, resulting in a lack of domain-specificity in the generated test cases and difficulty in meeting industry-specific testing requirements. Finally, the problem of missing end-to-end automation, existing solutions require switching between different tools at multiple stages such as requirement analysis, test design and case output, and involve more manual intervention, which not only reduces the efficiency of test case generation, but also introduces errors due to manual operation, and cannot achieve automatic closed-loop of the entire test case generation process.
[0005] Therefore, the existing technologies need to be improved and developed. SUMMARY
[0006] The technical problem solved by the present application is to provide an intelligent test case generation method, device, terminal and storage medium aiming at the above-mentioned defects of the prior art, so as to solve the problem that the prior art usually only performs surface treatment on the requirement document, cannot effectively mine the implicit logic therein, and leads to insufficient matching degree of the test case and the actual requirement.
[0007] The technical solution adopted by the present application to solve the problem is as follows: In a first aspect, the present application provides an intelligent test case generation method, which comprises: Obtaining a requirement document, extracting entities in the requirement document through natural language processing technology, mining the association relationship between the entities, and combing the complete business process link to obtain standardized structured requirement data; Constructing nodes and edges through an industry knowledge base and historical test case data, and generating a domain knowledge graph according to the nodes and edges; the node types include: function module nodes, input parameter nodes, expected result nodes, defect mode nodes and business process nodes; the edge types include: dependency relationship, equivalence class association and boundary condition; Selecting a test design method based on the structured requirement data and the domain knowledge graph, and generating a test strategy according to the selected test design method; Generating an initial test case according to the test strategy and performing verification and optimization to obtain an optimized test case.
[0008] In an embodiment, the entity types include: function points, input parameters and other key elements; the types of the association relationship include: the dependency relationship between the function points, and the constraint relationship of the input parameters.
[0009] In an embodiment, the historical test case data includes: function modules tested in the past, the value range of various types of input parameters, the corresponding expected results, the defect modes historically occurred and the corresponding test points.
[0010] In an embodiment, the node types further include: industry-specific nodes.
[0011] In an embodiment, the step of selecting a test design method based on the structured requirement data and the domain knowledge graph comprises: Determining a target node corresponding to the requirement based on the structured requirement data and the domain knowledge graph; Dynamically selecting a test design method based on the target node through an inference engine of the domain knowledge graph.
[0012] In an embodiment, the step of dynamically selecting a test design method based on the target node comprises: When the target node is an input parameter node with a value range, a boundary value analysis method and an equivalence class division method are automatically matched through boundary conditions and / or equivalence class associations in the domain knowledge graph; When the target node is a business process node involving multi-step connection, a scenario method is automatically matched through dependency relationships in the domain knowledge graph to sort out normal scenarios and abnormal scenarios. When the target node is a functional module node with high-frequency defects, a special test method is automatically supplemented through dependency relationships and / or equivalence class associations in the domain knowledge graph.
[0013] In an embodiment, the step of generating initial test cases and performing verification and optimization according to the test strategy to obtain optimized test cases includes: According to the test strategy, key elements of the test cases are automatically filled in to obtain initial test cases; the key elements include: case number, test steps, and expected results. According to the domain knowledge graph, the initial test cases are verified and optimized, corresponding test cases are automatically supplemented according to the verification and optimization results, and repeated or redundant test cases are removed to obtain the optimized test cases.
[0014] In a second aspect, the embodiments of the present application also provide an intelligent test case generation device, which includes: A requirement processing module is configured to obtain a requirement document, extract entities in the requirement document through natural language processing technology, mine association relationships between the entities, and sort out complete business process links to obtain standardized structured requirement data. A graph construction module is configured to construct nodes and edges through an industry knowledge base and historical test case data, and generate a domain knowledge graph according to the nodes and edges; the node types include: functional module nodes, input parameter nodes, expected result nodes, defect mode nodes, and business process nodes; the edge types include: dependency relationships, equivalence class associations, and boundary conditions. A strategy generation module is configured to select a test design method based on the structured requirement data and the domain knowledge graph, and generate a test strategy according to the selected test design method. A case generation module is configured to generate initial test cases according to the test strategy and perform verification and optimization to obtain optimized test cases.
[0015] In a third aspect, the embodiments of the present application also provide a terminal including a memory and one or more processors; the memory stores one or more programs; the programs contain instructions for executing the intelligent test case generation method described above; and the processor is configured to execute the programs.
[0016] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium having stored thereon a plurality of instructions adapted to be loaded and executed by a processor to implement the steps of the intelligent test case generation method according to any one of the above.
[0017] The present application has the following beneficial effects: the embodiments of the present application convert the requirement document into standardized structured requirement data by extracting the entities of the requirement document, mining the correlation between the entities, and sorting out the complete business process link; the embodiments of the present application construct the nodes and edges by the industry knowledge base and the historical test case data, and generate the domain knowledge graph according to the nodes and edges; the embodiments of the present application select the test design method based on the structured requirement data and the domain knowledge graph, and generate the test strategy according to the selected test design method; the embodiments of the present application generate the initial test case according to the test strategy, and verify and optimize the initial test case to obtain the optimized test case. The embodiments of the present application construct the full-process automation link of requirement analysis, test design, test case generation, verification and optimization, and do not need to switch between multiple tools from the requirement document processing to the final output of the optimized test case, greatly reducing the manual intervention link, and realizing the end-to-end automation closed loop of the test case generation. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0019] Figure 1 is a flowchart of the intelligent test case generation method provided by the embodiments of the present application.
[0020] Figure 2 is a module schematic diagram of the intelligent test case generation device provided by the embodiments of the present application.
[0021] Figure 3 is a principle block diagram of the terminal provided by the embodiments of the present application. DETAILED DESCRIPTION
[0022] The present application discloses an intelligent test case generation method, device, terminal and storage medium. In order to make the purpose, technical scheme and effect of the present application more clear and definite, the following will further describe the present application in detail with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0023] It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. As used herein, "connected," "coupled," and / or "coupling," can include both direct connections and / or indirect connections (i.e., via one or more other elements). As used herein, "connection" or "coupling" can include a wireless connection or a wireless coupling. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0024] Those skilled in the art will appreciate that unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the specification and relevant art and will not be interpreted in an overly legal sense unless expressly so defined herein.
[0025] In view of the above defects of the prior art, the present application provides an intelligent test case generation method, which obtains a requirement document, extracts entities in the requirement document through natural language processing technology, mines the correlation between the entities and combs out complete business process links to obtain standardized structured requirement data; constructs nodes and edges through an industry knowledge base and historical test case data, and generates a domain knowledge graph according to the nodes and edges; the node types include functional module nodes, input parameter nodes, expected result nodes, defect mode nodes and business process nodes; the edge types include dependency relationships, equivalence class associations and boundary conditions; a test design method is selected based on the structured requirement data and the domain knowledge graph, a test strategy is generated according to the selected test design method, initial test cases are generated according to the test strategy and are verified and optimized to obtain optimized test cases. The present application deeply analyzes the requirement document through natural language processing technology, not only extracts entities therein, but also mines the correlation between the entities and combs out complete business process links, converts unstructured requirements into standardized structured data, effectively captures the implied logic in the requirements, and improves the fit of the subsequently generated test cases and the actual requirements. Secondly, the present application dynamically selects a suitable test design method by combining the structured requirement data and the domain knowledge graph and generates a test strategy, which can flexibly cover diversified test scenarios and greatly improve the test coverage. In addition, the present application constructs a domain knowledge graph through an industry knowledge base and historical test case data, covers nodes such as functional modules, input parameters and defect modes and edges such as dependency relationships and equivalence class associations, deeply integrates industry-specific knowledge into the test case generation process, and makes the test cases have stronger domain specificity. Finally, the present application constructs a full-process automation link of requirement analysis, test design, test case generation, verification and optimization, and does not need to switch between multiple tools from requirement document processing to final optimized test case output, greatly reduces the manual intervention link, and realizes end-to-end automation of the test case generation closed loop.
[0026] As shown in Figure 1 the method specifically comprises the following steps: Step S100, a requirement document is obtained, entities in the requirement document are extracted through natural language processing technology, the correlation between the entities is mined, and complete business process links are combed to obtain standardized structured requirement data.
[0027] The processing of the requirement document in this embodiment can be performed by a requirement semantic analysis module. The requirement semantic analysis module first performs entity extraction on the requirement document based on NLP technology, accurately identifies key entities related to testing in the requirement document, such as function points, input parameters, and other basic elements of software, and avoids extracting only shallow entities. Secondly, relationship mining is performed, and the internal relationships between these entities are further analyzed, including dependency relationships, constraint relationships, and other implicit logic of requirements, so as to fully understand the logical association of the requirements. Finally, the business process is combed, and the scattered entities and associated relationships are linked according to the actual business operation logic to form a complete business process link. After the above extraction, mining, and combing, the requirement semantic analysis module converts these unstructured requirement information into standardized structured requirement data, providing usable basic data for subsequent steps such as combining with the domain knowledge graph and selecting a test design method.
[0028] In an implementation manner, the entity types include function points, input parameters, and other key elements; and the types of the associated relationships include dependency relationships between function points and constraint relationships of input parameters.
[0029] Specifically, a function point refers to a specific business capability that a software needs to implement, such as user registration, order query, payment refund, and the like, and is a key object for test case design. Input parameters are various data information required to support the implementation of function points, such as username, mobile phone number, and verification code for the input parameters of the registration function, and order number and user ID for the input parameters of the order query function. These entities are basic units for constructing test scenarios. The dependency relationship between function points reflects the internal logic of the business process, such as the order payment function must be completed in dependence on the user login function, and the refund application function needs to depend on the pre-function of successful order payment. This dependency relationship directly determines the sequence and link integrity of the test scenario. The constraint relationship of the input parameter explicitly defines the valid range or format requirement of the parameter, such as the username input parameter may have a constraint of a length of 6-20 characters and contain only letters and numbers, and the payment amount parameter may have a constraint of greater than 0 and not exceeding the account balance. Such a relationship is an important basis for subsequent test design methods such as equivalence class partitioning and boundary value analysis.
[0030] In step S200, nodes and edges are constructed through an industry knowledge base and historical test case data, and a domain knowledge graph is generated according to the nodes and edges; the node types include function module nodes, input parameter nodes, expected result nodes, defect mode nodes, and business process nodes; and the edge types include dependency relationships, equivalence class associations, and boundary conditions.
[0031] The construction process of the domain knowledge graph in this embodiment is mainly performed by a domain knowledge graph construction module. The module builds a multi-dimensional graph by systematically integrating key data resources, and provides key knowledge support for subsequent test case generation. Specifically, the domain knowledge graph construction module is based on industry knowledge base and historical test case data to construct the graph. The industry knowledge base contains exclusive business rules and processes in different domains, such as payment processes in the e-commerce domain, claim settlement rules in the insurance domain, and other domain-specific knowledge. The historical test case data contains the testing experience of past projects. On this basis, the domain knowledge graph construction module constructs a domain knowledge graph containing specific nodes and edges. The graph contains various nodes such as function module nodes, input parameter nodes, expected result nodes, defect mode nodes, and business process nodes, achieving comprehensive coverage of test-related elements. The graph also contains various edges including dependency relationships, equivalence class associations, and boundary conditions, clearly sorting out the internal logic between nodes. The domain knowledge graph can dynamically associate requirements, domain knowledge, and historical data, improve the semantic accuracy of test cases, enrich the dimensions of test design, effectively cover equivalence class division, boundary value analysis, and other diversified test scenarios, greatly improve the coverage rate of test cases, and also provide knowledge support for the selection of subsequent test design methods and the generation of test strategies.
[0032] In an implementation manner, the historical test case data includes: function modules that have been tested in the past, value ranges of various input parameters, corresponding expected results, defect modes that have occurred in the past, and corresponding test points.
[0033] Specifically, the function modules that have been tested in the past record the business units that have been covered in historical projects, and can provide a reference for the correlation analysis of function modules in new requirements, avoiding repeated design or missing key modules. The value ranges of various input parameters include valid values, invalid values, and boundary values of parameters in different scenarios, and are the basis for the construction of equivalence class associations and boundary conditions in subsequent graphs, which can help new test cases to more comprehensively cover parameter test scenarios. The corresponding expected results clearly define the normal state that the function should achieve under different input conditions, and can provide a reference for the design of expected results in test cases, ensuring the rationality and accuracy of the expected results of new test cases. The defect modes that have occurred in the past and the corresponding test points contain common problem types in past testing and key test directions for these defects. These information will be converted into defect mode nodes and association relationships in the graph, which can guide new test cases to focus on covering high-risk scenarios and avoid the repeated occurrence of similar defects. These multi-dimensional historical test case data, together with the industry knowledge base, provide practical experience and domain rules for the construction of the domain knowledge graph, and further help to dynamically associate requirements and test strategies, improve the semantic accuracy and scenario coverage rate of test cases.
[0034] In an implementation manner, the node type further comprises an industry-specific node.
[0035] Specifically, in order to enable the domain knowledge graph to accurately adapt to different domain test requirements, to strengthen the domain pertinence of the knowledge graph, and to avoid insufficient coverage of general nodes in industry specificity, the embodiment can also introduce an industry-specific node when constructing the domain knowledge graph. The industry-specific node can be generated based on an industry knowledge base, and is a transformation of business elements, compliance requirements, core links and the like specific to each industry into industry-specific nodes corresponding to each industry. For example, in the e-commerce field, the industry-specific nodes can include order fulfillment nodes, after-sales refund nodes, inventory warning nodes, etc.; in the insurance field, they can be underwriting nodes, claim material review nodes, premium accounting nodes. These nodes and the original functional modules, input parameters, and other general nodes are linked through edge types such as dependency relationships and constraint relationships. For example, the after-sales refund node in the e-commerce field can form a dependent association with the order information input parameter node and the refund amount expected result node in the general node.
[0036] Step S300, selecting a test design method based on the structured requirement data and the domain knowledge graph, and generating a test strategy according to the selected test design method.
[0037] The generation process of the test strategy in the embodiment can be performed by a test strategy dynamic generation module. Specifically, the function implementation of the test strategy dynamic generation module needs to utilize two kinds of data: one kind of data is the structured requirement data output by the requirement semantic analysis module, which contains semantic information such as entities, association relationships, and business processes in the requirement; the other kind of data is the multi-dimensional knowledge graph built by the domain knowledge graph construction module, which covers elements such as functional modules, defect modes, industry-specific nodes, and various association relationships. The test strategy dynamic generation module is based on these two kinds of data, and automatically matches and selects the appropriate test design method through requirement semantic reasoning and knowledge graph linkage analysis. After automatically selecting the test design method, the test strategy dynamic generation module further generates a test strategy containing test scope, use case priority, execution order, and the like. Therefore, this model can realize an end-to-end fully automated process: seamless conversion from requirement documents to Excel use cases, reducing manual intervention links (such as requirement marking and strategy configuration).
[0038] In an implementation manner, the step of selecting a test design method based on the structured requirement data and the domain knowledge graph comprises: determining a target node corresponding to the requirement based on the structured requirement data and the domain knowledge graph; dynamically selecting a test design method based on the target node through a reasoning engine of the domain knowledge graph.
[0039] Specifically, the structured requirement data has contained entities (such as function points, input parameters) extracted from the requirement document, association relationships and business processes, while the domain knowledge graph covers multiple types of nodes such as function modules, input parameters, defect patterns and industry-specific nodes. First, the core elements in the structured requirements are accurately positioned to the corresponding mapping nodes, i.e. target nodes, in the domain knowledge graph, ensuring that the selection of subsequent test design methods can be closely related to the requirements. Then, the inference engine deeply mines the association information of the target node in the graph. For example, if the target node is a payment function module node containing an amount input, the inference engine will identify the boundary conditions, equivalence class associations and historical defect patterns associated with the node, and then dynamically determine to select boundary value analysis and / or equivalence class partitioning method. If the target node is an industry-specific node of insurance claim settlement, the inference engine will select scenario method and / or process analysis method in combination with its associated business process dependencies and industry compliance rules. This process is completely automated by the system, without the need for manual intervention in the selection of test design methods, ensuring that the selected test design methods are highly adapted to the requirements scenarios and domain characteristics.
[0040] In an implementation manner, the step of dynamically selecting a test design method based on the target node comprises: When the target node is an input parameter node with a value range, the boundary value analysis method and the equivalence class partitioning method are automatically matched through the boundary conditions and / or equivalence class associations in the domain knowledge graph; When the target node is a business process node involving multi-step connection, the scenario method is automatically matched through the dependency relationship in the domain knowledge graph to sort out normal scenarios and abnormal scenarios; When the target node is a function module node with high-frequency defects, the special test method is automatically supplemented through the dependency relationship and / or equivalence class association in the domain knowledge graph.
[0041] Specifically, the present embodiment can dynamically adapt the most suitable test design method for different types of target nodes in combination with the corresponding association relationships in the domain knowledge graph: When the target node is an input parameter node with a value range, the boundary conditions (such as critical values and limit values of the parameter) and equivalence class associations (such as valid value set and invalid value set of the parameter) in the domain knowledge graph will become the matching basis. The system will automatically select the boundary value analysis method and the equivalence class division method, and the fusion application of the two methods can be realized. For example, for the input parameter node of “amount input box”, the domain knowledge graph records its boundary conditions (such as maximum value of 9999.99 yuan and minimum value of 0.01 yuan) and equivalence class associations (valid amount of 0.01-9999.99 yuan, invalid amount of negative number, 0 yuan, and more than 9999.99 yuan), the system will automatically generate boundary value test cases (such as 0.00 yuan, 0.01 yuan, 9999.99 yuan, and 10000.00 yuan) and equivalence class test cases (such as valid amount of 100 yuan and invalid amount of -50 yuan), which comprehensively cover the parameter test scenarios.
[0042] When the target node is a business process node involving multi-step connection, the dependency relationships (such as pre-post association and execution order constraint between steps) combed in the domain knowledge graph will become the matching basis. The system will automatically match the scenario method, comb out normal scenarios and abnormal scenarios through traversing the dependency links between process nodes, and ensure the full-link coverage of the business process. For example, the normal scenario is that the user login, product selection, and order-payment full process are executed smoothly, and the abnormal scenario is that the user tries to place an order after login failure or re-pays after payment timeout.
[0043] When the target node is a functional module node with high-frequency defects, the dependency relationships between the module and other nodes and the equivalence class associations stored in the domain knowledge graph will provide support. The system will automatically supplement special test methods in addition to basic test methods to strengthen the test intensity of high-risk scenarios. For example, for the parameter verification missing defect that occurs frequently, abnormal value injection test is supplemented; for the process connection breakage defect, cross-module linkage test is supplemented.
[0044] The whole process does not need human intervention in the selection and combination of test design methods, and can flexibly realize the fusion of multiple test design methods, greatly improving the coverage and accuracy of test cases.
[0045] Step S400, generating initial test cases according to the test strategy and performing verification and optimization to obtain optimized test cases.
[0046] Specifically, the verification and optimization of test cases can be performed by a case generation and optimization module. Through this module, the test strategy is converted into specific test cases to obtain initial test cases, which are verified and optimized to obtain optimized test cases.
[0047] In an implementation manner, the step of generating initial test cases and performing verification and optimization according to the test strategy comprises: According to the test strategy, the key elements of the test case are automatically filled in to obtain the initial test case; wherein the key elements include: case number, test step, expected result; According to the domain knowledge graph, the initial test case is verified and optimized, the corresponding test case is automatically supplemented according to the verification and optimization result, and the repeated or redundant test case is removed to obtain the optimized test case.
[0048] Specifically, the test strategy has clear test range, adaptation method and coverage focus, the system will automatically extract key information to fill in the core elements of the test case: the case number is automatically arranged according to the preset rule to ensure uniqueness, the test step is generated according to the business process dependency relationship in the knowledge graph and the test design method, and the expected result is accurately matched by combining the expected result node in the domain knowledge graph, historical test case data and requirement constraint relationship, so as to convert the abstract test strategy into specific executable initial test case. After generating the initial test case, the coverage of the initial test case is comprehensively verified through the business process node, dependency relationship, equivalence class association and other information in the domain knowledge graph, such as checking whether the key business process, boundary condition or high-frequency defect corresponding test scene is missed by comparing the domain knowledge graph; at the same time, based on the historical defect mode, equivalence class division strategy and other information in the domain knowledge graph, the repeated or redundant test case is identified and removed, and the special test case is automatically supplemented for the coverage gap, and finally the optimized test case with better quality is formed. After the whole process is completed, the system will output the optimized test case as a structured Excel file, which not only contains the automatically filled case number, test step and expected result, but also supplements the priority field by combining the defect risk level and function module importance in the knowledge domain knowledge graph, realizes the full automation of the test strategy to the available test case, and effectively solves the problems of incomplete test case coverage, high redundancy and the need for manual correction in the prior art.
[0049] The advantages of the present application are: 1. Efficiency improvement: the test case generation time can be shortened from 2 days to 10 minutes.
[0050] 2. Coverage optimization: through domain knowledge graph reasoning, the coverage rate of boundary conditions can be improved from 70% to 95%.
[0051] 3. Field adaptability: support quick adaptation to financial, medical and other industry needs by expanding the knowledge graph.
[0052] Based on the above embodiment, the present application further provides an intelligent test case generation device, as shown in Figure 2 the device comprises: The requirement processing module 01 is configured to acquire a requirement document, extract entities in the requirement document through a natural language processing technology, mine correlation between the entities, and sort out a complete business process link to obtain standardized structured requirement data. The graph construction module 02 is configured to construct nodes and edges through an industry knowledge base and historical test case data, and generate a domain knowledge graph according to the nodes and edges. The node types include a function module node, an input parameter node, an expected result node, a defect mode node, and a business process node. The edge types include a dependency relationship, an equivalence class association, and a boundary condition. The strategy generation module 03 is configured to select a test design method based on the structured requirement data and the domain knowledge graph, and generate a test strategy according to the selected test design method. The use case generation module 04 is configured to generate an initial test case according to the test strategy, and verify and optimize the initial test case to obtain an optimized test case.
[0053] Based on the above embodiment, the application further provides a terminal, and a principle block diagram of the terminal can be as shown in the figure. Figure 3 The terminal includes a processor, a memory, a network interface, and a display screen connected through a system bus. The processor of the terminal is configured to provide computing and control capabilities. The memory of the terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The network interface of the terminal is configured to communicate with external terminals through network connection. The computer program is executed by the processor to implement the intelligent test case generation method. The display screen of the terminal can be a liquid crystal display screen or an electronic ink display screen.
[0054] Those skilled in the art can understand that, Figure 3 The principle block diagram shown in the figure is only a block diagram of part of the structure related to the application scheme, and does not constitute a limitation on the terminal to which the application scheme is applied. The specific terminal can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0055] In an implementation manner, the memory of the terminal stores more than one program, and is configured to execute the more than one program by more than one processor to include instructions for performing the intelligent test case generation method.
[0056] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the computer program can include the processes of the above-mentioned embodiments of the methods. Any reference to memory, storage, databases, or other media in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in many forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0057] To sum up, the application discloses a kind of intelligent test case generation method, device, terminal and storage medium.The method is obtained by acquiring requirement document, the entity in the requirement document is extracted by natural language processing technology, the association between entities is mined and the complete business process link is combed, and the standardized structured requirement data is obtained;The node and edge are constructed by industry knowledge base and historical test case data, and the domain knowledge graph is generated according to the node and edge;Node type includes: function module node, input parameter node, expected result node, defect mode node and business process node;Edge type includes: dependency relationship, equivalence class association and boundary condition;The structured requirement data and the domain knowledge graph are selected based on the test design method, and the test strategy is generated according to the selected test design method;Initial test case is generated according to the test strategy and verified and optimized, and the optimized test case is obtained.The application deeply analyzes requirement document by natural language processing technology, not only extracts entity, but also mines the association between entities and combs complete business process link, converts unstructured requirement into standardized structured data, effectively captures the implicit logic in requirement, and improves the fit of subsequent generated test case and actual requirement.Secondly, the application dynamically selects the test design method suitable for the structured requirement data and the domain knowledge graph and generates the test strategy, can flexibly cover diversified test scenarios, and greatly improves test coverage.In addition, the application constructs the domain knowledge graph by industry knowledge base and historical test case data, covers function module, input parameter, defect mode and other nodes and dependency relationship, equivalence class association and edge, deeply integrates industry-specific knowledge into case generation process, so that test case has stronger domain specificity.Finally, the application constructs the whole process automation link of requirement analysis, test design, case generation, verification and optimization, from requirement document processing to final optimized test case output without multiple tool switching, greatly reduces manual intervention link, realizes end-to-end automation closed loop of test case generation.
[0058] It should be understood that the application of the present application is not limited to the above examples, and those skilled in the art can improve or change according to the above description, and all these improvements and changes shall belong to the protection scope of the claims of the present application.
Claims
1. An intelligent test case generation method, characterized in that, The method includes: Obtain the requirements document, extract the entities in the requirements document through natural language processing technology, mine the relationships between entities, and sort out the complete business process chain to obtain standardized structured requirements data; Nodes and edges are constructed using industry knowledge bases and historical test case data, and a domain knowledge graph is generated based on these nodes and edges. Node types include: functional module nodes, input parameter nodes, expected result nodes, defect pattern nodes, and business process nodes. Edge types include: dependency relationships, equivalence class associations, and boundary conditions. Based on the structured requirements data and the domain knowledge graph, a test design method is selected, and a test strategy is generated according to the selected test design method. Initial test cases are generated based on the test strategy, and then verified and optimized to obtain optimized test cases.
2. The intelligent test case generation method according to claim 1, characterized in that, Entity types include key elements such as function points and input parameters; relationship types include dependencies between function points and constraints on input parameters.
3. The intelligent test case generation method according to claim 1, characterized in that, The historical test case data includes: previously tested functional modules, the value range of various input parameters, the corresponding expected results, historical defect patterns, and corresponding test points.
4. The intelligent test case generation method according to claim 1, characterized in that, The node types also include: industry-specific nodes.
5. The intelligent test case generation method according to claim 1, characterized in that, The steps for selecting a test design method based on the structured requirements data and the domain knowledge graph include: Based on the structured requirement data and domain knowledge graph, the target nodes corresponding to the requirements are determined; The test design method is dynamically selected based on the target node using the inference engine of the domain knowledge graph.
6. The intelligent test case generation method according to claim 5, characterized in that, The steps for dynamically selecting a test design method based on the target node include: When the target node is an input parameter node with a range of values, boundary value analysis and equivalence class partitioning are automatically matched through boundary conditions and / or equivalence class associations in the domain knowledge graph. When the target node is a business process node involving multiple steps, the scenario matching method is automatically used through the dependency relationship in the domain knowledge graph to sort out normal and abnormal scenarios. When the target node is a functional module node with high-frequency defects, a special testing method is automatically supplemented through the dependency relationships and / or equivalence class associations in the domain knowledge graph.
7. The intelligent test case generation method according to claim 1, characterized in that, The steps for generating initial test cases based on the aforementioned test strategy and then verifying and optimizing them to obtain optimized test cases include: The key elements of the test cases are automatically populated according to the test strategy to obtain the initial test cases; the key elements include: test case number, test steps, and expected results; The initial test cases are verified and optimized based on the domain knowledge graph. Based on the verification and optimization results, corresponding test cases are automatically added, and duplicate or redundant test cases are removed to obtain the optimized test cases.
8. An intelligent test case generation device, characterized in that, The device includes: The requirement processing module is used to obtain requirement documents, extract entities from the requirement documents through natural language processing technology, mine the relationships between entities, and sort out the complete business process links to obtain standardized structured requirement data. The graph construction module is used to build nodes and edges using industry knowledge bases and historical test case data, and generate a domain knowledge graph based on the nodes and edges. Node types include: functional module nodes, input parameter nodes, expected result nodes, defect pattern nodes, and business process nodes; edge types include: dependency relationships, equivalence class associations, and boundary conditions. The strategy generation module is used to select a test design method based on the structured requirement data and the domain knowledge graph, and generate a test strategy based on the selected test design method. The test case generation module is used to generate initial test cases according to the test strategy and to verify and optimize them to obtain optimized test cases.
9. A terminal, characterized in that, The terminal includes a memory and one or more processors; the memory stores one or more programs; the programs contain instructions for executing the intelligent test case generation method as described in any one of claims 1 to 7; the processors are used to execute the programs.
10. A computer-readable storage medium storing a plurality of instructions thereon, characterized in that, The instructions are applicable to be loaded and executed by a processor to implement the steps of the intelligent test case generation method as described in any one of claims 1 to 7.