Test data generation method and device, equipment and storage medium
By constructing standardized data templates and performing format conversion based on the syntax rules of the target message protocol file, test data is generated, which solves the problem of low test accuracy caused by relying on manual learning in existing technologies and achieves more efficient test data generation.
Patent Information
- Application Number
- CN202510982184.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-16
- Publication Date
- 2025-11-04
AI Technical Summary
In the testing of message systems in the financial sector, existing technologies rely on manual learning of the technical specifications of each message system, resulting in low testing accuracy and high learning costs.
By receiving business transaction data input by users, a standardized data template is constructed, and the format is converted based on the syntax rules in the target message protocol file to generate test data that conforms to the specifications.
It improved the accuracy and efficiency of test data generation, reduced the reliance on manual learning of various message system specifications, and reduced test errors.
Smart Images

Figure CN120896982A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to methods, apparatus, devices and storage media for generating test data. Background Technology
[0002] In financial sectors such as cross-border payments, securities clearing, and trade settlement, transaction instructions between financial institutions are typically transmitted electronically via message systems. These message systems define standardized data formats, field rules, and communication protocols to ensure interoperability between different institutions. However, with the globalization of financial services, phenomena such as the coexistence of multiple message systems and a significant increase in heterogeneity have emerged, posing a significant challenge to the testing of message systems.
[0003] Currently, in the financial industry's message system testing process, testers typically need to generate test data conforming to the respective technical specifications of different message systems (such as SWIFT, CHIPS, and the People's Bank of China's cross-border payment system). However, due to significant differences in the syntax, field definitions, data formats, and business rules of various message systems, testers often need to spend a considerable amount of time and effort learning and mastering the technical specifications of each system for testing. This method, which relies on manual understanding, is not only costly to learn but also prone to generating test data that does not conform to the specifications due to misunderstandings or oversights in the rules, thus affecting the accuracy and effectiveness of the testing. Summary of the Invention
[0004] The main purpose of this application is to provide a test data generation method, apparatus, device and storage medium, which aims to solve the technical problem that relying on the technical specifications of message systems based on manual learning for message system testing can easily lead to low test accuracy.
[0005] To achieve the above objectives, this application proposes a test data generation method, the method comprising:
[0006] Receive business transaction data input by the user and construct a standardized data template corresponding to the business transaction data;
[0007] Determine the target message protocol file corresponding to the standardized data template;
[0008] Transmit the standardized data template to the target message protocol file;
[0009] Upon completion of transmission, the message protocol in the standardized data template is format-converted based on the message protocol syntax rules in the target message protocol file to obtain message protocol specification data.
[0010] The message protocol specification data is injected into the sent message to generate test data.
[0011] In one embodiment, the step of receiving user-inputted business transaction data and constructing a standardized data template corresponding to the business transaction data includes:
[0012] Receive business transaction data input by the user, and extract transaction information elements from the business transaction data;
[0013] Determine the constraints corresponding to the transaction information elements;
[0014] Generate transaction information tags corresponding to the transaction information elements based on the transaction information elements and the constraints;
[0015] Based on the transaction information tags and message system protocol specifications, a standardized data template corresponding to the business transaction data is constructed.
[0016] In one embodiment, the step of determining the target message protocol file corresponding to the standardized data template includes:
[0017] Determine the target message system corresponding to the standardized data template;
[0018] Search the message protocol file corresponding to the target message system in the Multi-Message System Technical Specification Knowledge Base;
[0019] The target message protocol file corresponding to the standardized data template is determined from the message protocol file.
[0020] In one embodiment, the step of determining the target message system corresponding to the standardized data template includes:
[0021] The business layer label and message label corresponding to the standardized data template are determined. The business layer label is a label used to describe the business scenario, and the message label is a label used to identify the message system and message protocol.
[0022] The business scenario to which the standardized data template belongs is determined based on the business layer label;
[0023] Based on the aforementioned business scenario and the knowledge base of multi-message system technical specifications, candidate message systems corresponding to the standardized data template are determined.
[0024] Based on the message tag, the target message system corresponding to the standardized data template is determined from the candidate message systems.
[0025] In one embodiment, the step of converting the message protocol in the standardized data template according to the message protocol syntax rules in the target message protocol file to obtain message protocol specification data includes:
[0026] Iterate through all fields in the transaction information tags of the standardized data template;
[0027] Determine the target message system protocol specification corresponding to each field based on the target message protocol file;
[0028] Extract the message protocol syntax rules corresponding to each field from the target message system protocol specification;
[0029] Based on the message protocol syntax rules, the message protocol in the standardized data template is formatted to obtain message protocol specification data.
[0030] In one embodiment, before the step of converting the message protocol in the standardized data template according to the message protocol syntax rules to obtain the message protocol specification data, the method further includes:
[0031] Determine the business type corresponding to the standardized data template;
[0032] When the business type is a special business type, determine the message field verification rules corresponding to the special business type;
[0033] Based on the message field verification rules, the message fields in the standardized data template are verified to obtain the data verification results.
[0034] The step of converting the message protocol in the standardized data template according to the message protocol syntax rules to obtain the message protocol specification data includes:
[0035] When the data verification result is successful, the message protocol in the standardized data template is formatted based on the message protocol syntax rules to obtain the message protocol specification data.
[0036] In one embodiment, after the step of injecting the message protocol specification data into the transmitted message to generate test data, the method further includes:
[0037] When a rejection message is detected, the outbound transaction information of the outbound business is obtained based on the rejection message. The outbound transaction information includes the outbound message system and outbound message protocol corresponding to the outbound business.
[0038] Generate an outbound transaction tag based on the outbound message system and the outbound message protocol;
[0039] Determine the message protocol tag of the refund message protocol corresponding to the refund message, and map and associate the message protocol tag with the outbound transaction tag.
[0040] Furthermore, to achieve the above objectives, this application also proposes a test data generation apparatus, the apparatus comprising:
[0041] The data template construction module is used to receive business transaction data input by the user and construct a standardized data template corresponding to the business transaction data.
[0042] The protocol file generation module is used to determine the target message protocol file corresponding to the standardized data template;
[0043] The data transmission module is used to transmit the standardized data template to the target message protocol file;
[0044] The protocol format conversion module is used to convert the message protocol in the standardized data template according to the message protocol syntax rules in the target message protocol file when the transmission is completed, so as to obtain the message protocol specification data.
[0045] The test data generation module is used to inject the message protocol specification data into the sent message to generate test data.
[0046] In addition, to achieve the above objectives, this application also proposes a test data generation device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the test data generation method as described above.
[0047] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the test data generation method described above.
[0048] This application provides a test data generation method. The method involves receiving user-input business transaction data and constructing a standardized data template corresponding to the business transaction data; determining the target message protocol file corresponding to the standardized data template; transmitting the standardized data template to the target message protocol file; upon completion of transmission, converting the message protocol in the standardized data template according to the message protocol syntax rules in the target message protocol file to obtain message protocol specification data; and injecting the message protocol specification data into the sent message to generate test data. Compared to existing technologies where testers manually learn and master the technical specifications of each message system for testing, which can easily affect the accuracy and effectiveness of the test, this invention can convert the message protocol in the standardized data template into message protocol specification data based on the message protocol syntax rules in the target message protocol file, and then inject the message protocol specification data into the sent message to generate test data. This solves the technical problem in existing technologies where relying on manually learned message system technical specifications for message system testing easily leads to low test accuracy. Attached Figure Description
[0049] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0050] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 This is a flowchart illustrating the test data generation method of this application in Embodiment 1.
[0052] Figure 2 This diagram illustrates the mapping relationship of data templates in the test data generation method of this application.
[0053] Figure 3 This is a flowchart illustrating Embodiment 2 of the test data generation method for this application.
[0054] Figure 4 This is a flowchart illustrating the test data generation method of this application in Embodiment 3;
[0055] Figure 5 This is a flowchart illustrating the overall process for generating test data in this application.
[0056] Figure 6 This is a schematic diagram of the module structure of the test data generation device according to an embodiment of this application;
[0057] Figure 7 This is a schematic diagram of the device structure of the hardware operating environment involved in the test data generation method in this application embodiment.
[0058] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0059] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.
[0060] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.
[0061] The main solution of this application embodiment is as follows: receiving business transaction data input by the user and constructing a standardized data template corresponding to the business transaction data; determining the target message protocol file corresponding to the standardized data template; transmitting the standardized data template to the target message protocol file; upon completion of transmission, performing format conversion on the message protocol in the standardized data template based on the message protocol syntax rules in the target message protocol file to obtain message protocol specification data; and injecting the message protocol specification data into the sent message to generate test data.
[0062] Because existing technologies rely on testers manually learning and mastering the technical specifications of each message system for testing, the learning cost is high, and the generated test data may not conform to the specifications due to misunderstandings or oversights of the rules, thus affecting the accuracy and effectiveness of the test.
[0063] This application provides a solution that can convert the message protocol in the standardized data template into message protocol specification data based on the message protocol syntax rules in the target message protocol file, and inject the message protocol specification data into the sent message to generate test data. This solves the technical problem in the prior art that relying on the technical specifications of the message system learned by humans for message system testing can easily lead to low test accuracy.
[0064] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone; or an electronic device, test data generation device, or test data generation system that includes the test data generation device, etc. The following description uses a test data generation system (hereinafter referred to as the system) as an example to illustrate this embodiment and the following embodiments.
[0065] Based on this, embodiments of this application provide a method for generating test data, referring to... Figure 1 , Figure 1This is a flowchart illustrating the test data generation method of this application in Embodiment 1.
[0066] In this embodiment, the test data generation method includes steps S10 to S50:
[0067] Step S10: Receive the business transaction data input by the user and construct a standardized data template corresponding to the business transaction data.
[0068] It should be understood that the aforementioned business transaction data can be data input by the user at the application layer that is related to a specific business scenario, such as business type, transaction direction (e.g., inward or outward remittance), remittance amount, remitter information, and recipient information. This embodiment does not impose any restrictions on this.
[0069] It should be noted that the aforementioned standardized data template can be a data structure used to abstract and standardize business transaction data. In this embodiment, the standardized data template can abstract business data, making it independent of specific message protocols, and enabling seamless data conversion and adaptation between different message systems. In practical applications, the standardized data input abstract labels are all application-layer oriented, making it easier for testers to understand labels with business significance. This allows the system to map protocol scenarios to business scenarios, ultimately completing the transmission of various messages within the business scenario.
[0070] Further, step S10 includes:
[0071] Step S101: Receive business transaction data input by the user, and extract transaction information elements from the business transaction data.
[0072] It is understandable that the aforementioned transaction information elements can be transaction data fields related to business logic in the business transaction data, such as remittance amount, BIC code, remitter information, and payee information.
[0073] Step S102: Determine the constraints corresponding to the transaction information elements.
[0074] It should be understood that the above constraints can be restrictions and requirements on transaction information elements, such as type, length, required fields, format, etc. Specifically, for example, the remittance amount must be a positive number; the BIC code must conform to a specific format (such as length, character set, etc.); the remitter information and payee information must be complete and conform to specific format requirements; the value range of specific fields (such as date format, currency type, etc.), etc. This embodiment does not impose restrictions on these. In this embodiment, the constraints corresponding to the transaction information elements can ensure the correctness and consistency of the transaction information elements, avoiding message generation failure or non-compliance with specifications due to data errors.
[0075] Step S103: Generate transaction information tags corresponding to the transaction information elements based on the transaction information elements and the constraints.
[0076] It should be noted that the aforementioned transaction information tags can be identifiers used to identify transaction information elements. These tags can describe key information in the business data; for example, the tag corresponding to the remittance amount can be "Amount," the tag corresponding to the BIC code can be "BIC," the tag corresponding to the remitter's information can be "SenderName," and the tag corresponding to the recipient's information can be "ReceiverAccount," etc. In practical applications, the system can generate unique transaction information tags based on the transaction information elements and their corresponding constraints. In this embodiment, the transaction information tags are the basis for standardized data templates, ensuring data consistency and identifiability.
[0077] Step S104: Construct a standardized data template corresponding to the business transaction data based on the transaction information tag and message system protocol specification.
[0078] It should be noted that the aforementioned message system protocol specifications can be the field definitions, format requirements, and mandatory field rules of message systems (such as SWIFT, CHIPS, and the People's Bank of China system). For example, SWIFT's BIC is 8 or 11 bits, and ISO20022's BIC is a mandatory field. In this embodiment, the system can map business transaction data and message system protocol specifications in the data template, ultimately constructing a standardized data template corresponding to the business transaction data. In practical applications, all business data and fields of the message system protocol specifications can be mapped through transaction information tags. For example, the business layer can pass business data to the transaction information tag Amount to achieve the mapping between transaction data and transaction information tags, and then map the transaction information tag Amount to the message protocol field MT103:32A to achieve the mapping between transaction information tags and message system protocol specifications, enabling upward compatibility with the business layer and downward compatibility with the message protocol layer.
[0079] In the specific implementation, refer to Figure 2 , Figure 2 This diagram illustrates the mapping relationship of data templates in the test data generation method of this application. For example... Figure 2 As shown, the standardized data template in this embodiment can be constructed based on transaction information, and is compatible with both the business layer and the message protocol layer. Furthermore, the data template can define data elements strongly related to the business (such as remittance amount, BIC code, remitter information, recipient information, business domain direction, and other transaction-related tag elements) and their constraints. In this embodiment, the first layer of the business layer is the input of standardized data, and the input template corresponding to this standardized data can be as follows: Figure 2The "Inflow Channel" is shown as "AC, CP, Currency Bridge", "Inflow Message" as "103", "Business Type" as "Cross-border Wealth Management", "Remitter Account" as "xxx", "Remitter Name" as "xxx", "Remitter Address" as "xxx". The business layer tags can be "Remittance Currency" as "32" as "USD", "21" as "HKD"...", "Document Type" as "P01" as "10", "P21" as "03"...", and "Remittance Amount" as "pacs.008" as "{Amount Format Length Definition}". In this embodiment, the standardized data template's upward compatibility with the business layer means that the standardized data template can directly interact with business logic (such as processing remittance transactions, cross-border payments, etc.). Through the transaction information tag, it can receive data from the business layer and convert it into a unified format, so that the business layer does not need to concern itself with the specific details of the underlying message protocol, but only needs to provide data according to the requirements of the standardized data template. The ability of standardized data templates to be backward compatible with message protocol layers means that standardized data templates can be adapted to the underlying message protocols. Through mapping rules, they can convert business data into data that conforms to message protocol specifications, enabling the message protocol layer to receive data from the standardized data templates and generate corresponding messages. For example, for transaction information tags, they can generate SWIFT format or ISO20022 format.
[0080] Step S20: Determine the target message protocol file corresponding to the standardized data template.
[0081] It should be noted that the aforementioned target message protocol file can be a protocol specification file that matches the standardized data template and is used to generate specific messages. This file can define syntax rules such as message structure, field order, field type, length, format, required fields, and dependencies. In practical applications, if the target message system corresponding to the standardized data template is SWIFT and the protocol type is MT103, then the target message protocol file corresponding to the standardized data template can be a file defining the MT103 message structure; if the target message system corresponding to the standardized data template is the People's Bank of China Cross-border Payment System and the protocol type is XML format pacs.008, then the target message protocol file corresponding to the standardized data template can be a file defining the pacs.008 message structure. In this embodiment, the target message protocol file is typically stored in the system's knowledge base in a structured format (such as JSON, XML, YAML) for easy system reading and parsing.
[0082] Step S30: Transmit the standardized data template to the target message protocol file.
[0083] It should be noted that transmitting a standardized data template to a target message protocol file can be the process of adapting the data in the standardized data template to the message protocol of a specific message system (such as SWIFT, CHIPS, the People's Bank of China system, etc.).
[0084] Step S40: Upon completion of transmission, the message protocol in the standardized data template is format-converted based on the message protocol syntax rules in the target message protocol file to obtain message protocol specification data.
[0085] In this embodiment, after transmitting the data from the standardized data template to the target message protocol file, the system can parse the standardized data template, extract the transaction information elements and their corresponding constraints, and read the target message protocol file to extract the syntax rules such as field types, lengths, and formats defined in the file. Then, these syntax rules are matched with the data elements in the standardized data template to format and verify the data in the standardized data template. Finally, the data in the standardized data template is converted into data that conforms to the message protocol specification to obtain the message protocol specification data.
[0086] Step S50: Inject the message protocol specification data into the sent message to generate test data.
[0087] It should be noted that the system can provide a unified mapping mechanism through a dynamic mapping engine to map message protocol specification data to the message protocol, generate messages that conform to the message protocol specification, and finally obtain test data.
[0088] This embodiment provides a test data generation method. The method discloses receiving user-input business transaction data and constructing a standardized data template corresponding to the business transaction data; determining the target message protocol file corresponding to the standardized data template; transmitting the standardized data template to the target message protocol file; upon completion of transmission, converting the message protocol in the standardized data template according to the message protocol syntax rules in the target message protocol file to obtain message protocol specification data; and injecting the message protocol specification data into the sent message to generate test data. Compared to existing technologies where testers manually learn and master the technical specifications of each message system for testing, which can easily affect the accuracy and effectiveness of the test, this embodiment can convert the message protocol in the standardized data template into message protocol specification data based on the message protocol syntax rules in the target message protocol file and inject the message protocol specification data into the sent message to generate test data. This solves the technical problem in existing technologies where relying on manually learned message system technical specifications for message system testing easily leads to low test accuracy.
[0089] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the test data generation method for this application.
[0090] In this embodiment, step S20 includes steps S201 to S203:
[0091] Step S201: Determine the target message system corresponding to the standardized data template.
[0092] It is understood that the target message system can be a message system that matches the standardized data template. In this embodiment, the system can extract business layer tags from the standardized data template to obtain information such as business type, transaction direction, and currency, and determine the message system that matches the standardized data template based on this information, thus obtaining the target message system.
[0093] Specifically, step S201 includes:
[0094] Step S201a: Determine the business layer label and message label corresponding to the standardized data template. The business layer label is a label used to describe the business scenario, and the message label is a label used to identify the message system and message protocol.
[0095] It should be understood that the aforementioned business layer labels can be labels used to describe business scenarios or business types. They can be used to determine the business scenario and thus select the appropriate messaging system (such as SWIFT MT103). In this embodiment, the business layer labels can define information such as business type (e.g., cross-border remittance, wealth management, refund), transaction direction (e.g., remittance out, remittance in), remittance currency (e.g., USD, CNY), and amount type (e.g., corporate, personal).
[0096] It is understood that the aforementioned message tag can be a tag used to describe the characteristics of a message system or protocol, which can identify the target message system or protocol type. In this embodiment, the target message protocol can be selected through the message tag, that is, the message system and protocol type currently used are determined. In this embodiment, the message tag can define information such as message system type (e.g., SWIFT, CHIPS, People's Bank of China system), message protocol type (e.g., MT103, pain.001, pacs.008), and message format (e.g., XML, FIX, TXT). For example, the format of the message tag can be {"Target Message System": "SWIFT", "Protocol Type": "MT103", "Message Format": "TXT"}.
[0097] Step S201b: Determine the business scenario to which the standardized data template belongs based on the business layer label.
[0098] In this embodiment, the system can read the business layer tags in the standardized data template and perform semantic analysis on the business layer tags to identify the business scenarios corresponding to the business in the standardized data template. The business scenario can be comprehensively represented by information such as business type, transaction direction and currency, such as "cross-border remittance + remittance + USD".
[0099] Step S201c: Based on the business scenario and the knowledge base of technical specifications for multi-message systems, determine the candidate message system corresponding to the standardized data template.
[0100] It should be understood that the aforementioned multi-message system technical specification knowledge base can be a database storing technical specifications such as the syntax structure, field definitions, and format requirements of different message systems. In practical applications, the multi-message system technical specification knowledge base supports routing, meaning it can automatically match the corresponding message system and its protocol based on standardized data templates.
[0101] It is understandable that this embodiment, by constructing a multi-message system technical specification knowledge base, can centrally store the field definitions, syntax rules, and format requirements of different message systems, forming a unified knowledge base that facilitates unified system access and maintenance. Simultaneously, the system can automatically generate test data conforming to the requirements of each protocol based on the rules in the knowledge base, eliminating the need for testers to manually learn the technical specifications of each message system, thus improving the accuracy and efficiency of test data generation. Furthermore, when adding a new message system, the system only needs to parse its technical specifications and add them to the multi-message system technical specification knowledge base, thereby eliminating the need to modify business logic or test scripts and reducing system expansion costs.
[0102] In practical applications, the system can collect technical specification documents for various message systems from official standard documents, industry standards, interface specifications, and other channels. These documents can include information such as message format, field definitions, field types, lengths, required or optional fields, dependencies, and validation rules. For example, there are field definitions for SWIFT MT103 messages, the structure of ISO20022 XML messages, and the specifications for People's Bank of China cross-border payment messages. The system can then parse these technical specifications and construct a storage structure according to the format of business type-transaction direction-currency-default message system-protocol type (e.g., cross-border remittance-out-USD-SWIFT-MT103, cross-border remittance-in-CNY-People's Bank of China system-XML). This storage structure is then used to store the data, ultimately building a scalable, maintainable, and automatically adaptable multi-message system technical specification knowledge base, which is stored in a database file. Different message system specification tags are stored in different files. The upper layer connects to the lower layer message system specification files through business layer files, providing a foundation for automatic message generation, routing selection, and protocol adaptation.
[0103] It should be noted that the aforementioned candidate message systems can be the set of all message systems that can be used in the current business scenario. In this embodiment, after determining the business scenario to which the standardized data template belongs, all message systems that can be used in the current business scenario can be queried from the multi-message system technical specification knowledge base to obtain the candidate message system set. For example, for the business scenario of "cross-border remittance + outward remittance + USD", the message systems that can be used may include, but are not limited to, SWIFT.
[0104] Step S201d: Determine the target message system corresponding to the standardized data template from the candidate message systems based on the message tag.
[0105] It should be noted that the target message system mentioned above can be a message system in the candidate message system that matches the standardized data template. In this embodiment, the system can further filter the candidate message systems based on the message tags in the standardized data template. Specifically, the system can search for the target message system that matches the standardized data template from the candidate message systems based on the message system and protocol type defined in the message tags.
[0106] Step S202: Search for the message protocol file corresponding to the target message system in the Multi-Message System Technical Specification Knowledge Base.
[0107] It should be understood that the aforementioned message protocol files can be protocol specification files from the Multi-Message System Technical Specification Knowledge Base that match the target message system. In this embodiment, the data in the Multi-Message System Technical Specification Knowledge Base can be stored in the format of business type-transaction direction-currency-default message system-protocol type. After determining the target message system corresponding to the standardized data template, all protocol specification files matching the target message system can be searched from the Multi-Message System Technical Specification Knowledge Base.
[0108] Step S203: Determine the target message protocol file corresponding to the standardized data template from the message protocol file.
[0109] In this embodiment, after determining the target message system corresponding to the standardized data template, the system can directly match the message protocol file corresponding to the target message system according to the mapping rules in the multi-message system technical specification knowledge base. If there is only one matching message protocol file for the target message system, then that message protocol file can be determined as the target message protocol file corresponding to the standardized data template. If there are multiple matching items for the target message system, then the final determination can be made based on priority, default configuration, or user selection.
[0110] In this embodiment, the method of determining the target message system corresponding to the standardized data template is disclosed; querying the message protocol file corresponding to the target message system in the multi-message system technical specification knowledge base; and determining the target message protocol file corresponding to the standardized data template from the message protocol file. Since this embodiment can encapsulate and uniformly manage the technical specifications of each message system through the multi-message system technical specification knowledge base, it is convenient for the system to be uniformly called and maintained, and at the same time, it can reduce the expansion cost of the system.
[0111] Based on the first and / or second embodiments of this application, in the third embodiment of this application, the content that is the same as or similar to the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 4 , Figure 4 This is a flowchart illustrating the test data generation method of this application in Embodiment 3.
[0112] In this embodiment, step S40 includes steps S401 to S404:
[0113] Step S401: Traverse all fields in the transaction information label of the standardized data template.
[0114] Step S402: Determine the target message system protocol specification corresponding to each field according to the target message protocol file.
[0115] It should be understood that the aforementioned target message system protocol specification can be the syntax rules defined in the target message protocol file, including field types, lengths, formats, orders, dependencies, etc. For example, the amount field is of type Decimal and has a length of 18,2; the date field is formatted as YYYYMMDD; string fields are left-aligned and padded with spaces if the length is insufficient; some fields are required and some fields are optional; there are dependencies between fields (e.g., if field A exists, field B must also exist), etc.
[0116] Step S403: Extract the message protocol syntax rules corresponding to each field from the target message system protocol specification.
[0117] In this embodiment, the system first iterates through all fields in the transaction information tag of the standardized data template, determines the protocol field corresponding to each field, and extracts the syntax rules corresponding to the protocol field from the target message protocol file. This allows the system to perform format conversion on the business data in the standardized data template using the syntax rules corresponding to each protocol field. This includes data type conversion (e.g., string to number); length processing (e.g., padding with spaces for left alignment and zeros for right alignment); format processing (e.g., amount formatting and date formatting); and encoding processing (e.g., character set conversion). For example, for date formatting, if the original data is 2025-07-09 and its corresponding protocol syntax rule is Date(YYYYMMDD), then the converted date can be 20250709.
[0118] Step S404: Based on the message protocol syntax rules, perform format conversion on the message protocol in the standardized data template to obtain message protocol specification data.
[0119] In this embodiment, format conversion of the message protocol in the standardized data template can be the process of converting the business data (e.g., Amount = 1000.00) in the standardized data template into a data format conforming to the syntax rules defined in the target message protocol file (e.g., the :32A field format of SWIFT MT103 is "100000,00"). In practical applications, after the system performs format conversion on the message protocol in the standardized data template and obtains the converted transaction data, it can also use a validator (e.g., ...) in the message protocol syntax rules to determine the correct format. Figure 2 The "isPositiveNumber" parameter in the code performs a validity check on the converted transaction data and finally outputs message protocol specification data that conforms to the target message system protocol specification.
[0120] Furthermore, before step S404, the method further includes: determining the business type corresponding to the standardized data template; when the business type is a special business type, determining the message field verification rule corresponding to the special business type; and verifying the message fields in the standardized data template based on the message field verification rule to obtain the data verification result.
[0121] It should be noted that the aforementioned special business types can be business scenarios with specific business rules, field requirements, or validation logic, such as wealth management, remittance refunds, and salary remittances. In practical applications, these business types have personalized or mandatory requirements in terms of message structure, field content, and business logic, requiring additional identification, validation, and processing by the system. In this embodiment, the system can determine whether a business type is a special business type through business layer tag matching (such as determining whether the business type field is "refund" or "salary remittance") and field keyword matching (such as whether "SALARY" or "PENSION" appears in the message field). After identifying a special business, the system needs to first search the special database to see if the relevant message meets the special business conditions before being sent, and then automatically route the query to the relevant protocol database within the bank to see if the user's input transaction data meets the conditions. If a strong blocking condition is hit, an error can be directly returned to the user; if a weak blocking flow is hit, the user's message tag data can be automatically replaced, helping users reduce the learning curve for special businesses, unifying management in the knowledge base, and improving the testing efficiency of connecting to multi-message systems.
[0122] It should be understood that the aforementioned message field validation rules can be used to validate data in message fields for specific business types, including rules for field integrity validation, field value validation, business logic validation, and format validation. For example, for the "Wealth Management" business, the system can use field integrity validation rules to verify whether required fields such as "Product Code" and "Source of Funds" are filled in; for the "Salary Remittance" business, the system can use field value validation rules to verify whether the "SALARY" field is associated with the "Salary Remittance" business type, etc.
[0123] Accordingly, step S404 includes: when the data verification result is that the verification is passed, performing format conversion on the message protocol in the standardized data template based on the message protocol syntax rules to obtain message protocol specification data.
[0124] Understandably, if the data verification result is successful, the system can continue to generate messages; if the data verification result is unsuccessful, the system can report an error to prompt the user to handle the problem in advance and reduce the time wasted in locating the problem. In addition, the system can also automatically repair the data. For example, if the amount is negative, it can report an error or set the amount to 0; if the currency is JPY, it can automatically remove decimal places; if the BIC format is incorrect, it can provide a prompt or automatically complete the data, etc. This embodiment does not limit the data repair method.
[0125] Furthermore, after step S50, the method further includes: when a bounce message is detected, obtaining outbound transaction information of the outbound business based on the bounce message, wherein the outbound transaction information includes the outbound message system and outbound message protocol corresponding to the outbound business; generating an outbound transaction tag based on the outbound message system and the outbound message protocol; determining the message protocol tag of the bounce message protocol corresponding to the bounce message, and mapping and associating the message protocol tag with the outbound transaction tag.
[0126] It should be understood that the aforementioned rejection message can be a message corresponding to an outward remittance transaction initiated by a bank or payment system. In practical applications, the aforementioned rejection message can be a unique transaction key value of the original outward remittance transaction, which can be used to accurately locate the corresponding outward remittance transaction in a database, log, or transaction register. In this embodiment, the aforementioned outward remittance transaction information includes the outward remittance message system and the outward remittance message protocol corresponding to the outward remittance business. The outward remittance message system can be the message system used by the system when executing the outward remittance business; the outward remittance message protocol can be the message protocol used by the system when executing the outward remittance business (such as pacs004 or pacs002, MT103, etc.).
[0127] It is understandable that the aforementioned outbound transaction label can be a label used to identify the messaging system and messaging protocol used in the outbound transaction.
[0128] In practical applications, the refund message is generated by the user inputting a unique key value of the original outgoing transaction. After detecting the refund message, the system can automatically obtain the outgoing transaction information, such as the message system and message protocol (SWIFT such as MT103 or pacs008), corresponding to the original outgoing transaction through this unique key value. It can also automatically obtain the refund message protocol (pacs004 or pacs002, MT103, etc.) corresponding to the refund message through the knowledge base and outgoing transaction information. After obtaining the refund protocol message, the system can obtain the message protocol tag corresponding to the refund protocol message in the knowledge base, and automatically retrieve the original outgoing transaction data from the application database and fill it in by mapping the transaction tag and associating the mapping relationship with the original outgoing tag. This allows the user to not need to pay attention to the refund protocol and content, but only need to tell the system which transaction to refund, so as to automatically obtain the original transaction and message system route, complete message assembly and end-to-end transmission.
[0129] In the specific implementation, refer to Figure 5 , Figure 5 This is a flowchart illustrating the overall process for generating test data in this application. Figure 5 As shown, assuming a cross-border remittance transaction exists, after the system receives the corresponding transaction data, it can generate a standardized data template using a general template. Upon receiving the standardized data template, the application layer can extract the template data to obtain the business data elements and their constraints. Then, the system can select the SWIFT messaging system based on business requirements and search for the corresponding SWIFT protocol file in the multi-message system technical specification knowledge base. From the SWIFT protocol file, it extracts the SWIFT message syntax rules and field definitions. Next, the system performs format conversion and validation on the data in the standardized data template according to the SWIFT message syntax rules and field definitions. If the data validation fails, an error is reported; if the data validation passes, the data in the standardized data template is converted to data conforming to the SWIFT message specification. For example, it verifies whether the Amount field in the standardized data template is positive and whether the BIC field conforms to the format, ultimately obtaining the message protocol specification data. Finally, the system can inject the message protocol specification data into the SWIFT message through the message generator to generate the final message, and complete the message transmission through the simulator interface library. At this point, the test data generation is complete.
[0130] This embodiment discloses the following steps: traversing all fields in the transaction information tags of the standardized data template; determining the target message system protocol specification corresponding to each field according to the target message protocol file; extracting the message protocol syntax rules corresponding to each field from the target message system protocol specification; and performing format conversion on the message protocol in the standardized data template based on the message protocol syntax rules to obtain message protocol specification data. Since this embodiment can perform format conversion on the data based on the message protocol syntax rules corresponding to each field in the target message system protocol specification to obtain message data that conforms to the target message system protocol specification, each business field can be accurately mapped to the corresponding field in the message, avoiding field misalignment or omission, which is beneficial to improving the accuracy of test data generation.
[0131] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the test data generation method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.
[0132] This application also provides a test data generation device, please refer to... Figure 6 The test data generation device includes:
[0133] The data template construction module 10 is used to receive business transaction data input by the user and construct a standardized data template corresponding to the business transaction data.
[0134] Protocol file generation module 20 is used to determine the target message protocol file corresponding to the standardized data template;
[0135] Data transmission module 30 is used to transmit the standardized data template to the target message protocol file;
[0136] The protocol format conversion module 40 is used to convert the message protocol in the standardized data template according to the message protocol syntax rules in the target message protocol file when the transmission is completed, so as to obtain the message protocol specification data.
[0137] The test data generation module 50 is used to inject the message protocol specification data into the sent message to generate test data.
[0138] The test data generation apparatus provided in this application, employing the test data generation method described in the above embodiments, can solve the technical problem in the prior art where relying on manual learning to test message systems based on technical specifications easily leads to low test accuracy. Compared with the prior art, the beneficial effects of the test data generation apparatus provided in this application are the same as those of the test data generation method provided in the above embodiments, and other technical features in the test data generation apparatus are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0139] This application provides a test data generation device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the test data generation method in Embodiment 1 above.
[0140] The following is for reference. Figure 7 The diagram illustrates a structural schematic of a test data generation device suitable for implementing embodiments of this application. The test data generation device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7The test data generation device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0141] like Figure 7 As shown, the test data generation device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in the read-only memory 1002 or a program loaded from the storage device 1003 into the random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the test data generation device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the test data generation device to communicate wirelessly or wiredly with other devices to exchange data. Although the figures show test data generation devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.
[0142] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.
[0143] The test data generation device provided in this application, employing the test data generation method in the above embodiments, can solve the technical problem of test data generation. Compared with the prior art, the beneficial effects of the test data generation device provided in this application are the same as those of the test data generation method provided in the above embodiments, and other technical features in this test data generation device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.
[0144] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.
[0145] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0146] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the test data generation method in the above embodiments.
[0147] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having 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. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.
[0148] The aforementioned computer-readable storage medium may be included in the test data generation device; or it may exist independently and not assembled into the test data generation device.
[0149] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by the test data generation device, the test data generation device causes the device to: receive business transaction data input by the user and construct a standardized data template corresponding to the business transaction data; determine the target message protocol file corresponding to the standardized data template; transmit the standardized data template to the target message protocol file; upon completion of transmission, perform format conversion on the message protocol in the standardized data template based on the message protocol syntax rules in the target message protocol file to obtain message protocol specification data; and inject the message protocol specification data into the transmitted message to generate test data.
[0150] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming 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).
[0151] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0152] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0153] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described test data generation method. This addresses the technical problem in the prior art where relying on manual learning to test message systems based on technical specifications easily leads to low test accuracy. Compared to the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the test data generation method provided in the above embodiments, and will not be repeated here.
[0154] The above description is only a part of the embodiments of this application and does not limit the scope of this application. All equivalent structural transformations made under the technical concept of this application and using the content of this application specification and drawings, or direct / indirect applications in other related technical fields, are included within the protection scope of this application.
Claims
1. A method for generating test data, characterized in that, The method includes: Receive business transaction data input by the user and construct a standardized data template corresponding to the business transaction data; Determine the target message protocol file corresponding to the standardized data template; Transmit the standardized data template to the target message protocol file; Upon completion of transmission, the message protocol in the standardized data template is format-converted based on the message protocol syntax rules in the target message protocol file to obtain message protocol specification data. The message protocol specification data is injected into the sent message to generate test data.
2. The method as described in claim 1, characterized in that, The step of receiving user-inputted business transaction data and constructing a standardized data template corresponding to the business transaction data includes: Receive business transaction data input by the user, and extract transaction information elements from the business transaction data; Determine the constraints corresponding to the transaction information elements; Generate transaction information tags corresponding to the transaction information elements based on the transaction information elements and the constraints; Based on the transaction information tags and message system protocol specifications, a standardized data template corresponding to the business transaction data is constructed.
3. The method as described in claim 1, characterized in that, The step of determining the target message protocol file corresponding to the standardized data template includes: Determine the target message system corresponding to the standardized data template; Search the message protocol file corresponding to the target message system in the Multi-Message System Technical Specification Knowledge Base; The target message protocol file corresponding to the standardized data template is determined from the message protocol file.
4. The method as described in claim 3, characterized in that, The step of determining the target message system corresponding to the standardized data template includes: The business layer label and message label corresponding to the standardized data template are determined. The business layer label is a label used to describe the business scenario, and the message label is a label used to identify the message system and message protocol. The business scenario to which the standardized data template belongs is determined based on the business layer label; Based on the aforementioned business scenario and the knowledge base of multi-message system technical specifications, candidate message systems corresponding to the standardized data template are determined. Based on the message tag, the target message system corresponding to the standardized data template is determined from the candidate message systems.
5. The method as described in claim 2, characterized in that, The step of converting the message protocol in the standardized data template according to the message protocol syntax rules in the target message protocol file to obtain the message protocol specification data includes: Iterate through all fields in the transaction information tags of the standardized data template; Determine the target message system protocol specification corresponding to each field based on the target message protocol file; Extract the message protocol syntax rules corresponding to each field from the target message system protocol specification; Based on the message protocol syntax rules, the message protocol in the standardized data template is formatted to obtain message protocol specification data.
6. The method as described in claim 5, characterized in that, Before the step of converting the message protocol in the standardized data template according to the message protocol syntax rules to obtain the message protocol specification data, the method further includes: Determine the business type corresponding to the standardized data template; When the business type is a special business type, determine the message field verification rules corresponding to the special business type; Based on the message field verification rules, the message fields in the standardized data template are verified to obtain the data verification results. The step of converting the message protocol in the standardized data template according to the message protocol syntax rules to obtain the message protocol specification data includes: When the data verification result is successful, the message protocol in the standardized data template is formatted based on the message protocol syntax rules to obtain the message protocol specification data.
7. The method according to any one of claims 1 to 6, characterized in that, After the step of injecting the message protocol specification data into the sent message to generate test data, the method further includes: When a rejection message is detected, the outbound transaction information of the outbound business is obtained based on the rejection message. The outbound transaction information includes the outbound message system and outbound message protocol corresponding to the outbound business. Generate an outbound transaction tag based on the outbound message system and the outbound message protocol; Determine the message protocol tag of the refund message protocol corresponding to the refund message, and map and associate the message protocol tag with the outbound transaction tag.
8. A test data generation device, characterized in that, The device includes: The data template construction module is used to receive business transaction data input by the user and construct a standardized data template corresponding to the business transaction data. The protocol file generation module is used to determine the target message protocol file corresponding to the standardized data template; The data transmission module is used to transmit the standardized data template to the target message protocol file; The protocol format conversion module is used to convert the message protocol in the standardized data template according to the message protocol syntax rules in the target message protocol file when the transmission is completed, so as to obtain the message protocol specification data. The test data generation module is used to inject the message protocol specification data into the sent message to generate test data.
9. A test data generation device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the test data generation method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the test data generation method as described in any one of claims 1 to 7.
Citation Information
Cited By
Test data generation method, electronic equipment and computer readable medium
CN121255660A
