A financial service testing method, device, equipment, medium and product

CN122795751APending Publication Date: 2026-09-22INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610624251.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-08
Publication Date
2026-09-22

AI Technical Summary

Technical Problem

一方面,测试用例多由人工手动编写,需投入大量人力梳理业务逻辑、设计测试场景,整体效率低下,难以适配金融系统快速迭代、频繁更新的研发节奏,易造成测试周期冗长

Benefits of technology

[0010]本申请实施例的技术方案中,过融合待测试项目源代码、金融业务规则逻辑树、状态机转换图及合规约束逻辑表达式,并借助金融知识图谱辅助生成输入向量,可驱动生成器自动完成测试用例生成,显著解决人工生成测试用例效率低下、周期长、成本高的问题。该方式生成的测试用例能够反映金融业务在代码逻辑、业务规则、流程时序、合规约束等多维度的潜在问题,对各类条件分支、规则组合、状态转换及合规风险点的覆盖性大幅提升,可有效避免人工设计带来的场景缺失与漏测风险,使测试覆盖更完整、更均衡。整体方案无需人工干预即可自动生成高覆盖度测试用例,显著提升金融系统测试的全面性、充分性与有效性,从而保障业务逻辑准确与合规运行。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122795751A_ABST
    Figure CN122795751A_ABST
Patent Text Reader

Abstract

The application discloses a kind of financial service test method, device, equipment, medium and product, involve the field of financial technology.Therein method includes: obtaining the source code of target financial institution's to-be-tested item, the business rules and state machine conversion graph of to-be-tested item corresponding financial business, and the compliance constraint information of target financial institution;According to the compliance logic expression corresponding to source code, the logic tree of business rule, state machine conversion graph and compliance constraint information, and the financial institution knowledge graph corresponding to target financial institution pre-constructed, determine the input vector for generating test case;Input vector and random noise are input into pre-trained case generator, to generate test case using case generator;Test case is input to to-be-tested item and is tested.The application scheme can improve the coverage of test point of test user under the premise of guaranteeing test case generation efficiency, improve the comprehensiveness and effectiveness of financial system test.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of financial technology, and in particular to a testing method, apparatus, equipment, medium, and product for financial business. Background Technology

[0002] In the field of software testing, test case generation for banking and other financial business systems still largely relies on traditional methods, which have significant drawbacks. On the one hand, test cases are mostly written manually, requiring a large investment of manpower to sort out business logic and design test scenarios, resulting in low overall efficiency and difficulty in keeping up with the rapid iteration and frequent updates of financial systems, easily leading to lengthy testing cycles.

[0003] On the other hand, manually designed test cases are limited by personal experience and thinking, and the business scenarios they cover are relatively simple. They are insufficient in covering complex key scenarios and cannot cover all kinds of potential test points in the financial system while ensuring the efficiency of test case generation. They are prone to omissions and missing tests, making it difficult to ensure the correctness of system functions, the rationality and integrity of business logic, and compliance with the necessary conditions. They cannot meet the high reliability and high security testing requirements of the financial field. Summary of the Invention

[0004] This application provides a testing method, apparatus, equipment, medium, and product for financial services, which can improve the coverage of test points by test users while ensuring the efficiency of test case generation.

[0005] According to one aspect of this application, a testing method for financial transactions is provided, comprising: Obtain the source code of the project to be tested from the target financial institution, the business rules and state machine transition diagram of the corresponding financial business of the project to be tested, and the compliance constraint information of the target financial institution; Based on the source code, the logic tree of business rules, the state machine transition diagram, and the compliance logic expression corresponding to the compliance constraint information, as well as the pre-built financial institution knowledge graph corresponding to the target financial institution, the input vector for generating test cases is determined. Input vectors and random noise are fed into a pre-trained test case generator to enable the test case generator to generate test cases; Input the test cases into the project to be tested.

[0006] According to another aspect of this application, a testing apparatus for financial operations is provided, comprising: The business information acquisition module is used to acquire the source code of the project to be tested from the target financial institution, the business rules and state machine transition diagram of the financial business corresponding to the project to be tested, and the compliance constraint information of the target financial institution. The input vector determination module is used to determine the input vectors for generating test cases based on the source code, the logic tree of business rules, the state machine transition diagram and the compliance logic expression corresponding to the compliance constraint information, as well as the pre-built financial institution knowledge graph corresponding to the target financial institution. The test case generation module is used to input the input vector and random noise into a pre-trained test case generator so that the test case generator can generate test cases. The test case project testing module is used to input test cases into the project to be tested.

[0007] According to another aspect of this application, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the financial business testing method described in any embodiment of this application.

[0008] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the test method for financial business described in any embodiment of this application.

[0009] According to another aspect of this application, a computer program product is provided, the computer program product including a computer program that, when executed by a processor, implements a testing method for financial transactions according to any embodiment of this application.

[0010] In the technical solution of this application embodiment, by integrating the source code of the project under test, the logic tree of financial business rules, the state machine transition diagram, and the logical expressions of compliance constraints, and with the assistance of a financial knowledge graph to generate input vectors, the generator can automatically generate test cases, significantly solving the problems of low efficiency, long cycle, and high cost of manually generating test cases. The test cases generated in this way can reflect potential problems in financial business in multiple dimensions such as code logic, business rules, process sequence, and compliance constraints. The coverage of various condition branches, rule combinations, state transitions, and compliance risk points is greatly improved, which can effectively avoid the risk of missing scenarios and missed tests caused by manual design, making the test coverage more complete and balanced. The overall solution can automatically generate high-coverage test cases without manual intervention, significantly improving the comprehensiveness, sufficiency, and effectiveness of financial system testing, thereby ensuring the accuracy and compliant operation of business logic.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart of a testing method for a financial business according to Embodiment 1 of this application; Figure 2 This is a flowchart of a testing method for a financial business according to Embodiment 2 of this application; Figure 3 This is a schematic diagram of the structure of a testing device for financial business provided according to Embodiment 3 of this application; Figure 4 This is a schematic diagram of the structure of an electronic device that implements the testing method for financial services according to the embodiments of this application. Detailed Implementation

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

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

[0016] Example 1 Figure 1This application provides a flowchart of a testing method for financial services, as shown in Embodiment 1. This embodiment is applicable to testing the software configurations of business systems of banks and financial institutions. The method can be executed by a financial services testing device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes: S110. Obtain the source code of the project to be tested from the target financial institution, the business rules and state machine transition diagram of the financial business corresponding to the project to be tested, and the compliance constraint information of the target financial institution.

[0017] The target financial institution can be any financial institution that needs software testing. A financial institution can be any unit or organization that needs to implement financial business, such as a bank. The project to be tested can be any business project that the target financial institution needs to test. Of course, a project to be tested may be configured with multiple software programs to handle the business. The business rules can be the business process specifications for the financial business corresponding to the project to be tested during execution; that is, a certain financial business must be executed according to this process.

[0018] A state machine transition diagram can be a diagram recording the state transitions of a business process. It's understood that a financial transaction often involves multiple parties, such as banks, users, and regulators. Therefore, different actions like submission, approval, rejection, or execution require the responsibility of each party, leading to changes in the corresponding business state. The information about these changes in the state machine during the state transition process is recorded in the state machine transition diagram. Compliance constraints can be the rules that the target financial institution must follow in implementing financial transactions. It's understood that because the financial industry is subject to strict regulation, there are mandatory compliance guidelines. These financial transactions can only be carried out within the scope of compliance constraints. Therefore, during testing, if test cases do not comply with compliance constraints, the project under test should report the violation to demonstrate that the project under test has the corresponding violation detection capabilities.

[0019] S120. Based on the source code, the logic tree of business rules, the state machine transition diagram, and the compliance logic expression corresponding to the compliance constraint information, as well as the pre-built financial institution knowledge graph corresponding to the target financial institution, determine the input vector used to generate test cases.

[0020] The business rule logic tree can be used to represent the tree-structured data information of the sequential order of business processes. The compliance logic expression can be the logical expression corresponding to compliance constraints. Compliance constraints, as terms that must be followed, cannot be directly applied to a computer system. Therefore, the conditions defined by these compliance constraints are transformed into logical expressions, making them easier to deploy in a computer system to verify compliance obligations during the execution of financial transactions based on triggering conditions.

[0021] A financial institution knowledge graph can be a pre-constructed knowledge graph based on all business operations and the institution's inherent attributes and information within the target financial institution. This knowledge graph allows users to query all entities related to the target financial institution and the relationships between them.

[0022] It is understandable that source code, logic trees of business rules, state machine transformation diagrams, and compliance roadmap expressions can all be converted into vector forms to participate in the computation of the computer system. A financial institution knowledge graph can help the project under test find the entities corresponding to financial businesses and the relationships between them. Based on these entities and relationships, it can assist in adjusting the vector weights of the source code, logic trees of business rules, state machine transformation diagrams, and compliance roadmap expressions after they have been converted into vectors, highlighting the more important parts in the knowledge graph, such as the compliance and business processes of the financial business that still require special attention. Therefore, the source code, logic trees of business rules, state machine transformation diagrams, and compliance roadmap expressions can all be converted into vector forms first, and then the weights of these four types of vectors can be adjusted according to the financial institution knowledge graph, finally merging them to generate the input vector. The fusion method can be weighted fusion, such as weighting first and then concatenating the vectors, etc., which is not limited in this embodiment.

[0023] S130. Input the input vector and random noise into the pre-trained test case generator so that the test case generator can generate test cases.

[0024] The input vector generated in the preceding steps is used as input to a pre-trained generator, which generates test cases for testing the item to be tested.

[0025] S140. Input the test cases into the project to be tested and perform the test.

[0026] The test cases generated in the preceding steps are input into the project under test for testing to verify whether the project under test can provide feedback on the issues in the test cases, thereby verifying whether the project under test has the ability to handle or provide feedback on issues of different dimensions based on the feedback issues.

[0027] In the technical solution of this application embodiment, by integrating the source code of the project under test, the logic tree of financial business rules, the state machine transition diagram, and the logical expressions of compliance constraints, and with the assistance of a financial knowledge graph to generate input vectors, the generator can automatically generate test cases, significantly solving the problems of low efficiency, long cycle, and high cost of manually generating test cases. The test cases generated in this way can reflect potential problems in financial business in multiple dimensions such as code logic, business rules, process sequence, and compliance constraints. The coverage of various condition branches, rule combinations, state transitions, and compliance risk points is greatly improved, which can effectively avoid the risk of missing scenarios and missed tests caused by manual design, making the test coverage more complete and balanced. The overall solution can automatically generate high-coverage test cases without manual intervention, significantly improving the comprehensiveness, sufficiency, and effectiveness of financial system testing, thereby ensuring the accuracy and compliant operation of business logic.

[0028] Example 2 Figure 2 This is a flowchart illustrating a testing method for financial transactions provided in Embodiment 2 of this application. This embodiment further refines the input vector determination operation based on the foregoing embodiments. Figure 2 As shown, the method includes: S210. Obtain the source code of the project to be tested from the target financial institution, the business rules and state machine transition diagram of the financial business corresponding to the project to be tested, and the compliance constraint information of the target financial institution.

[0029] S220. Generate high-dimensional feature vectors based on source code, logic tree, state machine transition diagram, and compliant logic expression.

[0030] This involves performing vector transformations on the source code, logic tree, state machine transition diagram, and compliance logic expression to obtain four types of low-dimensional vectors. Of course, the vector transformation can employ the same or different methods, such as, but not limited to, semantic embedding algorithms and graph embedding algorithms. After processing these four different types of low-dimensional vectors through dimensional alignment and / or semantic alignment, the high-dimensional feature vector is obtained. This high-dimensional feature vector includes all information from the source code, the logic tree of business rules, the state machine transition diagram, and the compliance logic expression of compliance constraints.

[0031] S230. In the knowledge graph of financial institutions, locate the four types of nodes corresponding to source code, business rules, state machine transition diagrams, and compliance constraint information.

[0032] Specifically, source code, business rules, state machine transition diagrams, and compliance constraint information can all be found as corresponding nodes in the financial institution knowledge graph. For example, entities or nodes corresponding to source code can include code repositories, code files, modules, classes, functions, interface endpoints, and database scripts; entities or nodes corresponding to business rules can include rule conditions, rule actions, rule sets, decision tables, and rule engines; entities or nodes corresponding to state machine transition diagrams can include the state machine itself, the source event of the state change, and the action of the state change; entities or nodes corresponding to compliance constraint information can include regulatory requirements, compliance obligations, prohibited behaviors, and compliance thresholds. This application embodiment does not exhaustively list the entities or nodes in the aforementioned financial institution knowledge graph. These four categories of nodes are found through the retrieval function of the financial knowledge graph.

[0033] S240. Statistically analyze the influencing factor indicators of each type of node in the four types of nodes, and determine the weight enhancement vector corresponding to the high-dimensional feature vector based on each influencing factor indicator.

[0034] Among these, the influencing factor indicators can be the basis for assessing the magnitude of a node's impact on the target financial institution or financial business. For example, these can include, but are not limited to, the complexity of node associations in a knowledge graph. It is understood that if a node in a financial institution's knowledge graph is associated with many other nodes, it indicates a high level of importance. Changes in the attributes of this node in actual business operations may have a ripple effect on many other business aspects. Therefore, the complexity of these associations can be used as one of the influencing factor indicators. Of course, influencing factor indicators can also be other types of indicators, which are not exhaustively listed in this application.

[0035] Correspondingly, the weight enhancement vector can be a vector that adjusts the high-dimensional feature vector. It is used to differentiate the weights of four types of low-dimensional vectors representing source code, business rules, state machine transition diagrams, and compliance constraint information within the high-dimensional feature vector, thereby emphasizing the importance of one or more of these low-dimensional vectors. The weight proportions are obtained by quantifying the influencing factor indicators for each of the four types of nodes, and the weights corresponding to the four types of nodes are combined to form a weight vector. Of course, any of the relevant technologies can be used to quantify the influencing factor indicators, such as numericalization and normalization; this embodiment does not limit this approach.

[0036] S250. Determine the input vector based on the high-dimensional feature vector and the weight enhancement vector.

[0037] The high-dimensional feature vector and the weight-enhanced vector can be fused. Specifically, each feature element in the high-dimensional feature vector corresponding to the four types of nodes is multiplied by each weight element in the weight-enhanced vector corresponding to the four types of nodes, and then recombined into a vector to obtain the input vector. Alternatively, the high-dimensional feature vector and the weight-enhanced vector can be directly used as the input vector. Of course, this requires setting up a similar process for processing the high-dimensional feature vector and the weight-enhanced vector during the training of the use case generator. This application does not limit this approach.

[0038] S260. Input the input vector and random noise into the pre-trained test case generator so that the test case generator can generate test cases.

[0039] S270. Input the test cases into the project to be tested and perform the test.

[0040] In the technical solution of this application embodiment, feature weights are adaptively determined based on the influencing factor indicators of four types of nodes in the financial institution knowledge graph. A weight-enhanced vector is constructed to weight and fuse high-dimensional feature vectors, highlighting the feature expressions of core financial elements such as business rules and compliance constraints, making the model more focused on high-value testing scenarios. This method can dynamically adjust feature emphasis according to different business scenarios, avoiding the weakening of key information caused by equalizing feature information, and improving the ability of the input vector to represent the characteristics of financial businesses. Simultaneously, the weighting process requires no manual intervention, ensuring objective and reasonable weight allocation, making the generated test cases more aligned with financial business logic and regulatory requirements, further improving the accuracy and comprehensiveness of test coverage, and enhancing test effectiveness.

[0041] In one optional implementation, the step of statistically analyzing the influencing factor indicators for each type of node among the four types of nodes in S240 may include: Count the number of nodes, in-degree, out-degree, and level depth of each type of node. Accordingly, the determination of the weight enhancement vector corresponding to the high-dimensional feature vector based on each influencing factor index, as described in S240, may include: S241. Calculate the influence weight of each type of node based on the number of nodes, in-degree of nodes, out-degree of nodes, and node level depth.

[0042] The number of nodes can be the number of nodes involved in each of the four node categories. For example, source code in a financial institution knowledge graph may involve multiple related nodes; the number of these nodes is counted as the number of nodes corresponding to the source code dimension. The other three dimensions are calculated similarly. The in-degree of a node can be the number of edges pointing to that node; similarly, the out-degree of a node can be the number of edges pointing from that node to other nodes. The node's depth can be the level in the knowledge graph's tree structure. It can be understood that a higher in-degree indicates that the node is used more frequently and is more core to the system; a higher out-degree indicates that the node has a wider impact and stronger control over business processes; and a greater depth indicates that the rules or constraints corresponding to that node are more refined, specific, and logically complex. For each node category corresponding to each dimension, the number of nodes, in-degree, out-degree, and depth are normalized to obtain the influence weight for each dimension.

[0043] S242. Combine the various influencing weights into a weight enhancement vector.

[0044] The influence weights obtained in the previous steps are combined to generate a weight enhancement vector.

[0045] In the above implementation, the influence weights of each type of node are calculated based on four indicators: number of nodes, in-degree, out-degree, and node level depth, and a weight enhancement vector is constructed. This objectively quantifies the importance of features from multiple dimensions, such as coreity, scope of influence, and structural complexity, avoiding evaluation bias caused by a single indicator. This method automatically highlights high-value features such as core business rules and key compliance constraints, making feature weighting more aligned with the actual laws of financial business, without requiring manual subjective setting. Through the fusion calculation of multi-dimensional indicators, the rationality and accuracy of feature weight allocation are effectively improved, enhancing the representational ability of the input vector, thereby making the generated test cases more targeted and significantly improving the comprehensiveness and accuracy of test coverage.

[0046] In another optional implementation, the step of generating a high-dimensional feature vector based on the source code, logic tree, state machine transition diagram, and compliant logic expression in S220 may include: S221. Based on the preset abstract syntax tree algorithm, perform syntax structure analysis on the source code and generate the first basic vector corresponding to the source code.

[0047] The first basic vector can be a low-dimensional vector corresponding to the source code dimension. A pre-defined abstract syntax tree algorithm is used to analyze the syntax structure of the source code, resulting in structured tree-like logical structure data. Then, a pre-defined tree embedding algorithm is used to transform the tree-like logical structure data into vector form, which serves as the first basic vector.

[0048] S222. Based on the preset tree-shaped long short-term memory network, convert the logic tree into the second basic vector corresponding to the business rules.

[0049] The second basic vector can be a low-dimensional vector corresponding to the business rule dimension. The logic tree itself is a tree-shaped logical structure data carrying business rules. According to the tree-shaped long short-term memory network (or other tree embedding algorithm), the logic tree is converted into vector form, which serves as the second basic vector.

[0050] S223. Based on the preset graph embedding algorithm, the state machine transition diagram is mapped to a low-dimensional vector space for representation, and the third basic vector corresponding to the state machine transition diagram is obtained.

[0051] The third fundamental vector can be a low-dimensional vector corresponding to the state machine transition diagram. The state machine transition diagram includes all possible changes of the state machine. Through a preset graph embedding algorithm, the state machine transition diagram is mapped to a low-dimensional vector space, thus transforming it into a vector form, which is the third fundamental vector.

[0052] S224. Convert the compliant logic expression into a symbol sequence, and convert the symbol sequence into the fourth basic vector corresponding to the compliant logic expression according to the preset word embedding algorithm.

[0053] The fourth basic vector can be a low-dimensional vector corresponding to the dimension of compliance constraint information. Variables, operators, thresholds, and logical connectors in the compliance logic expression are separated into independent units according to semantic order and arranged in their original logical order to form a symbol sequence. Then, a preset word embedding algorithm is used to transform the symbol sequence into a vector form, which is the fourth basic vector.

[0054] S225. Merge the first, second, third, and fourth basic vectors into a high-dimensional feature vector.

[0055] The first, second, third, and fourth basic vectors determined in the preceding steps are encoded with the preset embedding models of various countries into low-dimensional vectors of the same dimension to achieve dimension alignment. Then, they are concatenated to obtain the high-dimensional feature vector.

[0056] In the above implementation, features are extracted from the source code, business rule logic tree, state machine transition diagram, and compliance logic expression to generate corresponding low-dimensional vectors, which are then fused to form a high-dimensional feature vector. This approach can comprehensively characterize the core features of the tested financial system from multiple levels, including code implementation, business logic, state transition, and compliance constraints. Unified vectorization processing of multi-source heterogeneous structures can fully retain key information from each dimension, avoiding information loss caused by single features. Through structured-to-vector conversion, unstructured and semi-structured business information can be digitally expressed, providing accurate and comprehensive input support for the automatic generation of subsequent test cases. This effectively improves the completeness and relevance of test coverage, further enhancing test efficiency and sufficiency.

[0057] In another alternative implementation, the use case generator can be determined in the following way: A1. Obtain historical data from the target financial institution; the historical data includes the source code of the project to be tested in the historical period, the business rules and state machine transition diagram of the financial business corresponding to the project to be tested, and the compliance constraint information of the target financial institution.

[0058] To train a generator capable of producing test cases, the system requires the source code of the project under test from historical periods, the business rules and state machine transition diagrams of the corresponding financial transactions, and the compliance constraint information of the target financial institution. This information serves as the foundation for training.

[0059] A2. Based on historical data, generate a training vector set for training the preset initial generator.

[0060] The data obtained in step A1 are converted into vector form. The conversion method has been described above and can be referenced here, so it will not be repeated. These converted vector data are used as the training set, i.e., the training vector set. The initial generator is the basic generator that has not yet been trained.

[0061] A3. Input each training vector in the training vector set into the initial generator so that the initial generator generates initial test cases and inputs the initial test cases into the preset initial discriminator.

[0062] In this embodiment, an adversarial generative network training method is adopted. Each training vector in the training vector set is input into the initial generator (currently, random noise can also be input to facilitate the initial generator to randomly generate test cases). The initial generator generates initial test cases, which are then input into the initial discriminator. The initial discriminator identifies the initial test cases and judges the similarity of the initial test cases to actual business events, and outputs the corresponding discrimination result.

[0063] A4. Based on the discrimination results output by the initial discriminator, train the generator until it converges to obtain a trained test case generator.

[0064] The discrimination result is fed back to the initial generator, enabling it to adjust its generator parameters to improve the similarity of subsequently generated test cases to actual business events. The preset initial generator and initial discriminator used in this embodiment can be any form of generative adversarial network in the relevant field; this embodiment is not limited in this regard. It should be noted that, for testing the project under test, positive and negative examples of test cases can be generated separately. Positive examples can be normal, non-violation-free business events, while negative examples can be problematic business events that violate business processes or compliance constraints. The simultaneous existence of positive and negative examples allows for the verification of the software's business processing capabilities in the project under test using two different business examples, effectively covering the test points.

[0065] In the above implementation, the use of adversarial generative networks for test case generation enables the generator and discriminator to automatically learn the distribution of financial business characteristics through adversarial iteration, autonomously generating diverse and high-coverage test cases, eliminating reliance on manual design and significantly improving test case generation efficiency. At the same time, it can effectively uncover boundary scenarios, abnormal scenarios, and complex combination scenarios that are difficult to cover manually, enhancing the richness and relevance of test cases, improving test comprehensiveness, and ensuring the stability and reliability of the system under complex business logic.

[0066] In a further optional embodiment, the discrimination result is the evaluation score of the initial discriminator on the initial use case; wherein, the evaluation score can be the scoring result of the initial use case after the initial discriminator is pre-set to a scoring mechanism. For example, the similarity or realism percentage between the initial use case and the real example can be converted into an evaluation score according to a preset rule. This application embodiment does not limit the conversion method of the evaluation score.

[0067] The step A4 of the aforementioned implementation, which involves training the generator based on the discrimination result output by the initial discriminator until convergence to obtain a trained use case generator, may include: B1. Convert the evaluation score into a reward signal and calculate the policy gradient based on the preset near-end policy optimization algorithm.

[0068] The reward signal can be the input to the near-end policy optimization algorithm. It should be noted that the initial discriminator's evaluation score for the test cases can be used as the base reward score. This score is then normalized and weighted based on the test cases' coverage of business rules, state transitions, and compliance constraints, and mapped to the reinforcement learning reward signal. A higher discriminator score indicates stronger authenticity and reasonableness of the generated initial test cases, resulting in a higher reward signal value; conversely, a lower discriminator score indicates weaker authenticity and reasonableness of the generated initial test cases, resulting in a lower reward signal value. These two scenarios can be used for generating positive and negative examples, respectively. This allows the discriminator's evaluation to guide the generator's continuous optimization, improving the effectiveness and coverage of test cases.

[0069] The proximal policy optimization algorithm can address the instability and inefficiency of traditional policy gradient training methods. Its core idea is to limit the magnitude of each policy update, ensuring that the new policy does not differ excessively from the old policy, thereby achieving stable and gradual optimization. For example, it can be implemented by pruning the surrogate objective function or using adaptive KL divergence penalties, but this application does not impose any limitations on these methods.

[0070] A reward signal is constructed using the evaluation score output by the discriminator and the test coverage results. Based on the near-end policy optimization algorithm, the policy gradient is calculated with the goal of maximizing the cumulative reward, and the direction and update magnitude of parameter optimization are obtained.

[0071] B2. Based on the policy gradient, determine the policy adjustment parameters and map the policy adjustment parameters to the update parameters of the initial generator.

[0072] The updated parameters determine whether the initial generator can generate better test cases in the next training round compared to the previous round. Based on this policy gradient, the policy network parameters are iteratively updated to obtain the optimized policy adjustment parameters. These policy adjustment parameters are then transformed into parameter update increments for the generator through a fully connected mapping layer, driving the generator to complete weight updates.

[0073] B3. Based on the updated parameters, iteratively train the initial generator.

[0074] Based on the parameters determined in the aforementioned steps, iterative training is conducted round after round, repeating the parameter update and adjustment process of the initial generator until convergence and training ends.

[0075] B4. If the rate of change of the reward signal is less than a preset convergence threshold for a consecutive preset number of iterations, the trained test case generator is determined.

[0076] The rate of change of the reward signal can be the change of the reward signal over multiple consecutive periods, and the convergence threshold can be the basis for judging training convergence. In this embodiment, the convergence condition for iterative training is that the rate of change of the reward signal remains stable within the convergence threshold over several consecutive iteration periods. Of course, the specific number of iteration periods and the convergence threshold can be preset by relevant technical personnel based on extensive experiments or manual experience, and this application embodiment does not limit this.

[0077] This application introduces an adversarial generative network (GAN) that can be used in this application. The GAN may include a condition generator, a multimodal discriminator, and adversarial training units.

[0078] The condition generator can employ an improved long short-term memory network structure, using the input vector... As conditional inputs, they are mapped to input space distribution parameters through a fully connected layer, generating test input data that conforms to the source code input constraints. ; A multimodal discriminator can contain two sub-discriminators, one of which is used to determine the authenticity of the input data and distinguish between real test inputs. With the generation input Secondly, it is used to determine the matching degree between the generated input and semantic features, and output the discrimination probability. Match score ; Adversarial training units can construct a bi-objective loss function to optimize the parameters of the generator and discriminator. The loss function is: in, To combat the loss, the cross-entropy loss function is used: For semantic matching loss, cosine similarity loss is used. , (to generate semantic features corresponding to the input). This is a balancing coefficient used to adjust the importance of semantic matching.

[0079] The system automatically loads the target program's runtime dependencies, configures memory allocation and process permission parameters for the test execution environment, and ensures consistency. A multi-threaded scheduling mechanism is used to inject test input, monitor resource usage during execution, and record program running status, including normal termination and abnormal crashes. Code instrumentation techniques are used to collect path coverage information, identify executed and uncovered branches, parse exception logs to obtain defect trigger locations and types, and extract auxiliary indicators such as execution time and input redundancy.

[0080] Transform path coverage information into coverage improvement rate , The ratio of the current number of covered branches to the historical highest value; converting defect discovery results into defect weight values. , Assign values ​​based on defect severity; convert input redundancy into redundancy penalty values. , Specifically, this refers to the proportion of input paths that are repeatedly covered. Then, a linear weighted formula is used to generate the reinforcement learning reward signal: in, The baseline coverage improvement rate is set to 0 initially. , , The index weighting coefficients are optimized using the gradient descent method to maximize defect detection efficiency. The final reward signal is indicated by a positive value, which means the generation strategy is effective, and a negative value, which means the generation direction needs to be adjusted.

[0081] Preferably, the generator parameters of the generative adversarial network are mapped to the agent policy parameters of the reinforcement learning. The generator parameters include the weights of the long short-term memory and the bias of the fully connected layer; the policy parameters are updated using a near-end policy optimization algorithm, based on the reward signal. The strategy gradient is calculated, and the response weights of the generator to semantic features are adjusted to optimize the generated input towards high coverage and high defect detection rate. The rate of change of the reward signal is monitored for three consecutive iterations. When the rate of change is less than a preset threshold, the generation strategy is determined to have converged, and parameter updates are stopped.

[0082] In the above implementation, the discriminator evaluation score is converted into a reinforcement learning reward signal. A proximal policy optimization algorithm is used to train the generator, and the stability of the reward signal's rate of change is used as the training convergence criterion. This ensures a stable and efficient training process, avoiding model oscillations or failures caused by excessive parameter updates, and allows the generator to continuously optimize towards high-reward, high-quality test cases. Using the stability of the reward signal's rate of change as the convergence criterion automatically determines when training is complete, improving training efficiency and stability, optimizing the quality of generated test cases, and ensuring stable and reliable test case generation.

[0083] Example 3 Figure 3 This is a schematic diagram of a testing device for financial transactions provided in Embodiment 3 of this application. Figure 3 As shown, the device 300 includes: The business information acquisition module 310 is used to acquire the source code of the project to be tested of the target financial institution, the business rules and state machine transition diagram of the financial business corresponding to the project to be tested, and the compliance constraint information of the target financial institution. The input vector determination module 320 is used to determine the input vector for generating test cases based on the source code, the logic tree of business rules, the state machine transition diagram and the compliance logic expression corresponding to the compliance constraint information, as well as the pre-built financial institution knowledge graph corresponding to the target financial institution. The test case generation module 330 is used to input the input vector and random noise into a pre-trained test case generator so that the test case generator can generate test cases. Test Case Project Test Module 340 is used to input test cases into the project to be tested.

[0084] In the technical solution of this application embodiment, by integrating the source code of the project under test, the logic tree of financial business rules, the state machine transition diagram, and the logical expressions of compliance constraints, and with the assistance of a financial knowledge graph to generate input vectors, the generator can automatically generate test cases, significantly solving the problems of low efficiency, long cycle, and high cost of manually generating test cases. The test cases generated in this way can reflect potential problems in financial business in multiple dimensions such as code logic, business rules, process sequence, and compliance constraints. The coverage of various condition branches, rule combinations, state transitions, and compliance risk points is greatly improved, which can effectively avoid the risk of missing scenarios and missed tests caused by manual design, making the test coverage more complete and balanced. The overall solution can automatically generate high-coverage test cases without manual intervention, significantly improving the comprehensiveness, sufficiency, and effectiveness of financial system testing, thereby ensuring the accuracy and compliant operation of business logic.

[0085] In one alternative implementation, the input vector determination module 320 may include: The high-dimensional vector determination unit is used to generate high-dimensional feature vectors based on source code, logic tree, state machine transition diagram and compliant logic expression; The four types of node positioning units are used to locate the four types of nodes corresponding to source code, business rules, state machine transition diagrams, and compliance constraint information in the knowledge graph of financial institutions. The weight vector determination unit is used to statistically analyze the influencing factor indicators of each type of node in the four types of nodes, and determine the weight enhancement vector corresponding to the high-dimensional feature vector based on each influencing factor indicator. The input vector determination unit is used to determine the input vector based on the high-dimensional feature vector and the weight enhancement vector.

[0086] In one optional implementation, the weight vector determination unit may include: The node information statistics subunit is used to count the number of nodes, in-degree, out-degree, and level depth of each type of node. The influence weight determination sub-unit is used to calculate the influence weight of each type of node based on the number of nodes, node in-degree, node out-degree, and node level depth. The enhancement vector determines the sub-unit, which is used to combine the various influence weights into a weight enhancement vector.

[0087] In one optional implementation, the high-dimensional vector determination unit may include: The first vector generation subunit is used to perform syntactic structure analysis on the source code according to the preset abstract syntax tree algorithm and generate the first basic vector corresponding to the source code. The second vector generation subunit is used to convert the logic tree into the second basic vector corresponding to the business rule according to the preset tree-shaped long short-term memory network. The third vector generation subunit is used to map the state machine transition diagram to a low-dimensional vector space for representation according to a preset graph embedding algorithm, so as to obtain the third basic vector corresponding to the state machine transition diagram. The fourth vector generation subunit is used to convert the compliant logic expression into a symbol sequence, and according to the preset word embedding algorithm, convert the symbol sequence into the fourth basic vector corresponding to the compliant logic expression. The high-dimensional vector determines the sub-unit, which is used to fuse the first, second, third, and fourth basic vectors into a high-dimensional feature vector.

[0088] In one alternative embodiment, the device 300 may include a use case generator training module, which may include: The historical data acquisition unit is used to acquire historical data of the target financial institution. The historical data includes the source code of the project to be tested in the historical period, the business rules and state machine transition diagram of the financial business corresponding to the project to be tested, and the compliance constraint information of the target financial institution. The training set generation unit is used to generate a training vector set for training a preset initial generator based on historical data. The vector input unit is used to input each training vector in the training vector set into the initial generator so that the initial generator generates initial test cases and inputs the initial test cases into the preset initial discriminator; The test case generator training unit is used to train the generator until convergence based on the discrimination results output by the initial discriminator, thus obtaining a trained test case generator.

[0089] In one optional implementation, the discrimination result is the evaluation score of the initial discriminator for the initial use case; the use case generator training unit may include: The policy gradient determination subunit is used to convert the evaluation score into a reward signal and calculate the policy gradient based on a preset proximal policy optimization algorithm. The update parameter determination subunit is used to determine the policy adjustment parameters based on the policy gradient and map the policy adjustment parameters to the update parameters of the initial generator; The iterative training subunit is used to iteratively train the initial generator based on the updated parameters; The use case generator determination subunit is used to determine the trained use case generator in response to the rate of change of the reward signal being less than a preset convergence threshold for a consecutive preset number of iteration cycles.

[0090] The testing apparatus for financial services provided in this application can execute the testing methods for financial services provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the testing methods for each financial service.

[0091] Example 4 Figure 4 A schematic diagram of an electronic device 10, which can be used to implement embodiments of this application, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.

[0092] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory 12 or a random access memory 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the read-only memory 12 or loaded from storage unit 18 into the random access memory 13. The random access memory 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, read-only memory 12, and random access memory 13 are interconnected via a bus 14. An input / output interface 15 is also connected to the bus 14.

[0093] Multiple components in electronic device 10 are connected to input / output interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0094] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, central processing units, graphics processing units, various special-purpose artificial intelligence computing chips, various processors running machine learning model algorithms, digital signal processors, and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as testing methods for financial transactions.

[0095] In some embodiments, the testing method for financial transactions may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via read-only memory 12 and / or communication unit 19. When the computer program is loaded into random access memory 13 and executed by processor 11, one or more steps of the testing method for financial transactions described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the testing method for financial transactions by any other suitable means (e.g., by means of firmware).

[0096] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays, application-specific integrated circuits (ASICs), application-specific standard products (ASICs), system-on-a-chip (SoCs), payload programmable logic devices (PLCs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0097] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0098] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, optical fibers, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0099] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a monitor with a cathode ray tube or liquid crystal display) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0100] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0101] A computing system can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product within the cloud computing service system to address the shortcomings of traditional physical hosts and virtual private servers, such as high management difficulty and weak business scalability.

[0102] This application also discloses a computer program product, which includes a computer program that, when executed by a processor, implements the financial business testing method provided in any embodiment of this application. This program product and the financial business testing methods disclosed in the embodiments of this application belong to the same inventive concept, and therefore will not be described in detail here.

[0103] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.

[0104] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A testing method for financial transactions, characterized in that, include: Obtain the source code of the project to be tested from the target financial institution, the business rules and state machine transition diagram of the financial business corresponding to the project to be tested, and the compliance constraint information of the target financial institution; Based on the source code, the logic tree of the business rules, the state machine transition diagram, and the compliance logic expression corresponding to the compliance constraint information, as well as the pre-built financial institution knowledge graph corresponding to the target financial institution, the input vector for generating test cases is determined. The input vector and random noise are input into a pre-trained test case generator so that the test case generator generates test cases; The test cases are input into the project to be tested.

2. The method according to claim 1, characterized in that, The step of determining the input vector for generating test cases based on the source code, the logic tree of the business rules, the state machine transition diagram, the compliance logic expression corresponding to the compliance constraint information, and the pre-constructed financial institution knowledge graph corresponding to the target financial institution includes: Based on the source code, the logic tree, the state machine transition diagram, and the compliance logic expression, a high-dimensional feature vector is generated. In the knowledge graph of the financial institution, locate the four types of nodes corresponding to the source code, the business rules, the state machine transition diagram, and the compliance constraint information, respectively; The influencing factor indicators of each of the four types of nodes are statistically analyzed, and the weight enhancement vector corresponding to the high-dimensional feature vector is determined based on each of the influencing factor indicators. The input vector is determined based on the high-dimensional feature vector and the weight enhancement vector.

3. The method according to claim 2, characterized in that, The statistical analysis of influencing factors for each of the four types of nodes includes: Calculate the number of nodes, in-degree, out-degree, and level depth of each type of node. Accordingly, determining the weight enhancement vector corresponding to the high-dimensional feature vector based on each of the influencing factor indicators includes: The influence weights of each type of node are calculated based on the number of nodes, the in-degree of nodes, the out-degree of nodes, and the level depth of nodes. The aforementioned influence weights are combined into the weight enhancement vector.

4. The method according to claim 2, characterized in that, The step of generating a high-dimensional feature vector based on the source code, the logic tree, the state machine transition diagram, and the compliant logic expression includes: Based on a preset abstract syntax tree algorithm, the source code is subjected to syntactic structure analysis to generate the first basic vector corresponding to the source code; Based on a pre-defined tree-structured long short-term memory network, the logic tree is converted into a second basic vector corresponding to the business rule; According to the preset graph embedding algorithm, the state machine transition graph is mapped to a low-dimensional vector space for representation, thereby obtaining the third basic vector corresponding to the state machine transition graph; The compliance logic expression is converted into a symbol sequence, and the symbol sequence is converted into the fourth basic vector corresponding to the compliance logic expression according to a preset word embedding algorithm. The first basic vector, the second basic vector, the third basic vector, and the fourth basic vector are fused into the high-dimensional feature vector.

5. The method according to any one of claims 1-4, characterized in that, The use case generator is determined in the following way: Obtain historical data of the target financial institution; wherein, the historical data includes the source code of the project to be tested in a historical period, the business rules and state machine transition diagram of the financial business corresponding to the project to be tested, and the compliance constraint information of the target financial institution; Based on the historical data, a training vector set is generated for training a preset initial generator; Each training vector in the training vector set is input into the initial generator so that the initial generator generates initial use cases, and the initial use cases are input into a preset initial discriminator; Based on the discrimination result output by the initial discriminator, the generator is trained until convergence, resulting in the trained use case generator.

6. The method according to claim 5, characterized in that, The discrimination result is the evaluation score of the initial discriminator for the initial use case; The step of training the generator until convergence based on the discrimination result output by the initial discriminator to obtain the trained use case generator includes: The evaluation score is converted into a reward signal, and the policy gradient is calculated based on a preset near-end policy optimization algorithm. Based on the policy gradient, determine the policy adjustment parameters and map the policy adjustment parameters to the update parameters of the initial generator; The initial generator is iteratively trained based on the updated parameters; If the rate of change of the reward signal is less than a preset convergence threshold for a consecutive preset number of iterations, the test case generator is determined to be trained.

7. A testing device for financial operations, characterized in that, include: The business information acquisition module is used to acquire the source code of the project to be tested from the target financial institution, the business rules and state machine transition diagram of the financial business corresponding to the project to be tested, and the compliance constraint information of the target financial institution. The input vector determination module is used to determine the input vector for generating test cases based on the source code, the logic tree of the business rules, the state machine transition diagram, the compliance logic expression corresponding to the compliance constraint information, and the pre-built financial institution knowledge graph corresponding to the target financial institution. The test case generation module is used to input the input vector and random noise into a pre-trained test case generator so that the test case generator generates test cases; The test case project testing module is used to input the test cases into the project to be tested for testing.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the test method for financial transactions according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the test method for the financial business as described in any one of claims 1-6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the testing method for financial transactions according to any one of claims 1-6.