Automatic testing method for bank-enterprise direct connection program
By developing automated testing components based on Python to automatically check the messages of the bank-enterprise direct connection program, the problem of low efficiency and poor accuracy of manual inspection was solved, and the quality of bank-enterprise direct connection products and the efficiency of patch delivery were improved.
Patent Information
- Application Number
- CN202410898546.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-10-29
AI Technical Summary
The XML file format of the bank-enterprise direct connection program is complex, the amount of data is large, the semantic understanding is error-prone, and the version control and rules are diverse, resulting in high manual inspection costs, low efficiency, poor accuracy, and difficulty in unified management of test results.
Develop automated testing components based on Python, including TCP request sender, direct message receiver and inspection result generator, automatically send and receive messages, check whether message fields match according to rules, and generate visual test reports.
It improves the quality of bank-enterprise direct connection products, improves patch delivery efficiency, saves manpower and material resources, detects problems in a timely manner, reduces workload, and improves efficiency.
Smart Images

Figure CN118860871A_ABST
Abstract
Description
Technical Field
[0001] The invention discloses a method, and relates to the technical field of software testing, in particular to an automated testing method for a bank-enterprise direct connection program. Background Art
[0002] The bank-enterprise direct connection program is in a state of continuous iteration, and product patches can be regarded as a small but complete product development process. For bank-enterprise direct connection related tests, sending bank messages is the top priority, but there are some problems in the manual inspection process of messages, such as:
[0003] (1) Complex format: XML files have multiple structural levels and many nested elements, which may make them difficult to read and understand manually. Different elements and attributes may have similar names, increasing the possibility of confusion.
[0004] (2) Large amount of data: When comparing large amounts of XML data, manual operations are not only inefficient and time-consuming, but also prone to errors. Long hours of work may lead to fatigue, further affecting the accuracy of the comparison.
[0005] (3) Semantic understanding is prone to errors: XML files usually contain business-related semantic information, and the correct understanding of this information requires relevant background knowledge. When manually comparing, the actual meaning of certain elements and attributes may be ignored or misunderstood.
[0006] (4) Version control: When comparing different versions of XML files, it is necessary to track and identify which content has changed, which fields have been added or which fields have been reduced. Manual comparison is difficult to guarantee 100% accuracy, especially when dealing with large amounts of data. This requires the manual comparator to have a high degree of attention and patience.
[0007] (5) Diverse rules: The comparison rules may vary depending on business needs, which increases the complexity and uncertainty of manual comparison. Manual comparators need to be familiar with and follow these rules to ensure the accuracy of the comparison results. Summary of the invention
[0008] The present invention aims at the problems of the prior art and provides an automated testing method for a bank-enterprise direct connection program, which can realize automatic sending of TCP request messages, automatic acquisition of messages sent by the bank-enterprise direct connection program, and checking of actual messages according to established rules, thereby solving the problems of complicated steps for manually making a request to send a message, high cost of checking the message XML file, low execution efficiency, poor comparison accuracy, and inability to uniformly collect and manage test results. The method can improve work efficiency and inspection standardization to the greatest extent, and ultimately achieve the purpose of improving product quality.
[0009] The specific scheme proposed by the present invention is:
[0010] The present invention provides an automated testing method for a bank-enterprise direct connection program, comprising:
[0011] Develop an automated test component based on Python, which includes a TCP request sender, a direct message receiver, and a check result generator.
[0012] Use the TCP request sender to obtain the expected message for testing in the database, send the expected message to the bank-enterprise direct connection program through a TCP request, and pass the expected message and the expected test result to the inspection result generator.
[0013] The direct connection message receiver is used to automatically intercept the actual message forwarded to the bank by the bank-enterprise direct connection program, and pass the actual message to the inspection result generator.
[0014] The inspection result generator is used to check whether the fields of the expected message and the actual message are consistent, and the inspection results are uniformly classified and processed to generate a visual test report.
[0015] Furthermore, in the automated testing method for the bank-enterprise direct connection program, a TCP request sender is used to use SQL to clear database-related junk data, openpyxl is used to read the expected message for testing in the database file, and the expected message is automatically converted into GBK encoding format, sent to the bank-enterprise direct connection program in the form of a TCP request, and the expected message and the expected test result are passed to the inspection result generator.
[0016] Furthermore, in the automated testing method of the bank-enterprise direct connection program, a direct connection message receiver is used to start a persistent httpserver service to receive GET and POST requests sent to the service specified port, which is used to intercept the actual message forwarded by the bank-enterprise direct connection program to the bank, and pass the actual message to the inspection result generator.
[0017] Furthermore, in the automated testing method of the bank-enterprise direct connection program, the expected message and the actual message are divided into a list according to the XML format by using the inspection result generator, and the inspection exclusion items are removed, and the expected message and the actual message are compared and inspected according to the set inspection rules to obtain the inspection result.
[0018] The inspection rules include: whether the actual message has more fields, whether the actual message has fewer fields, and whether the actual message field values are correct.
[0019] Furthermore, in the automated testing method for the bank-enterprise direct connection program, if the inspection result is that the fields of the expected message and the actual message do not match, the inspection result generator traverses the field names and field values in the actual message list and the expected message list, and performs a detailed comparison to check for fields with more or fewer fields in the actual message, as well as fields with incorrect actual message field values.
[0020] The present invention also provides an automated testing device for a bank-enterprise direct connection program, wherein the automated testing device is based on Python to develop an automated testing component, wherein the automated testing component includes a TCP request sender, a direct connection message receiver, and a check result generator.
[0021] The TCP request sender obtains the expected message for testing in the database, sends the expected message to the bank-enterprise direct connection program through a TCP request, and passes the expected message and the expected test result to the inspection result generator.
[0022] The direct connection message receiver automatically intercepts the actual message forwarded to the bank by the bank-enterprise direct connection program, and passes the actual message to the inspection result generator.
[0023] The inspection result generator checks whether the fields of the expected message and the actual message are consistent, and classifies the inspection results uniformly to generate a visual test report.
[0024] Furthermore, the TCP request sender of the automated testing device for the bank-enterprise direct connection program uses SQL to clear database-related junk data, uses openpyxl to read the expected message for testing in the database file, and automatically converts the expected message into GBK encoding format, sends it to the bank-enterprise direct connection program in the form of a TCP request, and passes the expected message and the expected test result to the inspection result generator.
[0025] Furthermore, the direct connection message receiver of the automated testing device for the bank-enterprise direct connection program starts a persistent httpserver service to receive GET and POST requests sent to the service specified port, which is used to intercept the actual message forwarded by the bank-enterprise direct connection program to the bank, and pass the actual message to the inspection result generator.
[0026] Furthermore, the inspection result generator of the automated testing device for the bank-enterprise direct connection program divides the expected message and the actual message into a list according to the XML format, removes the inspection exclusion items, and compares the expected message with the actual message according to the set inspection rules to obtain the inspection result.
[0027] The inspection rules include: whether the actual message has more fields, whether the actual message has fewer fields, and whether the actual message field values are correct.
[0028] Furthermore, if the inspection result of the automated testing device for the bank-enterprise direct connection program is that the fields of the expected message and the actual message do not match, the inspection result generator traverses the field names and field values in the actual message list and the expected message list, and performs a detailed comparison to check for fields with more or fewer fields in the actual message, as well as fields with incorrect actual message field values.
[0029] The benefits of the present invention are:
[0030] It can realize automated testing of bank-enterprise direct connection program, and effectively solve the problems of tedious manual message sending and document preparation, high cost of manual inspection of message XML files, low execution efficiency, poor comparison accuracy, etc. It has greatly improved the quality of the company's bank-enterprise direct connection products, improved the efficiency of patch delivery, greatly saved manpower and material resources in the whole link during patch testing, and discovered problems in time. Compared with the company's previous manual testing method, the workload has been reduced and the benefits have been improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION
[0032] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0033] Example 1
[0034] Some preparatory work can be done, such as modifying the interface parameters of the bank direct connection program, changing REMORTIP to the address of the automated direct connection message receiver, and changing REMORTPORT to the port of the automated direct connection message receiver.
[0035] During the automated test, the following attributes are set in the configuration file: ip: specified ip, port: specified port, exclusion: tr_time. Among them, ip is the bank-enterprise direct connection program address, port is the bank-enterprise direct connection program port number, and exclusion is the check exclusion item.
[0036] The present invention provides an automated testing method for a bank-enterprise direct connection program, comprising:
[0037] S1: Develop an automated test component based on Python, wherein the automated test component includes a TCP request sender, a direct connection message receiver, and a check result generator.
[0038] Start the TCP request sender, direct connection message receiver and inspection result generator respectively.
[0039] S2: Call the TCP request sender to obtain the expected message for testing in the database, send the expected message to the bank-enterprise direct connection program through a TCP request, and pass the expected message and the expected test result to the inspection result generator.
[0040] The TCP request sender can be further used to use the relevant database technology in Python to clear the database-related junk data according to the pre-customized SQL, and openpyxl can be used to read the expected message for testing in the database file, and automatically convert the expected message into GBK encoding format, and send it to the bank-enterprise direct connection program in the form of a TCP request, and pass the expected message and the expected test results to the inspection result generator.
[0041] S3: Call the direct connection message receiver to automatically intercept the actual message forwarded to the bank by the bank-enterprise direct connection program, and pass the actual message to the inspection result generator.
[0042] The direct connection message receiver can be further used to use Python technology to start a persistent httpserver service to receive GET and POST requests sent to the service specified port, so as to intercept the actual message forwarded to the bank by the bank-enterprise direct connection program and pass the actual message to the inspection result generator.
[0043] S4: Call the check result generator to check whether the fields of the expected message and the actual message are consistent, and classify the check results uniformly to generate a visual test report.
[0044] The inspection result generator can be further used to split the expected message and the actual message into a list according to the XML format, remove the inspection exclusion items, and compare the expected message with the actual message according to the set inspection rules to obtain the inspection results.
[0045] The inspection rules include: whether the actual message has more fields, whether the actual message has fewer fields, and whether the actual message field values are correct.
[0046] If the inspection result shows that the fields of the expected message and the actual message do not match, the inspection result generator will traverse the field names and field values in the actual message list and the expected message list, and conduct a detailed comparison to check the fields with more or fewer fields in the actual message, as well as the fields with incorrect field values in the actual message. The inspection results will be written into a table to generate a visual test report in Excel format.
[0047] Example 2
[0048] The present invention also provides an automated testing device for a bank-enterprise direct connection program, wherein the automated testing device is based on Python to develop an automated testing component, wherein the automated testing component includes a TCP request sender, a direct connection message receiver, and a check result generator.
[0049] The TCP request sender obtains the expected message for testing in the database, sends the expected message to the bank-enterprise direct connection program through a TCP request, and passes the expected message and the expected test result to the inspection result generator.
[0050] The direct connection message receiver automatically intercepts the actual message forwarded to the bank by the bank-enterprise direct connection program, and passes the actual message to the inspection result generator.
[0051] The inspection result generator checks whether the fields of the expected message and the actual message are consistent, and classifies the inspection results uniformly to generate a visual test report.
[0052] As the information interaction, execution process and other contents between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.
[0053] Similarly, the device of the present invention can realize the automated testing of the bank-enterprise direct connection program, which can effectively solve the problems of cumbersome manual message sending, high cost, low execution efficiency, and poor comparison accuracy of manual inspection of message XML files. It has greatly improved the quality of the company's bank-enterprise direct connection products, improved the efficiency of patch delivery, greatly saved manpower and material resources in the whole link during patch testing, and discovered problems in time. Compared with the company's previous manual testing method, the workload has been reduced and the benefits have been improved.
[0054] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0055] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. An automated testing method for a bank-enterprise direct connection program, characterized in that include: Develop an automated test component based on Python, which includes a TCP request sender, a direct message receiver, and a check result generator. Use the TCP request sender to obtain the expected message for testing in the database, send the expected message to the bank-enterprise direct connection program through a TCP request, and pass the expected message and the expected test result to the inspection result generator. The direct connection message receiver is used to automatically intercept the actual message forwarded to the bank by the bank-enterprise direct connection program, and pass the actual message to the inspection result generator. The inspection result generator is used to check whether the fields of the expected message and the actual message are consistent, and the inspection results are uniformly classified and processed to generate a visual test report.
2. The automated testing method for a bank-enterprise direct connection program according to claim 1, characterized in that Use the TCP request sender to use SQL to clear database-related junk data, use openpyxl to read the expected message for testing in the database file, and automatically convert the expected message into GBK encoding format, send it to the bank-enterprise direct connection program in the form of a TCP request, and pass the expected message and the expected test results to the inspection result generator.
3. The automated testing method for a bank-enterprise direct connection program according to claim 1, characterized in that A persistent httpserver service is started using the direct connection message receiver to receive GET and POST requests sent to the service specified port, which is used to intercept the actual message forwarded to the bank by the bank-enterprise direct connection program and pass the actual message to the inspection result generator.
4. The automated testing method for a bank-enterprise direct connection program according to claim 1, characterized in that Use the inspection result generator to split the expected message and the actual message into lists according to the XML format, remove the inspection exclusion items, and compare the expected message with the actual message according to the set inspection rules to obtain the inspection results. The inspection rules include: whether the actual message has more fields, whether the actual message has fewer fields, and whether the actual message field values are correct.
5. The automated testing method for a bank-enterprise direct connection program according to claim 4, characterized in that If the inspection result shows that the fields of the expected message and the actual message do not match, the inspection result generator traverses the field names and field values in the actual message list and the expected message list, and performs a detailed comparison to check the fields with more or less fields in the actual message, as well as the fields with incorrect field values in the actual message.
6. An automated testing device for a bank-enterprise direct connection program, characterized in that The automated testing device develops an automated testing component based on Python, and the automated testing component includes a TCP request sender, a direct connection message receiver, and a check result generator. The TCP request sender obtains the expected message for testing in the database, sends the expected message to the bank-enterprise direct connection program through a TCP request, and passes the expected message and the expected test result to the inspection result generator. The direct connection message receiver automatically intercepts the actual message forwarded to the bank by the bank-enterprise direct connection program, and passes the actual message to the inspection result generator. The inspection result generator checks whether the fields of the expected message and the actual message are consistent, and classifies the inspection results uniformly to generate a visual test report.
7. The automatic testing device for bank-enterprise direct connection program according to claim 6 is characterized in that TCP The request sender uses SQL to clear database-related junk data, uses openpyxl to read the expected message for testing in the database file, automatically converts the expected message into GBK encoding format, sends it to the bank-enterprise direct connection program in the form of a TCP request, and passes the expected message and the expected test result to the inspection result generator.
8. The automatic testing device for the bank-enterprise direct connection program according to claim 6 is characterized in that The direct connection message receiver starts a persistent httpserver service to receive GET and POST requests sent to the service specified port, which is used to intercept the actual message forwarded to the bank by the bank-enterprise direct connection program and pass the actual message to the inspection result generator.
9. The automatic testing device for a bank-enterprise direct connection program according to claim 6, characterized in that The inspection result generator divides the expected message and the actual message into lists according to the XML format, removes the inspection exclusion items, and compares the expected message with the actual message according to the set inspection rules to obtain the inspection results. The inspection rules include: whether the actual message has more fields, whether the actual message has fewer fields, and whether the actual message field values are correct.
10. The automatic testing device for bank-enterprise direct connection program according to claim 9 is characterized in that If the inspection result shows that the fields of the expected message and the actual message do not match, the inspection result generator traverses the field names and field values in the actual message list and the expected message list, and performs a detailed comparison to check the fields with more or less in the actual message, as well as the fields with incorrect field values in the actual message.
