A method, apparatus, electronic device, and storage medium for updating a test rule base.
By obtaining the branch condition value sequence of the program under test, and using a preset correlation analysis model and transaction rule template to update the test rule base, the problem of testers updating the rule base is solved, realizing automated and timed program analysis, and improving the completeness and timeliness of the rule base.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AGRICULTURAL BANK OF CHINA
- Filing Date
- 2022-10-25
- Publication Date
- 2026-06-30
AI Technical Summary
In the financial system, testers lacking technical backgrounds often struggle to effectively update the test rule base, leading to omissions and errors in rule input, which in turn affects the integrity and soundness of assets.
By obtaining the branch condition value sequence of the program under test, the input parameter value sequence is determined using a preset correlation analysis model, and test rules are generated according to a preset transaction rule template to update the test rule library, thus realizing an automated and timed closed loop of program analysis.
This reduces the chances of incorrect or missing rules, improves the timeliness of testing and the quality of rule base assets, and enhances the timeliness and completeness of the rule base.
Smart Images

Figure CN115599679B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for updating a test rule base. Background Technology
[0002] Currently, the business of the financial system is complex and ever-changing. In order to ensure that the business rules are complete, timely, and easy for project personnel to find and learn, the financial system has begun to establish a proprietary test rule knowledge base and accumulate test assets.
[0003] In existing technologies, traditional test analysis and test rule knowledge base maintenance mostly involve sorting out business requirements, analyzing business rules through communication with business and development personnel, and finally maintaining the rule base after stable production deployment to form asset accumulation. However, if the project is a refactoring or optimization project without business requirements, and there are changes in testers or non-technical personnel who are not familiar with the project's code, and there is limited time for project communication, it will be difficult to obtain a basis for test analysis. Updates to the rule base may also suffer from omissions, errors, and outdated rules, thus affecting the integrity and soundness of the assets. How to intelligently recommend new or modified test rules in the test rule knowledge base for testers without technical backgrounds in such situations, using existing test cases, is a problem of significant research value. Summary of the Invention
[0004] In view of this, the present invention provides a method, apparatus, electronic device and storage medium for updating a test rule base, which can realize an automated and timed closed loop of program analysis, enabling testers to analyze the updated code according to the recommended rule templates, reducing the probability of incorrect or missing rule input, enhancing the timeliness and completeness of testing work, and improving the quality of rule base assets.
[0005] According to one aspect of the present invention, an embodiment of the present invention provides a method for updating a test rule base, the method comprising:
[0006] Obtain the sequence of branch condition values for the program under test;
[0007] The input parameter value sequence corresponding to the branch condition value sequence is determined according to the preset correlation analysis model, wherein the preset correlation analysis model is generated based on a training set containing historical input parameter value sequences and program branch condition value sequences covering the program;
[0008] Test rules are generated based on the input parameter value sequence and the preset transaction rule template to update the test rule library.
[0009] According to another aspect of the present invention, embodiments of the present invention also provide a test rule base update apparatus, the apparatus comprising:
[0010] The acquisition module is used to acquire the sequence of branch condition values of the program under test;
[0011] The determination module is used to determine the input parameter value sequence corresponding to the branch condition value sequence according to the preset correlation analysis model, wherein the preset correlation analysis model is generated based on a training set containing historical input parameter value sequences and program branch condition value sequences covering the program;
[0012] The update module is used to generate test rules based on the input parameter value sequence and the preset transaction rule template to update the test rule library.
[0013] According to another aspect of the present invention, embodiments of the present invention also provide an electronic device, the electronic device comprising:
[0014] At least one processor; and
[0015] A memory communicatively connected to the at least one processor; wherein,
[0016] 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 rule base update method according to any embodiment of the present invention.
[0017] According to another aspect of the present invention, embodiments of the present invention also provide a computer-readable storage medium storing computer instructions for causing a processor to execute and implement the test rule base update method described in any embodiment of the present invention.
[0018] The technical solution of this invention involves obtaining the branch condition value sequence of the program under test, determining the corresponding input parameter value sequence based on a preset correlation analysis model, and generating test rules to update the test rule base based on the input parameter value sequence and a preset transaction rule template. This invention achieves an automated and timed closed-loop program analysis, allowing testers to analyze updated code according to recommended rule templates, reducing the probability of incorrect or missing rule input, enhancing the timeliness and completeness of testing, and improving the quality of the rule base assets.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, 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 the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A flowchart illustrating a test rule base update method according to an embodiment of the present invention;
[0022] Figure 2 A flowchart illustrating another test rule base update method provided in an embodiment of the present invention;
[0023] Figure 3 This is a structural block diagram of a test rule base update device provided in an embodiment of the present invention;
[0024] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0025] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first," etc., in the specification, claims, and accompanying drawings of this invention 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 embodiments of the invention 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 a 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.
[0027] In one embodiment, Figure 1 This is a flowchart of a test rule base update method according to an embodiment of the present invention. This embodiment is applicable to the situation of intelligent automatic update of the test rule base. The method can be executed by a test rule base update device, which can be implemented in hardware and / or software and can be configured in an electronic device.
[0028] like Figure 1 As shown, the specific steps include:
[0029] S110. Obtain the sequence of branch condition values for the program under test.
[0030] Here, the branch condition value sequence can be understood as a new code branch condition value sequence, which contains new state parameters and corresponding transaction results. For example, the branch condition value sequence of the program under test can be 06, indicating that the account state is dormant, and the corresponding transaction result is transaction failure.
[0031] In this embodiment, when a branch condition value sequence of the program under test is input into the computer, the computer can automatically identify the branch condition value sequence. The uploaded branches of the program under test can be captured in real time, or they can be captured at fixed intervals within a set time period to obtain the corresponding condition value sequence from the branches. Of course, the number of branch condition value sequences of the program under test can be one or more.
[0032] In one embodiment, the branch condition value sequence of the program under test includes at least: the state parameter value sequence corresponding to the branch of the program under test and the transaction result parameter value sequence.
[0033] In this embodiment, the sequence of state parameter values can be understood as the sequence of conditional values corresponding to the transaction state parameters. For example, the sequence of state parameter values corresponding to the branch of the program under test are 00, 01, and 02, where 00 represents the state of a recommended user, 01 represents the state of a normal user, 02 represents the state of a dormant user, and so on. The sequence of transaction result parameter values can be understood as the sequence of parameter values corresponding to the transaction result. For example, the sequence of transaction result parameter values are 0 and 1, where 0 represents the transaction result as a failed transaction, 1 represents the transaction result as a successful transaction, and so on.
[0034] S120. Determine the input parameter value sequence corresponding to the branch condition value sequence according to the preset correlation analysis model, wherein the preset correlation analysis model is generated based on the training set containing the historical input parameter value sequence and the program branch condition value sequence covering the program.
[0035] The pre-defined correlation analysis model can be understood as establishing a mapping relationship between the historical input parameter value sequence and the branch coverage condition value sequence of the covered code, obtained through machine learning. The historical input parameter value sequence can be understood as the historical input parameter value sequence extracted from existing test cases, test rules, and other documents related to the corresponding transactions. The program branch condition value sequence can be understood as the branch coverage condition value sequence obtained using code coverage detection technology. The input parameter value sequence can be understood as the parameter value sequence corresponding to the branch condition value sequence of the program under test.
[0036] In this embodiment, a preset correlation analysis model, obtained based on a training set containing historical input parameter value sequences and program branch condition value sequences, can be used to determine the input parameter value sequence corresponding to the branch condition value sequence. This can be understood as follows: when the branch condition value sequence of the program under test is input into the preset correlation analysis model, the trained preset correlation analysis model can reversely generate the corresponding input parameter value sequence.
[0037] In one embodiment, the training process of the preset correlation analysis model includes:
[0038] Extract the program code corresponding to the test transactions of historical projects in the training set;
[0039] Based on a preset code coverage detection tool, at least one program branch covered by the program code is determined, wherein the program branch includes at least the status parameters and transaction result parameters corresponding to the test transactions of the historical project;
[0040] Extract pre-configured test cases that match the program branches;
[0041] Search the preset test rule library for the test rule corresponding to the pre-configured test case;
[0042] A preset machine learning model is trained based on the historical input parameter value sequence of the test rules and the program branch condition value sequence of the program branch as a preset correlation analysis model.
[0043] Historical project test transactions can be understood as existing transaction test cases. Pre-set code coverage testing tools are currently a major technical means and approach to achieve accurate testing. The proportion and extent to which source code in a program is tested is called code coverage, which can be used to quantify code test coverage, allowing testers to intuitively identify uncovered code branches. Pre-configured test cases can be understood as pre-configured test cases, which can be cases written by humans based on historical transactions, etc. Pre-set test rule bases can be understood as rule bases corresponding to existing test cases.
[0044] In this embodiment, a preset machine learning model is used to map at least one program branch covered by the program code to the test rules, so as to obtain a correlation model between the historical input parameter value sequence of the test rules and the program branch condition value sequence of the program branches.
[0045] In this embodiment, the content of the pre-configured test cases corresponding to the program branches may include, but is not limited to, user description, transaction type, test case attributes, test phase, test case priority, test case number, description of the steps corresponding to the executed program, and description of expected results. The content of the test rules in the preset test rule library corresponding to the pre-configured test cases includes, but is not limited to, the module to which the business belongs, transaction name, transaction code, program name, test rule number, test rule name and description, test coverage items, corresponding functional test case number, test rule status, and the update time corresponding to the test rule. It should be noted that the test case number in the pre-configured test cases corresponds to the corresponding functional test case number of the test rules. The test rule in the preset test rule library can be found by matching the test case number with the corresponding functional test case number.
[0046] In this embodiment, code version management tools can be used to acquire the program code of each transaction related to project testing, extract the program code corresponding to historical project test transactions in the training set, and then use code coverage detection tools to determine at least one program branch covered by the acquired program code. This program branch includes at least the state parameters and transaction result parameters corresponding to the historical project test transactions. The mapping relationship between the program branches and pre-configured test cases is determined. Each test case corresponds to a specific test user ID. The mapping relationship between test rules in the preset test rule base and each test case can be determined based on the test case ID, thus forming a mapping relationship between program branches, pre-configured test cases, and test rules. Mapping program branches and test rules using a machine learning model can be understood as training the mapping relationship between the sequence of program branch condition values corresponding to the input program branch and the sequence of historical input parameter values corresponding to the test rule. This mapping relationship includes at least the state parameters and transaction result parameters corresponding to the test transactions. The association model between the historical input parameter value sequence corresponding to the test rule and the sequence of program branch condition values corresponding to the program branch is extracted as a preset association analysis model, and this preset association analysis model is placed into the test rule knowledge base.
[0047] S130. Generate test rules based on the input parameter value sequence and preset transaction rule template to update the test rule library.
[0048] The preset transaction rule template can be understood as a pre-set recommended template for transaction rules. This preset transaction rule template can be set based on experience or customized manually; this embodiment does not impose any restrictions on this.
[0049] In this embodiment, the corresponding test rule update content can be determined by inputting a sequence of parameter values. Based on this, the test rule update content is inserted into a preset transaction rule template to update the test rule library. In some embodiments, a test rule template can also be generated based on the test rule framework, test rule data, and test rule conditions. The update content corresponding to the input parameter value sequence can then be placed into the test rule template for a full update operation. It should be noted that the content in the preset transaction rule template includes, but is not limited to, the module to which the business belongs, the transaction name, the transaction code, the program name, the test rule number, the test rule name and description, the test coverage items, the corresponding functional test case number, the test rule status, and the update time corresponding to the test rule.
[0050] In one embodiment, the content of the preset transaction rule template includes at least one of the following: the module to which the business belongs, the transaction name, the transaction code, the program name, the test rule number, the test rule name and description, the test coverage items, the corresponding functional test case number, the test rule status, and the update time corresponding to the test rule.
[0051] In this embodiment, the input parameter value sequence is converted into a test rule description according to a preset transaction rule template, and intelligent recommendations are made in the test rule library. This can be understood as inserting the test update content corresponding to the input parameter value sequence obtained from the analysis of a preset correlation analysis model—including the module to which the business belongs, transaction name, transaction code, program name, test rule number, test rule name and description, test coverage items, corresponding functional test case number, test rule status, and the update time corresponding to the test rule—into the preset transaction rule template.
[0052] The technical solution of this invention uses a preset correlation analysis model to determine the input parameter value sequence corresponding to the branch condition value sequence. Based on the input parameter value sequence and the preset transaction rule template, test rules are generated to update the test rule library, realizing an automated and timed closed loop of program analysis. This allows testers to analyze the updated code according to the rule template recommendations, reducing the probability of incorrect or missing rule input, enhancing the timeliness and completeness of testing work, and improving the quality of rule library assets.
[0053] In one embodiment, after generating test rules based on the input parameter value sequence and a preset transaction rule template to update the test rule base, the method further includes:
[0054] Based on the update notification information of the test rule base issued by the project management tool, the updated test rule base is intelligently recommended;
[0055] The new test rule base is displayed intelligently to enable testers to refine and modify it.
[0056] Here, "project management tools" refers to tools used to manage the test rule base. "New test rule base" refers to the test rule base that has undergone intelligent updates.
[0057] In this embodiment, update notifications for the test rule base are sent via project management tools, intelligently recommending the updated test rule base. This allows testers to see the machine-generated updated test rule base due to code updates. Testers can then view the intelligently displayed new test rule base and decide whether to refine the updated information corresponding to the newly added code analysis. This assists relevant testing and business personnel in updating related documentation, reducing the communication costs of developers explaining code to testers, and improving the timeliness, completeness, and intelligence of the test rule knowledge base, making the work of organizing test rules and documentation more efficient and comprehensive. Of course, the rules confirmed to be added to the test rule base can be used as data for the next machine learning iteration, further improving the completeness and accuracy of machine learning.
[0058] In one embodiment, Figure 2 This is a flowchart of another test rule base update method provided in an embodiment of the present invention. Based on the above embodiments, this embodiment further refines the process of obtaining the branch condition value sequence of the program under test and generating test rules based on the input parameter value sequence and the preset transaction rule template to update the test rule base.
[0059] like Figure 2 As shown, the test rule base update method in this embodiment may specifically include the following steps:
[0060] S210: Capture uploaded branches of the program under test in real time or at regular intervals.
[0061] The program branch under test can be understood as some code branches newly added by the user. The program branch under test contains new status parameters and corresponding condition results. For example, the new status parameter is 08 for frozen account status and 0 for transaction failure condition result.
[0062] In this embodiment, there are two ways to obtain the branch of the program under test. One is to automatically capture newly uploaded program branches by developers in real time as the branch of the program under test. The other is to capture uploaded program branches under test periodically by setting a corresponding time interval. It should be noted that the time interval can be set manually and can be set according to the time granularity. For example, by obtaining the branch in real time, at least one branch of the program under test corresponding to program A, which summarizes the user balance of an application, can be obtained.
[0063] S220. Extract the corresponding condition value sequence from the branches of the program under test as the branch condition value sequence of the program under test.
[0064] In this embodiment, the condition value sequence corresponding to each branch of the program under test can be extracted from the branches of the program under test, and the condition value sequence is used as the condition value sequence of the program under test branch. For example, the program under test branch corresponding to program A that applies the account balance aggregation is described as follows: if the branch status parameter is 08, it means that all accounts are closed, and the transaction result is 1, which means that the balance aggregation failed.
[0065] S230. Determine the input parameter value sequence corresponding to the branch condition value sequence according to the preset correlation analysis model, wherein the preset correlation analysis model is generated based on a training set containing the historical input parameter value sequence and the program branch condition value sequence covering the program.
[0066] S240. Extract the test rule update content corresponding to the input parameter value sequence.
[0067] The test rule update content can be understood as the rule update content corresponding to the current input parameter value sequence.
[0068] In this embodiment, after generating the input parameter value sequence corresponding to the branch condition value sequence based on the preset correlation analysis model, the test rule update content corresponding to it is determined from the input parameter value sequence. Of course, the specific information of the test rule update content includes, but is not limited to, the module to which the business belongs, the transaction name, the transaction code, the program name, the test rule number, the test rule name and description, the test coverage items, the corresponding functional test case number, the test rule status, the update time corresponding to the test rule, etc.
[0069] S250. Insert the updated test rules into the preset transaction rule template to update the test rule library.
[0070] In this embodiment, by extracting the test rule update content corresponding to the input parameter value sequence, the test rule update content can be inserted into the preset transaction rule template, so as to update the test rule library according to the corresponding content in the preset transaction rule template. For example, program A, which applies the individual account balance summary, adds an account status of "fully closed account". At this time, based on the input parameter value sequence obtained from the preset correlation analysis model and the preset transaction rule template, the test rule library can intelligently recommend an updated test rule library to the testers. That is, on the basis of the original test rule library, various information corresponding to the fully closed account status is added. The business module corresponding to this status is accounting, the transaction name is "application for individual account balance summary", the transaction code is ×××××001, the program name is A, the test rule number is ABC-YY71-004, the test rule name and description are "08 fully closed account balance summary failed", the test coverage is batch import into the pending account information table, the status is "08 fully closed account balance not summarized", the corresponding function test case number is ABC-YY71-000003, the test rule status is "pending confirmation", and the update time of the test rule is 20220221.
[0071] The technical solution described in this embodiment determines the input parameter value sequence corresponding to the branch condition value sequence through a preset correlation analysis model, extracts the test rule update content corresponding to the input parameter value sequence, and inserts the test rule update content into a preset transaction rule template to update the test rule library. This further realizes an automated and timed closed loop of program analysis, enabling testers to analyze the updated code according to the rules recommended by the rule template, reducing the probability of incorrect or missing rules, enhancing the timeliness and completeness of testing work, and improving the quality of rule library assets.
[0072] In one embodiment, to facilitate a better understanding of the test rule base update method, this embodiment prepares the data required by the machine learning model, then uses the machine learning model to train a mapping relationship between the branch coverage condition value sequence of the covered code and the historical input parameter value sequence of the test rules. Finally, it obtains the branch condition value sequence of the program under test, uses the trained machine learning model to determine the input parameter value sequence corresponding to the branch condition value sequence, and finally generates test rules based on the input parameter value sequence and a preset transaction rule template to update the test rule base. This embodiment can be used as a preferred embodiment to further illustrate the test rule base update method.
[0073] In this embodiment, an automated and timed closed-loop program analysis is achieved through the following steps: "Acquiring historical project transaction procedures, acquiring existing test cases, program branches corresponding to historical project transaction procedures, acquiring corresponding test rules, mapping program branches to test rules using machine learning, periodically capturing the branch condition value sequence of the program under test, and intelligently recommending and updating rules." This allows testers to promptly identify rule changes based on the analysis results, thereby updating the knowledge base and achieving an agile development-testing cycle. This results in more complete program coverage, improves communication efficiency among project stakeholders, and enhances the quality of assets such as the rule base. Specifically, the steps of acquiring historical project transaction procedures, acquiring existing test cases, acquiring program branches corresponding to historical project transaction procedures, and mapping program branches to test rules using machine learning involve inputting relevant data into a machine learning model for machine learning. The step of periodically capturing the branch condition value sequence of the program under test and intelligently recommending and updating rules involves using a trained machine learning model to intelligently update the test rule base. The following will further explain the test rule base update method from two aspects: the implementation scheme of the training process and the implementation scheme of using a pre-trained preset correlation analysis model to determine the input parameter value sequence corresponding to the branch condition value sequence of the program under test, so as to generate test rules based on the input parameter value sequence and the preset transaction rule template to update the test rule base.
[0074] In this embodiment, the specific implementation scheme of the training process is as follows:
[0075] a1. Using a code version management tool, obtain the program code for the relevant transactions of the project test one by one. For example, obtain a program A that summarizes the account balance.
[0076] a2. Obtaining existing test cases, project history transaction procedures, corresponding program branches, and corresponding test rules: Based on the historical execution of existing test cases, use code coverage detection tools to determine at least one program branch covered by the program code, determine the mapping relationship between existing test cases and program branches, and find the test rules in the preset test rule library corresponding to the existing test cases based on the test case numbers of the existing test cases, so as to obtain the mapping relationship between existing test cases, at least one program branch, and test rules.
[0077] For example, Table 1 shows test cases for the program branches corresponding to the application of summarizing individual account balances. The above application A for summarizing individual account balances corresponds to two program branches. For the three different account states (01 for normal accounts, 06 for dormant accounts, and 00 for recommended accounts), the transaction results have two branches: balance summarization is possible, and balance summarization is not possible (a transaction result of 1 indicates balance summarization is possible, and a transaction result of 0 indicates balance summarization is not possible). Test cases for the corresponding program branches for summarizing individual account balances are shown in Table 1:
[0078] Table 1: Test cases for program branches corresponding to the application of individual account balance aggregation
[0079]
[0080] Table 2 lists the test rules in the preset test rule library corresponding to the test cases. The existing test cases correspond to the following test rules in the preset test rule library:
[0081] Table 2: Test Rules in the Pre-set Test Rule Library Corresponding to Test Cases
[0082]
[0083] a3. Training a Machine Learning Model for Program Branch-Test Rule Mapping: All historical transactions to be modified, extracted from existing test cases and test rules, are used as the historical input parameter value sequence for the test rules. Then, based on the code coverage of existing test cases, the condition value sequence for code branch coverage is obtained. A mapping relationship is established between the historical input parameter value sequence and the code branch coverage condition value sequence of the covered code. This mapping relationship is then used to train a machine learning model, thereby extracting the correlation model between input parameters and branch condition parameters as a preset correlation analysis model, which is then placed into the test rule knowledge base.
[0084] In this embodiment, the specific steps for using a pre-trained preset correlation analysis model to determine the input parameter value sequence corresponding to the branch condition value sequence of the program under test, and to generate test rules based on the input parameter value sequence and the preset transaction rule template to update the test rule base are as follows:
[0085] b1. Periodically capture updated code: Periodically obtain the sequence of branch condition values of the program under test.
[0086] b2. Based on the branch condition value sequence of the program under test and the trained preset correlation analysis model, generate the input parameter value sequence of the transaction in reverse.
[0087] b3. Intelligent Recommendation and Update Rules: Based on preset transaction rules, a template is generated and converted into test rule descriptions, including transaction name, transaction code, program name, rule-related content, corresponding examples, update date, etc., which are then recommended in the test rule library. The test rule update content corresponding to the input parameter value sequence is extracted; this update content is then inserted into the preset transaction rule template to update the test rule library.
[0088] b4. Send update notifications for the test rule base through project management tools so that testers can see the rule updates recommended by machine intelligence due to code updates. Testers can then decide whether to make detailed modifications and assist relevant testers and business personnel in updating relevant documents. The test rules added to the test rule base after confirmation can be used as material for the next machine learning session to further improve the completeness and accuracy of machine learning.
[0089] For example, Table 3 shows the updated test rule base after a new account status was added to application A, which aggregates individual account balances. Based on machine learning results, the test rule base can now intelligently recommend rows corresponding to the last row in Table 3 to testers.
[0090] Table 3 shows the updated test rule base after Program A, which uses the individual account balance summary function, added a new account status.
[0091]
[0092] In this embodiment, historical transaction-related procedures for project testing are obtained using code version management tools. Existing test cases are mapped to program branches using code coverage detection tools. Since test cases and test rules have a one-to-one correspondence, records of the correspondence between test rules and program branches can be easily extracted. Machine learning is then applied to the existing test rule and program branch coverage records in the test rule base to form a test rule knowledge base mapping code branches to test rules. Preset transaction rule templates are embedded in the bank's project management tools. Each system maintains a rule base. By periodically capturing code branches uploaded by developers, the branch condition value sequence of the program under test is obtained. A pre-trained preset correlation analysis model is used for intelligent recommendations. This preset correlation analysis model is stored in the test rule knowledge base, and testers determine its accuracy. Test rules added to the test rule base after confirmation can serve as training datasets for the next machine learning iteration, further improving the completeness and accuracy of machine learning. This method reduces the communication costs of developers explaining code to testers, improves the timeliness, completeness, and intelligence of the test rule knowledge base, and makes test rule and documentation organization more efficient and comprehensive.
[0093] In one embodiment, Figure 3 This is a structural block diagram of a test rule base update device according to an embodiment of the present invention. This device is suitable for intelligent and automatic updates of the test rule base and can be implemented in hardware or software. It can be configured in an electronic device to implement a test rule base update method according to an embodiment of the present invention. Figure 3 As shown, the device includes: an acquisition module 310, a determination module 320, and an update module 330.
[0094] Among them, the acquisition module 310 is used to acquire the branch condition value sequence of the program under test;
[0095] The determining module 320 is used to determine the input parameter value sequence corresponding to the branch condition value sequence according to the preset correlation analysis model, wherein the preset correlation analysis model is generated based on a training set containing historical input parameter value sequences and program branch condition value sequences;
[0096] The update module 330 is used to generate test rules based on the input parameter value sequence and the preset transaction rule template to update the test rule library.
[0097] In this embodiment of the invention, the determining module uses a preset correlation analysis model to determine the sequence of input parameter values corresponding to the sequence of branch condition values, and the updating module generates test rules based on the sequence of input parameter values and a preset transaction rule template to update the test rule library. This achieves an automated and timed closed loop of program analysis, allowing testers to analyze the updated code according to the rules recommended by the rule template, reducing the probability of incorrect or missing rules, enhancing the timeliness and completeness of testing work, and improving the quality of the rule library assets.
[0098] In one embodiment, the module further includes:
[0099] The notification module is used to send update notification information corresponding to the test rule library according to the project management tool after generating test rules based on the input parameter value sequence and the preset transaction rule template to update the test rule library, so as to intelligently recommend the updated new test rule library.
[0100] The modification module is used to intelligently display the new test rule base, so that testers can make detailed modifications to the new test rule base.
[0101] In one embodiment, the content of the preset transaction rule template includes at least one of the following: the module to which the business belongs, the transaction name, the transaction code, the program name, the test rule number, the test rule name and description, the test coverage items, the corresponding functional test case number, the test rule status, and the update time corresponding to the test rule.
[0102] In one embodiment, the acquisition module 310 includes:
[0103] The acquisition unit is used to capture uploaded branches of the program under test in real time or at regular intervals.
[0104] The extraction unit is used to extract the corresponding condition value sequence in the branch of the program under test as the condition value sequence of the branch of the program under test.
[0105] In one embodiment, the update module 330 includes:
[0106] The first update unit is used to extract the test rule update content corresponding to the input parameter value sequence;
[0107] The second update unit is used to insert the updated test rule content into the preset transaction rule template to update the test rule library.
[0108] In one embodiment, the training process of the preset correlation analysis model includes:
[0109] Extract the program code corresponding to the test transactions of historical projects in the training set;
[0110] The program code is used to determine at least one program branch covered by the program code based on a preset code coverage detection tool. The program branch includes at least the status parameters and transaction result parameters corresponding to the historical project test transaction.
[0111] Extract pre-configured test cases that match the program branch;
[0112] Search the preset test rule library for the test rule corresponding to the pre-configured test case;
[0113] A preset machine learning model is trained as the association model based on the historical input parameter value sequence of the test rules and the program branch condition value sequence of the program branch.
[0114] The test rule base update device provided in this embodiment of the invention can execute the test rule base update method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0115] In one embodiment, Figure 4This is a schematic diagram of an electronic device provided for an embodiment of the present invention. The electronic device 10 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 may 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 invention described and / or claimed herein.
[0116] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 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 ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0117] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, 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.
[0118] 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, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as testing rule base update methods.
[0119] In some embodiments, the test rule base update method 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 ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the test rule base update method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the test rule base update method by any other suitable means (e.g., by means of firmware).
[0120] 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 (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), 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.
[0121] Computer programs used to implement the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable test rule base update 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 implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0122] In the context of this invention, 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 may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may 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 (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0123] 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 CRT (cathode ray tube) or LCD (liquid crystal display) monitor) 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).
[0124] 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.
[0125] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through 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 hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0126] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0127] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0128] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. 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 invention should be included within the scope of protection of this invention.
Claims
1. A method for updating a test rule base, characterized in that, include: Obtain the sequence of branch condition values for the program under test; The input parameter value sequence corresponding to the branch condition value sequence is determined according to the preset correlation analysis model, wherein the preset correlation analysis model is generated based on a training set containing historical input parameter value sequences and program branch condition value sequences covering the program; Test rules are generated based on the input parameter value sequence and the preset transaction rule template to update the test rule library; The training process of the preset correlation analysis model includes: Extract the program code corresponding to the test transactions of historical projects in the training set; The program code is used to determine at least one program branch covered by the program code based on a preset code coverage detection tool. The program branch includes at least the status parameters and transaction result parameters corresponding to the historical project test transaction. Extract pre-configured test cases that match the program branch; The test rule corresponding to the pre-configured test case is searched in the preset test rule library; wherein, the content of the test rule in the preset test rule library corresponding to the pre-configured test case includes at least one of the following: the module to which the business belongs, the transaction name, the transaction code, the program name, the test rule number, the test rule name and description, the test coverage items, the corresponding functional test case number, the test rule status, and the update time corresponding to the test rule; A preset machine learning model is trained based on the historical input parameter value sequence of the test rules and the program branch condition value sequence of the program branch as the preset correlation analysis model.
2. The method according to claim 1, characterized in that, After generating test rules based on the input parameter value sequence and the preset transaction rule template to update the test rule base, the method further includes: Based on the update notification information corresponding to the test rule base issued by the project management tool, the updated test rule base is intelligently recommended; The new test rule base is displayed intelligently to enable testers to refine and modify it.
3. The method according to claim 1, characterized in that, The preset transaction rule template includes at least one of the following: the module to which the business belongs, the transaction name, the transaction code, the program name, the test rule number, the test rule name and description, the test coverage items, the corresponding functional test case number, the test rule status, and the update time corresponding to the test rule.
4. The method according to claim 1, characterized in that, The process of obtaining the branch condition value sequence of the program under test includes: Capture uploaded branches of the program under test in real time or at regular intervals; Extract the corresponding condition value sequence from the branch of the program under test as the branch condition value sequence of the program under test.
5. The method according to claim 1, characterized in that, The step of generating test rules based on the input parameter value sequence and the preset transaction rule template to update the test rule library includes: Extract the test rule update content corresponding to the input parameter value sequence; The updated test rules are inserted into the preset transaction rule template to update the test rule library.
6. The method according to claim 1, characterized in that, The branch condition value sequence of the program under test includes at least: the state parameter value sequence and the transaction result parameter value sequence corresponding to the branch of the program under test.
7. A test rule base update device, characterized in that, include: The acquisition module is used to acquire the sequence of branch condition values of the program under test; The determination module is used to determine the input parameter value sequence corresponding to the branch condition value sequence according to the preset correlation analysis model, wherein the preset correlation analysis model is generated based on a training set containing historical input parameter value sequences and program branch condition value sequences covering the program; The update module is used to generate test rules based on the input parameter value sequence and the preset transaction rule template to update the test rule library; The training process of the preset correlation analysis model includes: Extract the program code corresponding to the test transactions of historical projects in the training set; The program code is used to determine at least one program branch covered by the program code based on a preset code coverage detection tool. The program branch includes at least the status parameters and transaction result parameters corresponding to the historical project test transaction. Extract pre-configured test cases that match the program branch; The test rule corresponding to the pre-configured test case is searched in the preset test rule library; wherein, the content of the test rule in the preset test rule library corresponding to the pre-configured test case includes at least one of the following: the module to which the business belongs, the transaction name, the transaction code, the program name, the test rule number, the test rule name and description, the test coverage items, the corresponding functional test case number, the test rule status, and the update time corresponding to the test rule; A preset machine learning model is trained based on the historical input parameter value sequence of the test rules and the program branch condition value sequence of the program branch as the preset correlation analysis model.
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 rule base update method 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 cause a processor to execute the test rule base update method according to any one of claims 1-6.