CN113760749A - Test message generation method and device, computer equipment and storage medium - Google Patents

Test message generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113760749A
CN113760749A CN202110902302.8A CN202110902302A CN113760749A CN 113760749 A CN113760749 A CN 113760749A CN 202110902302 A CN202110902302 A CN 202110902302A CN 113760749 A CN113760749 A CN 113760749A
Authority
CN
China
Prior art keywords
message
tested
interface
test
preset format
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110902302.8A
Other languages
Chinese (zh)
Inventor
吴昌珅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CMB Yunchuang Information Technology Co Ltd
Original Assignee
CMB Yunchuang Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CMB Yunchuang Information Technology Co Ltd filed Critical CMB Yunchuang Information Technology Co Ltd
Priority to CN202110902302.8A priority Critical patent/CN113760749A/en
Publication of CN113760749A publication Critical patent/CN113760749A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The application relates to a test message generation method, a test message generation device, computer equipment and a storage medium. The method comprises the following steps: acquiring message content of a target message which is monitored by a monitoring terminal and sent to a system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested; converting the message content into a message with a preset format; obtaining a message check code according to the message with the preset format and a preset secret key; and generating a test message of the interface to be tested according to the message with the preset format and the message check code. By adopting the method, the generation efficiency of the test message can be improved.

Description

Test message generation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a test packet, a computer device, and a storage medium.
Background
In the field of computer technology, when an interface of a certain system is tested, a corresponding test message needs to be generated, so that the interface is tested through the test message.
In the conventional technology, aiming at a test message generation method, an initial message is generally manually compiled according to an interface document, and the initial message and a message check code are manually assembled into a test message of an interface; however, the test message is obtained through manual assembly, the process is complicated, and errors are easy to occur, so that the generation efficiency of the test message is low.
Disclosure of Invention
In view of the above, it is necessary to provide a test packet generation method, an apparatus, a computer device, and a storage medium, which can improve the generation efficiency of a test packet.
A method for generating a test message, the method comprising:
acquiring message content of a target message which is monitored by a monitoring terminal and sent to a system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
converting the message content into a message with a preset format;
obtaining a message check code according to the message with the preset format and a preset secret key;
and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
In one embodiment, the converting the message content into a message in a preset format includes:
acquiring a message format conversion instruction;
and converting the format of the message content into the preset format according to the message format conversion instruction to obtain the message in the preset format.
In one embodiment, the obtaining a message check code according to the message in the preset format and a preset key includes:
and encrypting the message with the preset format according to the preset key to obtain an encrypted ciphertext serving as the message check code.
In one embodiment, the generating a test packet of the interface to be tested according to the packet with the preset format and the packet check code includes:
acquiring the combination sequence of the message with the preset format and the message check code;
and combining the message with the preset format and the message check code according to the combination sequence to obtain the test message of the interface to be tested.
In one embodiment, after generating the test packet of the interface to be tested according to the packet in the preset format and the packet check code, the method further includes:
sending the test message to a server corresponding to the interface to be tested;
receiving a response result returned by the server according to the test message;
and judging whether the response result meets the expected result of the test message.
A method for generating a test message, the method comprising:
acquiring the message content of the monitored target message sent to the system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
sending the message content to a message generating terminal; the message generating terminal is used for converting the message content into a message with a preset format, obtaining a message check code according to the message with the preset format and a preset secret key, and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
In one embodiment, the obtaining of the monitored message content of the target message sent to the system to be tested includes:
acquiring a monitored target message sent to a system to be tested;
and extracting the message content of the target message according to a preset message content extraction instruction.
A test packet generation apparatus, the apparatus comprising:
the content acquisition module is used for acquiring the message content of the target message which is monitored by the monitoring terminal and sent to the system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
the format conversion module is used for converting the message content into a message with a preset format;
the check code obtaining module is used for obtaining a message check code according to the message with the preset format and a preset secret key;
and the message generating module is used for generating a test message of the interface to be tested according to the message with the preset format and the message check code.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring message content of a target message which is monitored by a monitoring terminal and sent to a system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
converting the message content into a message with a preset format;
obtaining a message check code according to the message with the preset format and a preset secret key;
and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring message content of a target message which is monitored by a monitoring terminal and sent to a system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
converting the message content into a message with a preset format;
obtaining a message check code according to the message with the preset format and a preset secret key;
and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
According to the test message generation method, the test message generation device, the computer equipment and the storage medium, the message content of the target message which is monitored by the monitoring terminal and sent to the system to be tested is obtained; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested; then, converting the message content into a message with a preset format, and obtaining a message check code according to the message with the preset format and a preset secret key; finally, generating a test message of the interface to be tested according to the message with the preset format and the message check code; therefore, the purpose of automatically acquiring the message content and generating the test message of the interface to be tested according to the message content is achieved, manual participation is not needed in the whole process, the generation process of the test message is simplified, and the generation efficiency of the test message is improved.
Drawings
FIG. 1 is a diagram of an application environment of a test message generation method in an embodiment;
FIG. 2 is a flow chart illustrating a method for generating test packets according to an embodiment;
FIG. 3 is a flow chart illustrating a method for generating test packets according to another embodiment;
FIG. 4 is a flowchart illustrating a method for generating a test packet according to another embodiment;
FIG. 5 is a flowchart illustrating an implementation method for converting an ERP message sending request based on request content in an embodiment;
FIG. 6 is a block diagram of a test packet generation apparatus according to an embodiment;
FIG. 7 is a block diagram of a test packet generation apparatus according to another embodiment;
FIG. 8 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The test message generation method provided by the application can be applied to the application environment shown in fig. 1. The monitoring terminal 102 communicates with the message generating terminal 104 through a network. Specifically, referring to fig. 1, the monitoring terminal 102 obtains message content of a monitored target message sent to a system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested; then, the message content is sent to the message generation terminal 104; the message generating terminal 104 converts the message content into a message with a preset format, obtains a message check code according to the message with the preset format and a preset secret key, and generates a test message of the interface to be tested according to the message with the preset format and the message check code. The monitoring terminal 102 is a terminal for monitoring a message sent to a system to be tested and acquiring a message content of a target message sent to the system to be tested, and may be, but is not limited to, various message monitoring devices, and the message generating terminal 104 is a terminal for automatically generating a test message of an interface to be tested, and may be, but is not limited to, various message generating devices.
In an embodiment, as shown in fig. 2, a method for generating a test packet is provided, which is described by taking the application of the method to the packet generation terminal in fig. 1 as an example, and includes the following steps:
step S201, obtaining the message content of the target message which is monitored by the monitoring terminal and sent to the system to be tested; the target message is a message containing the same interface identifier as the interface identifier of the interface to be tested of the system to be tested.
The system to be tested refers to a system including an interface to be tested, such as a CBS (Cross-bank Solution for Cash Management platform) system. The interface to be tested refers to an interface which needs to be tested, such as an ERP (Enterprise Resource Planning) module interface.
The interface identifier refers to unique identification information of the interface, such as an interface name. The target packet specifically refers to a packet including an interface name that is the same as an interface name of a to-be-tested interface of the to-be-tested system, for example, a CBS request packet including an interface name that is an ERP module interface.
The message content of the target message refers to the request body content of the target message, and has a corresponding format, such as a JSON (JavaScript Object Notation) format.
Specifically, the monitoring terminal monitors the message sent to the system to be tested and acquires an interface identifier contained in the message sent to the system to be tested; comparing an interface identifier contained in the message sent to the system to be tested with an interface identifier of a to-be-tested interface of the system to be tested, and identifying the message currently sent to the system to be tested as a target message if the interface identifier contained in the message sent to the system to be tested is the same as the interface identifier of the to-be-tested interface of the system to be tested; and acquiring the message content of the target message, and sending the message content of the target message to the corresponding message generation terminal so as to generate a test message of the interface to be tested according to the message content of the target message through the message generation terminal.
For example, if the monitoring terminal monitors that an interface name included in the message sent to the CBS system is an ERP module interface, the monitoring terminal identifies the message currently sent to the CBS system as a CBS request message; and acquiring the request main body content of the CBS request message in the JSON format, and sending the request main body content in the JSON format to the message generation terminal.
Step S202, the message content is converted into a message with a preset format.
The preset format refers to a predefined format, such as an EXtensible Markup Language (XML) format.
Specifically, the message generating terminal performs format conversion processing on the message content according to a preset format to obtain a message in the preset format.
Step S203, obtaining a message check code according to the message with the preset format and the preset secret key.
The preset key is a key for encrypting a message in a preset format, and may be, but is not limited to, various types of keys. The message check code refers to a check code of a finally generated test message, such as a check code of an ERP message.
Specifically, the message generation terminal obtains a preset secret key and a message check code generation instruction, and processes the message in the preset format and the preset secret key according to the message check code generation instruction to obtain a message check code.
And step S204, generating a test message of the interface to be tested according to the message with the preset format and the message check code.
The test message refers to a message for testing an interface to be tested, such as an ERP message.
Specifically, the message generating terminal combines the message in the preset format and the message check code to obtain a test message of the interface to be tested.
In the test message generation method, the message content of the target message which is monitored by the monitoring terminal and sent to the system to be tested is obtained; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested; then, converting the message content into a message with a preset format, and obtaining a message check code according to the message with the preset format and a preset secret key; finally, generating a test message of the interface to be tested according to the message with the preset format and the message check code; therefore, the purpose of automatically acquiring the message content and generating the test message of the interface to be tested according to the message content is achieved, manual participation is not needed in the whole process, the generation process of the test message is simplified, and the generation efficiency of the test message is improved.
In an embodiment, the step S202 of converting the message content into a message with a preset format specifically includes: acquiring a message format conversion instruction; and according to the message format conversion instruction, converting the format of the message content into a preset format to obtain the message with the preset format.
The message format conversion instruction is an instruction for automatically converting the format of the message, for example, a JSON-format message is converted into an XML-format message. The message with the preset format specifically refers to a message with an XML format.
Specifically, the message generating terminal obtains a message format conversion instruction from a local database, and then converts the format of the message content according to the message format conversion instruction to obtain a message with a preset format.
For example, the message generation terminal converts the request body content in the JSON format into a message in the XML format according to the message format conversion instruction.
In the embodiment, the format of the message content is converted into the preset format through the message format conversion instruction, so that the message in the preset format is obtained, and the message in the preset format does not need to be manually written according to the interface document, so that the generation process of the message in the preset format is simplified, and the generation efficiency of the message in the preset format is improved.
In an embodiment, in step S203, obtaining a message check code according to the message in the preset format and the preset key specifically includes: and encrypting the message in the preset format according to the preset key to obtain an encrypted ciphertext serving as a message check code.
Specifically, the message generating terminal performs multiple encryption processing on the message in the preset format according to the preset key to obtain a message check code.
For example, the message generating terminal encrypts the XML-format message according to the preset key a to obtain the test message check code.
In this embodiment, the message in the preset format is encrypted according to the preset key to obtain the message check code, which is beneficial to improving the security of the finally generated test message.
In an embodiment, the step S204 generates a test packet of the interface to be tested according to the packet in the preset format and the packet check code, and specifically includes: acquiring a combination sequence of a message with a preset format and a message check code; and combining the message with the preset format and the message check code according to the combination sequence to obtain the test message of the interface to be tested.
Specifically, the message generating terminal combines the message check code and the message with the preset format according to the sequence that the message check code is on the left side and the message with the preset format is on the right side, so as to obtain the test message of the interface to be tested. Of course, the message generating terminal combines the message with the preset format and the message check code according to the sequence that the message with the preset format is on the left side and the message check code is on the right side, so as to obtain the test message of the interface to be tested.
For example, the message generation terminal combines the ERP message check code and the message in the XML format to obtain the ERP message.
In the embodiment, the test message of the interface to be tested is automatically generated according to the message with the preset format and the message check code without manual participation, so that the defect of low accuracy of the obtained test message due to manual assembly of the test message is avoided, and the accuracy of the generated test message is further improved.
In an embodiment, after the step S204 generates the test packet of the interface to be tested according to the packet in the preset format and the packet check code, the method further includes: sending the test message to a server corresponding to the interface to be tested; receiving a response result returned by the server according to the test message; and judging whether the response result meets the expected result of the test message.
The server corresponding to the interface to be tested specifically refers to a Hyper Text Transfer Protocol (HTTP) server of an ERP module interface in the CBS system. The response result is in accordance with the expected result of the test message, which means that the response result is close to or equal to the expected result of the test message.
Specifically, the message generating terminal sends the test message to a server corresponding to the interface to be tested; the server responds to the received test message to obtain a corresponding response result, and returns the response result to the message generating terminal; and the message generation terminal compares the received response result with the expected result of the test message to judge whether the response result meets the expected result of the test message or not, so that the test result of the interface to be tested is obtained.
In the embodiment, the test message of the interface to be tested is automatically generated and sent to the server corresponding to the interface to be tested, and the test result of the interface to be tested is automatically determined according to the response result returned by the server according to the test message, so that the whole test process does not need manual participation, the test cost of the interface to be tested is reduced, and the test efficiency of the interface to be tested is improved.
In an embodiment, as shown in fig. 3, another test packet generation method is provided, which is described by taking the example that the method is applied to the monitoring terminal in fig. 1, and includes the following steps:
step S301, obtaining the message content of the monitored target message sent to the system to be tested; the target message is a message containing the same interface identifier as the interface identifier of the interface to be tested of the system to be tested.
Step S302, sending the message content to a message generating terminal; the message generating terminal is used for converting the message content into a message with a preset format, obtaining a message check code according to the message with the preset format and a preset secret key, and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
It should be noted that, regarding the specific limitations of the above steps, the relevant description has been made from step S201 to step S204, and detailed description is not repeated herein.
The test message generation method achieves the purposes of automatically acquiring the message content and generating the test message of the interface to be tested according to the message content, and the whole process does not need manual participation, so that the generation process of the test message is simplified, and the generation efficiency of the test message is improved.
In an embodiment, the step S301 of obtaining the monitored message content of the target message sent to the system to be tested includes: acquiring a monitored target message sent to a system to be tested; and extracting the message content of the target message according to a preset message content extraction instruction.
The preset message content extraction instruction is used for automatically extracting the message content of the target message.
For example, if the monitoring terminal monitors that the interface name included in the message sent to the CBS system is the ERP module interface, the monitoring terminal identifies the message currently sent to the CBS system as the CBS request message, automatically obtains the request body content in the JSON format of the CBS request message, and uses the request body content in the JSON format as the message content of the CBS request message.
In this embodiment, the message content of the target message sent to the system to be tested is automatically extracted according to the preset message content extraction instruction, which is beneficial to improving the efficiency of obtaining the message content, and further improves the efficiency of generating the message in the preset format.
In an embodiment, as shown in fig. 4, a further test packet generation method is provided, which is described by taking the example that the method is applied to the packet generation terminal in fig. 1, and includes the following steps:
step S401, obtaining the message content of the target message which is monitored by the monitoring terminal and sent to the system to be tested; the target message is a message containing the same interface identifier as the interface identifier of the interface to be tested of the system to be tested.
Step S402, obtaining a message format conversion instruction; and according to the message format conversion instruction, converting the format of the message content into a preset format to obtain the message with the preset format.
Step S403, encrypt the packet with the preset format according to the preset key to obtain an encrypted ciphertext, which is used as the packet check code.
Step S404, acquiring a combination sequence of the message with a preset format and the message check code; and combining the message with the preset format and the message check code according to the combination sequence to obtain the test message of the interface to be tested.
Step S405, sending the test message to a server corresponding to the interface to be tested; receiving a response result returned by the server according to the test message; and judging whether the response result meets the expected result of the test message.
The test message generation method achieves the purposes of automatically acquiring the message content and generating the test message of the interface to be tested according to the message content, and the whole process does not need manual participation, so that the generation process of the test message is simplified, and the generation efficiency of the test message is improved.
In order to clarify the test packet generation method provided in the embodiment of the present application more clearly, the following describes the test packet generation method in a specific embodiment. In an embodiment, as shown in fig. 5, the present application further provides an implementation method for converting an ERP message sending request based on request content, which specifically includes the following steps:
(1) and configuring an ERP message key, a request port of the CBS ERP HTTP and starting an ERP HTTP server on an operation page of the ERP module of the CBS system.
(2) And modifying a Config configuration class ERP _ KEY (ERP message KEY) on the python script, wherein REQ _ URL (http:// 127.0.0.1: the port value/index. html configured in the step 1.
(3) Opening Fiddler software (HTTP debugging and packaging software), operating CBS, comparing interface names of Fiddler monitoring requests and ERP message interface description documents, if the requests and the ERP message interface description documents are consistent, copying request contents, and then putting request data and the ERP message interface description documents into a python script.
(4) When python is operated, the script automatically converts the content of the python dictionary format into a message in an XML format, then the check code of the ERP message is obtained according to the message in the XML format and the password, the program automatically assembles the check code and the message in the XML format into a final request message, the request message is automatically sent to the HTTP server of the ERP of the CBS system, and the program simultaneously prints the request content and the response content returned by the HTTP server of the ERP of the CBS system.
(5) And the tester judges whether the response content is in accordance with the expected result according to the printed response content.
The implementation method for converting the ERP message sending request based on the request content greatly saves the CBS testers familiar with the ERP message structure, reduces the manual operation steps and improves the testing efficiency through the realization of the python script.
It should be understood that although the various steps in the flow charts of fig. 2-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-5 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
In an embodiment, as shown in fig. 6, there is provided a test packet generating apparatus, including: a content obtaining module 601, a format conversion module 602, a check code obtaining module 603, and a message generating module 604, wherein:
a content obtaining module 601, configured to obtain a message content of a target message sent to a system to be tested and monitored by a monitoring terminal; the target message is a message containing the same interface identifier as the interface identifier of the interface to be tested of the system to be tested.
A format conversion module 602, configured to convert the message content into a message in a preset format.
The check code obtaining module 603 is configured to obtain a message check code according to the message in the preset format and the preset key.
The message generating module 604 is configured to generate a test message of the interface to be tested according to the message in the preset format and the message check code.
In an embodiment, the format conversion module 602 is further configured to obtain a message format conversion instruction; and according to the message format conversion instruction, converting the format of the message content into a preset format to obtain the message with the preset format.
In an embodiment, the check code obtaining module 603 is further configured to encrypt the packet with the preset format according to the preset key to obtain an encrypted ciphertext, which is used as the packet check code.
In an embodiment, the message generating module 604 is further configured to obtain a combination sequence of a message in a preset format and a message check code; and combining the message with the preset format and the message check code according to the combination sequence to obtain the test message of the interface to be tested.
In one embodiment, the test packet generating apparatus further includes an interface test module, configured to send the test packet to a server corresponding to the interface to be tested; receiving a response result returned by the server according to the test message; and judging whether the response result meets the expected result of the test message.
In an embodiment, as shown in fig. 7, another test packet generating apparatus is provided, including: an obtaining module 701 and a sending module 702, wherein:
an obtaining module 701, configured to obtain message content of a monitored target message sent to a system to be tested; the target message is a message containing the same interface identifier as the interface identifier of the interface to be tested of the system to be tested.
A sending module 702, configured to send the message content to the message generating terminal; the message generating terminal is used for converting the message content into a message with a preset format, obtaining a message check code according to the message with the preset format and a preset secret key, and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
In an embodiment, the obtaining module 701 is further configured to obtain a monitored target packet sent to a system to be tested; and extracting the message content of the target message according to a preset message content extraction instruction.
For specific limitations of the test packet generation apparatus, reference may be made to the above limitations on the test packet generation method, which is not described herein again. All or part of each module in the test message generation device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 8. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a test message generation method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 8 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring message content of a target message which is monitored by a monitoring terminal and sent to a system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
converting the message content into a message with a preset format;
obtaining a message check code according to a message with a preset format and a preset secret key;
and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring a message format conversion instruction; and according to the message format conversion instruction, converting the format of the message content into a preset format to obtain the message with the preset format.
In one embodiment, the processor, when executing the computer program, further performs the steps of: and encrypting the message in the preset format according to the preset key to obtain an encrypted ciphertext serving as a message check code.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring a combination sequence of a message with a preset format and a message check code; and combining the message with the preset format and the message check code according to the combination sequence to obtain the test message of the interface to be tested.
In one embodiment, the processor, when executing the computer program, further performs the steps of: sending the test message to a server corresponding to the interface to be tested; receiving a response result returned by the server according to the test message; and judging whether the response result meets the expected result of the test message.
In one embodiment, another computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring the message content of the monitored target message sent to the system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
sending the message content to a message generation terminal; the message generating terminal is used for converting the message content into a message with a preset format, obtaining a message check code according to the message with the preset format and a preset secret key, and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring a monitored target message sent to a system to be tested; and extracting the message content of the target message according to a preset message content extraction instruction.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring message content of a target message which is monitored by a monitoring terminal and sent to a system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
converting the message content into a message with a preset format;
obtaining a message check code according to a message with a preset format and a preset secret key;
and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a message format conversion instruction; and according to the message format conversion instruction, converting the format of the message content into a preset format to obtain the message with the preset format.
In one embodiment, the computer program when executed by the processor further performs the steps of: and encrypting the message in the preset format according to the preset key to obtain an encrypted ciphertext serving as a message check code.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a combination sequence of a message with a preset format and a message check code; and combining the message with the preset format and the message check code according to the combination sequence to obtain the test message of the interface to be tested.
In one embodiment, the computer program when executed by the processor further performs the steps of: sending the test message to a server corresponding to the interface to be tested; receiving a response result returned by the server according to the test message; and judging whether the response result meets the expected result of the test message.
In one embodiment, another computer-readable storage medium is provided, having a computer program stored thereon, the computer program, when executed by a processor, implementing the steps of:
acquiring the message content of the monitored target message sent to the system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
sending the message content to a message generation terminal; the message generating terminal is used for converting the message content into a message with a preset format, obtaining a message check code according to the message with the preset format and a preset secret key, and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a monitored target message sent to a system to be tested; and extracting the message content of the target message according to a preset message content extraction instruction.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for generating a test packet is characterized in that the method comprises the following steps:
acquiring message content of a target message which is monitored by a monitoring terminal and sent to a system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
converting the message content into a message with a preset format;
obtaining a message check code according to the message with the preset format and a preset secret key;
and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
2. The method according to claim 1, wherein the converting the message content into a message with a preset format comprises:
acquiring a message format conversion instruction;
and converting the format of the message content into the preset format according to the message format conversion instruction to obtain the message in the preset format.
3. The method according to claim 1, wherein obtaining a message check code according to the message in the preset format and a preset key comprises:
and encrypting the message with the preset format according to the preset key to obtain an encrypted ciphertext serving as the message check code.
4. The method according to claim 1, wherein the generating a test packet of the interface to be tested according to the packet with the preset format and the packet check code comprises:
acquiring the combination sequence of the message with the preset format and the message check code;
and combining the message with the preset format and the message check code according to the combination sequence to obtain the test message of the interface to be tested.
5. The method according to any one of claims 1 to 4, further comprising, after generating the test packet of the interface to be tested according to the packet of the preset format and the packet check code:
sending the test message to a server corresponding to the interface to be tested;
receiving a response result returned by the server according to the test message;
and judging whether the response result meets the expected result of the test message.
6. A method for generating a test packet is characterized in that the method comprises the following steps:
acquiring the message content of the monitored target message sent to the system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
sending the message content to a message generating terminal; the message generating terminal is used for converting the message content into a message with a preset format, obtaining a message check code according to the message with the preset format and a preset secret key, and generating a test message of the interface to be tested according to the message with the preset format and the message check code.
7. The method of claim 6, wherein the obtaining the message content of the monitored target message sent to the system to be tested comprises:
acquiring a monitored target message sent to a system to be tested;
and extracting the message content of the target message according to a preset message content extraction instruction.
8. A test packet generation apparatus, the apparatus comprising:
the content acquisition module is used for acquiring the message content of the target message which is monitored by the monitoring terminal and sent to the system to be tested; the target message is a message which contains the same interface identifier as the interface identifier of the interface to be tested of the system to be tested;
the format conversion module is used for converting the message content into a message with a preset format;
the check code obtaining module is used for obtaining a message check code according to the message with the preset format and a preset secret key;
and the message generating module is used for generating a test message of the interface to be tested according to the message with the preset format and the message check code.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110902302.8A 2021-08-06 2021-08-06 Test message generation method and device, computer equipment and storage medium Pending CN113760749A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110902302.8A CN113760749A (en) 2021-08-06 2021-08-06 Test message generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110902302.8A CN113760749A (en) 2021-08-06 2021-08-06 Test message generation method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113760749A true CN113760749A (en) 2021-12-07

Family

ID=78788615

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110902302.8A Pending CN113760749A (en) 2021-08-06 2021-08-06 Test message generation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113760749A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106603636A (en) * 2016-11-29 2017-04-26 中国银联股份有限公司 Error transaction standardization method and device
CN108876379A (en) * 2018-07-12 2018-11-23 北京京东金融科技控股有限公司 A kind of method and apparatus for generating message
CN109802957A (en) * 2019-01-03 2019-05-24 深圳壹账通智能科技有限公司 Interface butt joint method, device, computer equipment and storage medium
CN110830442A (en) * 2019-10-09 2020-02-21 贝壳技术有限公司 Message processing method, device and gateway
CN112333210A (en) * 2021-01-04 2021-02-05 视联动力信息技术股份有限公司 Method and equipment for realizing data communication function of video network

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106603636A (en) * 2016-11-29 2017-04-26 中国银联股份有限公司 Error transaction standardization method and device
CN108876379A (en) * 2018-07-12 2018-11-23 北京京东金融科技控股有限公司 A kind of method and apparatus for generating message
CN109802957A (en) * 2019-01-03 2019-05-24 深圳壹账通智能科技有限公司 Interface butt joint method, device, computer equipment and storage medium
CN110830442A (en) * 2019-10-09 2020-02-21 贝壳技术有限公司 Message processing method, device and gateway
CN112333210A (en) * 2021-01-04 2021-02-05 视联动力信息技术股份有限公司 Method and equipment for realizing data communication function of video network

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN108923908B (en) Authorization processing method, device, equipment and storage medium
CN107122297B (en) Method and equipment for generating request message of test interface
CN109474619B (en) Data encryption reporting method and device and data decryption method and device
CN103312551B (en) The method of testing of CGI(Common gateway interface) and testing apparatus
CN108347361B (en) Application program testing method and device, computer equipment and storage medium
CN106790083B (en) Detection method, device and the mobile terminal that DNS is kidnapped
CN111475376B (en) Method, apparatus, computer device and storage medium for processing test data
CN108256322B (en) Security testing method and device, computer equipment and storage medium
CN111444500A (en) Authentication method, device, equipment and readable storage medium
CN110188159B (en) Credit data access method, device, equipment and computer readable storage medium
CN109787974B (en) Message data stream generation method and device, computer equipment and storage medium
CN111736811A (en) Form data verification method, system, server and user terminal
CN109669859A (en) Service test method, device, computer equipment and storage medium
CN111737527A (en) Data processing method and device for heterogeneous terminal, electronic equipment and storage medium
WO2017071121A1 (en) Method and device for establishing wireless connection
CN110808950B (en) Message processing method, device, computer equipment and storage medium
CN111835710B (en) Method, device, computer equipment and storage medium for verifying request body
CN112367680A (en) External communication test method and device based on intelligent electric meter and computer equipment
CN112685077A (en) Data modification method, system, computer device and computer readable storage medium
CN110516172B (en) Resource calling method and device, computer equipment and storage medium
CN113760749A (en) Test message generation method and device, computer equipment and storage medium
CN114039760B (en) Security testing method and device, computer equipment and storage medium
CN112583602B (en) Information code data transmission method, device, system, computer device and medium
CN115374207A (en) Service processing method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination