CN114221883B - Message testing method, device, server and storage medium - Google Patents
Message testing method, device, server and storage medium Download PDFInfo
- Publication number
- CN114221883B CN114221883B CN202111526001.6A CN202111526001A CN114221883B CN 114221883 B CN114221883 B CN 114221883B CN 202111526001 A CN202111526001 A CN 202111526001A CN 114221883 B CN114221883 B CN 114221883B
- Authority
- CN
- China
- Prior art keywords
- message
- queue
- target
- request
- association information
- 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.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 150
- 238000000034 method Methods 0.000 claims abstract description 20
- 238000004590 computer program Methods 0.000 claims description 21
- 238000004140 cleaning Methods 0.000 claims description 17
- 230000005540 biological transmission Effects 0.000 claims description 5
- 230000001502 supplementing effect Effects 0.000 claims description 5
- 238000013473 artificial intelligence Methods 0.000 abstract description 9
- 230000009286 beneficial effect Effects 0.000 abstract description 3
- 238000005516 engineering process Methods 0.000 description 11
- 230000006870 function Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 230000008859 change Effects 0.000 description 4
- 238000000605 extraction Methods 0.000 description 4
- 238000007726 management method Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 3
- 238000011010 flushing procedure Methods 0.000 description 2
- 239000000203 mixture Substances 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000000047 product Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0817—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/14—Network analysis or design
- H04L41/145—Network analysis or design involving simulating, designing, planning or modelling of a network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/04—Real-time or near real-time messaging, e.g. instant messaging [IM]
- H04L51/043—Real-time or near real-time messaging, e.g. instant messaging [IM] using or handling presence information
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application is applicable to the technical field of artificial intelligence, and provides a message testing method, a device, a server and a storage medium, wherein the method comprises the following steps: receiving a test request sent by a test terminal; selecting the associated information corresponding to the target queue name from the prestored associated information set, and transmitting a queue message template in the selected associated information to the test terminal; acquiring a target queue message returned by the test terminal based on the queue message template from the target message queue; according to the message type of the target queue message, transmitting the target queue message to a message channel corresponding to the message type, so as to send the target queue message to a message server corresponding to the message type through the message channel. The application can realize that different platforms do not need to be logged in when testing and sending different types of queue messages, thereby being beneficial to improving the testing efficiency.
Description
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to a method and apparatus for testing messages, a server, and a storage medium.
Background
Message queues are containers that hold messages during their transmission. The main purpose of the message queue is to provide routing and to ensure delivery of messages; if the recipient is not available at the time the message is sent, the message queue will hold the message until it can be successfully delivered.
In the related art, message queues are frequently applied in micro-service system architecture. Management and operation of message queues is very dependent on the message platform. When users need to test and send queue messages of different types, the queue messages need to be sent by logging in different platforms, the operation is complex, and the testing efficiency is easy to reduce.
Disclosure of Invention
In view of the above, the embodiments of the present application provide a method, an apparatus, a server, and a storage medium for testing messages, so as to solve the problems in the related art that when a user needs to test to send different types of queue messages, the user needs to log in different platforms to send the queue messages, which is complex in operation and easy to test and has low efficiency.
A first aspect of an embodiment of the present application provides a message testing method, including:
Receiving a test request sent by a test terminal, wherein the test request comprises a target queue name of a target message queue;
Selecting associated information corresponding to a target queue name from a prestored associated information set, and sending a queue message template in the selected associated information to a test terminal, wherein the associated information in the associated information set comprises the queue name and the queue message template;
Acquiring a target queue message returned by the test terminal based on the queue message template from the target message queue;
Transmitting the target queue message to a message channel corresponding to the message type according to the message type of the target queue message, so as to send the target queue message to a message server corresponding to the message type through the message channel, wherein the message server is used for sending the queue message of the corresponding type to a message receiver.
Further, if the association information in the association information set further includes at least one scene identifier, and each scene identifier corresponds to a queue message template, the test request further includes a target scene identifier for indicating a test scene.
Further, the queue message template in the selected association information is sent to the test terminal, which comprises the following steps:
And sending the queue message template corresponding to the target scene identifier in the selected associated information to the test terminal.
Further, the method further comprises:
Storing the target queue message, the target queue name and the target scene identifier in a target data set in an associated manner;
Extracting target data matched with the request queue name and the request scene identification from a target data set and extracting association information matched with the request queue name from an association information set when a message update request comprising the request queue name, the request scene identification and new template description information is received;
and according to the new template description information and the queue message template corresponding to the request scene identifier in the extracted association information, performing data cleaning on the queue message in the extracted target data so that the queue message after data cleaning is matched with the new template described by the new template description information.
Further, according to the new template description information and the queue message template corresponding to the request scene identifier in the extracted association information, performing data cleaning on the queue message in the extracted target data, including:
Determining a set of data fields included in a queue message template corresponding to the request scene identifier, and recording the set of data fields included in the new template as a first field set, and determining a set of data fields included in the new template according to new template description information, and recording the set of data fields as a second field set;
and marking the queue message in the extracted target data as a request queue message, and cleaning the request queue message according to the first field set and the second field set.
Further, data cleansing is performed on the request queue message according to the first field set and the second field set, and the data cleansing comprises at least one of the following steps:
retaining crossing data fields in the request queue message, wherein the crossing data fields belong to a first field set and belong to a second field set;
Deleting redundant data fields in the request queue message, wherein the redundant data fields belong to a first field set and do not belong to a second field set;
And supplementing the newly added data field in the request queue message, wherein the newly added data field belongs to the second field set and does not belong to the first field set.
Further, the method further comprises:
if the associated information set does not contain the associated information corresponding to the target queue name, presenting a preset information input interface to the test terminal, wherein the preset information input interface is used for guiding a user to input the associated information corresponding to the target queue name;
And receiving the association information corresponding to the target queue name, which is input by the user on the preset information input interface, from the test terminal, and storing the received association information into an association information set.
A second aspect of an embodiment of the present application provides a message testing apparatus, including:
The request receiving unit is used for receiving a test request sent by the test terminal, wherein the test request comprises a target queue name of a target message queue;
An information selecting unit, configured to select, from a pre-stored association information set, association information corresponding to a target queue name, and send a queue message template in the selected association information to a test terminal, where the association information in the association information set includes the queue name and the queue message template;
the message acquisition unit is used for acquiring a target queue message returned by the test terminal based on the queue message template from the target message queue;
and the message transmission unit is used for transmitting the target queue message to a message channel corresponding to the message type according to the message type of the target queue message so as to send the target queue message to a message server corresponding to the message type through the message channel, wherein the message server is used for sending the queue message of the corresponding type to a message receiver.
Further, if the association information in the association information set further includes at least one scene identifier, and each scene identifier corresponds to a queue message template, the test request further includes a target scene identifier for indicating a test scene.
Further, the information selecting unit is specifically configured to:
And sending the queue message template corresponding to the target scene identifier in the selected associated information to the test terminal.
Further, the device also comprises an association storage unit, an information extraction unit and an update execution unit.
The association storage unit is used for storing the target queue information, the target queue name and the target scene identifier in an association manner into a target data set;
An information extraction unit for extracting, when a message update request including a request queue name, a request scene identification, and new template description information is received, target data matching the request queue name and the request scene identification from a target data set, and association information matching the request queue name from an association information set;
And the updating execution unit is used for carrying out data cleaning on the queue message in the extracted target data according to the new template description information and the queue message template corresponding to the request scene identifier in the extracted association information so as to enable the queue message after the data cleaning to be matched with the new template described by the new template description information.
Further, the update execution unit is specifically configured to:
Determining a set of data fields included in a queue message template corresponding to the request scene identifier, and recording the set of data fields included in the new template as a first field set, and determining a set of data fields included in the new template according to new template description information, and recording the set of data fields as a second field set;
and marking the queue message in the extracted target data as a request queue message, and cleaning the request queue message according to the first field set and the second field set.
Further, in the update execution unit, the data cleansing is performed on the request queue message according to the first field set and the second field set, including at least one of the following:
retaining crossing data fields in the request queue message, wherein the crossing data fields belong to a first field set and belong to a second field set;
Deleting redundant data fields in the request queue message, wherein the redundant data fields belong to a first field set and do not belong to a second field set;
And supplementing the newly added data field in the request queue message, wherein the newly added data field belongs to the second field set and does not belong to the first field set.
Further, the device also comprises an interface presenting unit and an information storage unit.
The interface presentation unit is used for presenting a preset information input interface to the test terminal if the associated information corresponding to the target queue name does not exist in the associated information set, wherein the preset information input interface is used for guiding a user to input the associated information corresponding to the target queue name;
And the information storage unit is used for receiving the association information corresponding to the target queue name and input by a user on the preset information input interface from the test terminal and storing the received association information into the association information set.
A third aspect of an embodiment of the present application provides a server comprising a memory, a processor and a computer program stored in the memory and operable on the server, the processor implementing the steps of the message testing method provided in the first aspect when the computer program is executed.
A fourth aspect of the embodiments of the present application provides a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the message testing method provided in the first aspect.
The message testing method, the device, the server and the storage medium provided by the embodiment of the application have the following beneficial effects: by analyzing the message type of the target queue message, transmitting the target queue message to a message channel corresponding to the message type and transmitting the target queue message to a message server corresponding to the message type through the message channel, the test transmission of different types of queue messages can be realized without logging in different platforms, the operation is more convenient, and the test efficiency is improved. In addition, when testing is performed, the related information corresponding to the target queue name can be found from the related information set based on the target queue name of the target message queue, so that a queue message template is obtained, and then the obtained queue message template is sent to the test terminal, so that the test terminal can quickly and effectively generate and return the queue message according to the format of the queue message template, and the test efficiency and the accuracy are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the related technical descriptions will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an implementation of a message testing method provided by an embodiment of the present application;
FIG. 2 is a flow chart of an implementation of a method for flushing queue messages provided by an embodiment of the application;
FIG. 3 is a flowchart of another message testing method according to an embodiment of the present application;
FIG. 4 is a block diagram of a message testing apparatus according to an embodiment of the present application;
Fig. 5 is a block diagram of a server according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Wherein artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) is the theory, method, technique, and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend, and expand human intelligence, sense the environment, acquire knowledge, and use knowledge to obtain optimal results.
Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
In the embodiment of the application, the message sending function is tested based on an artificial intelligence technology.
The message testing method according to the embodiment of the application can be executed by a server. When the message testing method is executed by the server, the execution subject is the server. In practice, the server is usually a management server, and the management server may manage the test process data or the development process data.
It should be noted that the above-mentioned server may include, but is not limited to, a server, a computer, a cell phone, a tablet or a wearable smart device, etc. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 1, fig. 1 shows a flowchart of an implementation of a message testing method according to an embodiment of the present application, including:
And step 101, receiving a test request sent by a test terminal.
Wherein the test request includes a target queue name of the target message queue. The target message queue is typically the message queue selected for testing. The execution body can acquire the message to be tested from the test terminal through the target message queue. The target queue name is typically the name of the target message queue.
Here, the execution body may receive the test request sent by the test terminal through the network.
Step 102, selecting the associated information corresponding to the target queue name from the prestored associated information set, and transmitting the queue message template in the selected associated information to the test terminal.
The association information in the association information set comprises a queue name and a queue message template.
The queue message templates described above are typically used to indicate the composition of messages transmitted by a target message queue. As one example, the composition of the target message queue may be as follows:
{
"orderId":"H202108112227490298792202",
"orderState":"10",
"penaltyAmount":"410000000"
}
In the above example, the target message queue includes three data fields, "orderId", "orderState", "penaltyAmount", respectively, where the data corresponding to the data field "orderId" may have 25 bits, the data corresponding to the data field "orderState" may have 2 bits, and the data corresponding to the data field "penaltyAmount" may have 9 bits.
Here, the execution body may use a target queue name, find association information where the target queue name is located from the association information set, and send a queue message template in the found association information to the test terminal. Therefore, the test terminal can quickly and effectively generate and return the queue message according to the format of the queue message template, and the test terminal is beneficial to improving the test efficiency and accuracy.
And step 103, obtaining the target queue message returned by the test terminal based on the queue message template from the target message queue.
Here, the test terminal may generate a queue message in the format of a queue message template and send the queue message to the target message queue. Thus, the execution body may obtain the queue message from the target message queue.
Step 104, transmitting the target queue message to the message channel corresponding to the message type according to the message type of the target queue message, so as to send the target queue message to the message server corresponding to the message type through the message channel.
The message server is used for sending the queue message of the corresponding type to the message receiver. The message servers described above may include MQ servers, TOPIC servers, and KAFKA servers. The message recipient is typically a pre-set device or server. The message type of the target queue message may be one of MQ type, TOPIC type and KAFKA type.
As an example, the message type may be carried in the target queue message, so that the execution body may obtain the message type of the target queue message while obtaining the target queue message. As another example, the target message queue may correspond to a unique message type, and the execution body may obtain the message type of the target message queue by using the message type corresponding to the target message queue.
Here, the message channel may be established for each message type in advance, for example, the above-described execution body may establish, for each message type, a message channel between a message queue of the message type and a corresponding message server based on a type identifier of the message type and a server identifier of the message server. For example, a message channel between a KAFKA type message queue and a KAFKA message server may be established for KAFKA types. In this way, the execution body may transmit the target queue message to the corresponding message channel according to the message type of the target queue message, so as to send the target queue message to the message server corresponding to the message type through the message channel, thereby implementing sending the target queue message to the message receiver through the message server.
According to the method provided by the embodiment, the message type of the target queue message is analyzed, the target queue message is transmitted to the message channel corresponding to the message type, and the target queue message is sent to the message server corresponding to the message type through the message channel, so that when testing and sending are carried out on different types of queue messages, different platforms are not required to be logged in, the operation is more convenient, and the testing efficiency is improved. In addition, when testing is performed, the related information corresponding to the target queue name can be found from the related information set based on the target queue name of the target message queue, so that a queue message template is obtained, and then the obtained queue message template is sent to the test terminal, so that the test terminal can quickly and effectively generate and return the queue message according to the format of the queue message template, and the test efficiency and the accuracy are improved.
In some optional implementations of this embodiment, if the association information in the association information set further includes at least one scenario identifier, and each scenario identifier corresponds to a queue message template, the test request further includes a target scenario identifier for indicating a test scenario.
The test scenario is generally a scenario described by a test case. The target scenario identification is typically the scenario identification included in the test request.
Here, each association information may further include a corresponding plurality of pairs of scene identifiers and queue message templates. In this way, the target message queue may be used to transmit messages for a variety of test scenarios.
In the implementation manner, the sending the queue message template in the selected association information to the test terminal may include: and sending the queue message template corresponding to the target scene identifier in the selected associated information to the test terminal.
Here, when the test request further includes a target scene identifier for indicating a test scene, and each associated information in the associated information set further includes a plurality of pairs of corresponding scene identifiers and queue message templates, the execution body may send the queue message template corresponding to the target scene identifier in the associated information to the test terminal.
It should be noted that other information may also be included in the association information, for example, queue function description information may also be included. The above-described queue function description information is generally information for describing functions of a target message queue, such as a message type of a queue message that can be transmitted, a service line to which the queue message belongs, a system to which the queue message belongs, and the like. When the association information includes a plurality of messages, the tested queue message can be searched through at least one of the plurality of messages. For example, a queue name may be used to find all queue messages transmitted by a certain message queue. The scene identification and the queue name can also be adopted to search the tested queue message corresponding to a certain test scene in a certain message queue.
In some optional implementations, when the test request further includes a target scenario identifier for indicating a test scenario, and each associated information in the associated information set further includes a corresponding plurality of pairs of scenario identifiers and queue message templates, the message test method may further include the following steps 201-203. Fig. 2 is a flowchart of an implementation for flushing queue messages according to an embodiment of the present application.
Step 201, storing the target queue message, the target queue name and the target scene identifier in a target data set in an associated manner.
Here, the execution body may store the target queue message, the target queue name, and the target scene identifier in a target data set as one target data. For example, three of the name1, the case2, and the message2 may be associated, so as to obtain one target data as follows: name1-case2-message2. Wherein, name1 is the queue name, case2 is the scene identifier, and message2 is the queue message.
It should be noted that by default, the target data set is an empty set.
Step 202, when a message update request including a request queue name, a request scene identifier and new template description information is received, extracting target data matching the request queue name and the request scene identifier from a target data set, and extracting association information matching the request queue name from an association information set.
The request queue name is usually a queue name included in the message update request. The request context identifier is typically a context identifier included in the message update request. The above new template description information is generally information for describing a new template.
Here, the execution body may extract, when receiving the message update request, target data in which the request queue name and the request scene identifier are located from the target data set using the request queue name and the request scene identifier therein, and then extract, using the request queue name, association information in which the request queue name is located from the association information set.
For example, if there are 3 target data in the target data set, the target data set is { name1-case1-message1, name1-case2-message2, name2-case3-message3}, where name1 and name2 are queue names, case1, case2 and case3 are scene identifications, and message1, message2 and message3 are queue messages. If the name of the request queue is name1 and the request scene identifier is case2, the target data extracted from the target data set by the execution body may be: name1-case2-message2.
And 203, performing data cleaning on the queue message in the extracted target data according to the new template description information and the queue message template corresponding to the request scene identifier in the extracted association information, so that the queue message after data cleaning is matched with the new template described by the new template description information.
The above data cleansing generally refers to adding, preserving or deleting data fields in a queue message.
Here, the execution body may use the new template description information and the queue message template corresponding to the request scene identifier to perform data cleaning on the queue message in the extracted target data, so that the cleaned queue message is adapted to the new template described by the new template description information.
As an example, if the extracted target data is: name1-case2-message2, then the message2 may be data cleaned. If the message2 has 3 data fields, namely, field A, B, C, and the new template has 5 data fields, namely, A, B, C, D, E, then the data of the message2 may be cleaned, and two new fields D and E may be added to the message 2. It should be noted that, when the data field is added to the queue message, the value of the newly added data field may be either null or a preset default value.
It should be noted that, as the service progresses, the service requirement may change, and the content of the message to be transmitted may change, so the message template corresponding to each message queue needs to change accordingly. The user can change the queue information generated based on the old template into the adaptation with the new template by sending the information updating request to the execution main body, so that the data utilization rate is improved.
In some optional implementations, the data cleansing of the queue message in the extracted target data according to the new template description information and the queue message template corresponding to the request scene identifier in the extracted association information may include the following step one and step two.
Step one, determining a set of data fields included in a queue message template corresponding to a request scene identifier, and marking the set as a first field set, and determining a set of data fields included in a new template according to new template description information, and marking the set as a second field set.
Here, the execution body may analyze a queue message template corresponding to the request scene identifier, and directly obtain all the data fields included in the queue message template, so as to obtain the first field set. The execution body may then analyze the new template described by the new template description information to obtain all the data fields included in the new template, thereby obtaining the second field set.
And secondly, marking the queue information in the extracted target data as a request queue information, and cleaning the data of the request queue information according to the first field set and the second field set.
Here, for convenience of description, the execution body may refer to a queue message in the extracted target data as a request queue message. The execution body may compare the first field set with the second field set to determine a data field having a difference in the two sets, so as to perform data cleansing on the request queue message based on the data field having the difference, for example, a new data field in the second field set may be added to the request queue message.
It should be noted that, performing data cleansing on the request queue message may enable the request queue message after data cleansing to be adapted to the new template described by the new template description information.
In the implementation manner, the data cleansing is performed on the request queue message according to the first field set and the second field set, and the data cleansing includes at least one of the following three items.
The first item, the cross data field in the request queue message is reserved.
Wherein the interleaved data field belongs to the first set of fields and belongs to the second set of fields.
Here, the execution body may reserve a cross data field in the request queue message. The data fields in the first set of fields are data fields included in the request queue message. For example, if the first field set includes A, B, C data fields and the second field set includes A, B, D, E, F data fields, the intersecting data fields are A, B, and the execution body may reserve A, B two data fields in the request queue message.
Second, the redundant data fields in the request queue message are deleted.
Wherein the redundant data field belongs to the first field set and does not belong to the second field set.
Here, the execution body may delete the redundant data field in the request queue message. For example, if the first field set includes A, B, C data fields and the second field set includes A, B, D, E, F data fields, the redundant data field is C, and at this time, the execution body may delete the data field C in the request queue message.
And thirdly, supplementing a newly added data field in the request queue message.
Wherein the newly added data field belongs to the second field set and does not belong to the first field set.
Here, the execution body may append a new data field to the request queue message. For example, if the first field set includes A, B, C data fields and the second field set includes A, B, D, E, F data fields, the newly added data field is D, E, F, and the execution body may supplement D, E, F three data fields in the request queue message.
In an optional implementation manner of the embodiments of the present application, after performing data cleansing on the queue message in the extracted target data, it may further include finding out association information matching with the request queue name from the association information set, and switching a queue message template corresponding to the request scene identifier in the found association information to the new template.
Here, after the data of the queue message is cleaned, the corresponding old queue message template is replaced by a new template, so that the template of the queue message can be updated in time.
Referring to fig. 3, fig. 3 is a flowchart illustrating an implementation of a message testing method according to an embodiment of the present application. The message testing method provided by the embodiment can include the following steps:
step 301, a test request sent by a test terminal is received.
Wherein the test request includes a target queue name of the target message queue.
In this embodiment, the specific operation of step 301 is substantially the same as that of step 101 in the embodiment shown in fig. 1, and will not be described here again.
And 302, if the association information set does not contain the association information corresponding to the target queue name, presenting a preset information input interface to the test terminal.
The preset information input interface is used for guiding a user to input the associated information corresponding to the target queue name.
Here, when the association information corresponding to the target queue name does not exist in the association information set, the execution subject may send the preset information input interface to the test terminal, so that the test terminal may present the preset information input interface. The tester can input the associated information aiming at the target message queue based on the content presented by the preset information input interface.
Step 303, receiving association information corresponding to the target queue name, which is input by a user on a preset information input interface, from the test terminal, and storing the received association information in an association information set.
Wherein the user is typically a tester. Here, the tester may input the association information corresponding to the above-described target queue name on the preset information input interface. The test terminal may then send the association information to the execution subject. Thus, the executing body can receive the association information and store the association information in the association information set.
And 304, selecting the associated information corresponding to the target queue name from the associated information set, and transmitting a queue message template in the selected associated information to the test terminal.
The association information in the association information set comprises a queue name and a queue message template.
And 305, acquiring the target queue message returned by the test terminal based on the queue message template from the target message queue.
Step 306, transmitting the target queue message to the message channel corresponding to the message type according to the message type of the target queue message, so as to send the target queue message to the message server corresponding to the message type through the message channel.
The message server is used for sending the queue message of the corresponding type to the message receiver.
In this embodiment, the specific operations of steps 304-306 are substantially the same as the operations of steps 102-104 in the embodiment shown in fig. 1, and are not described herein.
In this embodiment, the user may configure the association information in the association information set, which is conducive to implementing unified management of the queue messages for testing based on the association information set, so as to facilitate subsequent viewing of the test data.
Referring to fig. 4, fig. 4 is a block diagram illustrating a message testing apparatus 400 according to an embodiment of the application. The message testing device in this embodiment includes units for executing the steps in the embodiments corresponding to fig. 1-3. Refer specifically to fig. 1-3 and the related descriptions in the embodiments corresponding to fig. 1-3. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 4, the message test apparatus 400 includes:
A request receiving unit 401, configured to receive a test request sent by a test terminal, where the test request includes a target queue name of a target message queue;
An information selecting unit 402, configured to select, from a pre-stored association information set, association information corresponding to a target queue name, and send a queue message template in the selected association information to the test terminal, where the association information in the association information set includes the queue name and the queue message template;
a message obtaining unit 403, configured to obtain, from a target message queue, a target queue message returned by the test terminal based on the queue message template;
A message transmission unit 404, configured to transmit the target queue message to a message channel corresponding to the message type according to the message type of the target queue message, so as to send the target queue message to a message server corresponding to the message type through the message channel, where the message server is configured to send the queue message of the corresponding type to a message receiver.
As an embodiment of the present application, if the association information in the association information set further includes at least one scene identifier, and each scene identifier corresponds to a queue message template, the test request further includes a target scene identifier for indicating a test scene.
As an embodiment of the present application, the information selecting unit 402 is specifically configured to:
And sending the queue message template corresponding to the target scene identifier in the selected associated information to the test terminal.
The device further comprises an association storage unit, an information extraction unit and an update execution unit (not shown in the figure) as an embodiment of the application.
The association storage unit is used for storing the target queue information, the target queue name and the target scene identifier in an association manner into a target data set;
An information extraction unit for extracting, when a message update request including a request queue name, a request scene identification, and new template description information is received, target data matching the request queue name and the request scene identification from a target data set, and association information matching the request queue name from an association information set;
And the updating execution unit is used for carrying out data cleaning on the queue message in the extracted target data according to the new template description information and the queue message template corresponding to the request scene identifier in the extracted association information so as to enable the queue message after the data cleaning to be matched with the new template described by the new template description information.
As an embodiment of the present application, the update execution unit is specifically configured to:
Determining a set of data fields included in a queue message template corresponding to the request scene identifier, and recording the set of data fields included in the new template as a first field set, and determining a set of data fields included in the new template according to new template description information, and recording the set of data fields as a second field set;
and marking the queue message in the extracted target data as a request queue message, and cleaning the request queue message according to the first field set and the second field set.
In one embodiment of the present application, in the update execution unit, the data cleansing for the request queue message according to the first field set and the second field set includes at least one of the following:
retaining crossing data fields in the request queue message, wherein the crossing data fields belong to a first field set and belong to a second field set;
Deleting redundant data fields in the request queue message, wherein the redundant data fields belong to a first field set and do not belong to a second field set;
And supplementing the newly added data field in the request queue message, wherein the newly added data field belongs to the second field set and does not belong to the first field set.
The device further comprises an interface presenting unit and an information storage unit (not shown in the figure) as an embodiment of the application.
The interface presentation unit is used for presenting a preset information input interface to the test terminal if the associated information corresponding to the target queue name does not exist in the associated information set, wherein the preset information input interface is used for guiding a user to input the associated information corresponding to the target queue name;
And the information storage unit is used for receiving the association information corresponding to the target queue name and input by a user on the preset information input interface from the test terminal and storing the received association information into the association information set.
According to the device provided by the embodiment, the message type of the target queue message is analyzed, the target queue message is transmitted to the message channel corresponding to the message type, and the target queue message is sent to the message server corresponding to the message type through the message channel, so that when testing and sending of different types of queue messages are carried out, different platforms are not required to be logged in, the operation is more convenient, and the testing efficiency is improved. In addition, when testing is performed, the related information corresponding to the target queue name can be found from the related information set based on the target queue name of the target message queue, so that a queue message template is obtained, and then the obtained queue message template is sent to the test terminal, so that the test terminal can quickly and effectively generate and return the queue message according to the format of the queue message template, and the test efficiency and the accuracy are improved.
It should be understood that, in the block diagram of the message testing apparatus shown in fig. 4, each unit is configured to perform each step in the embodiments corresponding to fig. 1-3, and each step in the embodiments corresponding to fig. 1-3 has been explained in detail in the foregoing embodiments, and specific reference is made to fig. 1-3 and related descriptions in the embodiments corresponding to fig. 1-3, which are not repeated herein.
Fig. 5 is a block diagram of a server according to another embodiment of the present application. As shown in fig. 5, the server 500 of this embodiment includes: a processor 501, a memory 502 and a computer program 503 stored in the memory 502 and executable on the processor 501, such as a program of a message testing method. The steps of the various embodiments of the message testing method described above, such as steps 101 through 104 shown in fig. 1, are implemented when the processor 501 executes the computer program 503. Or the processor 501 may perform the functions of each unit in the embodiment corresponding to fig. 4, for example, the functions of the units 401 to 404 shown in fig. 4, when executing the computer program 503, refer to the related descriptions in the embodiment corresponding to fig. 4, which are not repeated here.
By way of example, the computer program 503 may be divided into one or more units, one or more units being stored in the memory 502 and executed by the processor 501 to accomplish the present application. One or more of the elements may be a series of computer program instruction segments capable of performing a specified function, which are intended to describe the execution of the computer program 503 in the server 500. For example, the computer program 503 may be divided into a request receiving unit, an information selecting unit, a message acquiring unit, a message transmitting unit, each unit functioning specifically as above.
Servers can include, but are not limited to, a processor 501, a memory 502. It will be appreciated by those skilled in the art that fig. 5 is merely an example of server 500 and is not limiting of server 500, and may include more or fewer components than shown, or may combine certain components, or different components, such as a turntable device may also include an input-output device, a network access device, a bus, etc.
The Processor 501 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 502 may be an internal storage unit of the server 500, such as a hard disk or a memory of the server 500. The memory 502 may also be an external storage device of the server 500, such as a plug-in hard disk provided on the server 500, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), or the like. Further, the memory 502 may also include both internal storage units and external storage devices of the server 500. The memory 502 is used to store computer programs and other programs and data required by the turntable device. The memory 502 may also be used to temporarily store data that has been output or is to be output.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Wherein the computer readable storage medium may be nonvolatile or volatile. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the steps of each method embodiment described above may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable storage medium may include: any entity or device capable of carrying computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the content of the computer readable storage medium may be appropriately scaled according to the requirements of jurisdictions in which such computer readable storage medium does not include electrical carrier signals and telecommunication signals, for example, according to jurisdictions and patent practices.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.
Claims (10)
1. A method of message testing, the method comprising:
receiving a test request sent by a test terminal, wherein the test request comprises a target queue name of a target message queue;
Selecting association information corresponding to the target queue name from a prestored association information set, and sending a queue message template in the selected association information to the test terminal, wherein the test terminal generates a queue message based on the queue message template and sends the queue message to the target message queue, and the association information in the association information set comprises the queue name and the queue message template;
acquiring a target queue message returned by the test terminal based on the queue message template from the target message queue;
Transmitting the target queue message to a message channel corresponding to the message type according to the message type of the target queue message, so as to send the target queue message to a message server corresponding to the message type through the message channel, wherein the message server is used for sending the queue message of the corresponding type to a message receiver.
2. The message testing method according to claim 1, wherein if the association information in the association information set further includes at least one scenario identifier, and each scenario identifier corresponds to a queue message template, the test request further includes a target scenario identifier for indicating a test scenario.
3. The message testing method according to claim 2, wherein the sending the queue message template in the selected association information to the test terminal includes:
and sending the queue message template corresponding to the target scene identifier in the selected associated information to the test terminal.
4. The message testing method of claim 2, wherein the method further comprises:
storing the target queue message, the target queue name and the target scene identifier in a target data set in an associated manner;
Extracting target data matched with the request queue name and the request scene identification from the target data set when a message update request comprising the request queue name, the request scene identification and new template description information is received, and extracting association information matched with the request queue name from the association information set;
And according to the new template description information and the queue message template corresponding to the request scene identifier in the extracted association information, performing data cleaning on the queue message in the extracted target data so as to enable the queue message after data cleaning to be matched with the new template described by the new template description information.
5. The message testing method according to claim 4, wherein the data cleansing of the queue message in the extracted target data according to the new template description information and the queue message template corresponding to the request scene identifier in the extracted association information includes:
Determining a set of data fields included in a queue message template corresponding to the request scene identifier, and marking the set as a first field set, and determining a set of data fields included in the new template according to the new template description information, and marking the set as a second field set;
and marking the queue message in the extracted target data as a request queue message, and cleaning the request queue message according to the first field set and the second field set.
6. The message testing method of claim 5, wherein the data cleansing of the request queue message according to the first field set and the second field set comprises at least one of:
retaining crossing data fields in the request queue message, wherein the crossing data fields belong to the first field set and belong to the second field set;
Deleting redundant data fields in the request queue message, wherein the redundant data fields belong to the first field set and do not belong to the second field set;
and supplementing a new data field in the request queue message, wherein the new data field belongs to the second field set and does not belong to the first field set.
7. The message testing method according to any of claims 1-6, wherein the method further comprises:
If the association information set does not contain the association information corresponding to the target queue name, a preset information input interface is presented to the test terminal, wherein the preset information input interface is used for guiding a user to input the association information corresponding to the target queue name;
And receiving the association information corresponding to the target queue name, which is input by a user on the preset information input interface, from the test terminal, and storing the received association information into the association information set.
8. A message testing apparatus, the apparatus comprising:
The request receiving unit is used for receiving a test request sent by the test terminal, wherein the test request comprises a target queue name of a target message queue;
An information selecting unit, configured to select, from a pre-stored association information set, association information corresponding to the target queue name, and send a queue message template in the selected association information to the test terminal, where the test terminal generates a queue message based on the queue message template, and sends the queue message to the target message queue, where the association information in the association information set includes the queue name and the queue message template;
The message acquisition unit is used for acquiring a target queue message returned by the test terminal based on the queue message template from the target message queue;
And the message transmission unit is used for transmitting the target queue message to a message channel corresponding to the message type according to the message type of the target queue message so as to send the target queue message to a message server corresponding to the message type through the message channel, wherein the message server is used for sending the queue message of the corresponding type to a message receiver.
9. A server comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111526001.6A CN114221883B (en) | 2021-12-14 | 2021-12-14 | Message testing method, device, server and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111526001.6A CN114221883B (en) | 2021-12-14 | 2021-12-14 | Message testing method, device, server and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114221883A CN114221883A (en) | 2022-03-22 |
CN114221883B true CN114221883B (en) | 2024-06-21 |
Family
ID=80701727
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111526001.6A Active CN114221883B (en) | 2021-12-14 | 2021-12-14 | Message testing method, device, server and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114221883B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114979982B (en) * | 2022-04-13 | 2023-08-15 | 中移互联网有限公司 | Message issuing method and device, electronic equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111371892A (en) * | 2020-03-05 | 2020-07-03 | 中国银行股份有限公司 | High-concurrency distributed message pushing system and method |
CN113220782A (en) * | 2021-04-30 | 2021-08-06 | 土巴兔集团股份有限公司 | Method, device, equipment and medium for generating multivariate test data source |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112689005B (en) * | 2020-12-21 | 2023-04-07 | 青岛海尔科技有限公司 | Message sending method and device, storage medium and electronic device |
-
2021
- 2021-12-14 CN CN202111526001.6A patent/CN114221883B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111371892A (en) * | 2020-03-05 | 2020-07-03 | 中国银行股份有限公司 | High-concurrency distributed message pushing system and method |
CN113220782A (en) * | 2021-04-30 | 2021-08-06 | 土巴兔集团股份有限公司 | Method, device, equipment and medium for generating multivariate test data source |
Also Published As
Publication number | Publication date |
---|---|
CN114221883A (en) | 2022-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110569298B (en) | Data docking and visualization method and system | |
CN109033471B (en) | Information asset identification method and device | |
CN113987074A (en) | Distributed service full-link monitoring method and device, electronic equipment and storage medium | |
CN108572970B (en) | Structured data processing method and distributed processing system | |
CN110019263B (en) | Information storage method and device | |
US11469951B2 (en) | Network-configuration-information generation method and communication device | |
CN108093026B (en) | Method and device for processing multi-tenant request | |
CN111641554B (en) | Message processing method and device and computer readable storage medium | |
CN114647698A (en) | Data synchronization method and device and computer storage medium | |
CN112860811B (en) | Method and device for determining data blood relationship, electronic equipment and storage medium | |
CN114221883B (en) | Message testing method, device, server and storage medium | |
CN116545701A (en) | HTTP message rule matching method, system, equipment and medium | |
CN111078573A (en) | Test message generation method and device | |
CN112667631A (en) | Method, device and equipment for automatically editing service field and storage medium | |
CN103220327B (en) | user information storage method and device | |
CN109214846B (en) | Information storage method and device | |
CN114205325B (en) | Message sending method, device, server and storage medium | |
CN114449031B (en) | Information acquisition method, device, equipment and storage medium | |
CN114186046A (en) | Information processing method, information processing apparatus, server, and storage medium | |
CN115292166A (en) | Multi-person collaborative test case management method, device, equipment and medium | |
CN114416597A (en) | Test case record generation method and device | |
CN114547184A (en) | Personnel information synchronization method, terminal device and storage medium | |
CN112597119A (en) | Method and device for generating processing log and storage medium | |
CN112948195A (en) | Interface testing method and device, electronic equipment and storage medium | |
CN106547679B (en) | Script management method and script management platform |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |