Financial test case intelligent auditing method based on knowledge graph
By applying intelligent auditing methods based on knowledge graphs in the field of financial testing, the problems of low efficiency of financial test cases, difficulty in semantic matching and insufficient accuracy are solved, and efficient, accurate and standardized test case audits are achieved, reducing costs and improving system reliability.
Patent Information
- Application Number
- CN202411950757.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-11
AI Technical Summary
The audit efficiency of financial test cases is low, difficult to match semantics, and insufficient accuracy, resulting in inconsistent test cases and requirements, and it is impossible to fully cover all business scenarios and boundary conditions.
Using an intelligent audit method based on knowledge graphs, using large language models and knowledge graph technology, we automatically analyze financial test requirements and test cases, build knowledge graphs and semantic matching, and automatically diagnose the semantic inconsistency between errors in test cases and test requirements.
It improves the efficiency and accuracy of test case audits, reduces the cost of manual audits, enhances the standardization and consistency of test cases, and ensures the reliability and security of the system.
Smart Images

Figure CN119807064A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of financial testing, and specifically relates to an intelligent review method for financial test cases based on a knowledge graph. Background Art
[0002] Financial systems involve complex transaction logic, highly sensitive data processing, and strict regulatory requirements. Any minor omissions may lead to serious economic losses, legal risks, or reputational damage. During the development and testing of financial application systems, the goal of test case review is to ensure that the test cases can fully cover the complex requirements of the financial system and are highly consistent with the financial business requirements in logic. However, traditional test case review mainly relies on manual completion, which is inefficient and prone to errors. Especially when faced with the huge requirements documents and complex test cases of the financial system, manual review seems to be stretched.
[0003] Financial application systems are highly complex and risky, involving a large amount of transaction processing, risk control, compliance management, and data analysis. Requirements documents are usually written in complex natural languages, containing professional financial terms and complex business logic. Test cases consist of structured information such as test intent, preconditions, test steps, and expected results. This cross-semantic and cross-structural matching task increases the complexity and difficulty of auditing. Therefore, how to use artificial intelligence technology to achieve intelligent matching and auditing of financial application test cases and requirements has become an urgent problem to be solved.
[0004] By utilizing the natural language processing capabilities of large models and knowledge graph construction technology, it is possible to automatically parse, represent and match test requirements with test cases, thus improving audit efficiency and accuracy. However, in the field of financial application testing, intelligent audit technology for test cases has not yet been widely used.
[0005] The main deficiencies of existing technologies are:
[0006] Low accuracy: Financial requirements documents use professional financial terms and complex natural language descriptions, while test cases are presented in a structured format. Manual comparison is difficult to fully capture the semantics and business logic relationship between the two. Manual review relies on the experience and understanding of testers, which is prone to omissions or misjudgments, resulting in inconsistencies between test cases and test requirements, and failure to fully cover all business scenarios and boundary conditions;
[0007] Poor consistency: Test cases written and reviewed by different testers may have inconsistent styles and standards, which increases the difficulty of subsequent maintenance and management;
[0008] High cost: Manual review of test cases requires a lot of time and human resources, especially in financial applications. The number of test requirements and test cases is huge, and manual methods are difficult to meet project schedule requirements in a timely manner. Financial business requirements change frequently, and test cases need to be updated and adjusted frequently. Manual maintenance methods are labor-intensive, inefficient, and prone to errors. Summary of the invention
[0009] The present invention provides a method for intelligent review of financial test cases based on knowledge graphs, which uses large language models (LLM) and knowledge graph technology to automatically parse financial test requirements and test cases, build knowledge graphs, and perform semantic matching, and automatically diagnose errors in test cases and semantic inconsistencies between test requirements. The invention aims to solve technical problems such as low efficiency of manual review, difficulty in semantic matching, and insufficient accuracy in financial application testing. The technical solution of the present invention is as follows: A method for intelligent review of financial test cases based on knowledge graphs, comprising:
[0010] Step 1: Test requirements analysis;
[0011] Step 2: Test case analysis;
[0012] Step 3: Knowledge graph construction: To achieve semantic matching, the parsed test requirement items and test case information need to be converted into a knowledge graph, thereby establishing a structured semantic network to represent entities and their relationships.
[0013] Step 4: Semantic matching of test requirement items and test cases: After the knowledge graphs of test requirements and test cases are constructed, they need to be matched to determine whether the test cases fully cover the corresponding test requirements and to evaluate the degree of matching.
[0014] As an improvement of the present invention, the step 1 of testing requirement analysis includes:
[0015] Data preprocessing: First, the large language model BERT is used to parse the financial test requirement text and extract the smallest testable requirement items. The extracted test requirement items are expressed in the form of natural language short sentences.
[0016] Requirement item extraction, breaking down complex requirement descriptions into minimum testable requirement items.
[0017] As an improvement of the present invention, the step 2 of test case analysis includes:
[0018] Structured data extraction, since test case documents usually have a fixed format, regular expressions are used to match specific patterns to automatically extract "test intent", "preconditions", "test steps" and "expected results".
[0019] Here is an example:
[0020]
[0021] Data preprocessing,In the data preprocessing stage, the extracted test case text information will be segmented and POS tagged to identify the key actions and objects in the sentence. For example, for the text "user logs in to the system", the segmentation result is "user / login / system", where the action "login" is identified as a verb, and the objects "user" and "system" are tagged as nouns. Subsequently, through entity recognition technology, key entities in the test case are extracted, such as "user", "account balance" and "transfer amount". This process lays the foundation for subsequent semantic analysis and structured processing.
[0022] As an improvement of the present invention, the step 3 of constructing the knowledge graph includes:
[0023] Entity and relationship extraction. In the process of building the knowledge graph, we first use natural language technology to identify key entities in the text; for example, "user", "account", "transfer amount", etc. Then, we identify the relationship between these entities, such as "user" performs "transfer operation" and "account" has "balance", so as to clarify their association logic. In addition, we also need to extract the attribute information of the entity, such as "account balance = 1,000 yuan" or "transfer amount = 500 yuan". The following is an example:
[0024]
[0025] To construct a knowledge graph, the parsed entities are first created as nodes, and corresponding attribute information is attached to improve the expression of the nodes. Then, edges are created based on the semantic relationships between entities to connect related nodes. The relationship types are labeled to accurately describe their associated meanings. Finally, a complete knowledge graph is generated through the combination of nodes and edges to clearly represent the semantic structure of test requirements or test cases.
[0026] Here is an example:
[0027] The test requirement knowledge graph is as follows:
[0028]
[0029] The test case knowledge graph is as follows:
[0030]
[0031] As an improvement of the present invention, the semantic matching of the test requirement items and the test cases in step 4 includes:
[0032] Semantic vectorization first uses Sentence Transformer to vectorize the nodes and edges in the knowledge graph, converting text information into high-dimensional semantic vectors. The names and attributes of the nodes are encoded to generate corresponding semantic vectors to accurately express their semantic information. At the same time, the relationship types of the edges in the graph are encoded to generate semantic vectors of the edges to fully describe the semantic associations between entities. The following is an example: Use Sentence Transformer to encode the node "user" and get the vector V user ; Encode the relation "execution" to obtain the vector V performs .
[0033] Similarity Calculation,In the semantic matching process, the cosine similarity between the,semantic vectors of the corresponding nodes and edges in the test,requirement graph and the test case graph is calculated to,evaluate their matching degree.
[0034] Matching result determination,In the matching result determination stage, a matching threshold is set according to business requirements. When the matching score between the test case and the test requirement is higher than this threshold, the requirement is considered to have been covered.
[0035] As an improvement of the present invention, the data preprocessing in the step 1 test requirement analysis includes:
[0036] Word segmentation: Use Jieba word segmentation tool to split the test requirement text into independent words or phrases; for example, for the requirement text "users can transfer money when their account balance is sufficient", the word segmentation result is "users can transfer money when their account balance is sufficient".
[0037] Part-of-speech tagging, marking the part of speech of each word (such as noun, verb, adjective, etc.) to understand the function of the word in the sentence; example: "user (noun) / in (preposition) / account balance (noun) / sufficient (adjective) / of (particle) / situation (noun) / under (directional word) / can (modal verb) / conduct (verb) / transfer (noun) / operation (noun)".
[0038] Named entity recognition, identifying entities in text, such as "user", "account balance", "transfer operation", etc. This is crucial for understanding key concepts in the financial field; example: identifying the entities "user", "account balance", "transfer operation".
[0039] Syntactic analysis: Through dependency syntactic analysis, we understand the dependency relationship between words in a sentence and build a grammatical structure of the sentence. Example: Identify the subject "user", the predicate "conduct", the object "transfer operation", and the conditional adverbial "under the condition that the account balance is sufficient".
[0040] As an improvement of the present invention, the step of extracting requirement items in the test requirement analysis in step 1 includes:
[0041] Condition identification, locate conditional statements in requirements, such as "under the condition of...", "if...". This helps to clarify the test scenario; example: identify the condition "under the condition of sufficient account balance".
[0042] Action recognition, extracting the specific operations or functions involved in the requirements; example: identifying the operation of "performing a transfer operation".
[0043] Result expectations: clarify the expected results or system behaviors in the requirements; example: expected result: "transfer successful, account balance reduced by the corresponding amount."
[0044] Construct the minimum test requirement entry, combining conditions, actions, and expected results into concise and clear test requirement entries. Example: "When the account balance is sufficient, the user should be able to successfully transfer money and the account balance will decrease accordingly."
[0045] As an improvement of the present invention, in the similarity calculation step, the similarity of the nodes is calculated by formula (1):
[0046] Sim node = cosine_similarity(V node_requirement ,V node_testcase )(1),
[0047] In formula (1), V node_requirement ,V node_testcase Respectively represent the semantic vector of a node in the test requirement knowledge graph
[0048] And the semantic vector of the corresponding node in the test case knowledge graph. At the same time, the similarity of the edge is calculated by formula (2):
[0049] Sim edge = cosine_similarity(V edge_requirement ,V edge_testcase )(2).
[0050] In formula (2), V edge_requirement ,V edge_testcase They represent the semantic vector of an edge in the test requirement knowledge graph and the semantic vector of the corresponding edge in the test case knowledge graph. In formula (1) and formula (2), cosine_similarity represents the cosine similarity. Used to measure the degree of directional similarity between two vectors in high-dimensional space.
[0051] The following is an example: Calculate the similarity of the "user" node in the two graphs. The result is close to 1, indicating a high match. Calculate the similarity of the relationship "execution" in the two graphs to confirm that the relationship types are consistent.
[0052] As an improvement of the present invention, in the similarity calculation step, in order to achieve efficient matching between the test requirement graph and the test case graph, it is necessary to comprehensively consider the node similarity, edge similarity and similarity of the overall graph structure. When the test case graph completely contains all the nodes and relationships of the test requirement graph, it is determined to be a complete match. If the test case graph only partially covers the nodes or relationships of the test requirement graph, it is necessary to calculate the partial matching degree. The matching score is to quantify the overall matching situation by integrating the similarity of the nodes and edges, and is calculated by formula (3):
[0053]
[0054] The following are the definitions of the parameters in formula (3):
[0055] Score:
[0056] Definition: The overall graph matching score is used to quantify the matching degree between the test case knowledge graph and the test requirement knowledge graph.
[0057] Value range: 0≤Score≤1. The higher the score, the higher the matching degree.
[0058] Sim node :
[0059] Definition: The semantic similarity of a node in the test case knowledge graph and the test requirement knowledge graph.
[0060] Calculation method: The similarity between semantic vectors is calculated by cosine similarity. The formula is:
[0061] Sim node = cosine_similarity(V node_requirement ,V node_testcase ),
[0062] Value range: 0≤Sim node ≤1.
[0063] Sim edge :
[0064] Definition: The semantic similarity of an edge in the test case knowledge graph and the test requirement knowledge graph.
[0065] Calculation method: The similarity between edge relationship vectors is calculated using cosine similarity. The formula is:
[0066] Simedge = cosine_similarity(V edge_requirement ,V edge_testcase ),
[0067] Value range: 0≤Sim edge ≤1.
[0068] weight node :
[0069] Definition: The importance weight of a node, which reflects the relative contribution of the node in the matching calculation.
[0070] Note: It can be set according to business needs. For example, the weight of certain key nodes (such as "account" or "transfer amount") can be set to a higher value.
[0071] weight edge :
[0072] Definition: The importance weight of an edge, which reflects the relative contribution of the edge in the matching calculation.
[0073] Note: It can be set according to business needs. For example, the weight of the edge representing the core business logic (such as "transfer amount → must not exceed → account balance") can be set to a higher value.
[0074] Total_nodes:
[0075] Definition: The total number of nodes in the test requirement knowledge graph.
[0076] Description: Used to normalize the matching score to ensure that the score is independent of the scale of the knowledge graph.
[0077] Total_edges:
[0078] Definition: The total number of edges in the test requirement knowledge graph.
[0079] Description: Used to normalize the matching score, and together with Total_nodes, measures the scale of the graph.
[0080] Formula explanation:
[0081] Numerator: It comprehensively considers the similarities of all nodes and edges multiplied by their weights, reflecting the overall matching quality of the knowledge graph.
[0082] Denominator: Normalize with Total_nodes+Total_edges so that the final score ranges from [0, 1], which is convenient for comparing the matching results of graphs of different sizes.
[0083] Weight function: By adjusting weight node and weightedge , can highlight the importance of specific nodes and edges to meet business needs.
[0084] As an improvement of the present invention, in the matching result determination step, for the requirement items that do not reach the matching threshold, they are marked as uncovered, and improvement suggestions are generated according to the specific requirement content, so as to optimize the test case design later. Based on the matching results, a comprehensive test case review report is generated, and improvement suggestions are provided to help testers improve the test cases. The generation of the review report includes the following steps: first, all test requirement items and their corresponding matching analysis results are summarized, and the matching scores and coverage status are sorted. Then, the coverage of the overall test requirements is calculated, which is calculated by formula (4):
[0085]
[0086] Finally, specific suggestions for improvement are provided for requirements that are not covered or have a low degree of match.
[0087] Example:
[0088]
[0089] Compared with the prior art, the beneficial effects of the present invention are as follows: in view of the shortcomings of poor accuracy, low consistency and high cost of existing manual review test cases, the financial test case intelligent review method based on knowledge graph proposed by the present invention realizes efficient, accurate and standardized test case review through automated and intelligent means, reduces costs, improves system reliability, and is expected to improve the efficiency and quality of financial test case review, which is specifically reflected in the following aspects:
[0090] 1) Improve audit efficiency. Traditional manual audit methods are inefficient and difficult to meet the needs of rapid iteration of financial systems. The present invention uses large language models and knowledge graph technology to achieve automatic parsing and matching of test requirements and test cases. By automatically extracting the minimum test requirement items and key elements of test cases and constructing corresponding knowledge graphs, the system can quickly complete the audit process. Compared with manual audits, audit efficiency is greatly improved, significantly reducing manpower and time costs;
[0091] 2) Solve the difficulty of semantic matching. Financial demand documents often contain complex natural language descriptions and professional terms. It is difficult for manual review to accurately capture the semantic relationship between demand and test cases. This invention uses the natural language understanding ability of the large language model to perform deep semantic analysis of financial demand and test cases, and combines the structured representation of the knowledge graph to accurately achieve semantic matching between demand and test cases. It effectively solves the problem of semantic matching difficulties and improves the accuracy and reliability of the review;
[0092] 3) Improve the accuracy of audits. Manual audits are easily affected by subjective factors and may result in omissions or misjudgments. The present invention ensures that test cases fully cover test requirements through automated semantic matching and logical reasoning. The system can identify logical loopholes and deficiencies in test cases, provide improvement suggestions, and reduce the risk of system defects. The audit results are objective and consistent, avoiding errors in manual audits and improving test quality;
[0093] 4) Standardized test cases. Due to differences in experience and understanding among different testers, traditional test cases often have problems with inconsistent formats and standards. This invention adopts a unified knowledge graph representation method to standardize the test intent, preconditions, test steps, and expected results of test cases. This enhances the standardization and consistency of test cases, facilitates team collaboration and subsequent maintenance, and improves the efficiency of test management.
[0094] 5) Reduce maintenance costs. Financial business requirements change frequently, and test cases need to be updated frequently. Manual maintenance is labor-intensive, inefficient, and error-prone. The tool of the present invention has an automatic update function, which can quickly respond to changes in requirements and automatically adjust the knowledge graph and matching results. It reduces the workload of manual maintenance, reduces maintenance costs, and ensures the timeliness and accuracy of the test process;
[0095] 6) Improve system reliability and security. By ensuring that test cases fully cover all test requirements, the present invention reduces system defects and risks. The financial system has extremely high requirements for reliability and security. The present invention improves the depth and breadth of testing, ensures the stable operation of the system, and meets the strict requirements of the financial industry for high-quality software;
[0096] 7) Cost saving: By improving audit efficiency, reducing maintenance costs and reducing manual errors, the present invention saves the cost of testing work as a whole, improves the economic benefits of the project, and has significant commercial value. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] Figure 1 This is a flowchart for intelligent review of financial test cases based on knowledge graph. DETAILED DESCRIPTION
[0098] The present invention will be further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0099] Embodiment: This embodiment provides a method for implementing a financial test case intelligent review tool based on a knowledge graph. Figure 1The entire workflow is shown. After the user uploads the data, the system performs test requirement analysis and test case analysis, generates a knowledge graph and performs semantic matching, and finally generates an audit result. The user views the report and modifies the test case through the interactive interface to form a feedback loop. The core modules of the system include test requirement analysis, test case analysis, knowledge graph construction, semantic matching, and audit result generation; the user function module includes the user interactive interface and its related operations.
[0100] The specific steps include:
[0101] 1. Test requirement analysis: Use the large model BERT to perform natural language processing on the test requirement text, including word segmentation, part-of-speech tagging, entity recognition, and dependency syntax analysis. On this basis, extract the minimum testable requirement items from the complex requirement description, and each item represents an independent test goal. The extracted requirement items are expressed in clear natural language short sentences to ensure clear and unambiguous semantics.
[0102] 2. Test case analysis: The system uses structured information extraction technology to extract key elements such as test intent, preconditions, test steps, and expected results from the document. Subsequently, the extracted information is semantically normalized to unify terminology and expressions and eliminate ambiguity.
[0103] 3. Knowledge graph construction: After further processing of the parsing results, the test requirements and test cases are converted into knowledge graphs respectively. The system extracts entities and relationships from the parsing results, identifying entities (such as accounts, transaction types, amounts) and relationships (such as operations, conditions, results). Then, the system uses entities as nodes and relationships as edges to construct a structured semantic network.
[0104] 4. Semantic matching: In the semantic matching stage, the large model Sentence Transformer is used to vectorize the nodes and edges in the knowledge graph and convert them into high-dimensional semantic vector representations. We use cosine similarity to calculate the semantic similarity between test requirements and test cases. By designing a graph matching algorithm based on the knowledge graph, the node attributes, relationship types, and graph structure are comprehensively considered to accurately evaluate the degree of matching between the two. The matching results are determined based on the set threshold, and the test requirements that are not fully covered are identified and marked.
[0105] 5. Audit result generation: Based on the matching results, the system generates an audit report containing coverage, uncovered requirement items, and recommended test cases for modification.
[0106] To better understand how to match test requirement items and test cases, we will use a specific example to illustrate the whole process. Example background: Suppose we are testing an online banking system, one of the main functions is "user transfer". The test requirement specification describes the process of how users transfer money from one account to another, as well as the business rules and constraints involved. We will collect test requirement specifications related to the "user transfer" function.
[0107] The requirements document may contain the following:
[0108]
[0109] A test case may contain the following:
[0110]
[0111]
[0112] Perform natural language processing on the test requirement text and test cases: First, segment the text into individual words, such as "user", "after login", "transfer operation", etc.; then, perform part-of-speech tagging to mark the part of speech of each word, such as noun, verb, adjective, etc.; then, use entity recognition technology to identify key entities in the text, such as "user", "account", "balance", "payee account number", etc.; finally, apply disambiguation technology to solve the problem that the same word may have multiple meanings to ensure the semantic accuracy of the word. Based on the preprocessing results, extract the entities in the requirements and the relationships between them. Entity extraction includes the following: subjects such as users and systems; objects such as accounts, balances, payee account numbers, transfer amounts, and transaction records; and actions such as login, transfer, input, update, generate, etc. At the same time, relationship extraction specifically includes: operation relationship (for example, the user performs a transfer operation), conditional relationship (for example, the transfer amount must not exceed the account balance), process relationship (for example, transfer can only be performed after logging in), constraint relationship (for example, exceeding the daily limit requires secondary identity verification), and result relationship (for example, after the transfer is successful, the system updates the account balance and generates a transaction record).
[0113] The extracted entities and relationships are organized into a knowledge graph, where the knowledge graph is represented by a directed graph consisting of nodes (entities) and edges (relationships). Nodes represent each entity as a node, such as "user", "transfer operation", "account balance", etc., while edges represent the establishment of directed edges through the relationships between entities and the annotation of relationship types, thereby building a complete semantic network to support the structured representation of test requirements. Through the above steps, test requirements, test cases and background knowledge are integrated to finally build a complete knowledge graph of test requirements as follows:
[0114]
[0115] The knowledge graph of the test case is constructed as follows:
[0116]
[0117] After completing the knowledge graph construction of the test requirement items and test cases, the two need to be aligned to find out the differences between them and identify possible problems in the test cases. The following is the knowledge graph alignment process:
[0118] Node Vectorization
[0119] The nodes in the knowledge graph include "user", "system", "transfer amount", "account balance", "5000" and "secondary identity authentication" of the test requirement knowledge graph, and "user", "system", "transfer operation", "transfer amount (3,000 yuan)", "account (balance = 10,000 yuan)", "payee account number (1234567890)", "account (updated balance = 7,000 yuan)" and "transaction record (transfer amount = 3,000 yuan; payee account number = 1234567890; transaction time = current time)" of the test case knowledge graph.
[0120] Using the Sentence Transformer model, each node is generated into a high-dimensional semantic vector. For example, the vectors generated by "user" and "system" have a high similarity, while "account balance" and "account (balance = 10,000 yuan)" may have a relatively high vector similarity due to their low semantic differences. The vectorized nodes include: user The vector representing “user”, V system The vector representing the “system”, V account_requirement A vector representing the “account balance”, and V account_testcase A vector representing "account(balance=10,000 yuan)".
[0121] Edge Vectorization
[0122] The edges in the knowledge graph include "user→after login→system", "transfer amount→must not exceed→account balance" and "transfer amount→exceeds→5000→requires→secondary identity verification" in the test requirement knowledge graph. The edges in the test case knowledge graph include "user→login→system", "transfer amount→must not exceed→account (balance=10,000 yuan)" and "system→update→account (balance after update=7,000 yuan)". Similarly, the Sentence Transformer is used to vectorize the edge relationships (such as "login", "input", and "must not exceed"). For example, V login The semantic vector representing “login”, Vexceeds Semantic vector representing “exceed”.
[0123] Similarity calculation
[0124] Node similarity calculation uses cosine similarity to compare nodes in the knowledge graph:
[0125] Sim node = cosine_similarity(V node_requirement ,V node_testcase )
[0126] For example, the similarity of the "User" node is Sim user =1; the similarity between "account balance" and "account (balance = 10,000 yuan)" is Sim account ≈0.9; "5000" and "transfer amount (3,000 yuan)" have a low similarity, which is Sim amount ≈0.6.
[0127] Edge similarity calculation For the edges in the knowledge graph, the cosine similarity is also calculated:
[0128] Sim edge = cosine_similarity(V edge_requirement ,V edge_testcase )
[0129] For example, the similarity of “user→login→system” is Sim login ≈0.95; the similarity between “transfer amount → must not exceed → account balance” and “transfer amount → must not exceed → account (balance = 10,000 yuan)” is Sim exceeds =1.
[0130] The comprehensive similarity calculation combines the similarity of nodes and edges to calculate the similarity score of the overall knowledge graph:
[0131]
[0132] Assume node similarity Sim user =1, Sim account =0.9, Sim amount =0.6, edge similarity Sim login =0.95, Sim exceeds =1, the final score is calculated as follows:
[0133]
[0134] The matching threshold is set to 0.8. If the overall score Score ≥ 0.8, it is considered that the test case knowledge graph covers the test requirement knowledge graph.
[0135] Coverage calculation The calculation formula for coverage is as follows:
[0136]
[0137] Assuming that the number of successfully matched nodes is 5 and the total number of requirement items is 6, the coverage is:
[0138]
[0139] Through vectorization of nodes and edges and similarity calculation, this method systematically evaluates the coverage of the test case knowledge graph to the test requirement knowledge graph. The comprehensive score Score≈0.89 indicates that the test case covers the requirements comprehensively.
[0140] It should be noted that the above content only illustrates the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications all fall within the protection scope of the claims of the present invention.
Claims
1. A method for intelligent review of financial test cases based on knowledge graph, characterized in that: The method comprises the following steps: Step 1: Test requirements analysis; Step 2: Test case analysis; Step 3: knowledge graph construction; Step 4: Test requirement items and test case semantic matching.
2. According to claim 1, a financial test case intelligent review method based on knowledge graph is characterized in that: The step 1 of test requirement analysis includes: Data preprocessing: First, use the large language model BERT to parse the financial test requirement text and extract the smallest testable requirement items. The extracted test requirement items are expressed in the form of natural language short sentences. Requirement item extraction, breaking down complex requirement descriptions into minimum testable requirement items.
3. According to claim 1, a financial test case intelligent review method based on knowledge graph is characterized in that: The step 2 test case analysis includes: Structured data extraction: Since test case documents usually have a fixed format, regular expressions are used to match specific patterns to automatically extract "test intent", "preconditions", "test steps" and "expected results"; Data Preprocessing,In the data preprocessing stage, the extracted test case text information,will be segmented and POS tagged to identify key actions and,objects in the sentences.
4. According to claim 1, a financial test case intelligent audit method based on knowledge graph is characterized in that: The step 3 of knowledge graph construction includes: Entity and relationship extraction,In the process of knowledge graph construction, first, the key entities in the text are identified through natural language technology; To construct a knowledge graph, the parsed entities are first created as nodes, and corresponding attribute information is attached to improve the expression of the nodes. Then, edges are created based on the semantic relationships between entities to connect related nodes. The relationship types are labeled to accurately describe their associated meanings. Finally, a complete knowledge graph is generated through the combination of nodes and edges to clearly represent the semantic structure of test requirements or test cases.
5. According to claim 1, a financial test case intelligent audit method based on knowledge graph is characterized in that: The step 4 of testing the semantic matching between the test requirement items and the test cases includes: Semantic vectorization: First, use Sentence Transformer to vectorize the nodes and edges in the knowledge graph, converting text information into high-dimensional semantic vectors. The names and attributes of the nodes are encoded to generate corresponding semantic vectors to accurately express their semantic information. At the same time, the relationship types of the edges in the graph are encoded to generate semantic vectors of the edges to fully describe the semantic associations between entities. Similarity calculation,In the semantic matching process, the cosine similarity between the semantic vectors of corresponding nodes and edges in the test requirement graph and the test case graph is calculated to evaluate their matching degree; Matching result determination,In the matching result determination stage, a matching threshold is set according to business requirements. When the matching score between the test case and the test requirement is higher than this threshold, the requirement is considered to have been covered.
6. According to claim 2, a financial test case intelligent review method based on knowledge graph is characterized in that: The data preprocessing in the step 1 test requirement analysis includes: Word segmentation: Use Jieba word segmentation tool to segment the test requirement text into independent words or phrases; Part-of-speech tagging, marking the part of speech for each word; Named Entity Recognition, identifying entities in text; Syntactic analysis: through dependency syntactic analysis, we understand the dependency relationship between words in a sentence and establish a grammatical structure tree of the sentence.
7. According to claim 2, a financial test case intelligent audit method based on knowledge graph is characterized in that: The step of extracting requirement items in the test requirement analysis in step 1 includes: Condition identification, locating conditional statements in requirements; Action recognition, extracting the specific operations or functions involved in the requirements; Result expectations, clarifying the expected results or system behaviors in the requirements; Construct minimal test requirement items, combining conditions, actions, and expected results into concise and clear test requirement items.
8. According to claim 5, a financial test case intelligent review method based on knowledge graph is characterized in that: In the similarity calculation step, the similarity of the nodes is calculated by formula (1): Sim node =cosine_similarity(V node_requirement ,V node_testcase )(1), In formula (1), V node_requirement , V node_testcase They represent the semantic vector of a node in the test requirement knowledge graph and the semantic vector of the corresponding node in the test case knowledge graph. At the same time, the similarity of the edges is calculated using formula (2): Sim edge =cosine_similarity(V edge_requirement ,V edge_testcase )(2), In formula (2), V edge_requirement ,V edge_testcase They represent the semantic vector of an edge in the test requirement knowledge graph and the semantic vector of the corresponding edge in the test case knowledge graph. In formula (1) and formula (2), cosine_similarity represents the cosine similarity. Used to measure the degree of directional similarity between two vectors in high-dimensional space.
9. According to claim 5, a financial test case intelligent review method based on knowledge graph is characterized in that: In the similarity calculation step, in order to achieve efficient matching between the test requirement graph and the test case graph, it is necessary to comprehensively consider the node similarity, edge similarity and similarity of the overall graph structure. When the test case graph completely contains all the nodes and relationships of the test requirement graph, it is determined to be a complete match. If the test case graph only partially covers the nodes or relationships of the test requirement graph, it is necessary to calculate its partial matching degree. The matching score is to quantify the overall matching situation by integrating the similarity of the nodes and edges, and is calculated by formula (3): The following are the definitions of the parameters in formula (3): Score is the overall graph matching score, which is used to quantify the matching degree between the test case knowledge graph and the test requirement knowledge graph. The value range is 0≤Score≤1. The higher the score, the higher the matching degree. node The semantic similarity of a node in the test case knowledge graph and the test requirement knowledge graph is calculated by using the cosine similarity to calculate the similarity between the semantic vectors. The calculation method is defined as shown in formula (1). node The value range is 0≤Sim node ≤1;Sim edge For the semantic similarity of a certain edge in the test case knowledge graph and the test requirement knowledge graph, we use cosine similarity to calculate the similarity between the relationship vectors of the edges. The calculation method is defined in reference to formula (2). Sim edge The value range is 0≤Sim edge ≤1; weight node is the importance weight of the node, reflecting the relative contribution of the node in the matching calculation. edge is the importance weight of the edge, reflecting the relative contribution of the edge in the matching calculation; Total_nodes is the total number of nodes in the test requirement knowledge graph, and Total_edges is the total number of edges in the test requirement knowledge graph. The numerator in formula (3) comprehensively considers the similarity of all nodes and edges multiplied by their weights, and the denominator is normalized by Total_nodes+Total_edges, so that the final score ranges from [0 to 1].
10. According to claim 5, a financial test case intelligent review method based on knowledge graph is characterized in that: In the matching result determination step, the requirement items that do not reach the matching threshold are marked as uncovered, and improvement suggestions are generated based on the specific requirement content to facilitate subsequent optimization of the test case design. Based on the matching results, a comprehensive test case review report is generated, and improvement suggestions are provided to help testers improve the test cases. The generation of the review report includes the following steps: First, all test requirement items and their corresponding matching analysis results are summarized, and the matching scores and coverage status are sorted out. Then, the coverage of the overall test requirement is calculated using formula (4): Finally, specific suggestions for improvement are provided for requirements that are not covered or have a low degree of match.
Citation Information
Cited By
Clinical test data verification method and system based on modular architecture
CN120376004A
Test method and test system for railway signal safety system software
CN121116837A
A test method and test system for railway signal safety system software
CN121116837B