Communication middleware test method and device, equipment, medium and product
By constructing a standardized parameter list to generate server and client programs, and combining test case collections for automated testing, the problem of low efficiency in communication middleware testing in the existing technology is solved, and efficient and wide-coverage test results are achieved.
Patent Information
- Application Number
- CN202410673629.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-23
AI Technical Summary
The testing work of communication middleware in the existing technology is inefficient and difficult to ensure test quality. This is mainly due to the manual testing method that results in high interface test repetition rate and heavy workload.
Build a normal service model through the standardized parameter list input by the user, generate server and client programs, and run these programs using a collection of test cases, automatically capture and parse network messages, compare message timing to obtain test results, and implement automated testing.
It improves the testing efficiency and test coverage of communication middleware, reduces repeated testing, and improves test quality.
Smart Images

Figure CN118540244A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of vehicle networking technology, and in particular to a testing method, device, equipment, medium and product for communication middleware. Background Art
[0002] Since commercial middleware is expensive and difficult to maintain, some OEMs choose to develop their own communication middleware and add support for private communication protocol stacks on top of the basic operating system kernel. In order to improve the stability of the operating system, testing of the communication middleware is particularly important.
[0003] In the prior art, the communication middleware is usually tested manually on multiple platforms, but this method has the problems of high repetition rate of each interface test and heavy workload, which leads to low efficiency of the communication middleware test. Summary of the invention
[0004] Embodiments of the present application provide a communication middleware testing method, apparatus, device, medium and product to solve the problem of low testing efficiency of communication middleware.
[0005] A first aspect of an embodiment of the present application provides a communication middleware testing method, which is applied to a computer device, including:
[0006] Acquire application parameters of the middleware to be tested, wherein the application parameters include the functions of the middleware to be tested; generate a normal service model of the middleware to be tested in response to a user's filling and confirmation operation on a preset standardized parameter list according to the application parameters, wherein the normal service model includes a service call message timing; generate a server program and a client program according to the normal service model; acquire source files of the server program, source files of the client program and source files of the middleware to be tested; jointly compile the source files of the server program and the source files of the middleware to be tested to generate a first executable file of the server; jointly compile the source files of the client program and the source files of the middleware to be tested to generate a first executable file of the client; use a test case set to run the first executable file of the server and the first executable file of the client to capture a first network message, wherein the test case set is pre-generated according to the functions of the middleware to be tested; parse the first network message to obtain an actual message timing; compare the actual message timing with the service call message timing to obtain a normal test result of the middleware to be tested.
[0007] Optionally, after generating the normal service model of the middleware to be tested, it also includes: obtaining injection parameters of one or more abnormal services; in response to the user's filling and confirmation operation on the standardized list according to the injection parameters, generating an abnormal injection model of the middleware to be tested, wherein the abnormal injection model includes an expected reply type after injection; according to the configuration of the abnormal injection model, generating a second executable file on the server and a second executable file on the client; using a test case set to run the second executable file on the server and the second executable file on the client to obtain an execution result; comparing the execution result with the expected reply type after injection to obtain the abnormal injection test result of the middleware to be tested.
[0008] Optionally, after obtaining the execution result by running the second executable file of the server and the second executable file of the client using the test case set, the method further includes: continuing to capture the first network message and parsing the first network message to obtain the original service call message timing after injection; parsing the second network message to obtain the newly initiated message timing, wherein the second network message is captured in the process of running the second executable file of the server and the second executable file of the client using the test case set; comparing the original service call message timing after injection and the newly initiated message timing with the service call message timing, respectively, to obtain the stability verification test result of the middleware to be tested.
[0009] Optionally, the normal service model includes a server configuration and a client configuration; accordingly, a server program and a client program are generated according to the normal service model, including: encapsulating the server configuration into a server class using a programming language; encapsulating the client configuration into a client class using a programming language; generating a main function and supporting functions of the program running using a programming language according to the functions of the middleware to be tested; generating a server program according to the server class and the main function and supporting functions of the program running; generating a client program according to the client class and the main function and supporting functions of the program running.
[0010] Optionally, after comparing the actual message timing with the service call message timing to obtain the normal test result of the middleware to be tested, it also includes: if the actual message timing is consistent with the service call message timing, the normal test result is recorded as passed; if the actual message timing is inconsistent with the service call message timing, the normal test result is recorded as failed; all recorded data is saved through logs.
[0011] A second aspect of an embodiment of the present application provides a communication middleware testing device, including:
[0012] A parameter acquisition module is used to acquire application parameters of the middleware to be tested, wherein the application parameters include the functions of the middleware to be tested;
[0013] A normal service model generation module, used to generate a normal service model of the middleware to be tested in response to a user's filling and confirmation operation on a preset standardized parameter list according to application parameters, wherein the normal service model includes a service call message sequence;
[0014] A program generation module is used to generate server programs and client programs according to a normal service model;
[0015] A source file acquisition module is used to acquire the source files of the server program, the source files of the client program, and the source files of the middleware to be tested;
[0016] A server-side executable file generation module, used to jointly compile the source file of the server-side program and the source file of the middleware to be tested to generate a first executable file of the server;
[0017] A client executable module generation module, used for jointly compiling the source file of the client program and the source file of the middleware to be tested to generate a first executable file of the client;
[0018] A network message capture module, used to run a first executable file of a server and a first executable file of a client using a test case set to capture a first network message, wherein the test case set is pre-generated according to the function of the middleware to be tested;
[0019] A network message parsing module, used to parse the first network message to obtain an actual message sequence;
[0020] The normal test result generation module is used to compare the actual message timing with the service call message timing to obtain the normal test result of the middleware to be tested.
[0021] A third aspect of an embodiment of the present application provides a computer device, comprising: a memory and a processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the communication middleware testing method of any one of the first aspects.
[0022] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the communication middleware testing method of any one of the first aspects.
[0023] A fifth aspect of an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the communication middleware testing method of any one of the first aspects.
[0024] The embodiments of the present application provide a testing method, apparatus, device, medium and product for communication middleware. The method comprises: using a simple language to describe a normal service model of a standardized parameter list input by a user, and then converting the normal service model into a server program and a client program. The source files of the server program and the source files of the middleware to be tested are jointly compiled to generate an executable file of the server. The source files of the client program and the source files of the middleware to be tested are jointly compiled to generate an executable file of the client. A method for automatically testing the middleware to be tested is performed by using test examples of corresponding functions of the middleware to be tested in combination with running the executable files corresponding to the server and the executable files corresponding to the client, thereby improving the testing efficiency and test coverage. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0026] Figure 1 A flow chart of a method for testing communication middleware provided in an embodiment of the present application;
[0027] Figure 2 A schematic diagram of the structure of a test device for communication middleware provided in an embodiment of the present application;
[0028] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of the present application.
[0029] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0030] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0031] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0032] Glossary:
[0033] Middleware: A special software or service program that provides an abstraction layer between the operating system and applications, allowing applications to more easily access and use underlying resources such as hardware devices, network connections, and other software services.
[0034] Communication middleware: It is a type of middleware located between the operating system and the application program, and is mainly responsible for managing and coordinating the communication between different applications or services. It provides a unified interface for applications so that they can more easily access and use the underlying hardware resources, network connections, and other software services. It has typical functions such as service discovery, remote service calls, and reading and writing process information, and realizes inter-process communication within a single node in the vehicle or communication transmission between multiple nodes, and transitions from CAN signal-based to service-oriented in-vehicle Ethernet data packet transmission.
[0035] Service call relationship: refers to the common functions provided by service-oriented service middleware, including but not limited to service discovery, remote calling, subscription publishing, and parameter exchange.
[0036] In order to clearly understand the technical solution of the present application, the solution of the prior art is first introduced in detail. Since communication middleware will affect the realization of application functions, and commercial middleware is expensive and difficult to maintain, some host manufacturers will choose to develop communication middleware on top of the basic operating system kernel and add private communication protocol stack support. The traditional testing method usually performs manual testing on multiple platforms for communication middleware testing. However, this testing method has the problems of high repetition rate and large workload of each interface test, which leads to low efficiency of communication testing and difficulty in ensuring test quality.
[0037] Therefore, in order to solve the problem of low testing efficiency and low testing quality of communication middleware in the prior art, the inventors found that a normal service model constructed based on a standardized parameter list input by the user is used to describe the behavior of the communication middleware, and then the objects under test including the server program and the client program are automatically generated based on the normal service model. The test cases corresponding to the functions of the middleware to be tested are used in combination with running the objects under test, which can reduce repeated testing and thus improve test efficiency and test coverage.
[0038] The embodiments of the present application are introduced below in conjunction with the drawings in the specification.
[0039] Figure 1 A flow chart of a method for testing communication middleware provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, in this embodiment, the execution subject of the embodiment of the present application is a computer device, and it can also be other devices with similar functions. This embodiment is not particularly limited here. Figure 1As shown, the method includes:
[0040] S101: Acquire application parameters of the middleware to be tested, wherein the application parameters include functions of the middleware to be tested.
[0041] The application parameters of the middleware to be tested include not only the functions of the middleware to be tested but also the specifications and boundary values of the middleware to be tested.
[0042] S102: In response to the user's filling and confirming operation on a preset standardized parameter list according to application parameters, a normal service model of the middleware to be tested is generated, wherein the normal service model includes a service call message sequence.
[0043] The preset standardized parameter list includes a server parameter list and a client parameter list. The server parameter list may include the name ServerName, the address IP, the port Port, the provided services and multiple events Events, each event Event may include information such as the event name EventName and the event type EventType. The client list may include the required service Service, the terminal address Endpoint and multiple events Events, each event Event may include information such as the event name EventName and the event type EventType.
[0044] Specifically, based on easy-to-read file formats such as YAML / JSON, or using modeling tools such as UML, the server parameter list and the client parameter list are modeled, and the functions of the communication middleware are modeled in a simple language.
[0045] Among them, the normal service model may include the number of servers and clients, the type and number of service rules of each server and client, the normal service call relationship between the server and the client, and the service call message timing of each normal service call relationship.
[0046] S103: Generate a server program and a client program according to a normal service model.
[0047] Specifically, for the description of the normal service model, the server configuration and the client configuration use program codes to be replaced with the server program and the client program respectively, including steps Sa1 to Sa5:
[0048] Sa1: Based on the server configuration, encapsulate it into a server class using programming language.
[0049] Specifically, the server configuration of the normal service model is read, including the name ServerName, address IP, port Port, provided services and multiple events Events, including the event name EventName and event type EventType and other information, and the application code is used to realize the automatic conversion from the server configuration in the normal service model to the server class.
[0050] Sa2: Based on the client configuration, encapsulate it into a client class using programming language.
[0051] Specifically, the client configuration of the normal service model is read, including the required service Service, the terminal address Endpoint and multiple events Events, including the event name EventName and the event type EventType and other information, and application programming is used to realize the automatic conversion from the client configuration in the normal service model to the client class.
[0052] Sa3: Based on the functions of the middleware to be tested, use the programming language to generate the main function and supporting functions of the program.
[0053] Specifically, the functions of the middleware to be tested are programmed using a programming language to generate a main function and various supporting functions for program operation, wherein the main function serves as the entry and exit of program execution, and the various supporting functions realize the functions of the middleware to be tested.
[0054] Sa4: Generate a server program based on the server class and the main function and supporting functions of the program.
[0055] Specifically, the server class and various supporting functions are called in the main function of the program to generate a server program.
[0056] Sa5: Generates the client program based on the client class and the main function and supporting functions of the program.
[0057] Specifically, the client class and various supporting functions are called in the main function of the program to generate a client program.
[0058] S104: Acquire the source files of the server program, the source files of the client program, and the source files of the middleware to be tested.
[0059] S105: jointly compile the source file of the server program and the source file of the middleware to be tested to generate a first executable file of the server.
[0060] Among them, joint compilation is a technology that combines multiple source files into a single compilation unit.
[0061] Specifically, a compiler is used to preprocess the source files of the server and the source files of the middleware to be tested, and the macro definition, header file, conditional compilation and other contents are processed into a single file, and then compiled and assembled to finally generate the first executable file of the server.
[0062] S106: jointly compile the source file of the client program and the source file of the middleware to be tested to generate a first executable file of the client.
[0063] Specifically, a compiler is used to preprocess the source files of the client and the source files of the middleware to be tested, and the macro definition, header file, conditional compilation and other contents are processed into a single file, and then compiled and assembled to finally generate the first executable file of the client.
[0064] S107: Run the first executable file of the server and the first executable file of the client using the test case set to capture the first network message, wherein the test case set is pre-generated according to the function of the middleware to be tested.
[0065] The test case set includes all test cases. For example, if the service subscription function is tested, the test case set includes server startup, client startup, extracting service subscription function messages, and verifying the consistency of the timing sequence with expectations.
[0066] Specifically, the test content is generated according to the function of the middleware to be tested, and then a test case set is designed according to the test content. In the process of using the test case set to run the first executable file of the server and the first executable file of the client, a network packet capture tool is used to capture the actual network data packet to obtain the first network message exchanged between the client and the server. The network packet capture tool can be wireshark.
[0067] The first executable file of the server and the first executable file of the client are run using the test case set, and the test can be performed automatically or manually.
[0068] S108: Parse the first network message to obtain an actual message sequence.
[0069] Specifically, the TCP connection process or the UDP connection process in the captured first network message is analyzed to obtain the actual message timing generated by the actual interaction between the server and the client.
[0070] S109: Compare the actual message timing with the service call message timing to obtain a normal test result of the middleware to be tested.
[0071] Specifically, the actual message sequence is compared with the service call message sequence preset when the normal service model is established to obtain the normal test result of the middleware to be tested, and then Sb1 to Sb3 are also included:
[0072] Sb1: If the actual message timing is consistent with the service call message timing, the normal test result is recorded as passed.
[0073] Sb2: If the actual message timing is inconsistent with the service call message timing, the normal test result will be recorded as a failure.
[0074] Sb3: Save all recorded data through logs.
[0075] Specifically, the actual message timing is compared with the service call message timing. If all comparisons are successful, it means that all service calls corresponding to the normal service model are consistent with the functional design of the middleware to be tested. If the comparison is unsuccessful, it means that it is inconsistent with the functional design of the middleware. The comparison results are saved through logs.
[0076] In summary, the method of automatically testing the middleware under test is to use test cases corresponding to the functions of the middleware under test in combination with running the executable files corresponding to the server and the client, thereby improving the test efficiency and test coverage.
[0077] In another embodiment of the present application, after the normal service model of the middleware to be tested is generated in step S102, an abnormal injection model of the middleware to be tested can be simultaneously constructed according to the test requirements, and a stability verification model can be synchronously constructed, specifically including:
[0078] S201: Obtain injection parameters of one or more abnormal services.
[0079] S202: In response to the user's filling and confirming operation on the standardized list according to the injection parameters, an exception injection model of the middleware to be tested is generated, wherein the exception injection model includes an expected response type after injection.
[0080] Specifically, based on a file format with good readability such as YAML / JSON, or using a modeling tool such as UML, the injected server parameter list and client parameter list are modeled, and the functions of the communication middleware are modeled in a simple language.
[0081] The exception injection model includes the name of the tested object of the exception injection, the type and number of injected exception service rules, and the expected reply message type after injection.
[0082] S203: Generate a second executable file of the server and a second executable file of the client according to the configuration of the exception injection model.
[0083] Specifically, according to the server configuration in the exception injection model, the application code realizes the automatic conversion from the server configuration in the exception injection model to the server class, and according to the client configuration in the exception injection model, the application code realizes the automatic conversion from the client configuration in the exception injection model to the client class. In the main function of the program running, the server class and each supporting function are called to generate the server program. In the main function of the program running, the client class and each supporting function are called to generate the client program. The source file of the server program and the source file of the middleware to be tested are jointly compiled to generate the second executable file of the server. The source file of the client program and the source file of the middleware to be tested are jointly compiled to generate the second executable file of the client.
[0084] S204: Run the second executable file on the server and the second executable file on the client using the test case set to obtain an execution result.
[0085] Specifically, in the process of running the second executable file of the server and the second executable file of the client using the test case set, a network packet capture tool is used to capture actual network data packets to obtain a second network message for interaction between the client and the server, and then the following is further included:
[0086] Sc1: Continue to capture the first network message, and parse the first network message to obtain the original service call message sequence after injection.
[0087] Specifically, a test case set is used to rerun the first executable file of the server and the first executable file of the client, the first network message is captured, the TCP connection process or the UDP connection process in the first network message is analyzed, and the message timing generated by the original interaction between the server and the client after injection is obtained.
[0088] Sc2: Parse the second network message to obtain a newly initiated message sequence, wherein the second network message is captured during the process of running the second executable file of the server and the second executable file of the client using the test case set.
[0089] Specifically, the TCP connection process or the UDP connection process in the second network message is analyzed to obtain the message timing newly initiated by the server and the client after injection.
[0090] Sc3: Compare the original service call message timing and the newly initiated message timing after injection with the service call message timing to obtain the stability verification test results of the middleware under test.
[0091] Specifically, the original service call message sequence after injection is compared with the service call message sequence. If all the comparisons are successful, it means that the middleware under test is relatively stable in long-term operation, and the abnormal injection does not affect the existing service call relationship; the newly initiated message sequence is compared with the service call message sequence. If all the comparisons are successful, the newly initiated service call is not affected by the abnormal injection. If the comparison is unsuccessful, it means that the stability of the middleware under test is poor, and the comparison results are saved in the log.
[0092] Exemplarily, after the normal service model runs successfully, the first client successfully subscribes to the first service, and the service call relationship always exists. After the exception injection, verify whether the service call relationship message timing of the original first client and server after the injection is consistent with the service call message timing defined in the normal service model. If it is consistent, it means that the service can be provided to the client stably and will not be affected after the exception injection. A new subscription service to the injected object is initiated, such as the second client subscribing to the first service after injection. If the newly initiated message timing is consistent with the service call message timing, it means that the first service is not affected by the exception injection.
[0093] S205: Compare the execution result with the expected response type after injection to obtain the abnormal injection test result of the middleware to be tested.
[0094] Specifically, the execution result is compared with the memory of the expected reply message type after injection. If all comparisons are successful, it means that the middleware under test has strong adaptability in the face of abnormal situations and can run correctly under the influence of external interference. If the comparison is unsuccessful, it means that the middleware under test has poor robustness, and the comparison results are saved through logs.
[0095] In summary, by building an exception injection model for the middleware to be tested to simulate whether the middleware to be tested handles the abnormal situation normally, the robustness of the middleware to be tested can be verified. In addition, by building a stability verification model for the middleware to be tested to verify that the middleware to be tested can run stably under abnormal circumstances, the stability of the middleware to be tested can be tested.
[0096] Figure 2 A schematic diagram of the structure of the communication middleware testing device provided in the embodiment of the present application. Figure 2As shown, the testing device of the communication middleware includes: a parameter acquisition module 201, a normal service model generation module 202, a program generation module 203, a source file acquisition module 204, a server executable file generation module 205, a client executable module generation module 206, a network message capture module 207, a network message parsing module 208 and a normal test result generation module 209.
[0097] The parameter acquisition module 201 is used to acquire application parameters of the middleware to be tested, wherein the application parameters include functions of the middleware to be tested.
[0098] The normal service model generation module 202 is used to generate a normal service model of the middleware to be tested in response to the user's filling and confirming operation on the preset standardized parameter list according to the application parameters, wherein the normal service model includes the service call message sequence.
[0099] The program generation module 203 is used to generate a server program and a client program according to a normal service model.
[0100] The source file acquisition module 204 is used to acquire the source files of the server program, the source files of the client program and the source files of the middleware to be tested.
[0101] The server-side executable file generating module 205 is used to jointly compile the source file of the server-side program and the source file of the middleware to be tested to generate a first executable file of the server.
[0102] The client executable module generating module 206 is used to jointly compile the source file of the client program and the source file of the middleware to be tested to generate a first executable file of the client.
[0103] The network message capture module 207 is used to run the first executable file of the server and the first executable file of the client using the test case set to capture the first network message, wherein the test case set is pre-generated according to the function of the middleware to be tested.
[0104] The network message parsing module 208 is used to parse the first network message to obtain the actual message sequence.
[0105] The normal test result generating module 209 is used to compare the actual message timing with the service call message timing to obtain the normal test result of the middleware to be tested.
[0106] Optionally, the testing device of the communication middleware also includes an exception injection module, which is used to obtain injection parameters of one or more exception services; in response to the user's filling and confirmation operation on the standardized list according to the injection parameters, an exception injection model of the middleware to be tested is generated, wherein the exception injection model includes an expected reply type after injection; according to the configuration of the exception injection model, a second executable file of the server and a second executable file of the client are generated; the second executable file of the server and the second executable file of the client are run using a test case set to obtain an execution result; the execution result is compared with the expected reply type after injection to obtain the exception injection test result of the middleware to be tested.
[0107] Optionally, the testing device of the communication middleware also includes a stability verification module, which is used to continue to capture the first network message and parse the first network message to obtain the original service call message timing after injection; parse the second network message to obtain the newly initiated message timing, wherein the second network message is captured in the process of running the second executable file of the server and the second executable file of the client using the test case set; the original service call message timing after injection and the newly initiated message timing are respectively compared with the service call message timing to obtain the stability verification test result of the middleware to be tested.
[0108] Optionally, the program generation module 203 is specifically used to encapsulate into a server class using a programming language according to the server configuration; encapsulate into a client class using a programming language according to the client configuration; generate a main function and various supporting functions of the program operation using a programming language according to the functions of the middleware to be tested; generate a server program according to the server class and the main function and various supporting functions of the program operation; generate a client program according to the client class and the main function and various supporting functions of the program operation.
[0109] Optionally, the testing device of the communication middleware also includes a storage module, which is used to record the normal test result as passed if the actual message timing is consistent with the service call message timing; if the actual message timing is inconsistent with the service call message timing, the normal test result is recorded as failed; and all recorded data is saved through logs.
[0110] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0111] According to an embodiment of the present application, a computer device, a computer-readable storage medium and a computer program product are also provided.
[0112] like Figure 3 As shown, Figure 3A schematic diagram of the structure of a computer device provided for an embodiment of the present application. The computer device is intended to be used for various electronic devices that can execute the test method of the communication middleware, such as a microcomputer and a single-chip microcomputer. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present application described and / or required herein.
[0113] like Figure 3 As shown, the computer device includes: a processor 301 and a memory 302. The memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the communication middleware testing method of the above embodiment.
[0114] The memory 302 is a computer-readable storage medium provided in the embodiment of the present application. The computer-readable storage medium stores computer-executable instructions, which are used to implement the communication middleware testing method of the above embodiment when executed by the processor.
[0115] The memory 302, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the communication middleware testing method in the embodiment of the present application. The processor 301 executes various functional applications and data processing by running the software programs, instructions and modules stored in the memory 302, that is, implementing the communication middleware testing method in the above method embodiment.
[0116] At the same time, this embodiment also provides a computer program product, including a computer program. When the instructions in the computer product are executed by a processor, the communication middleware testing method of the above embodiment can be executed.
[0117] Those skilled in the art will readily come to other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application embodiments, which follow the general principles of the present application embodiments and include common knowledge or customary technical means in the art that are not disclosed in the present application embodiments. The specification and embodiments are intended to be exemplary only, and the true scope and spirit of the present application embodiments are indicated by the claims.
[0118] It should be understood that the embodiments of the present application are not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the embodiments of the present application is limited only by the appended claims.
Claims
1. A communication middleware testing method, characterized in that: Applicable to computer equipment, including: Acquire application parameters of the middleware to be tested, wherein the application parameters include functions of the middleware to be tested; In response to a user's filling and confirming operation on a preset standardized parameter list according to the application parameters, a normal service model of the middleware to be tested is generated, wherein the normal service model includes a service call message sequence; Generate a server program and a client program according to the normal service model; Obtaining the source files of the server program, the source files of the client program and the source files of the middleware to be tested; Combine the source file of the server program and the source file of the middleware to be tested to generate a first executable file of the server; Combine the source file of the client program and the source file of the middleware to be tested to generate a first executable file of the client; Using a test case set to run the first executable file of the server and the first executable file of the client to capture a first network message, wherein the test case set is pre-generated according to the function of the middleware to be tested; Parsing the first network message to obtain an actual message sequence; The actual message timing is compared with the service call message timing to obtain a normal test result of the middleware to be tested.
2. The method according to claim 1, characterized in that After generating the normal service model of the middleware to be tested, the method further includes: Get the injection parameters of one or more abnormal services; In response to the user's filling and confirming operation on the standardized list according to the injection parameters, generating an abnormal injection model of the middleware to be tested, wherein the abnormal injection model includes an expected response type after injection; Generate a second executable file of the server and a second executable file of the client according to the configuration of the exception injection model; Using the test case set to run the second executable file of the server and the second executable file of the client to obtain an execution result; The execution result is compared with the expected response type after injection to obtain the abnormal injection test result of the middleware to be tested.
3. The method according to claim 2, characterized in that The method of using the test case set to run the second executable file of the server and the second executable file of the client, after obtaining the execution result, further includes: Continue to capture the first network message, and parse the first network message to obtain the original service call message sequence after injection; Parsing a second network message to obtain a newly initiated message sequence, wherein the second network message is captured during the process of running a second executable file of the server and a second executable file of the client using the test case set; The original service call message timing after the injection and the newly initiated message timing are respectively compared with the service call message timing to obtain the stability verification test result of the middleware to be tested.
4. The method according to claim 1, characterized in that: The normal service model includes server configuration and client configuration; Accordingly, generating a server program and a client program according to the normal service model includes: According to the server configuration, encapsulate it into a server class using a programming language; According to the client configuration, encapsulate it into a client class using a programming language; According to the functions of the middleware to be tested, a main function and supporting functions of the program are generated by using a programming language; Generate a server program according to the server class and the main function and supporting functions of the program; A client program is generated according to the client class and the main function and various supporting functions of the program operation.
5. The method according to any one of claims 1 to 4, characterized in that: After comparing the actual message timing with the service call message timing to obtain a normal test result of the middleware to be tested, the method further includes: If the actual message timing is consistent with the service call message timing, the normal test result is recorded as passed; If the actual message timing is inconsistent with the service call message timing, the normal test result is recorded as a failure; All recorded data will be saved in logs.
6. A communication middleware testing device, characterized in that: include: A parameter acquisition module, used to acquire application parameters of the middleware to be tested, wherein the application parameters include functions of the middleware to be tested; A normal service model generation module, configured to generate a normal service model of the middleware to be tested in response to a user's filling and confirmation operation on a preset standardized parameter list according to the application parameters, wherein the normal service model includes a service call message sequence; A program generation module, used to generate a server program and a client program according to the normal service model; A source file acquisition module, used to acquire the source files of the server program, the source files of the client program and the source files of the middleware to be tested; A server-side executable file generation module, used for jointly compiling the source file of the server-side program and the source file of the middleware to be tested to generate a first executable file of the server; A client executable module generation module, used for jointly compiling the source file of the client program and the source file of the middleware to be tested to generate a first executable file of the client; A network message capture module, used to run the first executable file of the server and the first executable file of the client using a test case set to capture a first network message, wherein the test case set is pre-generated according to the function of the middleware to be tested; A network message parsing module, used to parse the first network message to obtain an actual message sequence; The normal test result generating module is used to compare the actual message timing with the service call message timing to obtain the normal test result of the middleware to be tested.
7. The device according to claim 6, characterized in that The normal service model includes server configuration and client configuration; Accordingly, the program generation module is specifically used to encapsulate the server class using a programming language according to the server configuration; encapsulate the client class using a programming language according to the client configuration; and generate the main function and various supporting functions of the program operation using a programming language according to the function of the middleware to be tested; Generate a server program according to the server class and the main function and supporting functions of the program; A client program is generated according to the client class and the main function and various supporting functions of the program operation.
8. A computer device, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the communication middleware testing method according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the communication middleware testing method according to any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the communication middleware testing method according to any one of claims 1 to 5 is implemented.
