Test case construction method and device

By analyzing the rules and entry information in the rule database, the rule calculation engine is called to generate test cases and data for capital circulation transactions, solving the problems of inefficiency and safety hazards in the verification process of capital circulation transactions, and achieving rapid and accurate Test case generation and efficient human resource utilization.

CN119201664APending Publication Date: 2024-12-27NETSUNION CLEARING CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310770058.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-27
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

There are problems such as inefficiency and high human resources consumption in the verification process of capital circulation transactions, and manual operations are prone to errors, which pose safety risks.

Method used

By analyzing the rules and parameter information stored in the rule library, we obtain key information of the object to be tested, including business rule information and boundary parameters, and call the rule calculation engine to generate test cases and test data, reducing manual writing and data preparation.

Benefits of technology

It realizes rapid and accurate acquisition of test cases, saves manpower and material resources, improves throughput of testers, and improves test accuracy, reduces manual errors and enhances security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201664A_ABST
    Figure CN119201664A_ABST
Patent Text Reader

Abstract

The invention discloses a test case construction method and device, and the method comprises the steps: analyzing rules and input parameter information stored in a rule base, and obtaining the key information of a to-be-tested object in a test process; the key information at least comprises business rule information and boundary parameters; and calling a rule calculation engine, and generating a test case for the to-be-tested object according to the business rule information and the boundary parameters. According to the method and the device, the test case of the to-be-tested object can be quickly and accurately obtained only according to the key information of the to-be-tested object in combination with the corresponding business rule, manual case writing and data preparation are not needed any more, a large amount of manpower and material resources can be saved, and the throughput rate of testers is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data testing, and in particular to a method and device for constructing a test case. Background Art

[0002] In the process of fund transfer transactions, the verification of funds is an important prerequisite for the safe delivery of funds. For example, the reserve fund information verification mechanism is an important means of post-prevention of reserve fund risks after the reserve fund is centrally deposited. The fund transfer information verification mechanism can greatly simplify the collaborative workflow of reserve fund verification in the entire industry and reduce the workload of payment institutions. However, at present, each stage of the verification process of fund transfer transactions involves the verification of cross-checking relationships between multiple tables. From the perspective of system verification, if general test cases and data construction methods are followed, a lot of manual preparation work will be required, such as the preparation of test cases and data for each cross-checking relationship at each stage, as well as the preparation of cases and data for cross-checking relationships between stages.

[0003] Therefore, the current verification and validation process for capital flow still has problems of low efficiency and high human resource consumption. In addition, due to the manual writing of test cases and data preparation, it is easy to cause major errors due to manual errors, posing a safety hazard. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and device for constructing a test case to solve the problem that the existing verification and validation process of capital flow is inefficient due to manual participation and has potential safety hazards.

[0005] According to the first aspect, an embodiment of the present invention provides a method for constructing a test case, which comprises: parsing the rules and input parameter information stored in a rule base to obtain key information of the object to be tested during the testing process; the key information comprises at least business rule information and boundary parameters; calling a rule calculation engine to generate a test case for the object to be tested according to the business rule information and boundary parameters.

[0006] In combination with the first aspect, in a first implementation of the first aspect, the test case construction method further includes: generating test data according to the business rule information of the object to be tested and the test case.

[0007] In combination with the first embodiment of the first aspect, in the second embodiment of the first aspect, the test case includes: a forward case and a reverse case, and generating test data according to the business rule information of the object to be tested and the test case includes: obtaining benchmark test data of the object to be tested, the benchmark test data being the test data corresponding to the forward case or the reverse case; determining the test object case data of the object to be tested according to the benchmark test data based on the called rule calculation engine, the test object case data being another case in the test case that is different from the case corresponding to the benchmark test data; determining the test data of the object to be tested based on the benchmark test data and the test object case data.

[0008] In combination with the first implementation or the second implementation of the first aspect, in the third implementation of the first aspect, the test case construction method also includes: determining the correspondence between the test case and the test data, and storing the test case and the test data based on the correspondence.

[0009] In combination with the third implementation of the first aspect, in the fourth implementation of the first aspect, the storing of the test cases and test data based on the corresponding relationship includes: storing the test data in a test database, and recording the corresponding case ID based on the test cases, test data and their corresponding relationship.

[0010] In combination with any one of the first to fourth embodiments of the first aspect, in the fifth embodiment of the first aspect, the test case construction method also includes: writing the test data into a test file, storing the test file in a server, and storing the address information of the server in a test database.

[0011] In combination with the first aspect, in the sixth implementation of the first aspect, the rule set used by the rule calculation engine is a set constructed according to the rule data source and the business type, and the rule set contains calculation rules corresponding to different businesses; the rule data source includes at least: the rule requirement document of the business and the message protocol file for communicating with the outside; the calling rule calculation engine generates a test case for the object to be tested according to the business rule information and boundary parameters, including: calling the corresponding calculation rule based on the rule requirement document and the message protocol file to extract the business file information; obtaining the test case for the object to be tested based on the extracted business file information and boundary parameters.

[0012] In combination with the first aspect or any embodiment of the first aspect, in the seventh embodiment of the first aspect, the boundary parameters include at least: time information for indicating the processing time range of the object to be tested, and data information for indicating the allowable range of data of the object to be tested.

[0013] According to the second aspect, an embodiment of the present invention provides a test case construction device, which includes: a key information acquisition module, used to parse the rules and input parameter information stored in the rule base, and obtain key information of the object to be tested during the testing process; the key information at least includes business rule information and boundary parameters; a test case generation module, used to call a rule calculation engine, and generate a test case for the object to be tested according to the business rule information and boundary parameters.

[0014] According to the third aspect, an embodiment of the present invention provides an electronic device / mobile terminal / server, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the test case construction method described in the first aspect or any one of the embodiments of the first aspect by executing the computer instructions.

[0015] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the test case construction method described in the first aspect or any one of the embodiments of the first aspect.

[0016] The beneficial effect of the present invention is that, by implementing the present invention, the test cases of the object to be tested can be quickly and accurately obtained based on the key information of the object to be tested and in combination with the corresponding business rules, and there is no need to manually write cases and prepare data, which can save a lot of manpower and material resources and improve the throughput of testers. Furthermore, the energy saved in the process of building test cases can be more focused on steps such as sorting out business scenarios and abstracting business rules, thereby covering all business scenarios as much as possible and improving the accuracy of the test phase. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present invention in any way. In the accompanying drawings:

[0018] Figure 1 A schematic diagram showing a flow chart of a method for constructing a test case according to an embodiment of the present invention;

[0019] Figure 2 A schematic diagram showing a flow chart of a method for constructing a test case according to another embodiment of the present invention;

[0020] Figure 3 A schematic diagram showing a flow chart of a method for constructing a test case according to another embodiment of the present invention;

[0021] Figure 4A schematic diagram showing the structure of a test case generation system according to an embodiment of the present invention is shown;

[0022] Figure 5 A schematic diagram showing the structure of a test case construction device according to an embodiment of the present invention;

[0023] Figure 6 A schematic diagram showing the hardware structure of a computer device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0025] The present invention provides a method for constructing a test case. Figure 1 As shown, the construction method of this test case mainly includes:

[0026] Step S10: parse the rules and input parameter information stored in the rule base to obtain key information of the object to be tested during the test process; the key information at least includes business rule information and boundary parameters.

[0027] In this embodiment, the test case constructed for the test object can be, for example, a system applied to the capital circulation business, such as used in the verification process of the reserve fund, or applied to the data interaction system involving various businesses, and the present invention is not limited thereto. For such an object to be tested, it usually carries corresponding key information during the circulation and interaction of business data. In this embodiment, the key information mainly includes business rule information and boundary parameters.

[0028] Among them, business rule information refers to the rules that the business currently executed by the object to be tested needs to follow, the type of business, the requirements of related documents, etc.; the boundary parameters can at least include: time information used to indicate the processing time range of the object to be tested (for example, used to limit the execution period of the current test process to 9 am to 4 pm), and data information used to indicate the allowable range of data of the object to be tested (for example, when the data is the transaction amount generated, the range of the data is limited to a value greater than or equal to 0, and cannot be a negative number).

[0029] In practical applications, all different testing processes for the object to be tested need to follow the corresponding rules and input parameter information. The rules are known business rules pre-stored in the rule base, and the input parameter information refers to the input parameters related to the business rules. In the specific implementation, there may be a situation that in the initial stage, the corresponding business rules have not been stored in the rule base, or the known rules in the rule base are not applicable to the current object to be tested. At this time, it is necessary to obtain the preset rules and input parameter information for the object to be tested. In this embodiment, this acquisition process can be determined by finding the corresponding rules of the known test object with the highest correlation with the current object to be tested, or it can be pre-set in advance for the object to be tested. The present invention is not limited to this.

[0030] Step S20: calling a rule calculation engine to generate a test case for the object to be tested according to the business rule information and boundary parameters.

[0031] In this embodiment, the rule calculation engine is the core component of the entire test process, and the rule calculation engine can be used to calculate the test cases used to test the object under test. The rule set used by the rule calculation engine is a set constructed according to the rule data source and business type, and the rule set contains calculation rules corresponding to different businesses; the rule data source includes at least: the business rule requirement document and the message protocol file for communicating with the outside.

[0032] Based on the rule data source in the rule set, the business rules and boundary parameters of the test case of the object to be tested are limited, so that a test case that is more suitable for the object to be tested can be generated.

[0033] Through the test case construction method of the embodiment of the present invention, it is only necessary to quickly and accurately obtain the test case of the object to be tested based on the key information of the object to be tested and the corresponding business rules. It is no longer necessary to manually write cases and prepare data, which can save a lot of manpower and material resources and improve the throughput of testers. Furthermore, the energy saved in the process of building test cases can be more focused on steps such as sorting out business scenarios and abstracting business rules, so as to cover all business scenarios as much as possible and improve the accuracy of the test stage.

[0034] In an optional embodiment, the above step S20, calling the rule calculation engine to generate a test case for the object to be tested according to the business rule information and boundary parameters, mainly includes:

[0035] Based on the rule requirement document and the message protocol file, the corresponding calculation rules are called to extract the business file information; wherein, the business requirement document refers to the requirement document formed according to the file format requirements, time requirements, etc. of the actual business; the message protocol file for communicating with the outside refers to the message protocol constructed with the external device when the tested reconciliation system executes the corresponding business and needs to communicate with the outside. In actual applications, different rule sets can be formed for different business versions and business development status, and the functions of various rule data sources in the rule set are also different. For example, for newly added business data, when extracting business rules, it is mainly based on the requirement documents and message protocols; for business data that is already running online, the corresponding rules are extracted based on the business files that have passed the verification.

[0036] The test case for the object to be tested is obtained based on the extracted business file information and boundary parameters.

[0037] In an alternative embodiment, if Figure 2 As shown, the test case construction method of this embodiment further includes: Step S30: generating test data according to the business rule information of the object to be tested and the test case.

[0038] After generating the test case for the object to be tested through step S20, test data can be further generated based on the business rule information of the object to be tested and the test case. Among them, the test case mainly includes: a positive case and a negative case, wherein the positive case refers to a case in which the data and information generated by the object to be tested when executing the corresponding business meet the requirements of the corresponding business rules and boundary parameters; the negative case refers to a case in which the data and information generated by the object to be tested when executing the corresponding business do not meet the requirements of the corresponding business rules and boundary parameters. In actual applications, both the positive case and the negative case may include boundary cases, which refer to cases mainly used to represent the boundary parameters of the business. Figure 3 As shown in the figure, the process of generating test data based on the business rule information and test cases of the object to be tested mainly includes:

[0039] Step S301: Obtain benchmark test data of the object to be tested, where the benchmark test data may be test data corresponding to a positive case or a negative case.

[0040] When generating specific test data for a test case, a reference standard is also required. In this embodiment, the test data corresponding to one of the positive case or the reverse case is used as the benchmark test data. Normally, the test data corresponding to the positive case is used as the benchmark test data, but the present invention is not limited to this.

[0041] Step S302: Based on the called rule calculation engine, the test object case data of the object to be tested is determined according to the benchmark test data. The test object case data is another case in the test case that is different from the case corresponding to the benchmark test data. That is, when the test data corresponding to the positive case is used as the benchmark test data, the determined test object case data is the test data corresponding to the reverse case; when the test data corresponding to the reverse case is used as the benchmark test data, the determined test object case data is the test data corresponding to the positive case.

[0042] Once the benchmark test data is determined, the rule calculation engine can be called to determine other test case data of the object to be tested based on the benchmark test data. For example, the test data corresponding to the forward case is used as the benchmark test data, and the business rules and boundary parameters involved in the forward case can be used to determine the rules and standards of the object to be tested when processing the corresponding business data, and thereby obtain the corresponding reverse case rules and standards, and then generate the corresponding reverse cases and boundary cases according to the determined rules and standards.

[0043] The above is an example of using the test data corresponding to the positive case as the benchmark test data. It should be understandable that when the test data corresponding to the reverse case is used as the benchmark test data, the test case construction method of this embodiment can also realize the process of determining the test object case of the object to be tested based on the benchmark test data.

[0044] Step S303: Determine the test data of the object to be tested based on the benchmark test data and the test object case data. After the specific test case is determined, the test data for the object to be tested can be determined based on the test case.

[0045] In an optional embodiment, for the test cases and test data constructed by the above process, the correspondence between the test cases and the test data can be further determined, and the test cases, test data and the correspondence can be integrated and stored uniformly to facilitate subsequent calls and queries.

[0046] Specifically, for the case where the input of the object to be tested does not require an external storage method, such as a basic data format, an object, etc., the test data can be stored in a test database, and based on the test case, the test data and the corresponding relationship record, the corresponding case ID is recorded to maintain the corresponding relationship between the case and the data. In an optional embodiment, for the case where the input of the object to be tested needs to rely on an external storage method, such as a file or a database, the test data is written into the established test file, the test file is stored in a server (for example, an SFTP server, etc.), and only the address information (SFTP address) of the server is stored in the test database, so that the test case and test data can be called according to the address later.

[0047] The following further describes the test case construction method of this embodiment in conjunction with specific application examples.

[0048] In practical applications, this test case construction method can be applied to Figure 4 The test case generation system shown in FIG. The test case generation system mainly includes:

[0049] The rule parsing module 41 is used to parse the business rule information to obtain the rule standards such as business rules and message specifications, and parse the input parameter information to obtain the boundary parameters such as the input parameter type and boundary value;

[0050] The test case generation module 42 is used to call the rule calculation engine to generate corresponding test cases according to the rule standards and boundary parameters obtained by the rule parsing module. The test cases include: positive cases that meet the rules, reverse cases that violate the rules, and cases with input parameter boundary values;

[0051] The test data generation module 43 is used to generate corresponding test data according to the test case, and store and record the test case, the test data and their corresponding relationship;

[0052] The log recording module 44 is used to generate logs for recording according to the execution process of each of the above modules, so as to facilitate subsequent calls and inquiries;

[0053] The notification module 45 is used to feed back the generation results of the test cases and test data to relevant personnel.

[0054] Through the test case generation system, test cases and test data are automatically generated for corresponding test objects. Corresponding test cases and data can be generated for different test applications or business systems to test the application or business system.

[0055] The embodiment of the present invention also provides a test case construction device, such as Figure 5 As shown, the construction device of the test case includes:

[0056] The key information acquisition module 51 is used to parse the rules and input parameter information stored in the rule base to obtain the key information of the object to be tested during the test process; the key information at least includes business rule information and boundary parameters; the detailed process can be found in the relevant description of step S10 of the above method embodiment, which will not be repeated here.

[0057] The test case generation module 52 is used to call the rule calculation engine to generate a test case for the object to be tested according to the business rule information and boundary parameters. The detailed process can be found in the relevant description of step S20 of the above method embodiment, which will not be repeated here.

[0058] Through the test case construction device of the embodiment of the present invention, the test case of the object to be tested can be quickly and accurately obtained based on the key information of the object to be tested and the corresponding business rules. It is no longer necessary to manually write cases and prepare data, which can save a lot of manpower and material resources and improve the throughput of testers. Furthermore, the energy saved in the process of building test cases can be more focused on steps such as sorting out business scenarios and abstracting business rules, so as to cover all business scenarios as much as possible and improve the accuracy of the test stage.

[0059] The embodiment of the present invention also provides a computer device, such as Figure 6 As shown, the computer device may include a processor 61 and a memory 62, wherein the processor 61 and the memory 62 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.

[0060] The processor 61 may be a central processing unit (CPU). The processor 61 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0061] The memory 62 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the test case construction method in the embodiment of the present invention (for example, Figure 6 The processor 61 executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory 62, that is, the test case construction method in the above method embodiment is implemented.

[0062] The memory 62 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created by the processor 61, etc. In addition, the memory 62 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 62 may optionally include a memory remotely arranged relative to the processor 61, and these remote memories may be connected to the processor 61 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0063] The one or more modules are stored in the memory 62, and when executed by the processor 61, the following is performed: Figure 1-Figure 3 The test case construction method in the illustrated embodiment.

[0064] For details of the above computer equipment, please refer to Figures 1 to 3 The corresponding related descriptions and effects in the illustrated embodiments can be understood and will not be repeated here.

[0065] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0066] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for constructing a test case, characterized in that: The test case construction method includes: Parse the rules and input parameter information stored in the rule base to obtain key information of the object to be tested during the test process; the key information at least includes business rule information and boundary parameters; A rule calculation engine is called to generate a test case for the object to be tested according to the business rule information and boundary parameters.

2. The test case construction method according to claim 1, characterized in that: The test case construction method also includes: Generate test data based on the business rule information and test cases of the object to be tested.

3. The test case construction method according to claim 2, characterized in that: The test cases include: positive cases and reverse cases. The generating of test data according to the business rule information and test cases of the object to be tested includes: Obtaining benchmark test data of the object to be tested, wherein the benchmark test data is test data corresponding to the positive case or the negative case; Based on the called rule calculation engine, determining the test object case data of the object to be tested according to the benchmark test data, wherein the test object case data is another case in the test case that is different from the case corresponding to the benchmark test data; The test data of the object to be tested is determined based on the benchmark test data and the test object case data.

4. The method for constructing a test case according to claim 2 or 3, characterized in that: The test case construction method also includes: Determine a correspondence between the test case and the test data, and store the test case and the test data based on the correspondence.

5. The test case construction method according to claim 4, characterized in that: The storing of the test cases and the test data based on the corresponding relationship includes: The test data is stored in a test database, and is recorded to a corresponding case ID based on the test case, the test data and their corresponding relationship.

6. The method for constructing a test case according to any one of claims 2 to 5, characterized in that: The test case construction method also includes: The test data is written into a test file, the test file is stored in a server, and the address information of the server is stored in a test database.

7. The test case construction method according to claim 1, characterized in that: The rule set used by the rule calculation engine is a set constructed according to the rule data source and business type, and the rule set contains calculation rules corresponding to different businesses; the rule data source includes at least: the business rule requirement document and the message protocol file for communicating with the outside; The calling rule calculation engine generates a test case for the object to be tested according to the business rule information and boundary parameters, including: Based on the rule requirement document and the message protocol file, the corresponding calculation rule is called to extract the business file information; The test case for the object to be tested is obtained based on the extracted business file information and boundary parameters.

8. The method for constructing a test case according to any one of claims 1 to 7, characterized in that: The boundary parameters at least include: time information for indicating a processing time range of the object to be detected, and data information for indicating an allowable data range of the object to be detected.

9. A test case construction device, characterized in that: The test case construction device comprises: The key information acquisition module is used to parse the rules and input parameter information stored in the rule base to obtain the key information of the object to be tested during the test process; the key information at least includes business rule information and boundary parameters; The test case generation module is used to call the rule calculation engine to generate a test case for the object to be tested according to the business rule information and boundary parameters.

10. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the test case construction method according to any one of claims 1 to 8 by executing the computer instructions.