Interface test message generation method and device, equipment and medium
By building a historical interface database and using machine learning models to generate interface test messages, the problem of low efficiency in traditional methods is solved, achieving fast and accurate test message generation and improving the efficiency and reliability of acceptance testing.
Patent Information
- Application Number
- CN202411937758.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2026-01-13
AI Technical Summary
In enterprise acceptance testing, traditional methods for obtaining interface test messages are inefficient, require multi-party collaboration, and cannot obtain the required messages when the upstream interface is down, making testing difficult.
By building a primary resource library of historical interface data, machine learning models are used to generate interface test messages, including data cleaning, field transformation, and permutation and combination, to generate accurate test messages.
It enables rapid and accurate determination of test messages, reduces manual coding time, and improves the efficiency and reliability of interface testing.
Smart Images

Figure CN121326656A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, specifically to the field of big data technology and software testing technology, and in particular to a method, apparatus, device, medium and program product for generating interface test messages. Background Technology
[0002] In enterprises, including banks, as the industry's technical architecture transforms and decoupling between various nodes continues, long-chain transactions are becoming more common. A single long-chain transaction involves API calls from multiple applications, many of which are isolated from each other. Acceptance testing often encounters situations where a particular API in the chain is modified, requiring performance testing of that API to assess its performance capacity. To address such load testing needs, testers must first obtain or construct the upload messages for that API in order to apply targeted stress to it.
[0003] There are two traditional methods for obtaining message data. One is to initiate a full-chain transaction from the very beginning of the transaction process, then search for messages in the application logs. Using the found messages as a basis, specific fields are parameterized according to business requirements before pressure is applied. However, this method requires a successful full-chain transaction and cooperation from multiple parties. Since various applications may be tested simultaneously in the test environment, if the upstream interface of the interface under test fails, the required messages cannot be obtained. Furthermore, it requires cooperation from business personnel, developers, and environment maintenance personnel, resulting in low debugging efficiency due to the large number of personnel involved. The other method involves manually constructing messages based on the interface call documentation. This method requires manually clarifying the relationships between fields each time, and since staff may not be familiar with the specific business logic of the transaction, a significant amount of time is spent debugging messages. Summary of the Invention
[0004] In view of the above problems, this disclosure provides an interface test message generation method, apparatus, device, medium and program product.
[0005] According to a first aspect of this disclosure, a method for generating interface test messages is provided. The method includes: acquiring *a* historical interface data and constructing a first resource library, where *a* is an integer and *a* is greater than or equal to 2; acquiring a document of an interface to be tested and obtaining the interface type to be tested from the document; constructing a second resource library based on the interface type to be tested and the first resource library, the second resource library including: *b* specific fields of a first historical interface, where *b* is an integer and *b* is greater than or equal to 2; acquiring the *b* specific fields of the first historical interface and inputting the *b* specific fields of the first historical interface into a pre-trained binary classification machine learning model to output *c* specific fields of an interface to be tested, where the *c* specific fields of an interface to be tested are predetermined fields, where *c* is an integer and *c* is greater than or equal to 1, and *c* is less than *b*; permuting and combining the *c* specific fields of an interface to be tested to generate *n* groups of specific fields of an interface to be tested, where *n* is an integer and *n* is greater than or equal to 1; and generating *m* interface test messages based on the *n* groups of specific fields of an interface to be tested, where *m* is an integer and *m* is greater than or equal to 1.
[0006] According to an embodiment of this disclosure, acquiring *a* historical interface data and constructing a first material library includes: acquiring *a* historical interface data, wherein each historical interface data includes a historical interface type; performing data cleaning on the *a* historical interface data to generate *d* cleaned historical interface data, wherein *d* is an integer and *d* is greater than or equal to 1, and *d* is less than *a*; performing field transformation on the *d* cleaned historical interface data to generate *e* historical interface fields, wherein *e* is an integer and *e* is greater than or equal to *d*; removing the historical interface general fields from the *e* historical interface fields to generate *f* second historical interface specific fields, wherein *f* is an integer and *f* is greater than or equal to 1, and *f* is less than *e*; and classifying the *f* second historical interface specific fields based on multiple historical interface types to construct the first material library.
[0007] According to an embodiment of this disclosure, data cleaning is performed on the a historical interface data to generate d cleaned historical interface data, including: deduplicating the a historical interface data to generate d deduplicated historical interface data; correcting the d deduplicated historical interface data to generate d corrected historical interface data; and formatting the d corrected historical interface data to generate d cleaned historical interface data.
[0008] According to an embodiment of this disclosure, constructing a second material library based on the interface type under test and the first material library includes: comparing the interface type under test with multiple historical interface types in the first material library to obtain historical interface types that are the same as the interface type under test; obtaining b second historical interface-specific fields of the historical interface types that are the same as the interface type under test, generating b first historical interface-specific fields; and constructing a second material library based on the b first historical interface-specific fields.
[0009] According to an embodiment of this disclosure, generating m interface test messages based on the n specific field groups of the interface under test includes: obtaining a general field group of the interface under test from the document of the interface under test; and combining the m specific field groups of the interface under test with the general field group of the interface under test to generate m interface test messages.
[0010] According to an embodiment of this disclosure, the method further includes: acquiring the m interface test messages, and performing stress testing on the interface under test by adjusting the request volume of the m interface test messages.
[0011] According to an embodiment of this disclosure, the method further includes: acquiring the m interface test messages, and performing stress testing on the interface under test by adjusting the concurrency of the m interface test messages.
[0012] According to a second aspect of this disclosure, an interface test message generation apparatus is provided. The apparatus includes: a first generation module, configured to acquire *a* historical interface data and construct a first resource library, wherein *a* is an integer and *a* is greater than or equal to 2; a first acquisition module, configured to acquire a document of an interface under test and acquire the type of the interface under test from the document; a second generation module, configured to construct a second resource library based on the type of the interface under test and the first resource library, the second resource library including: *b* specific fields of a first historical interface, wherein *b* is an integer and *b* is greater than or equal to 2; and a third generation module, configured to acquire the *b* first historical... The system comprises a first historical interface-specific field module, which inputs the b first historical interface-specific fields into a pre-trained binary classification machine learning model and outputs c interface-specific fields to be tested, wherein the c interface-specific fields to be tested are predetermined fields, and c is an integer greater than or equal to 1 and less than b; a fourth generation module, which is used to permutate and combine the c interface-specific fields to be tested to generate n groups of interface-specific fields to be tested, wherein n is an integer greater than or equal to 1; and a fifth generation module, which is used to generate m interface test messages based on the n groups of interface-specific fields to be tested, wherein m is an integer greater than or equal to 1.
[0013] According to an embodiment of this disclosure, the first generation module includes: a second acquisition module, used to acquire a historical interface data, wherein each historical interface data includes a historical interface type; a sixth generation module, used to perform data cleaning on the a historical interface data to generate d cleaned historical interface data, wherein d is an integer and d is greater than or equal to 1, and d is less than a; a seventh generation module, used to perform field transformation on the d cleaned historical interface data to generate e historical interface fields, wherein e is an integer and e is greater than or equal to d; an eighth generation module, used to remove the historical interface general fields from the e historical interface fields to generate f second historical interface specific fields, wherein f is an integer and f is greater than or equal to 1, and f is less than e; and a ninth generation module, used to classify the f second historical interface specific fields based on multiple historical interface types to construct the first material library.
[0014] According to an embodiment of this disclosure, the sixth generation module includes: a tenth generation module, used to deduplicate the a historical interface data to generate d deduplicated historical interface data; an eleventh generation module, used to correct the d deduplicated historical interface data to generate d corrected historical interface data; and a twelfth generation module, used to format the d corrected historical interface data to generate d cleaned historical interface data.
[0015] According to an embodiment of this disclosure, the second generation module includes: a comparison module, configured to compare the interface type under test with multiple historical interface types in the first material library to obtain historical interface types that are the same as the interface type under test; a thirteenth generation module, configured to obtain b second historical interface specific fields of the historical interface types that are the same as the interface type under test, and generate b first historical interface specific fields; and a fourteenth generation module, configured to construct a second material library based on the b first historical interface specific fields.
[0016] According to an embodiment of this disclosure, the fifth generation module includes: a second acquisition module, configured to acquire a common field group of the interface under test from the document of the interface under test; and a fifteenth generation module, configured to combine m specific field groups of the interface under test with the common field group of the interface under test to generate m interface test messages.
[0017] According to a third aspect of this disclosure, an electronic device is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the aforementioned interface test message generation method.
[0018] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having executable instructions or a computer program stored thereon, which, when executed by a processor, cause the processor to perform the above-described interface test message generation method.
[0019] According to the fifth aspect of this disclosure, a computer program product is also provided, including a computer program that, when executed by a processor, implements the above-described interface test message generation method.
[0020] This method constructs a first resource library based on historical data and a second resource library containing key data based on the test interface type. Key elements are extracted from the second resource library, and a machine learning model is used to extract known key elements to generate test messages. This solves the technical problem in traditional testing models where the required test messages cannot be obtained if the upstream interface of the interface under test is down. It can quickly, accurately, and reliably determine test messages, reducing the time and cost of manually writing test cases, saving time and improving work efficiency, and ultimately enhancing the efficiency and reliability of interface testing. Attached Figure Description
[0021] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0022] Figure 1 This diagram illustrates an application scenario of the interface test message generation method and apparatus according to embodiments of the present disclosure.
[0023] Figure 2 A flowchart illustrating an interface test message generation method according to an embodiment of the present disclosure is shown schematically.
[0024] Figure 3 This illustration schematically shows a flowchart of constructing a first material library in an interface test message generation method according to an embodiment of the present disclosure;
[0025] Figure 4 This illustration schematically shows a flowchart of data cleaning in an interface test message generation method according to an embodiment of the present disclosure;
[0026] Figure 5 This illustration schematically shows a flowchart of constructing a second material library in an interface test message generation method according to an embodiment of the present disclosure;
[0027] Figure 6 This illustration schematically shows a flowchart of the interface test message generation method according to an embodiment of the present disclosure;
[0028] Figure 7This schematically illustrates a structural block diagram of an interface test message generation apparatus according to an embodiment of the present disclosure; and
[0029] Figure 8 A block diagram schematically illustrates an electronic device suitable for implementing an interface test message generation method according to an embodiment of the present disclosure. Detailed Implementation
[0030] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0031] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0032] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0033] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0034] The accompanying drawings show some block diagrams and / or flowcharts. It should be understood that some blocks or combinations thereof in the block diagrams and / or flowcharts can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable control device, so that when executed by the processor, these instructions can create means for implementing the functions / operations described in these block diagrams and / or flowcharts.
[0035] This disclosure provides an embodiment of a method for generating interface test messages. The method includes: acquiring *a* historical interface data and constructing a first material library, where *a* is an integer and *a* is greater than or equal to 2; acquiring a document of an interface to be tested and obtaining the interface type to be tested from the document; constructing a second material library based on the interface type to be tested and the first material library, the second material library including: *b* specific fields of a first historical interface, where *b* is an integer and *b* is greater than or equal to 2; acquiring the *b* specific fields of the first historical interface and inputting the *b* specific fields of the first historical interface into a pre-trained binary classification machine learning model to output *c* specific fields of an interface to be tested, where the *c* specific fields of an interface to be tested are determined fields, where *c* is an integer and *c* is greater than or equal to 1, and *c* is less than *b*; arranging and combining the *c* specific fields of an interface to be tested to generate *n* groups of specific fields of an interface to be tested, where *n* is an integer and *n* is greater than or equal to 1; and generating *m* interface test messages based on the *n* groups of specific fields of an interface to be tested, where *m* is an integer and *m* is greater than or equal to 1.
[0036] According to embodiments of this disclosure, a first material library is constructed using historical data, and a second material library containing key data is constructed based on the test interface type. Key elements are obtained from the second material library, and known key elements are extracted using a machine learning model to generate test messages. This solves the technical problem in traditional testing models where the required test messages cannot be obtained if the upstream interface of the interface under test is down. Test messages can be determined quickly, accurately, and reliably, reducing the time and cost of manually writing test cases, saving time and improving work efficiency, and ultimately enhancing the efficiency and reliability of interface testing.
[0037] Figure 1 The diagram illustrates an application scenario of the interface test message generation method and apparatus according to embodiments of this disclosure. It should be noted that... Figure 1 The examples shown are merely examples of scenarios in which the embodiments of this disclosure can be applied, to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.
[0038] like Figure 1 As shown, application scenario 100 according to this embodiment may include an application scenario for generating interface test messages. Network 104 is used as a medium to provide a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0039] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0040] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0041] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0042] It should be noted that the interface test message generation method provided in this embodiment can generally be executed by server 105. Correspondingly, the interface test message generation device provided in this embodiment can generally be located in server 105. The interface test message generation method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the interface test message generation device provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.
[0043] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0044] The following will be based on Figure 1 The described scene, through Figures 2-6 The interface test message generation method of the disclosed embodiments is described in detail. It should be noted that the above application scenarios are shown only to facilitate understanding of the spirit and principles of this disclosure, and the implementation of this disclosure is not limited in any way. On the contrary, the implementation of this disclosure can be applied to any applicable scenario.
[0045] Figure 2 A flowchart illustrating an interface test message generation method according to an embodiment of the present disclosure is shown schematically.
[0046] like Figure 2 As shown, the method 200 includes steps S201 to S206.
[0047] Step S201: Obtain a historical interface data and construct the first material library, where a is an integer and a is greater than or equal to 2.
[0048] Figure 3 The flowchart illustrating the construction of the first material library in the interface test message generation method according to an embodiment of the present disclosure is shown.
[0049] like Figure 3 As shown, the method 300 includes steps S301 to S305.
[0050] Step S301: Obtain a historical interface data, wherein each historical interface data includes: historical interface type.
[0051] For example, taking personal financial transactions as an example, each historical interface data includes not only the historical interface type, but also: various types of bank card numbers, accounts with balances, accounts without balances, virtual personnel information, national branch numbers, teller numbers, etc.
[0052] Step S302: Perform data cleaning on the a historical interface data to generate d cleaned historical interface data, where d is an integer and d is greater than or equal to 1, and d is less than a.
[0053] Figure 4 The flowchart illustrating data cleaning in the interface test message generation method according to an embodiment of the present disclosure is shown in the illustration.
[0054] like Figure 4 As shown, the method 400 includes steps S401 to S403.
[0055] Step S401: Deduplicate the data of the a historical interfaces to generate d deduplicated historical interfaces.
[0056] Step S402: Correct the d deduplicated historical interface data to generate d corrected historical interface data.
[0057] Step S403: Format the d corrected historical interface data to generate d cleaned historical interface data.
[0058] Data cleaning can remove noisy fields, improve data quality, reduce the overall data volume, improve data processing efficiency, increase CPU utilization, save computing resources, and improve computing efficiency.
[0059] Return to reference Figure 3 In step S303, the d cleaned historical interface data are transformed to generate e historical interface fields, where e is an integer and e is greater than or equal to d.
[0060] For example, regular expressions can be used to split the data into d cleaned historical interfaces, generating e historical interface fields to improve the accuracy of field generation.
[0061] Step S304: Remove the general historical interface fields from the e historical interface fields and generate f second historical interface specific fields, where f is an integer and f is greater than or equal to 1 and f is less than e.
[0062] Step S305: Based on multiple historical interface types, classify the specific fields of the f second historical interfaces to construct the first material library.
[0063] By acquiring historical data and removing common interface fields, a primary resource library is constructed. This improves the comprehensiveness and reliability of generated test messages while simplifying the data, increasing data processing efficiency, and saving computer resources.
[0064] Return to reference Figure 2 In step S202, the test interface document is obtained, and the test interface type is obtained from the test interface document.
[0065] For example, the documentation for the interface being tested typically includes: interface type, interface name, method name, version number, format and information of the sent message header, name, data type, and data length of each field in the message body.
[0066] Interface types can generally include: deposit and withdrawal transfer transactions, wealth management transactions, and account opening and closing transactions, etc.
[0067] Step S203: Based on the tested interface type and the first material library, construct a second material library. The second material library includes b specific fields of the first historical interface, where b is an integer and b is greater than or equal to 2.
[0068] Figure 5 The flowchart illustrating the construction of the second material library in the interface test message generation method according to an embodiment of the present disclosure is shown.
[0069] like Figure 5 As shown, the method 500 includes steps S501 to S503.
[0070] Step S501: Compare the interface type under test with multiple historical interface types in the first material library to obtain the historical interface type that is the same as the interface type under test.
[0071] Step S502: Obtain b second historical interface-specific fields of the same historical interface type as the interface being tested, and generate b first historical interface-specific fields.
[0072] For example, the specific fields for the interfaces of the aforementioned deposit, withdrawal, and transfer transaction types generally include: bank account, transaction limit, and channel. The specific fields for the interfaces of the aforementioned wealth management transaction types generally include: customer information, wealth management transaction account, card number, transaction type, product number, and product type. The specific fields for the interfaces of the aforementioned account opening and closing transaction types generally include: customer information, bank card number, teller number, region code, branch number, and password.
[0073] Step S503: Construct a second material library based on the b specific fields of the first historical interface.
[0074] A second resource library is built by using the type of the interface being tested. This allows for precise identification of the resources and further clarification of the required fields, thereby improving the reliability and accuracy of the generated test messages.
[0075] Return to reference Figure 2 In step S204, the b first historical interface specific segments are obtained, the b first historical interface specific fields are input into a pre-trained binary classification machine learning model, and c test interface specific fields are output, wherein the c test interface specific fields are determined fields, where c is an integer and c is greater than or equal to 1, and c is less than b.
[0076] For example, taking interbank transfer transactions as an example, specific fields of the interbank transfer transaction type interface—bank account field, transaction amount field, and channel field—can be input into a pre-trained binary classification machine learning model, which will output the transaction amount field and channel field. The transaction amount field and channel field are known fields.
[0077] Alternatively, by inputting the b specific fields of the first historical interface into a pre-trained binary classification machine learning model, multiple undetermined fields can be output.
[0078] Step S205: Arrange and combine the c specific fields of the tested interface to generate n groups of specific fields of the tested interface, where n is an integer and n is greater than or equal to 1.
[0079] For example, suppose the channel being tested has three channel ID fields: c1, c2, and c3, and the total transfer amount fields for load testing are h1, h2, and h3 yuan, where h is greater than or equal to 0. The total amount is the product of the single transaction amount and the number of load tests. All scenarios require k accounts, where k is an integer greater than or equal to 1. Then, these specific fields of the interface being tested can be permuted and combined.
[0080] The field combination methods can be: Channel number c1, transfer amount h1, number of sending accounts k, number of receiving accounts k; Channel number c1, transfer amount h2, number of sending accounts k, number of receiving accounts k; Channel number c1, transfer amount h3, number of sending accounts k, number of receiving accounts k; Channel number c2, transfer amount h1, number of sending accounts k, number of receiving accounts k; Channel number c2, transfer amount h2, number of outgoing accounts k, number of incoming accounts k; channel number c2, transfer amount h3, number of outgoing accounts k, number of incoming accounts k; channel number c3, transfer amount h1, number of outgoing accounts k, number of incoming accounts k; channel number c3, transfer amount h2, number of outgoing accounts k, number of incoming accounts k; channel number c3, transfer amount h3, number of outgoing accounts k, number of incoming accounts k.
[0081] By adjusting the value of k for k unknown accounts, the number of records for the required field can be determined.
[0082] Step S206: Based on the n specific field groups of the tested interfaces, generate m interface test messages, where m is an integer and m is greater than or equal to 1.
[0083] Figure 6 The flowchart illustrating the generation of interface test messages in the interface test message generation method according to an embodiment of the present disclosure is shown in the illustration.
[0084] like Figure 6 As shown, the method 600 includes steps S601 to S602.
[0085] Step S601: Obtain the common field group of the interface under test from the interface under test document.
[0086] Step S602: Combine the m specific field groups of the tested interface with the general field groups of the tested interface to generate m interface test messages.
[0087] By combining general fields and specific fields, the robustness and reliability of the generated messages can be improved, thus increasing testing efficiency.
[0088] After obtaining the m interface test messages, the interface under test can be stress-tested by adjusting the request volume and concurrency of the m interface test messages.
[0089] For example, an automated stress testing tool with adjustable request and concurrency levels can be used to initiate a transaction for all accounts across the three channels mentioned above. If the transaction succeeds, the message is considered usable, and the accounts with successful transactions can be used for stress testing. If the number of usable accounts is less than k, multiple rounds of matching can be performed until the account requirement is met. The request volume refers to the total number of requests received by the interface within a certain time period, which measures the interface's load capacity. Concurrency refers to the number of requests the interface can execute concurrently at the same point in time, which measures the interface's parallel processing capability.
[0090] Stress testing is performed by adjusting concurrency and request volume. This allows for thorough testing of the interface's load performance and processing capacity, improving the reliability of the test.
[0091] This solution requires maintaining a material library from the perspective of daily business operations and extracting key element libraries for different business types. Acceptance testers only need to determine the business type of the transaction under test, match the appropriate key element field values in the material library according to the key elements of the business type, and then fill in other field values in conjunction with the interface documentation to create a usable upload message, thereby improving the efficiency of message debugging. It can be used for single interface testing and load testing script debugging in acceptance testing.
[0092] Specific methods include: First, preparing a resource library. Taking personal financial transactions as an example, this includes, but is not limited to: various types of bank card numbers, accounts with balances, accounts without balances, virtual personnel information, nationwide branch numbers, teller numbers, etc. Simultaneously, API call documentation is needed, which typically includes: API name, method name, version number, the format and information of the uploaded message header, the name, data type, and data length of each field in the message body, etc.
[0093] Secondly, a key element library is built from API documentation. Key elements vary depending on the specific business. The library summarizes and analyzes API documentation for the same business type and integrates them into a key element library. For example: key elements for deposit, withdrawal, and transfer transactions may include: bank account, transaction limit, and channel; key elements for wealth management transactions may include: customer information, wealth management transaction account, card number, transaction type, product number, and product type; key elements for account opening and closing transactions may include: customer information, bank card number, teller number, region code, branch number, and password.
[0094] Next, based on the type of the interface being tested, key elements are queried. Based on the type of interface to be tested, the same transaction type is searched in the key element library to determine the range of key elements for the transaction being tested.
[0095] Next, by matching key elements to obtain a core field list, a message set for submission is formed. Key elements are matched from the resource library, and based on the different key elements, a certain number of "core elements" (core elements are contained within key elements) are selected. These are then combined using permutations and combinations to construct the message set for submission. Taking an interbank transfer transaction as an example, the key elements of this transaction are: bank account, transaction amount, and channel. From a programming perspective, these three key elements are unknown. However, from a testing perspective, the transaction amount and channel are known when the transaction is to be performed. Therefore, the unknown item is the bank account, making it the core element. Machine learning can be used to obtain the known transaction amount and channel, along with the unknown bank account. Based on the known transaction amount and channel, and the unknown bank account, accounts for all transaction amounts across all channels can be generated. Once the key elements are determined, combined with general elements, all the information for the submission message can be pieced together.
[0096] Finally, using an automated stress testing tool, a transaction is initiated for all accounts across all channels with available credit limits. If the transaction is successful, the message is considered available, and the accounts with successful transactions can be used for stress testing message submission. If the number of available accounts is less than the number of bank accounts, multiple rounds of matching can be performed until the account requirement is met.
[0097] This method maintains a material library and a key element library. Based on different business types, it matches key elements from the material library to create appropriate upload messages, improving the efficiency of interface debugging. It can be used for single-node interface verification and stress test script debugging in acceptance testing. Based on the abstracted key elements, the core fields of the upload message can be quickly matched and the usable core fields can be filtered, improving the efficiency of debugging upload messages.
[0098] Figure 7 A schematic block diagram of an interface test message generation apparatus according to an embodiment of the present disclosure is shown.
[0099] like Figure 7 As shown, the device 700 includes: a first generation module 701, a first acquisition module 702, a second generation module 703, a third generation module 704, a fourth generation module 705, and a fifth generation module 706.
[0100] The first generation module 701 is used to acquire 'a' historical interface data and construct a first material library, where 'a' is an integer and a is greater than or equal to 2. In one embodiment, the first generation module 701 can be used to execute step S201 described above.
[0101] The first generation module 701 includes: a second acquisition module, a sixth generation module, a seventh generation module, an eighth generation module, and a ninth generation module.
[0102] The second acquisition module is used to acquire a historical interface data points, wherein each historical interface data point includes a historical interface type. In one embodiment, the second acquisition module can be used to execute step S301 described above, which will not be repeated here.
[0103] The sixth generation module is used to clean the a historical interface data to generate d cleaned historical interface data, where d is an integer greater than or equal to 1 and less than a. In one embodiment, the sixth generation module can be used to execute step S302 described above.
[0104] The sixth generation module includes: the tenth generation module, the eleventh generation module, and the twelfth generation module.
[0105] The tenth generation module is used to deduplicate the a historical interface data to generate d deduplicated historical interface data. In one embodiment, the tenth generation module can be used to execute step S401 described above, which will not be repeated here.
[0106] The eleventh generation module is used to correct the d deduplicated historical interface data and generate d corrected historical interface data. In one embodiment, the eleventh generation module can be used to execute step S402 described above, which will not be repeated here.
[0107] The twelfth generation module is used to format the d corrected historical interface data to generate d cleaned historical interface data. In one embodiment, the twelfth generation module can be used to execute step S403 described above, which will not be repeated here.
[0108] The seventh generation module is used to perform field transformation on the d cleaned historical interface data to generate e historical interface fields, where e is an integer and e is greater than or equal to d. In one embodiment, the seventh generation module can be used to execute step S303 described above, which will not be repeated here.
[0109] The eighth generation module is used to remove the general historical interface fields from the e historical interface fields and generate f second historical interface specific fields, where f is an integer greater than or equal to 1 and less than e. In one embodiment, the eighth generation module can be used to execute step S304 described above, which will not be repeated here.
[0110] The ninth generation module is used to classify specific fields of the f second historical interfaces based on multiple historical interface types to construct the first material library. In one embodiment, the ninth generation module can be used to execute step S305 described above, which will not be repeated here.
[0111] The first acquisition module 702 is used to acquire the test interface document and obtain the test interface type from the test interface document. In one embodiment, the first acquisition module 702 can be used to execute the step S202 described above, which will not be repeated here.
[0112] The second generation module 703 is used to construct a second material library based on the tested interface type and the first material library. The second material library includes b specific fields of the first historical interface, where b is an integer and b is greater than or equal to 2. In one embodiment, the second generation module 703 can be used to perform step S203 described above.
[0113] The second generation module 703 includes: a comparison module, a thirteenth generation module, and a fourteenth generation module.
[0114] The comparison module is used to compare the interface type under test with multiple historical interface types in the first material library to obtain the historical interface type that is the same as the interface type under test. In one embodiment, the comparison module can be used to perform step S501 described above, which will not be repeated here.
[0115] The thirteenth generation module is used to obtain b second historical interface-specific fields of the same historical interface type as the interface being tested, and generate b first historical interface-specific fields. In one embodiment, the thirteenth generation module can be used to execute step S502 described above, which will not be repeated here.
[0116] The fourteenth generation module is used to construct a second material library based on the b specific fields of the first historical interface. In one embodiment, the fourteenth generation module can be used to execute step S503 described above, which will not be repeated here.
[0117] The third generation module 704 is used to obtain the b specific fields of the first historical interface, input the b specific fields of the first historical interface into a pre-trained binary classification machine learning model, and output c specific fields of the interface to be tested, wherein the c specific fields of the interface to be tested are predetermined fields, and c is an integer greater than or equal to 1 and less than b. In one embodiment, the third generation module 704 can be used to execute step S204 described above, which will not be repeated here.
[0118] The fourth generation module 705 is used to arrange and combine the c specific fields of the tested interface to generate n groups of specific fields of the tested interface, where n is an integer and n is greater than or equal to 1. In one embodiment, the fourth generation module 705 can be used to execute step S205 described above, which will not be repeated here.
[0119] The fifth generation module 706 is used to generate m interface test messages based on the n specific field groups of the tested interfaces, where m is an integer and m is greater than or equal to 1. In one embodiment, the fifth generation module 706 can be used to execute step S206 described above, which will not be repeated here.
[0120] The fifth generation module 706 includes: the third acquisition module and the fifteenth generation module.
[0121] The third acquisition module is used to acquire the common field group of the interface under test from the interface under test document. In one embodiment, the third acquisition module can be used to perform step S601 described above, which will not be repeated here.
[0122] The fifteenth generation module is used to combine m specific field groups of the tested interface with the general field group of the tested interface to generate m interface test messages. In one embodiment, the fifteenth generation module can be used to execute step S602 described above, which will not be repeated here.
[0123] According to embodiments of this disclosure, any plurality of modules among the first generation module 701, the first acquisition module 702, the second generation module 703, the third generation module 704, the fourth generation module 705, and the fifth generation module 706 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the first generation module 701, the first acquisition module 702, the second generation module 703, the third generation module 704, the fourth generation module 705, and the fifth generation module 706 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging the circuitry, or implemented in any one of software, hardware, and firmware methods, or in a suitable combination of any of these methods. Alternatively, at least one of the first generation module 701, the first acquisition module 702, the second generation module 703, the third generation module 704, the fourth generation module 705, and the fifth generation module 706 can be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0124] Figure 8 A block diagram schematically illustrates an electronic device suitable for implementing an interface test message generation method according to an embodiment of the present disclosure.
[0125] like Figure 8 As shown, an electronic device 800 according to an embodiment of this disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage portion 808 into a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.
[0126] RAM 803 stores various programs and data required for the operation of electronic device 800. Processor 801, ROM 802, and RAM 803 are interconnected via bus 804. Processor 801 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 802 and / or RAM 803. It should be noted that the programs may also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0127] According to embodiments of this disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to a bus 804. The electronic device 800 may also include one or more of the following components connected to the I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 810 as needed so that computer programs read from it can be installed into the storage section 808 as needed.
[0128] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0129] According to embodiments of this disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 802 and / or RAM 803 and / or one or more memories other than ROM 802 and RAM 803 described above.
[0130] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to enable the computer system to implement the interface test message generation method provided in the embodiments of this disclosure.
[0131] When the computer program is executed by the processor 801, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0132] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 809, and / or installed from a removable medium 811. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0133] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by processor 801, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0134] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0135] 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 disclosure. 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 a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may 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.
[0136] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0137] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.
Claims
1. A method for generating interface test messages, characterized in that, The method includes: Obtain a historical interface data points and construct the first material library, where a is an integer and a is greater than or equal to 2; Obtain the document of the interface under test, and obtain the type of the interface under test from the document of the interface under test; Based on the tested interface type and the first material library, a second material library is constructed. The second material library includes b specific fields of the first historical interface, where b is an integer and b is greater than or equal to 2. Obtain the b specific fields of the first historical interface, input the b specific fields of the first historical interface into a pre-trained binary classification machine learning model, and output c specific fields of the interface under test, wherein the c specific fields of the interface under test are determined fields, and c is an integer and c is greater than or equal to 1 and c is less than b; The c specific fields of the tested interface are permuted and combined to generate n groups of specific fields of the tested interface, where n is an integer and n is greater than or equal to 1; and Based on the n specific field groups of the tested interfaces, generate m interface test messages, where m is an integer and m is greater than or equal to 1.
2. The method according to claim 1, characterized in that, Obtain data from 'a' historical interfaces and construct the first material library, including: Obtain 'a' historical interface data, wherein each historical interface data includes: historical interface type; Data cleaning is performed on the a historical interface data to generate d cleaned historical interface data, where d is an integer and d is greater than or equal to 1, and d is less than a; The cleaned historical interface data of the d data are transformed to generate e historical interface fields, where e is an integer and e is greater than or equal to d; Remove the common historical interface fields from the e historical interface fields to generate f second historical interface specific fields, where f is an integer greater than or equal to 1 and less than e; and Based on multiple historical interface types, specific fields of the f second historical interfaces are classified to construct the first material library.
3. The method according to claim 2, characterized in that, Data cleaning is performed on the a historical interface data to generate d cleaned historical interface data, including: The a historical interface data are deduplicated to generate d deduplicated historical interface data. The d deduplicated historical interface data are corrected to generate d corrected historical interface data; and The d corrected historical interface data are formatted to generate d cleaned historical interface data.
4. The method according to claim 2, characterized in that, Based on the tested interface type and the first material library, a second material library is constructed, including: The interface type under test is compared with multiple historical interface types in the first material library to obtain the historical interface type that is the same as the interface type under test. Obtain b specific fields of the same historical interface type as the interface being tested as the second historical interface, and generate b specific fields of the first historical interface; and Based on the b specific fields of the first historical interface, a second material library is constructed.
5. The method according to claim 1, characterized in that, Based on the n specific field groups of the tested interfaces, generate m interface test messages, including: Obtain the common field group of the interface under test from the document of the interface under test; and Combine the m specific field groups of the interface under test with the general field groups of the interface under test to generate m interface test messages.
6. The method according to any one of claims 1 to 5, characterized in that, The method also includes: Obtain the m interface test messages, and perform stress testing on the interface under test by adjusting the request volume of the m interface test messages.
7. The method according to any one of claims 1 to 5, characterized in that, The method also includes: Obtain the m interface test messages, and perform stress testing on the interface under test by adjusting the concurrency of the m interface test messages.
8. An interface test message generation device, characterized in that, The device includes: The first generation module is used to obtain a historical interface data and build the first material library, where a is an integer and a is greater than or equal to 2; The first acquisition module is used to acquire the test interface document and acquire the test interface type from the test interface document; The second generation module is used to construct a second material library based on the tested interface type and the first material library. The second material library includes b specific fields of the first historical interface, where b is an integer and b is greater than or equal to 2. The third generation module is used to obtain the b specific fields of the first historical interface, input the b specific fields of the first historical interface into a pre-trained binary classification machine learning model, and output c specific fields of the tested interface, wherein the c specific fields of the tested interface are determined fields, wherein c is an integer and c is greater than or equal to 1, and c is less than b. The fourth generation module is used to arrange and combine the c specific fields of the tested interface to generate n groups of specific fields of the tested interface, where n is an integer and n is greater than or equal to 1; and The fifth generation module is used to generate m interface test messages based on the n specific field groups of the tested interfaces, where m is an integer and m is greater than or equal to 1.
9. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.