Automatic testing method and device for streaming asynchronous job, electronic equipment and storage medium
Through the combination of message generator, asynchronous listener and result verifier, the data processing logic of streaming asynchronous jobs is automatically tested, solving the problem of inefficient testing in the existing technology and achieving efficient test report generation.
Patent Information
- Application Number
- CN202411314308.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-13
AI Technical Summary
The prior art is difficult to effectively test and verify the data processing logic of streaming asynchronous operations, resulting in inefficient testing and manual query and verification, which is cumbersome and repetitive.
Use the message generator to generate test messages and send them to the Flink job operation environment, monitor the processing logic through the asynchronous listener and obtain the results, use the result verifier to perform field-level comparison with the expected results, automatically generate test reports, and realize the test case template , batch generation of data and automation of result verification.
Improve testing efficiency, reduce manual intervention, and realize one-click generation of test reports, avoiding tedious work in traditional testing.
Smart Images

Figure CN119135563A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of autonomous driving technology, and in particular to an automated testing method, device, electronic device, and storage medium for streaming asynchronous operations. Background Art
[0002] The source system data is transmitted to the target system in real time. Due to the large differences between the source system and target system models, streaming asynchronous jobs need to perform a series of logical processing on the source system data in order to convert the source system data into the target system data.
[0003] In order to ensure the accuracy of the processing logic, it is necessary to test the streaming asynchronous job data processing logic through testing methods. Summary of the invention
[0004] The embodiments of the present application provide an automated testing method, device, electronic device, and storage medium for streaming asynchronous jobs to improve testing efficiency.
[0005] The present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides an automated testing method for streaming asynchronous jobs, wherein the method comprises:
[0007] Generate message data to be tested through a message generator and send the test message to the Flink job running environment, where the Flink job running environment includes multiple Flink streaming asynchronous jobs;
[0008] Through the asynchronous listener, the processing logic of the Flink streaming asynchronous job is monitored and the processing results in the Flink streaming asynchronous job are obtained;
[0009] A test report is generated by a result verifier based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job.
[0010] In some embodiments, the method further comprises:
[0011] Based on the asynchronous execution mechanism of Flink streaming asynchronous jobs, the asynchronous listener is used, and the processing result layer configured at each layer of the streaming job verifies the processing result through the result verifier;
[0012] and / or,
[0013] The asynchronous listener is used and configured at the final result layer of the streaming job to listen to the final processing result, and the processing result is verified by the result verifier.
[0014] In some embodiments, the method further comprises:
[0015] The asynchronous listener, by utilizing the production subscription feature in the Kafka queue, automatically pushes the processing result in the Flink streaming asynchronous job and the expected result message to the result verifier when obtaining the streaming job processing result from the corresponding Kafka cluster topic.
[0016] In some embodiments, the message generator generates message data to be tested and sends a test message to a Flink job running environment, wherein the Flink job running environment includes multiple Flink streaming asynchronous jobs, including:
[0017] According to the message generator, a request message of a preset API debugging tool is received or a test case template is loaded from a file, wherein the request message and the test case template define target request field generation rules and expected result content.
[0018] In some embodiments, the message generator generates message data to be tested and sends a test message to a Flink job running environment, wherein the Flink job running environment includes multiple Flink streaming asynchronous jobs, including:
[0019] The message generator reads the address of the streaming asynchronous job Kafka cluster topic from the configuration file during the startup process, and the streaming asynchronous job Kafka cluster topic is used to receive the test message sent to the flink streaming asynchronous job;
[0020] Synchronously listen to the same streaming asynchronous job Kafka cluster topic address to automatically read the test message for processing and calculation through the Flink streaming asynchronous job.
[0021] In some embodiments, the result verifier generates a test report based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job, including:
[0022] The expected result message and the verification result of the processing result in the Flink streaming asynchronous job are obtained by parsing the result verifier;
[0023] Perform a field-level comparison between the expected result message and the verification result of the processing result in the Flink streaming asynchronous job;
[0024] If the comparison fails, the preset flag case execution fails;
[0025] If the comparison is successful, the preset mark case is executed successfully.
[0026] In some embodiments, generating a test report includes:
[0027] Read the test report from the template, parse the template to generate report content, and read the verification result of the processing result in the Flink streaming asynchronous job pushed by the result verifier, the corresponding test case source message, and the expected result message;
[0028] According to the verification results, the preset flag case is marked as successful or failed, and the field where the verification failed is output.
[0029] In a second aspect, an embodiment of the present application further provides an automated testing device for streaming asynchronous jobs, wherein the device comprises:
[0030] A generation module, used to generate message data to be tested through a message generator and send a test message to a Flink job running environment, wherein the Flink job running environment includes multiple Flink streaming asynchronous jobs;
[0031] A monitoring module, used to monitor the processing logic of the Flink streaming asynchronous job and obtain the processing result in the Flink streaming asynchronous job through an asynchronous listener;
[0032] The verification module is used to generate a test report based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job through a result verifier.
[0033] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform the above method.
[0034] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes the above method.
[0035] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: through the message generator, the message data to be tested is generated and the test message is sent to the Flink job running environment, and the Flink job running environment includes multiple Flink streaming asynchronous jobs. The message generator can automatically generate test messages and interact with the Flink streaming asynchronous job. Through the asynchronous listener, the processing logic of the Flink streaming asynchronous job is monitored and the processing results in the Flink streaming asynchronous job are obtained. The asynchronous listener can monitor the message processing results and send them to the result verifier. Through the result verifier, a test report is generated based on the verification results of the expected result message and the processing results in the Flink streaming asynchronous job. The result verifier can automatically verify the results and use the results to generate a test report.
[0036] Through the above method, functions such as templated configuration of test cases, batch generation of test data, automated verification of data processing results, and one-click generation of test reports are realized, avoiding the tedious and repetitive work of manual query, verification, and output of test reports in the traditional testing process, and effectively improving the testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0038] Figure 1 This is a flow chart of an automated testing method for streaming asynchronous jobs in an embodiment of the present application;
[0039] Figure 2 This is a schematic diagram of the structure of an automated testing device for streaming asynchronous operations in an embodiment of the present application;
[0040] Figure 3 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0042] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0043] The present application embodiment provides an automated testing method for streaming asynchronous jobs, such as Figure 1 As shown, a flow chart of an automated testing method for streaming asynchronous jobs in an embodiment of the present application is provided, and the method at least includes the following steps S110 to S130:
[0044] Step S110: Generate message data to be tested through a message generator and send a test message to a Flink job running environment, where the Flink job running environment includes multiple Flink streaming asynchronous jobs.
[0045] The message generator is an important module for stream automated testing. The message generator sends the generated message data to be tested to the Flink job running environment. In this way, the test system is physically isolated from the stream computing job. The test system does not implement business logic, has low business intrusion, and reduces the complexity of testing and the entry threshold.
[0046] The Flink job running environment includes multiple Flink streaming asynchronous jobs. The message generator sends test messages to each Flink streaming asynchronous job to implement message testing.
[0047] In specific implementation, the message generator can be used to abstract the relevant test processes, and form an automated testing tool based on the Java language through program modularization.
[0048] Step S120: monitor the processing logic of the Flink streaming asynchronous job through the asynchronous listener and obtain the processing result in the Flink streaming asynchronous job.
[0049] The asynchronous listener can obtain code execution results from multiple Flink streaming asynchronous jobs and listen to the processing logic of code execution results in Flink streaming jobs. According to the processing logic, it can further determine whether the test message in the message generator meets the requirements of Flink streaming asynchronous jobs, that is, it is suitable for automated testing of streaming jobs with different processing logics.
[0050] Step S130, generating a test report through a result verifier based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job.
[0051] The result verifier obtains the verification result through comparison and generates the corresponding test report. The expected result message can be considered as the expected running result in the Flink streaming asynchronous job, while the processing result in the Flink streaming asynchronous job is the actual running result of the test message in the Flink streaming asynchronous job. By comparing the difference between the two, a test report can be generated.
[0052] Through the above method, the automated testing of streaming asynchronous jobs is realized. The test tool is isolated from the streaming asynchronous jobs. The tester does not need to pay attention to the processing logic of the streaming jobs, but only needs to configure the test cases and templates.
[0053] Through the above method, the message generator generates the message data to be tested and sends the test message to the Flink job running environment, which includes multiple Flink streaming asynchronous jobs. Automated testing supports test case template configuration, and case templates can be obtained from files or message testing tools to generate test cases with one click.
[0054] In one embodiment of the present application, the method also includes: based on the asynchronous execution mechanism of Flink streaming asynchronous jobs, using the asynchronous listener, and configuring the processing result layer of each layer of the streaming job to verify the processing results through the result verifier; and / or, using the asynchronous listener, configuring the final result layer of the streaming job to listen to the final processing results, and verifying the processing results through the result verifier.
[0055] In order to optimize the function of the asynchronous listener, the asynchronous listener can be configured to listen to different processing results. Due to the asynchronous execution mechanism of Flink streaming jobs, the automated testing tool listens to the processing logic of streaming jobs through asynchronous listeners. One execution method is: based on the asynchronous execution mechanism of Flink streaming asynchronous jobs, the asynchronous listener is used, and the processing result layer of each layer of the streaming job can be configured to verify the processing results through the result verifier. Another execution method is: using the asynchronous listener, configured in the final result layer of the streaming job to listen to the final processing results, and verifying the processing results through the result verifier.
[0056] The above method can not only monitor the processing results of each layer of the streaming job, but also be configured to monitor only the final processing results, thereby optimizing the function of the asynchronous listener.
[0057] In one embodiment of the present application, the method also includes: the asynchronous listener, by utilizing the production subscription feature in the Kafka queue, when the streaming job processing result is obtained from the corresponding Kafka cluster topic, automatically pushes the processing result in the Flink streaming asynchronous job and the expected result message to the result verifier.
[0058] Preferably, the asynchronous listener utilizes the production subscription feature of Kafka, and when the processing result of the streaming job is obtained from the corresponding topic, the processing result and the expected result are automatically pushed to the result verifier. A topic is a logical concept that can be subdivided into multiple partitions. A partition belongs to only a single topic, and partitions are often referred to as topic partitions.
[0059] It can be understood that messages in Kafka are classified by topic. Producers are responsible for sending messages to specific topics (each message sent to the Kafka cluster must specify a topic), while consumers are responsible for subscribing to topics and consuming.
[0060] In one embodiment of the present application, the message data to be tested is generated by a message generator and a test message is sent to a Flink job running environment, wherein the Flink job running environment includes multiple Flink streaming asynchronous jobs, including: according to the message generator, a request message of a preset API debugging tool is received or a test case template is loaded from a file, wherein the request message and the test case template define target request field generation rules and expected result content.
[0061] The message generator supports receiving requests from open source API debugging tools or loading test case templates from files. The test case template or request message defines the request field generation rules and expected result content. The message generator parses the message format in the request message template, performs message format verification and other preprocessing, and then dynamically generates content that meets the requirements according to the message generation rules and refills it into the message template.
[0062] In one embodiment of the present application, the message generator is used to generate message data to be tested and send test messages to the Flink job running environment, and the Flink job running environment includes multiple Flink streaming asynchronous jobs, including: reading the address of the streaming asynchronous job Kafka cluster topic from the configuration file during the startup process by the message generator, and the streaming asynchronous job Kafka cluster topic is used to receive the test message sent to the Flink streaming asynchronous job; synchronously listening to the address of the same streaming asynchronous job Kafka cluster topic to automatically read the test message through the Flink streaming asynchronous job for processing and calculation.
[0063] During the startup process, the message generator reads the address of the streaming asynchronous job Kafka cluster topic from the configuration file, synchronously listens to the same Kafka topic, and pushes the Flink asynchronous job data source receiver after the test message is generated. The Flink streaming job automatically reads the test message for processing and calculation.
[0064] In one embodiment of the present application, the result verifier generates a test report based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job, including: obtaining the verification result of the expected result message and the processing result in the Flink streaming asynchronous job through parsing by the result verifier; performing a field-level comparison between the expected result message and the verification result of the processing result in the Flink streaming asynchronous job; if the comparison fails, the preset mark case execution fails; if the comparison succeeds, the preset mark case execution succeeds.
[0065] The result verifier parses the expected result message and the processing result message processed by the streaming job logic, and performs field-level comparison. If the comparison fails, the case execution is marked as failed. Otherwise, the case execution is marked as successful.
[0066] It should be noted that the field level is only an example and is not used to specifically limit the scope of protection of this application.
[0067] In one embodiment of the present application, generating a test report includes: reading a test report from a template, parsing the template to generate report content, reading the verification results of the processing results in the Flink streaming asynchronous job pushed by the result verifier, the corresponding test case source message and the expected result message; according to the verification results, marking a preset flag case as success or failure, and outputting the verification failure field.
[0068] The test report generator supports reading test reports from templates, parsing templates to generate report contents in Word format, reading verification results pushed by the result verifier and the corresponding test case source messages and result messages, marking the test cases as successful or failed according to the verification results, and outputting the fields that failed the verification, thus realizing one-click generation of test reports.
[0069] Through the above method, the test results can be automatically obtained and verified, the report template can be configured, and the test report can be generated with one click.
[0070] The embodiment of the present application also provides an automated testing device 200 for streaming asynchronous operations, such as Figure 2 As shown, a schematic diagram of the structure of an automated testing device for streaming asynchronous jobs in an embodiment of the present application is provided. The automated testing device 200 for streaming asynchronous jobs at least includes: a generating module 210, a monitoring module 220, and a verifying module 230, wherein:
[0071] In one embodiment of the present application, the generation module 210 is specifically used to: generate message data to be tested through a message generator and send a test message to a Flink job running environment, wherein the Flink job running environment includes multiple Flink streaming asynchronous jobs.
[0072] The message generator is an important module for stream automated testing. The message generator sends the generated message data to be tested to the Flink job running environment. In this way, the test system is physically isolated from the stream computing job. The test system does not implement business logic, has low business intrusion, and reduces the complexity of testing and the entry threshold.
[0073] The Flink job running environment includes multiple Flink streaming asynchronous jobs. The message generator sends test messages to each Flink streaming asynchronous job to implement message testing.
[0074] In specific implementation, the message generator can be used to abstract the relevant test processes, and form an automated testing tool based on the Java language through program modularization.
[0075] In one embodiment of the present application, the monitoring module 220 is specifically used to: monitor the processing logic of the Flink streaming asynchronous job through the asynchronous listener and obtain the processing result in the Flink streaming asynchronous job.
[0076] The asynchronous listener can obtain code execution results from multiple Flink streaming asynchronous jobs and listen to the processing logic of code execution results in Flink streaming jobs. According to the processing logic, it can further determine whether the test message in the message generator meets the requirements of Flink streaming asynchronous jobs, that is, it is suitable for automated testing of streaming jobs with different processing logics.
[0077] In one embodiment of the present application, the verification module 230 is specifically used to generate a test report based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job through a result verifier.
[0078] The result verifier obtains the verification result through comparison and generates the corresponding test report. The expected result message can be considered as the expected running result in the Flink streaming asynchronous job, while the processing result in the Flink streaming asynchronous job is the actual running result of the test message in the Flink streaming asynchronous job. By comparing the difference between the two, a test report can be generated.
[0079] In one embodiment of the present application, it also includes: an asynchronous monitoring module for
[0080] Based on the asynchronous execution mechanism of Flink streaming asynchronous jobs, the asynchronous listener is used, and the processing result layer configured at each layer of the streaming job verifies the processing result through the result verifier;
[0081] and / or,
[0082] The asynchronous listener is used and configured at the final result layer of the streaming job to listen to the final processing result, and the processing result is verified by the result verifier.
[0083] In one embodiment of the present application, the asynchronous monitoring module is also used to
[0084] The asynchronous listener, by utilizing the production subscription feature in the Kafka queue, automatically pushes the processing result in the Flink streaming asynchronous job and the expected result message to the result verifier when obtaining the streaming job processing result from the corresponding Kafka cluster topic.
[0085] In one embodiment of the present application, the generating module 210 is further used to
[0086] According to the message generator, a request message of a preset API debugging tool is received or a test case template is loaded from a file, wherein the request message and the test case template define target request field generation rules and expected result content.
[0087] In one embodiment of the present application, the generating module 210 is further used to
[0088] The message generator reads the address of the streaming asynchronous job Kafka cluster topic from the configuration file during the startup process, and the streaming asynchronous job Kafka cluster topic is used to receive the test message sent to the flink streaming asynchronous job;
[0089] Synchronously listen to the same streaming asynchronous job Kafka cluster topic address to automatically read the test message for processing and calculation through the Flink streaming asynchronous job.
[0090] In one embodiment of the present application, the verification module 230 is also used to
[0091] The expected result message and the verification result of the processing result in the Flink streaming asynchronous job are obtained by parsing the result verifier;
[0092] Perform a field-level comparison between the expected result message and the verification result of the processing result in the Flink streaming asynchronous job;
[0093] If the comparison fails, the preset flag case execution fails;
[0094] If the comparison is successful, the preset mark case is executed successfully.
[0095] In one embodiment of the present application, the verification module 230 is also used to
[0096] Read the test report from the template, parse the template to generate report content, and read the verification result of the processing result in the Flink streaming asynchronous job pushed by the result verifier, the corresponding test case source message, and the expected result message;
[0097] According to the verification results, the preset flag case is marked as successful or failed, and the field where the verification failed is output.
[0098] It can be understood that the above-mentioned automated testing device for streaming asynchronous jobs can implement the various steps of the automated testing method for streaming asynchronous jobs provided in the aforementioned embodiments. The relevant explanations about the automated testing method for streaming asynchronous jobs are all applicable to the automated testing device for streaming asynchronous jobs and will not be repeated here.
[0099] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 3 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0100] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0101] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0102] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming an automated test device for streaming asynchronous operations at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0103] Generate message data to be tested through a message generator and send the test message to the Flink job running environment, where the Flink job running environment includes multiple Flink streaming asynchronous jobs;
[0104] Through the asynchronous listener, the processing logic of the Flink streaming asynchronous job is monitored and the processing results in the Flink streaming asynchronous job are obtained;
[0105] A test report is generated by a result verifier based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job.
[0106] The above application Figure 1The method for executing the automated test device for streaming asynchronous jobs disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0107] The electronic device may also perform Figure 1 A method for executing an automated test device for streaming asynchronous jobs in a method for executing an automated test device for streaming asynchronous jobs in a Figure 1 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0108] The present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, enable the electronic device to execute Figure 1 The method for executing the automated testing device for streaming asynchronous jobs in the illustrated embodiment is specifically used to execute:
[0109] Generate message data to be tested through a message generator and send the test message to the Flink job running environment, where the Flink job running environment includes multiple Flink streaming asynchronous jobs;
[0110] Through the asynchronous listener, the processing logic of the Flink streaming asynchronous job is monitored and the processing results in the Flink streaming asynchronous job are obtained;
[0111] A test report is generated by a result verifier based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job.
[0112] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0113] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0114] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0115] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0116] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0117] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0118] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0119] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0120] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0121] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. An automated testing method for streaming asynchronous jobs, wherein: The method comprises: Generate message data to be tested through a message generator and send the test message to the Flink job running environment, where the Flink job running environment includes multiple Flink streaming asynchronous jobs; Through the asynchronous listener, the processing logic of the Flink streaming asynchronous job is monitored and the processing results in the Flink streaming asynchronous job are obtained; A test report is generated by a result verifier based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job.
2. The method of claim 1, wherein: The method further comprises: Based on the asynchronous execution mechanism of Flink streaming asynchronous jobs, the asynchronous listener is used, and the processing result layer configured at each layer of the streaming job verifies the processing result through the result verifier; and / or, The asynchronous listener is used and configured at the final result layer of the streaming job to listen to the final processing result, and the processing result is verified by the result verifier.
3. The method of claim 2, wherein: The method further comprises: The asynchronous listener, by utilizing the production subscription feature in the Kafka queue, automatically pushes the processing result in the Flink streaming asynchronous job and the expected result message to the result verifier when obtaining the streaming job processing result from the corresponding Kafka cluster topic.
4. The method of claim 1, wherein: The message generator generates message data to be tested and sends a test message to the Flink job running environment, wherein the Flink job running environment includes multiple Flink streaming asynchronous jobs, including: According to the message generator, a request message of a preset API debugging tool is received or a test case template is loaded from a file, wherein the request message and the test case template define target request field generation rules and expected result content.
5. The method of claim 4, wherein: The message generator generates message data to be tested and sends the test message to the Flink job running environment, wherein the Flink job running environment includes multiple Flink streaming asynchronous jobs, including: The message generator reads the address of the streaming asynchronous job Kafka cluster topic from the configuration file during the startup process, and the streaming asynchronous job Kafka cluster topic is used to receive the test message sent to the flink streaming asynchronous job; Synchronously listen to the same streaming asynchronous job Kafka cluster topic address to automatically read the test message for processing and calculation through the Flink streaming asynchronous job.
6. The method of claim 1, wherein: The result verifier generates a test report based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job, including: The expected result message and the verification result of the processing result in the Flink streaming asynchronous job are obtained by parsing the result verifier; Perform a field-level comparison between the expected result message and the verification result of the processing result in the Flink streaming asynchronous job; If the comparison fails, the preset flag case execution fails; If the comparison is successful, the preset mark case is executed successfully.
7. The method of claim 6, wherein: The generating of the test report includes: Read the test report from the template, parse the template to generate report content, and read the verification result of the processing result in the Flink streaming asynchronous job pushed by the result verifier, the corresponding test case source message, and the expected result message; According to the verification results, the preset flag case is marked as successful or failed, and the field where the verification failed is output.
8. An automated testing device for streaming asynchronous jobs, wherein: The device comprises: A generation module, used to generate message data to be tested through a message generator and send a test message to a Flink job running environment, wherein the Flink job running environment includes multiple Flink streaming asynchronous jobs; A monitoring module, used to monitor the processing logic of the Flink streaming asynchronous job and obtain the processing result in the Flink streaming asynchronous job through an asynchronous listener; The verification module is used to generate a test report based on the verification result of the expected result message and the processing result in the Flink streaming asynchronous job through a result verifier.
9. An electronic device, comprising: processor; as well as A memory arranged to store computer executable instructions, which when executed cause the processor to perform the method of any one of claims 1 to 7.
10. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including a plurality of application programs, causes the electronic device to execute any one of the methods of claims 1 to 7.
Citation Information
Cited By
API (Application Program Interface) security protection method, device and equipment based on HTTP (Hyper Text Transport Protocol) message streaming processing
CN119892515A
