Method and apparatus for generating test cases based on knowledge graphs

By constructing a test case generation model to structure new business requirements, generate test cases, and update the knowledge graph, the problem of existing technologies being unable to handle new requirements is solved, and efficient test case generation and accurate reuse are achieved.

CN117130938BActive Publication Date: 2026-11-17中国邮政储蓄银行股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311287685.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-07
Publication Date
2026-11-17
Estimated Expiration
2043-10-07

AI Technical Summary

Technical Problem

In existing technologies, knowledge graphs can only find similar cases and cannot process new requirements, resulting in the inability to generate test cases for new business requirements.

Method used

By constructing a case generation model, the model trained with multiple sets of training data is used to structure new business requirements, generate corresponding test cases, and input them into the knowledge graph for updating, thus forming an updated knowledge graph.

Benefits of technology

It enables the generation of test cases for new business requirements, improves testing efficiency, reduces the time and workload of manually writing test cases, and supports automated requirement management and accurate reuse of test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117130938B_ABST
    Figure CN117130938B_ABST
Patent Text Reader

Abstract

This application provides a method and apparatus for generating test cases based on a knowledge graph. The method includes: acquiring new business requirements; constructing a test case generation model; inputting the new business requirements into the test case generation model to obtain new test cases corresponding to the new business requirements; and inputting the new business requirements and corresponding new test cases into a knowledge graph to obtain an updated knowledge graph. When there are new business requirements, test cases corresponding to the new business requirements are generated according to the test case generation model, ensuring a correspondence between the test cases and the new business requirements. The new business requirements and corresponding new test cases are then input into the knowledge graph, allowing the knowledge graph to store the new test business requirements and their corresponding new test cases. Therefore, this solution can generate test cases for requirements outside of existing knowledge graphs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software testing technology, and more specifically, to a method, apparatus, computer-readable storage medium, and test case management system for generating test cases based on knowledge graphs. Background Technology

[0002] The banking business is characterized by high complexity and rapid changes. In recent years, structured or semi-structured business requirements have been gradually adopted to cope with rapid business changes and improve business capabilities.

[0003] Currently, the mainstream test analysis methods include manual analysis of test requirements, creation of mind maps, and the formation of test outlines and test cases. This approach consumes a significant amount of manpower and cannot guarantee the quality of test cases, failing to meet the requirements of agile testing. Another approach involves using knowledge graphs to find test cases. Test requirements are input, and the knowledge graph searches for existing or similar knowledge. However, this method only allows for the reuse of test cases for similar requirements. When the search element does not exist in the existing test case knowledge base, it cannot process new requirements and can only output test cases for similar requirements. Summary of the Invention

[0004] The main objective of this application is to provide a method, apparatus, computer-readable storage medium, and case management system for generating test cases based on knowledge graphs, so as to at least solve the problem that knowledge graphs in the prior art can only find similar cases and cannot handle new requirements.

[0005] To achieve the above objectives, according to one aspect of this application, a method for generating test cases based on a knowledge graph is provided, comprising: acquiring new business requirements, wherein the new business requirements are business requirements not stored in the knowledge graph, and the business requirements are requirements for handling business; constructing a test case generation model, wherein the test case generation model is trained using multiple sets of training data, each set of training data including historical business requirements acquired within a historical time period, a historical knowledge base, historical business rules, and historical test cases; inputting the new business requirements into the test case generation model to obtain new test cases corresponding to the new business requirements; and inputting the new business requirements and the corresponding new test cases into the knowledge graph to obtain an updated knowledge graph, wherein the updated knowledge graph includes at least the business requirements, the test cases corresponding to the business requirements, the new business requirements, and the new test cases corresponding to the new business requirements.

[0006] Optionally, inputting the new business requirement into the test case generation model to obtain new test cases corresponding to the new business requirement includes: using deep learning technology to perform structuring processing on the new business requirement to obtain at least one structured requirement, wherein the structuring processing is to perform ordered and standardized decomposition processing on the new business requirement, and one structured requirement corresponds to one test scenario or one test step; inputting all the structured requirements sequentially into the test case generation model to obtain all the new test cases corresponding to the new business requirement, wherein one new business requirement corresponds to at least one structured requirement, and one structured requirement corresponds to at least one new test case.

[0007] Optionally, the knowledge graph also includes test points, which are tasks for testing one of the test cases. All the structured requirements are sequentially input into the case generation model to obtain all the new test cases corresponding to the new business requirements. This includes: searching the knowledge graph for test points corresponding to the structured requirements; if a test point is found, extracting it as a target test point; if a target business with a business similarity greater than a similarity threshold is found, updating the test points of the target business according to the structured requirements to obtain the target test point; if no test point is found, generating the target test point according to the structured requirements; and inputting the target test point into the case generation model to obtain all the new test cases corresponding to the new business requirements.

[0008] Optionally, before acquiring new business requirements, the method further includes: cleaning the business data to obtain cleaned business data, wherein the business data includes the business requirements and the test cases corresponding to the business requirements; performing data verification on the cleaned business data to obtain verification results, wherein the data verification includes one or more of consistency verification, integrity verification, and accuracy verification; if the verification result indicates that the verification has passed, generating a knowledge base based on the verified business data; if the verification result indicates that the verification has failed, generating a prompt message.

[0009] Optionally, before constructing the case generation model, the method further includes: constructing a base model, wherein the base model is trained using multiple sets of training data, each set of training data including the historical business requirements, the historical knowledge base, the historical business rules, and the historical test cases obtained within a historical time period; and optimizing the base model to obtain the case generation model, wherein the optimization process includes adjusting model parameters, adjusting coverage, and similarity comparison, or one or more of these.

[0010] Optionally, after obtaining the new business requirements, the method further includes: a data preparation step, obtaining structured requirements and test cases generated by the case generation model; a knowledge extraction step, obtaining the subject used to construct the knowledge graph, wherein the subject is the central node in the knowledge graph, and obtaining the association relationship between the business requirements and the test cases; a knowledge fusion step, performing fusion processing on the knowledge extracted in the knowledge extraction step, wherein the fusion processing includes one or more of relation alignment, relation disambiguation, and relation verification; and a knowledge application step, constructing the knowledge graph using the business requirements as entities, the test cases as attributes, and the association relationships as triples.

[0011] Optionally, after constructing the knowledge graph, the method further includes: obtaining query requirements, wherein the query requirements are requirements for querying the business requirements and / or the test cases from the knowledge graph; performing keyword search in the knowledge graph based on the keywords in the query requirements to obtain search results, and displaying the search results in a graphical manner.

[0012] According to another aspect of this application, a test case generation apparatus based on a knowledge graph is provided, comprising: a first acquisition unit, configured to acquire new business requirements, wherein the new business requirements are business requirements not stored in the knowledge graph, and the business requirements are requirements for handling business; a first construction unit, configured to construct a test case generation model, wherein the test case generation model is trained using multiple sets of training data, each set of training data including historical business requirements acquired within a historical time period, a historical knowledge base, historical business rules, and historical test cases; a first processing unit, configured to input the new business requirements into the test case generation model to obtain new test cases corresponding to the new business requirements; and an update unit, configured to input the new business requirements and the corresponding new test cases into the knowledge graph to obtain an updated knowledge graph, wherein the updated knowledge graph includes at least the business requirements, the test cases corresponding to the business requirements, the new business requirements, and the new test cases corresponding to the new business requirements.

[0013] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to execute any of the knowledge graph-based test case generation methods.

[0014] According to another aspect of this application, a case management system is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including a method for generating test cases based on any of the aforementioned knowledge graphs.

[0015] By applying the technical solution of this application, when there are new business requirements, test cases corresponding to the new business requirements are generated according to the test case generation model. In this way, the test cases obtained from the new business requirements correspond to the new business requirements. Then, the new business requirements and the corresponding new test cases are input into the knowledge graph. In this way, the knowledge graph can store the new test business requirements and the new test cases corresponding to the new test business requirements. Therefore, this solution can generate test cases for requirements outside the existing knowledge graph. Attached Figure Description

[0016] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0017] Figure 1 A hardware structure block diagram of a mobile terminal for executing a knowledge graph-based test case generation method is shown in an embodiment of this application.

[0018] Figure 2 A flowchart illustrating a knowledge graph-based test case generation method according to an embodiment of this application is shown.

[0019] Figure 3 This diagram illustrates the process of test analysis and test case generation.

[0020] Figure 4 A flowchart illustrating the process of building an expert knowledge base is shown.

[0021] Figure 5 A schematic diagram illustrating the process of building a test case generation model is shown.

[0022] Figure 6 A schematic diagram illustrating the process of constructing the knowledge graph for the test is shown;

[0023] Figure 7 A structural block diagram of a knowledge graph-based test case generation apparatus provided according to an embodiment of this application is shown.

[0024] The above figures include the following reference numerals:

[0025] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. Detailed Implementation

[0026] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0027] 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.

[0028] 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 for the embodiments of this application 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.

[0029] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0030] Machine learning: Machines learn from large amounts of historical data through statistical algorithms, and then use the generated experience models to guide business operations;

[0031] Natural Language Processing (NLP) is a discipline that uses computer technology to analyze, understand, and process natural language. It uses computers as a powerful tool for language research, conducts quantitative research on language information with the support of computers, and provides language descriptions that can be used by both humans and computers.

[0032] Knowledge graphs are a series of different graphics that display the development process and structural relationships of knowledge. They use visualization technology to describe knowledge resources and their carriers, and to mine, analyze, construct, draw and display knowledge and the interrelationships between them.

[0033] The banking industry is characterized by high complexity and rapid changes. In recent years, structured or semi-structured business requirements have been increasingly adopted to cope with rapid business changes and improve operational capabilities. To respond quickly to changing requirements, a more precise and efficient set of testing techniques and methods is needed to improve testing efficiency and accuracy.

[0034] Currently, there are two main test analysis methods. One is manual analysis of test requirements, creating mind maps, and forming test outlines and test cases. This method consumes a lot of manpower and cannot guarantee the quality of test cases, failing to meet the requirements of agile testing. The other method is to pre-generate a neural network model and a test case knowledge graph. Test requirements are input, and the neural network model searches for similar requirements. If similar requirements are found, the test case knowledge graph is queried, and test cases are output. This method can only reuse test cases for similar requirements and cannot handle newly added requirements.

[0035] The current approach involves dividing and labeling existing test cases, then training them using a model and knowledge graph to form a test case knowledge base. Case keywords are acquired, and semantic analysis is performed on these keywords to obtain the results. Based on the semantic analysis results, the test case knowledge base is searched to obtain search results. If the search results indicate the existence of similar case sets in the test case knowledge base, the target similar case set is obtained. Finally, the knowledge graph is used to analyze the case keywords and the target similar case set to generate the test case set.

[0036] As described in the background section, existing knowledge graphs can only find similar cases and cannot handle new requirements. To solve the above problems, embodiments of this application provide a method, apparatus, computer-readable storage medium, and case management system for generating test cases based on knowledge graphs.

[0037] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0038] The methods and embodiments provided in this application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a knowledge graph-based test case generation method according to an embodiment of the present invention. Figure 1 As shown, a mobile 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. The mobile 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 mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0039] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device information display method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and 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 the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0040] This embodiment provides a method for generating knowledge graph-based test cases that run on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0041] Figure 2 This is a flowchart illustrating a method for generating test cases based on a knowledge graph, according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:

[0042] Step S201: Obtain new business requirements, wherein the new business requirements are business requirements not stored in the knowledge graph, and the business requirements are requirements for handling business.

[0043] Specifically, the knowledge graph will pre-store some business requirements. If a new business requirement comes in, i.e. a new business requirement, it can be queried from the knowledge graph to determine if there is a corresponding business requirement in the knowledge graph. If there is no corresponding business requirement in the knowledge graph, then this new business requirement is a new business requirement.

[0044] Step S202: Construct a case generation model. The case generation model is trained using multiple sets of training data. Each set of training data includes historical business requirements, historical knowledge base, historical business rules, and historical test cases obtained within a historical time period.

[0045] Specifically, the historical knowledge base is a pre-labeled expert knowledge base, which refers to a database or resource repository that collects expert knowledge and experience.

[0046] Specifically, historical data can be used for machine learning training. Historical data includes historical business requirements, historical test cases corresponding to historical business requirements, historical knowledge bases, historical test cases corresponding to historical knowledge bases, historical business rules, and historical test cases corresponding to historical business rules. Historical test cases are generated based on historical business requirements, historical knowledge bases, and historical business rules. Historical test cases are test cases that have been built based on historical business requirements, historical knowledge bases, and historical business rules within a historical time period. By learning the patterns and rules in historical data, predictions, classifications, or new data can be made, thereby obtaining a case generation model.

[0047] Step S203: Input the above-mentioned new business requirements into the above-mentioned case generation model to obtain the new test cases corresponding to the above-mentioned new business requirements;

[0048] Specifically, existing test analysis methods have the following drawbacks: they can only handle similar requirements and cannot perform test analysis and test case generation for new requirements; the input sources for the test case knowledge base of existing methods are limited and do not support input of structured business knowledge, semi-structured business requirements, and transaction baselines. Therefore, they can only search for existing or similar knowledge, output existing test cases, or generate new cases based on similar test cases, and the test cases generated in this way have a certain degree of error compared to business requirements. Furthermore, when the searched element does not exist in the existing test case knowledge base, it cannot be further processed.

[0049] For example, if a business requirement A is stored in the knowledge graph, and there is a business requirement A', test cases for business requirement A can be found in the knowledge graph. However, if a new business requirement B is added, since the knowledge graph does not store any knowledge about business requirement B, the test cases obtained will be completely inaccurate. They may be test cases for business requirement A or business requirement C.

[0050] Therefore, according to the solution of this application, if there are new business requirements, the new business requirement C can be input into the test case generation model to generate new test cases corresponding to the new business requirement C, that is, to expand the test cases for the new business requirement C.

[0051] Of course, if the business requirement is A, and the knowledge graph already stores test cases for business requirement A, then you don't need to input business requirement A into the test case generation model. You can directly use the test cases for business requirement A in the knowledge graph. Alternatively, to further expand the test cases, you can input business requirement A into the test case generation model to expand the test cases for business requirement A.

[0052] Step S204: Input the above-mentioned new business requirements and the corresponding new test cases into the above-mentioned knowledge graph to obtain the updated knowledge graph. The updated knowledge graph includes at least the above-mentioned business requirements, the test cases corresponding to the above-mentioned business requirements, the above-mentioned new business requirements, and the above-mentioned new test cases corresponding to the above-mentioned new business requirements.

[0053] Specifically, the knowledge graph pre-stores business requirements and corresponding test cases. When new test cases are generated based on the test case generation model for new business requirements, the knowledge graph can be updated by inputting the new business requirements and corresponding test cases into the knowledge graph, thus improving the knowledge graph.

[0054] In this embodiment, when there are new business requirements, test cases corresponding to the new business requirements are generated according to the test case generation model. In this way, the test cases obtained from the new business requirements correspond to the new business requirements. Then, the new business requirements and the corresponding new test cases are input into the knowledge graph. In this way, the knowledge graph can store the new test business requirements and the new test cases corresponding to the new test business requirements. Therefore, this solution can generate test cases for requirements outside the existing knowledge graph.

[0055] Specifically, the solution in this application provides a method for test analysis and test case generation, with the aim of quickly analyzing requirements, reducing the time and workload of manually writing test cases, thereby improving testing efficiency and reducing personnel costs.

[0056] New business requirements are often large requirements, involving many steps or scenarios to achieve. Therefore, these requirements can be broken down for better analysis. Specifically, the new business requirements are input into the test case generation model to obtain corresponding test cases. This can be achieved through the following steps: Deep learning technology is used to structure the new business requirements, resulting in at least one structured requirement. This structuring involves orderly and standardized decomposition of the new business requirements, with each structured requirement corresponding to one test scenario or test step. All structured requirements are then sequentially input into the test case generation model to obtain all corresponding test cases for each new business requirement. Each new business requirement corresponds to at least one structured requirement, and each structured requirement corresponds to at least one test case.

[0057] In this solution, new business requirements can be structured by breaking them down into at least one structured requirement. This allows for better analysis of new business requirements and reduces ambiguity and misunderstanding. Structured requirements are also easier for computer programs to process and analyze, supporting automated tasks such as requirement management, requirement tracking, and requirement prioritization. Furthermore, structured requirements are easier to classify, archive, and retrieve, promoting requirement reuse. Therefore, structured requirements can be sequentially input into the test case generation model, with each structured requirement generating at least one new test case. This allows for more efficient generation of new test cases based on requirements at each step.

[0058] Specifically, new business requirements and structured requirements can have a one-to-many relationship, as can structured requirements and new test cases. Therefore, new business requirements can be broken down into smaller structured requirements, and each smaller structured requirement can generate multiple new test cases. If new business requirements are directly input into the test case generation model, some requirements may not be recognized, resulting in low-quality new test cases and low efficiency in test case generation. Therefore, breaking down new business requirements and inputting the resulting multiple structured requirements into the test case generation model can avoid this situation. The requirements at each step can be analyzed to generate corresponding new test cases.

[0059] Using deep learning technology to structure business requirements involves cleaning, preprocessing, and labeling data to make it suitable for deep learning model training. A suitable deep learning model for handling business needs is selected, such as a Recurrent Neural Network (RNN), Convolutional Neural Network (CNN), or Transformer. Model selection and design are based on the characteristics and data types of the requirements. Features are extracted from the raw data, transforming it into a form that the model can understand and process. For text data, word embedding techniques can be used to convert text into vector representations; for image data, convolutional neural networks can be used to extract features; and for speech data, acoustic feature extraction techniques can be used. The deep learning model is trained using a prepared dataset. Appropriate optimization algorithms and loss functions are selected based on the requirements and the amount of data. Model parameters are iteratively optimized to better fit the data and improve the accuracy of requirement structuring. The trained model is evaluated using a test set, calculating metrics such as accuracy, recall, and F1 score to assess performance and generalization ability. The model is then fine-tuned and improved based on the evaluation results. Finally, the trained model is deployed to real-world business scenarios to structure new business requirements. Services that meet structured requirements can be provided through API interfaces, mobile applications, and other means.

[0060] Specifically, when a new business requirement is obtained, it can first be searched in the knowledge graph to determine whether the same business requirement can be found in the knowledge graph. If the same business requirement can be found in the knowledge graph, the test cases of the business requirement stored in the knowledge graph can be directly extracted. If the same business requirement cannot be found in the knowledge graph, the new business requirement can be input into the test case generation model to generate new test cases.

[0061] Specifically, new business requirements can be processed using deep learning technology. For example, using natural language processing, a new business requirement is that user A wants to transfer money to user B. With natural language processing, the language can be recognized and converted into structured requirements, which can then be organized into an orderly and standardized process. For instance, the first structured requirement is that the business scenario is a money transfer; the second is that the users involved in the transfer are user A and user B; the third is that the transfer type is mobile banking, branch transfer, or ATM transfer; the fourth is to check if user A's account balance meets the transfer requirement (if the transfer amount is 500 yuan and user A's account balance is 100 yuan, the transfer requirement cannot be met); if the transfer requirement is met, the fifth structured requirement is to deduct the amount from user A's account balance; and the sixth structured requirement is to increase the amount in user B's account balance.

[0062] The knowledge base also contains test points related to the relevant fields. These test points can better guide the testing work. In the specific implementation process, the knowledge graph also includes test points, which are the tasks for testing one of the test cases. All the structured requirements are sequentially input into the case generation model to obtain all the new test cases corresponding to the new business requirements. This can be achieved through the following steps: Search the knowledge graph for test points corresponding to the structured requirements; if a test point is found, extract it as the target test point; if a target business with a business similarity greater than a similarity threshold is found, update the test points for the target business according to the structured requirements to obtain the target test point; if no test point is found, generate the target test point based on the structured requirements; input the target test point into the case generation model to obtain all the new test cases corresponding to the new business requirements.

[0063] This solution allows for the search of test points within a knowledge graph. If identical or similar test points are found in the knowledge graph, they can be directly used as target test points. If similar test points are found, they can be updated directly to obtain the target test points. If no test points are found in the knowledge graph, new test points can be generated directly. This ensures the comprehensiveness and accuracy of the testing work, avoids designing security test cases from scratch, saves time in generating test cases, and guarantees the consistency and traceability of the tests. Furthermore, new test cases can be generated based on the target test points, improving the efficiency and quality of the testing work, further ensuring the comprehensiveness, accuracy, consistency, and traceability of the tests, and providing repeatability and scalability.

[0064] Specifically, the similarity threshold can be 80%, 90%, or any other feasible value.

[0065] Of course, the target test points and structured requirements can also be input into the knowledge graph. In this way, the updated knowledge graph includes the business requirements, the test cases corresponding to the business requirements, the new business requirements, the new test cases corresponding to the new business requirements, the target test points, and the structured requirements.

[0066] Specifically, the process for test analysis and test case generation and organization is as follows: Figure 3As shown, the process includes the following steps: Step (1), the business requirements are structured through manual analysis or deep learning to obtain standard structured requirements; Step (2), the structured requirements are identified by entities, the existing test knowledge graph is queried, all test points are differentially analyzed, and the test points that need to be added, modified, or deleted are output; Step (3), the added and modified test points are input into the case generation model, and the test cases corresponding to the test points are output; Step (4), the knowledge graph is updated according to the results of the above steps (2) and (3), as well as the existing test points and test cases in the knowledge graph, to obtain the test case set corresponding to the requirements.

[0067] Specifically, regarding point 2) above, a search can be performed in a knowledge graph. The extracted structured requirements are input into the knowledge graph, allowing for the search of channels (e.g., transfers, whether mobile or branch transfers). All content within the knowledge graph can be retrieved. For example, if a user is found, it can be determined that if it is an individual user, the associated scenarios could be the user, the product used by the user, the transfer channel used by the user, and the actions performed, such as transferring, depositing, and withdrawing money. This information is then compiled into a knowledge graph. Entity recognition can identify channels, entities, branches, banks, online banking, autonomous devices, and user types (individual users, corporate users, government users, financial institutions). After identifying business requirements, they are broken down into structured requirements. The entities within these requirements are then input into the knowledge graph. It is determined which structured requirements are present in the knowledge graph and which are not. The search results are then used to update the knowledge graph.

[0068] For example, the reason for deleting test points mentioned above is that there are many structured common steps, such as checking the balance in the card whether it is transferring money or withdrawing money. This action can be applied to many scenarios, and repetitive actions can be deleted.

[0069] For example, new requirements may be derived from existing scenarios. If there is a requirement for bank transfer, and the new requirement is for mobile banking transfer, then one test point for bank transfer is ID card verification. However, for mobile banking transfer, ID card verification at the counter is generally not required; instead, the user needs to log in to the app on their mobile phone. Therefore, based on bank transfer, a login test point can be added, and the ID card verification test point can be removed.

[0070] Specifically, the solution proposed in this application can perform multi-dimensional retrieval and analysis of business requirements and test cases based on customers, channels, products, and demand points, and can generate test cases for new requirements. By querying the knowledge graph, new test points can be identified. Test cases can also be generated for requirements outside the existing knowledge graph.

[0071] The solution proposed in this application enables precise reuse of existing test cases. Based on a test knowledge graph generated from structured requirements, new requirements can be identified as entities and accurately searched within the test knowledge graph, thus achieving precise reuse of test cases.

[0072] To filter out noise and improve data quality and accuracy, ensuring higher credibility and reliability of the data used to build the knowledge base, the above method further includes the following steps before acquiring new business requirements: cleaning the business data to obtain cleaned business data, wherein the business data includes the aforementioned business requirements and the corresponding test cases; validating the cleaned business data to obtain validation results, wherein the data validation includes one or more of consistency, integrity, and accuracy validations; generating a knowledge base based on the validated business data if the validation results indicate that the validation has passed, and generating a prompt message if the validation results indicate that the validation has failed.

[0073] This solution involves cleaning and validating the data. The original business data may contain noise, errors, or incomplete information. Data cleaning can remove these problems, improve the quality and reliability of the data, and make the data conform to consistent standards and formats. This helps to establish a unified data model and structure in the knowledge base, which facilitates subsequent data analysis and application. Furthermore, the cleaned and validated data can generate a higher-quality knowledge base, further improving the accuracy of the knowledge in the knowledge base.

[0074] Specifically, applying deep learning technology to the scenario of automatic test case generation involves the following main steps in model building:

[0075] Step 1: Build an expert knowledge base; Step 2: Generate a basic model; Step 3: Optimize the basic model to generate a case generation model.

[0076] Specifically, the expert knowledge base is built upon information such as business requirements, existing test case libraries, and expert experience, using technologies such as standardized requirement structuring (e.g., business modeling) and natural language processing. Its primary function is to establish the relationship between requirements and test cases, assist in training large-scale models, and validate the test case data generated by these models. Figure 4 As shown, the main process of building an expert knowledge base includes:

[0077] Step A, Temporary Layer Data Extraction: Extract structured business requirement data, test case data, and other basic data samples through ETL data extraction, and perform simple processing on the data through data cleaning and other methods.

[0078] Step B, Data Layer Business Processing: Read the requirement data and test case data after temporary layer processing. Extract the requirement data and labeled test case data according to the requirement rule template. The rule template converts business requirements into structured requirements and marks them. That is, it marks the things done in the test case (such as transferring money through the counter or withdrawing money through a branch), the required nodes, and the test reasons. Marking the data in this way is beneficial for subsequent machine learning.

[0079] Step C, Data Quality Verification: Consistency verification, integrity verification, and accuracy verification are performed during ETL operations at the data layer.

[0080] Specifically, consistency verification of cleaned business data can be performed by determining consistency rules based on business needs and data characteristics, such as the value range and relationships of data fields. This includes verifying whether the data field types and formats comply with regulations, such as the format of date fields and the data types of numeric fields. It also involves checking whether the data meets predefined constraints, such as uniqueness constraints and foreign key constraints. Furthermore, it requires comparing data from different data sources to ensure the consistency of key field values, such as the consistency of customer information across different systems. If inconsistencies are found, conflict resolution is necessary, such as through data merging or data updates.

[0081] Specifically, integrity verification of cleaned business data can be performed based on business needs and data characteristics, defining integrity rules such as required fields, relationships, and data ranges. This includes verifying whether the data contains required fields to ensure integrity; verifying the existence of relationships between data points, such as foreign keys and parent-child relationships; and verifying whether the data is within specified ranges, such as whether age or amount is within a preset range. If missing data is found, it should be supplemented according to business rules to ensure data integrity.

[0082] Specifically, accuracy verification of cleaned business data can be performed by clearly defining accuracy standards and expected results based on business needs and data characteristics. This can include aspects such as data correctness, logical relationships, and legality. The business data to be verified is collected and cleaned and preprocessed to ensure data quality and consistency. This can include removing duplicate data, handling missing values, and handling outliers. Appropriate data verification methods are selected based on data type and verification requirements. Common methods include rule-based verification, logical verification, and algorithmic verification. Data can be verified based on business rules and predefined rules. For example, verifying whether date fields conform to a specified format or whether numeric fields are within a reasonable range. Data can also be verified based on logical relationships between data. For example, verifying whether related fields match or whether parent-child relationships are correct. Algorithmic calculations can be performed on specific data to verify the accuracy of the calculation results. For example, summing or averaging certain numeric fields and comparing the results with the expected results.

[0083] To improve the performance and effectiveness of the model and meet the needs of actual testing applications, the above method further includes the following steps before building the case generation model: building a basic model, wherein the basic model is trained using multiple sets of training data, each set of training data including the aforementioned historical business requirements, the aforementioned historical knowledge base, the aforementioned historical business rules, and the aforementioned historical test cases obtained within a historical time period; optimizing the aforementioned basic model to obtain the aforementioned case generation model, wherein the optimization process includes adjusting model parameters, adjusting coverage, and similarity comparison, or one or more of these.

[0084] In this approach, the base model can be optimized, which can improve its accuracy and generalization ability. Furthermore, the optimized test case generation model can reduce model errors and has better robustness and stability, thus ensuring that the test cases generated by the test case generation model are more accurate.

[0085] Specifically, test cases can be associated with front-end transactions according to preset rules to generate executable test cases. The correctness and coverage of these test cases are then verified through an expert knowledge base and test implementation. Based on the verification results, the basic model is optimized to improve test coverage and efficiency. Automatic test case generation is a dynamic and constantly evolving process, requiring continuous maintenance and optimization of the generated model to ensure its effectiveness and usability in real-world scenarios.

[0086] Specifically, the test cases generated after the basic model is trained can be used for verification. This can be achieved by comparing the results using neural network vector similarity calculations. If the results do not meet expectations, the basic model can be trained again by optimizing parameters or supplementing training data. Through continuous iteration, the ability to generate test cases can be optimized and improved, refining the basic model and resulting in a test case generation model.

[0087] Specifically, optimizing a model requires adjusting its parameters to find the optimal configuration. This can be achieved using various optimization algorithms and techniques, such as grid search, random search, and Bayesian optimization. The best-performing parameters are selected through cross-validation on different parameter combinations.

[0088] Specifically, the features of the input data can be processed to extract more useful information. For example, text data can be processed using the bag-of-words model or TF-IDF encoding, or image data can be processed using edge detection or color distribution analysis.

[0089] Specifically, the generalization ability of a model can be increased by augmenting the training data. For example, in image classification tasks, the number of training samples can be increased by rotating, flipping, scaling, etc.

[0090] Specifically, appropriate similarity calculation methods can be used to measure the degree of similarity between different samples. Commonly used similarity calculation methods include cosine similarity, Euclidean distance, and edit distance. The choice of an appropriate similarity calculation method depends on the specific application scenario and data characteristics.

[0091] Specifically, for generating the base model, such as Figure 5 As shown, the basic model can be obtained by using the test case data labeled in the expert knowledge base and conducting supervised instruction learning training in batches in a scientific manner.

[0092] Specifically, for case generation models that are optimized from a base model, such as... Figure 5 As shown, the test cases output after the basic model is trained are verified by comparing the results through neural network vector similarity calculation. If the results do not meet expectations, the basic model can be trained again by optimizing parameters or supplementing training data. Through continuous iteration, the task capability of producing test cases can be optimized and improved to obtain the test case generation model.

[0093] Specifically, the test cases output after the basic model is trained can be verified manually. After the basic model is trained, the output test cases are manually verified and matched with test cases edited by the user. If the similarity is less than the threshold (e.g., 95% or 80%), the basic model can be optimized. If the similarity is greater than or equal to the threshold, the basic model can be left unoptimized and will serve as the test case generation model. Of course, to ensure the accuracy of the data, the basic model can also be optimized when the similarity is greater than or equal to the threshold.

[0094] In addition, another optimization method is to supplement the training data. If the data contains A+B in the format AABBCC, the basic model may only be able to recognize the AABBCC format and not the ABBCCC format. Therefore, training data in different formats can be used to supplement the training data to continue training the basic model and optimize it.

[0095] Specifically, the solution described in this application enables precise testing, shortens the testing cycle, and supports rapid business iteration. This adapts to the agile development model of bank software in the new stage, enabling rapid agile testing and ensuring quick system delivery and deployment. By automatically locating the impact of requirement changes, the test analysis process is simplified, allowing for rapid analysis of new requirements and precise location of requirement changes, thereby reducing testing costs and improving testing efficiency.

[0096] In some embodiments, after obtaining new business requirements, the above method further includes the following steps: a data preparation step, obtaining structured requirements and test cases generated by the above case generation model; a knowledge extraction step, obtaining the subject used to construct the above knowledge graph, wherein the subject is the central node in the above knowledge graph, and obtaining the association relationship between the above business requirements and the above test cases; a knowledge fusion step, performing fusion processing on the knowledge extracted in the above knowledge extraction step, wherein the fusion processing includes one or more of relation alignment, relation disambiguation, and relation verification; and a knowledge application step, constructing the above knowledge graph by using the above business requirements as entities, the above test cases as attributes, and the above association relationships as triples.

[0097] In this solution, data preparation obtains the raw data needed to build the knowledge graph, providing a usable data foundation for subsequent steps. Knowledge extraction extracts meaningful information, relationships, and attributes from the raw data, transforming unstructured or semi-structured data into a structured knowledge representation, making it computable and providing a foundation for subsequent knowledge fusion and application. Knowledge fusion integrates and merges knowledge from different sources and formats, eliminating conflicts, resolving data inconsistencies, and improving the accuracy and reliability of knowledge. This knowledge base can then be built and applied to the domain of test cases, providing more accurate search results, personalized recommendations, and intelligent question answering for test cases and business needs, thereby improving user experience and business effectiveness.

[0098] Specifically, the construction process of the test knowledge graph is as follows: Figure 6 As shown, the main steps include the following:

[0099] Basic data preparation steps: Structure business requirements and test case data generated using a large model (case generation model); Specifically, the domain and target of the knowledge graph can be determined, raw data can be collected, which may include structured data, semi-structured data and unstructured data, the raw data is cleaned to remove noise, duplicate data and incomplete information, the data is preprocessed, including data format conversion, standardization and normalization, etc., and data patterns and pattern mappings are established to prepare for subsequent knowledge extraction;

[0100] Knowledge extraction steps: Through preprocessing and ontology construction (ontology extraction), a test knowledge graph framework is built, mainly including attribute extraction, relation extraction, and entity extraction. Specifically, appropriate knowledge extraction methods and technologies, such as natural language processing and information extraction, can be selected according to the domain and objectives. Entity extraction is performed on the cleaned and preprocessed data to identify entity objects in the text, such as people, places, and organizations. Relationship extraction is performed to extract the relationships between entities and establish a relationship network. Attribute information is extracted to extract attribute values ​​of entities, such as age, gender, and address. The extracted entities, relations, and attributes are labeled and classified to establish a knowledge representation.

[0101] Knowledge fusion steps: An automatic knowledge graph construction engine is used, which includes algorithms and processes such as entity recognition, relation extraction, referential resolution, disambiguation alignment (entity disambiguation), triple storage, and manual verification. It can also perform quality assessment. Specifically, it can align knowledge from different data sources, eliminate duplicate and conflicting content, resolve inconsistencies such as inconsistent naming and synonym issues, establish knowledge links, connect and integrate identical or related entities and relations, construct knowledge graph schemas, define the attributes and constraints of entities and relations, ensure the consistency and integrity of the knowledge graph, and perform data verification and quality control.

[0102] Knowledge application steps: The output is a test knowledge graph composed of massive knowledge triples, and knowledge reasoning is performed through the knowledge graph; specifically, appropriate knowledge application methods and technologies, such as search engines and recommendation systems, can be selected according to specific tasks and needs to establish indexing and search mechanisms, support information retrieval and query based on knowledge graphs, perform knowledge reasoning and inference, and use knowledge graphs for logical reasoning and association analysis.

[0103] For example, in the test scenario of transferring money from user A to user B, when constructing the ontology, can we use the user as the ontology, the transfer as the ontology, or the transfer steps as the ontology? The ontology serves as the central node of the knowledge graph, for example, there are A, A', and A'". It doesn't matter which one is chosen as the ontology.

[0104] For example, in the context of knowledge fusion, a business scenario involves users transferring money at a bank counter. The specific steps, such as how many entities, how many customers, and what transfer channels are involved, all need to be broken down. For instance, the first step is checking the balance. Each step is useful, and the relationships between each step can be linked. Similar needs can also be extracted, such as purchasing wealth management products through mobile banking. The system can identify if a user wants to purchase wealth management products. The specific steps are: first, logging into the account; second, determining the business rules. In fact, purchasing wealth management products and transferring money have similar steps, such as the login step. Therefore, these steps can be integrated.

[0105] Specifically, the solution proposed in this application can construct an expert knowledge base, a case generation model, and a test knowledge graph by inputting various types of knowledge. These include structured business requirements, semi-structured business requirements, and system transaction baselines.

[0106] Currently, some solutions establish relationships between multiple requirement points based on the requirement document and extracted requirement points, creating a requirement view that shows the relationship between requirements and functional points. However, the relationship between requirements and test cases is not established. This makes it impossible to determine the test scope based on the requirements, or to locate related business scenarios through test cases. Therefore, it is impossible to achieve bidirectional traceability between business requirements and test cases. In some embodiments, after constructing the knowledge graph, the method further includes the following steps: obtaining query requirements, wherein the query requirements are requirements for querying the business requirements and / or the test cases from the knowledge graph; performing keyword search in the knowledge graph based on the keywords in the query requirements, obtaining search results, and displaying the search results graphically.

[0107] In this solution, the knowledge graph being tested can achieve a multi-dimensional query visualization analysis method. It can perform multi-dimensional queries based on different scenarios and elements, and can use keyword search and graph data display (graph data mining) technology for visualization queries to help users better understand and explore the information in the knowledge graph.

[0108] Knowledge graph visualization query is a more intuitive way to query knowledge graphs from multiple dimensions, displaying information in a graphical format. Visualization queries visualize different types of data, such as node attributes, relationships, and semantics, presenting them in a graphical form. This makes it easier for users to understand the query results, reducing their cognitive load. For example, tree diagrams and bubble diagrams can be used to express the hierarchy or relationships of information. Interactive graphs refer to graphs that users can interact with to explore the knowledge graph's information. For example, users can interact by clicking, zooming, and viewing details to obtain more detailed information.

[0109] Keyword search in knowledge graphs is a common method of querying knowledge graphs. It involves inputting words or phrases to retrieve related knowledge graph information. While simple and easy to use, this method suffers from low accuracy due to the potential ambiguity of user-input keywords. Furthermore, it lacks precise control over the quantity and precision of search results, making it relatively inefficient when handling large-scale datasets. As a form of multidimensional querying, the core aspects lie in keyword selection and query expression.

[0110] Specifically, the above solution can link business requirements and test cases. By looking at business requirements, you can see what the test cases are. For example, if you enter the keyword "mobile banking", you can see what test cases are available for mobile banking and what the current test progress is. The forward search is to find test cases through business requirements, and the reverse search is to find business requirements through test cases. The reverse search can determine the business scope associated with the test cases.

[0111] The bidirectional traceability from knowledge graph to test case mainly combines graph data mining, correlation data query and information retrieval technologies to perform correlation queries and analysis on knowledge graph, test cases and business information, and present the relevant data in a visual way.

[0112] This application's solution enables bidirectional traceability from business requirements to test cases and vice versa. Forward traceability involves querying associated test scenarios and corresponding test cases through business model information, facilitating rapid clarification of the test scope. Linked test progress tracking allows for obtaining test execution status data for relevant business scenarios, such as test coverage (e.g., a money transfer was designed with 100 test cases, but only 80 were tested, resulting in 80% coverage; this determines the exact number of test cases used) and test pass rate. This can be applied to scenarios such as analyzing the impact of requirement changes on testing. Reverse traceability involves quickly locating the corresponding business model content through test cases, facilitating rapid identification of the business impact scope of defects discovered during testing, narrowing the problem scope, and uncovering potential defects.

[0113] The above-described solution in this application can establish traceability of the testing process. By establishing the correlation between business requirements, test cases, and test defects through knowledge graphs, when test defects are discovered, all relevant elements corresponding to the defect can be quickly located. AI technology is used to better analyze and trace relevant data and information, achieving efficient test supervision and control.

[0114] This application also provides a knowledge graph-based test case generation apparatus. It should be noted that this knowledge graph-based test case generation apparatus can be used to execute the knowledge graph-based test case generation method provided in this application. This apparatus is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0115] The following describes the knowledge graph-based test case generation apparatus provided in the embodiments of this application.

[0116] Figure 7 This is a structural block diagram of a knowledge graph-based test case generation device according to an embodiment of this application. Figure 7 As shown, the device includes:

[0117] The first acquisition unit 10 is used to acquire new business requirements, wherein the new business requirements are business requirements not stored in the knowledge graph, and the business requirements are requirements for handling business.

[0118] The first building unit 20 is used to build a case generation model. The case generation model is trained using multiple sets of training data. Each set of training data includes historical business requirements, historical knowledge base, historical business rules and historical test cases obtained within a historical time period.

[0119] The first processing unit 30 is used to input the above-mentioned new business requirements into the above-mentioned case generation model to obtain new test cases corresponding to the above-mentioned new business requirements.

[0120] The update unit 40 is used to input the aforementioned new business requirements and the corresponding new test cases into the aforementioned knowledge graph to obtain an updated knowledge graph. The updated knowledge graph includes at least the aforementioned business requirements, the test cases corresponding to the aforementioned business requirements, the aforementioned new business requirements, and the aforementioned new test cases corresponding to the aforementioned new business requirements.

[0121] In this embodiment, when there are new business requirements, test cases corresponding to the new business requirements are generated according to the test case generation model. In this way, the test cases obtained from the new business requirements correspond to the new business requirements. Then, the new business requirements and the corresponding new test cases are input into the knowledge graph. In this way, the knowledge graph can store the new test business requirements and the new test cases corresponding to the new test business requirements. Therefore, this solution can generate test cases for requirements outside the existing knowledge graph.

[0122] New business requirements are often large requirements, involving many steps or scenarios to achieve. Therefore, new business requirements can be broken down for better analysis. In the specific implementation, the first processing unit includes a first processing module and a second processing module. The first processing module uses deep learning technology to perform structured processing on the new business requirements, obtaining at least one structured requirement. The structured processing involves orderly and standardized decomposition of the new business requirements, with each structured requirement corresponding to one test scenario or one test step. The second processing module sequentially inputs all the structured requirements into the test case generation model to obtain all the new test cases corresponding to the new business requirements. Each new business requirement corresponds to at least one structured requirement, and each structured requirement corresponds to at least one new test case.

[0123] In this solution, new business requirements can be structured by breaking them down into at least one structured requirement. This allows for better analysis of new business requirements and reduces ambiguity and misunderstanding. Structured requirements are also easier for computer programs to process and analyze, supporting automated tasks such as requirement management, requirement tracking, and requirement prioritization. Furthermore, structured requirements are easier to classify, archive, and retrieve, promoting requirement reuse. Therefore, structured requirements can be sequentially input into the test case generation model, with each structured requirement generating at least one new test case. This allows for more efficient generation of new test cases based on requirements at each step.

[0124] The knowledge base also contains test points related to the relevant domain. These test points can better guide the testing work. In the specific implementation process, the knowledge graph also includes test points, which are the tasks for testing one of the test cases. The second processing module includes a search submodule, a first processing submodule, a second processing submodule, a third processing submodule, and a fourth processing submodule. The search submodule is used to search the knowledge graph for the test points corresponding to the structured requirements. The first processing submodule is used to, when the test points corresponding to the structured requirements are found, process the corresponding test points. The above test points are extracted as target test points; the second processing submodule is used to update the above test points of the target business according to the above structured requirements when a target business with a business similarity greater than the similarity threshold is found, thereby obtaining the above target test points; the third processing submodule is used to generate the above target test points according to the above structured requirements when no above test points corresponding to the above structured requirements are found; the fourth processing submodule is used to input the above target test points into the above case generation model to obtain all the above new test cases corresponding to the above new business requirements.

[0125] This solution allows for the search of test points within a knowledge graph. If identical or similar test points are found in the knowledge graph, they can be directly used as target test points. If similar test points are found, they can be updated directly to obtain the target test points. If no test points are found in the knowledge graph, new test points can be generated directly. This ensures the comprehensiveness and accuracy of the testing work, avoids designing security test cases from scratch, saves time in generating test cases, and guarantees the consistency and traceability of the tests. Furthermore, new test cases can be generated based on the target test points, improving the efficiency and quality of the testing work, further ensuring the comprehensiveness, accuracy, consistency, and traceability of the tests, and providing repeatability and scalability.

[0126] To filter out noise and improve data quality and accuracy, thereby ensuring higher credibility and reliability of the data used to build the knowledge base, the aforementioned apparatus further includes a cleaning unit, a verification unit, and a generation unit. The cleaning unit cleans the business data before acquiring new business requirements, obtaining cleaned business data, which includes the aforementioned business requirements and the corresponding test cases. The verification unit verifies the cleaned business data, obtaining verification results, which include one or more of consistency, integrity, and accuracy verification. The generation unit generates a knowledge base based on the verified business data if the verification results indicate that the verification has passed; otherwise, it generates a prompt message.

[0127] This solution involves cleaning and validating the data. The original business data may contain noise, errors, or incomplete information. Data cleaning can remove these problems, improve the quality and reliability of the data, and make the data conform to consistent standards and formats. This helps to establish a unified data model and structure in the knowledge base, which facilitates subsequent data analysis and application. Furthermore, the cleaned and validated data can generate a higher-quality knowledge base, further improving the accuracy of the knowledge in the knowledge base.

[0128] To improve the performance and effectiveness of the model and meet the needs of practical testing applications, the above-mentioned device further includes a second construction unit and a second processing unit. The second construction unit is used to construct a basic model before constructing the case generation model. The basic model is trained using multiple sets of training data. Each set of training data includes the historical business requirements, historical knowledge base, historical business rules, and historical test cases obtained within a historical time period. The second processing unit is used to optimize the basic model to obtain the case generation model. The optimization process includes adjusting model parameters, adjusting coverage, and similarity comparison, or one or more of these.

[0129] In this approach, the base model can be optimized, which can improve its accuracy and generalization ability. Furthermore, the optimized test case generation model can reduce model errors and has better robustness and stability, thus ensuring that the test cases generated by the test case generation model are more accurate.

[0130] In some embodiments, the above-described apparatus further includes a data preparation unit, a knowledge extraction unit, a knowledge fusion unit, and a knowledge application unit. The data preparation unit is used to perform data preparation steps after obtaining new business requirements, to obtain structured requirements, and to obtain test cases generated by the case generation model. The knowledge extraction unit is used to perform knowledge extraction steps, to obtain the subject used to construct the knowledge graph, wherein the subject is the central node in the knowledge graph, and to obtain the association relationship between the business requirements and the test cases. The knowledge fusion unit is used to perform knowledge fusion steps, to perform fusion processing on the knowledge extracted in the knowledge extraction steps, wherein the fusion processing includes one or more of relation alignment, relation disambiguation, and relation verification. The knowledge application unit is used to perform knowledge application steps, to construct the knowledge graph by using the business requirements as entities, the test cases as attributes, and the association relationships as triples.

[0131] In this solution, data preparation obtains the raw data needed to build the knowledge graph, providing a usable data foundation for subsequent steps. Knowledge extraction extracts meaningful information, relationships, and attributes from the raw data, transforming unstructured or semi-structured data into a structured knowledge representation, making it computable and providing a foundation for subsequent knowledge fusion and application. Knowledge fusion integrates and merges knowledge from different sources and formats, eliminating conflicts, resolving data inconsistencies, and improving the accuracy and reliability of knowledge. This knowledge base can then be built and applied to the domain of test cases, providing more accurate search results, personalized recommendations, and intelligent question answering for test cases and business needs, thereby improving user experience and business effectiveness.

[0132] In some current solutions, relationships between multiple requirement points are established based on the requirement document and the extracted requirement points to create a requirement view. This requirement view shows the relationship between requirements and functional points, but it does not establish the relationship between requirements and test cases. Therefore, it is impossible to determine the test scope based on the requirements, or to locate related business scenarios through test cases. Thus, bidirectional traceability between business requirements and test cases cannot be achieved. In some embodiments, the above-mentioned device further includes a second acquisition unit and a third processing unit. The second acquisition unit is used to acquire query requirements after constructing the knowledge graph, wherein the query requirements are requirements to query the business requirements and / or test cases from the knowledge graph. The third processing unit is used to perform keyword searches in the knowledge graph based on the keywords in the query requirements, obtain search results, and display the search results graphically.

[0133] In this solution, the knowledge graph being tested can achieve a multi-dimensional query visualization analysis method. It can perform multi-dimensional queries based on different scenarios and elements, and can use keyword search and graph data display (graph data mining) technology for visualization queries to help users better understand and explore the information in the knowledge graph.

[0134] The aforementioned knowledge graph-based test case generation device includes a processor and a memory. The first acquisition unit, first construction unit, first processing unit, and update unit are all stored as program units in the memory, and the processor executes these program units stored in the memory to achieve the corresponding functions. All of the above modules are located in the same processor; alternatively, the modules may be located in different processors in any combination.

[0135] The processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and adjusting kernel parameters can address the problem that existing knowledge graph technologies can only find similar cases and cannot handle new requirements.

[0136] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0137] This invention provides a computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to execute the knowledge graph-based test case generation method.

[0138] This invention provides a processor for running a program, wherein the program executes the knowledge graph-based test case generation method.

[0139] This application also provides a case management system, including one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a method for generating any of the above-described knowledge graph-based test cases.

[0140] This invention provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements a method for generating test cases based on a knowledge graph. The device described herein can be a server, PC, tablet, mobile phone, etc.

[0141] This application also provides a computer program product that, when executed on a data processing device, is adapted to perform a program that initializes a method for generating test cases based on at least a knowledge graph.

[0142] It is obvious to those skilled in the art that the modules or steps of the present invention 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. They can be implemented using computer-executable program code, and thus can be stored 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 described herein, 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, the present invention is not limited to any particular combination of hardware and software.

[0143] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0144] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0145] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0146] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0147] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0148] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0149] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0150] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0151] As can be seen from the above description, the embodiments of this application achieve the following technical effects:

[0152] 1) The knowledge graph-based test case generation method of this application generates test cases corresponding to new business requirements based on the test case generation model when there are new business requirements. In this way, the test cases obtained from the new business requirements correspond to the new business requirements. Then, the new business requirements and the corresponding new test cases are input into the knowledge graph. In this way, the knowledge graph can store the new test business requirements and the new test cases corresponding to the new test business requirements. Therefore, this solution can generate test cases for requirements outside the existing knowledge graph.

[0153] 2) The knowledge graph-based test case generation device of this application generates test cases corresponding to new business requirements according to the test case generation model when there are new business requirements. In this way, the test cases obtained from the new business requirements correspond to the new business requirements. Then, the new business requirements and the corresponding new test cases are input into the knowledge graph. In this way, the knowledge graph can store the new test business requirements and the new test cases corresponding to the new test business requirements. Therefore, this solution can generate test cases for requirements outside the existing knowledge graph.

[0154] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for generating test cases based on knowledge graphs, characterized in that, include: Obtain new business requirements, wherein the new business requirements are business requirements not stored in the knowledge graph, and the business requirements are requirements for handling business. A case generation model is constructed, wherein the case generation model is trained using multiple sets of training data, and each set of training data includes historical business requirements, historical knowledge base, historical business rules and historical test cases obtained within a historical time period. The new business requirement is input into the case generation model to obtain the new test case corresponding to the new business requirement; The new business requirement and the corresponding new test case are input into the knowledge graph to obtain an updated knowledge graph. The updated knowledge graph includes at least the business requirement, the test case corresponding to the business requirement, the new business requirement, and the new test case corresponding to the new business requirement. The process involves inputting the new business requirement into the test case generation model to obtain new test cases corresponding to the new business requirement. This includes: using deep learning technology to perform structured processing on the new business requirement to obtain at least one structured requirement, wherein the structured processing involves orderly and standardized decomposition of the new business requirement, and one structured requirement corresponds to one test scenario or one test step; and sequentially inputting all the structured requirements into the test case generation model to obtain all the new test cases corresponding to the new business requirement, wherein one new business requirement corresponds to at least one structured requirement, and one structured requirement corresponds to at least one new test case. The knowledge graph also includes test points, which are tasks for testing a test case. All structured requirements are sequentially input into the test case generation model to obtain all new test cases corresponding to the new business requirements. This includes: searching the knowledge graph for test points corresponding to the structured requirements; if a test point is found, extracting it as a target test point; performing entity recognition on the structured requirements, querying the existing test knowledge graph, and performing differential analysis on all test points to output the test points to be added, modified, or deleted; if a target business with a business similarity greater than a similarity threshold is found, updating the test points of the target business according to the structured requirements to obtain the target test point; if no test point is found, generating the target test point based on the structured requirements; and inputting the target test point into the test case generation model to obtain all new test cases corresponding to the new business requirements.

2. The method according to claim 1, characterized in that, Before acquiring new business requirements, the method further includes: The business data is cleaned to obtain cleaned business data, wherein the business data includes the business requirements and the test cases corresponding to the business requirements; The cleaned business data is validated to obtain validation results, wherein the data validation includes one or more of consistency validation, integrity validation and accuracy validation. If the verification result indicates that the verification has passed, a knowledge base is generated based on the verified business data; if the verification result indicates that the verification has failed, a prompt message is generated.

3. The method according to claim 1, characterized in that, Before constructing the case generation model, the method further includes: A basic model is constructed, wherein the basic model is trained using multiple sets of training data, and each set of training data includes the historical business requirements, the historical knowledge base, the historical business rules, and the historical test cases obtained within a historical time period. The basic model is optimized to obtain the case generation model. The optimization process includes adjusting model parameters, adjusting coverage, and similarity comparison, or one or more of these.

4. The method according to claim 1, characterized in that, After obtaining the new business requirements, the method further includes: Data preparation steps include obtaining structured requirements and obtaining test cases generated by the case generation model; The knowledge extraction step involves obtaining the subject used to construct the knowledge graph, where the subject is the central node in the knowledge graph, and obtaining the association between the business requirements and the test cases. The knowledge fusion step involves fusing the knowledge extracted in the knowledge extraction step. The fusion process includes one or more of relation alignment, relation disambiguation, and relation verification. The knowledge application steps involve constructing a knowledge graph based on the business requirement as the head entity, the test case as the tail entity, and the association relationship as the relation.

5. The method according to claim 4, characterized in that, After constructing the knowledge graph, the method further includes: Obtain query requirements, wherein the query requirements are the requirements to query the business requirements and / or the test cases from the knowledge graph; Based on the keywords in the query request, a keyword search is performed in the knowledge graph to obtain the search results, which are then displayed graphically.

6. A test case generation device based on knowledge graph, characterized in that, include: The first acquisition unit is used to acquire new business requirements, wherein the new business requirements are business requirements not stored in the knowledge graph, and the business requirements are requirements for handling business. The first construction unit is used to construct a case generation model, wherein the case generation model is trained using multiple sets of training data, and each set of training data includes historical business requirements, historical knowledge base, historical business rules and historical test cases obtained within a historical time period. The first processing unit is used to input the new business requirement into the case generation model to obtain the new test case corresponding to the new business requirement. An update unit is used to input the new business requirement and the corresponding new test case into the knowledge graph to obtain an updated knowledge graph, wherein the updated knowledge graph includes at least the business requirement, the test case corresponding to the business requirement, the new business requirement, and the new test case corresponding to the new business requirement; The first processing unit includes a first processing module and a second processing module. The first processing module is used to perform structured processing on the new business requirements using deep learning technology to obtain at least one structured requirement. The structured processing involves orderly and standardized decomposition of the new business requirements, and one structured requirement corresponds to one test scenario or one test step. The second processing module is used to sequentially input all the structured requirements into the case generation model to obtain new test cases corresponding to all the new business requirements. One new business requirement corresponds to at least one structured requirement, and one structured requirement corresponds to at least one new test case. The knowledge graph also includes test points, which are tasks for testing one of the test cases. The second processing module includes a search submodule, a first processing submodule, a second processing submodule, a third processing submodule, and a fourth processing submodule. The search submodule is used to search the knowledge graph for whether there is a test point corresponding to the structured requirement. The first processing submodule is used to extract the test point corresponding to the structured requirement as the target test point when a test point corresponding to the structured requirement is found. The structured requirement is then subjected to entity recognition, and the existing test knowledge graph is queried. The first processing module performs differential analysis on the test points and outputs the test points that need to be added, modified, or deleted. The second processing module updates the test points of the target business according to the structured requirements when a target business with a business similarity greater than a similarity threshold is found, thus obtaining the target test points. The third processing module generates the target test points according to the structured requirements when no test points corresponding to the structured requirements are found. The fourth processing module inputs the target test points into the case generation model to obtain all the new test cases corresponding to the new business requirements.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the knowledge graph-based test case generation method according to any one of claims 1 to 5.

8. A case management system, characterized in that, include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing the knowledge graph-based test case generation method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Test method and system and storage medium

    CN114996160A

  • Extraction method of reusable test case, server and storage medium

    CN115470112A