Testing method and device for stream processing application

By obtaining the test subgraphs and test data of the stream processing application, generating executable files and adding test data, the problem of fine-grained splitting and scene simulation difficulties in stream processing application testing is solved, and high accuracy and flexibility of stream processing tests are achieved.

CN119690848APending Publication Date: 2025-03-25BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411918446.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

Existing stream processing application testing has problems such as difficult to split fine-grained test cases and difficult to simulate test scenarios, resulting in test errors and inaccurate scenario simulation.

Method used

By obtaining the test subgraph of the stream processing application, including operator nodes selected from the data stream graph, obtaining test data and generating executable files for test cases, flexibly adding test data to simulate the scenario where new data is continuously generated during the stream processing test.

Benefits of technology

It realizes fine-grained test cases splitting for stream processing applications, avoids test case errors, simulates the scenarios generated by new data in stream processing tests, and improves the accuracy and flexibility of the test.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690848A_ABST
    Figure CN119690848A_ABST
Patent Text Reader

Abstract

The invention discloses a testing method and device for a stream processing application, and relates to the technical field of computers. According to one specific embodiment, the method comprises the steps that a test sub-graph is obtained according to a test instruction of a stream processing application, and the test sub-graph comprises at least one operator node selected from a data flow graph of the stream processing application; obtaining test data according to operator nodes included in the test sub-graph, and generating an executable file of the test case according to the test data; executing the main logic of the test case according to the executable file, and executing the main logic of the test case based on the added test data in response to the addition of the test data in the execution process of the main logic of the test case; and in response to the main logic judgment of the test case, stopping executing the test case, and generating a test result of the stream processing application. According to the embodiment, the problem of negative test effect caused by errors of the test case is avoided, and the problem of difficulty in test scene simulation in the existing stream processing application test is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a testing method and device for a stream processing application. Background Art

[0002] With the continuous development of big data technology, the business requirements for data timeliness are becoming more and more stringent, which has also led to the rapid development and iteration of stream processing technology. The use of data processing applications developed based on the stream processing framework (i.e., stream processing applications) is also increasing. At present, when testing stream processing applications, the test tasks are divided into independent computing units and the computing units are connected in series to perform targeted fast stream processing tests.

[0003] However, due to the complexity of code logic and other reasons, the existing stream processing application testing has the problem of difficulty in splitting fine-grained test cases and prone to errors; because stream processing tasks will continuously generate new data during operation, the existing stream processing application testing has the problem of difficulty in simulating test scenarios. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and device for testing a stream processing application, which can perform fine-grained test case splitting on the test process of an application developed based on a stream processing framework, flexibly perform stream processing testing, and avoid the problem of negative test effects caused by test case errors. At the same time, in the process of performing stream processing testing based on the test case corresponding to the test subgraph, test data can also be flexibly added, and testing can be performed based on the added test data, thereby simulating the scenario of continuously generating new data during the stream processing test process, and solving the problem of difficult test scenario simulation in existing stream processing application testing.

[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for testing a stream processing application is provided, comprising: According to a test instruction of a stream processing application, a test subgraph is obtained, wherein the test subgraph includes at least one operator node selected from a data flow graph of the stream processing application; Acquire test data according to the operator nodes included in the test subgraph, and generate an executable file of the test case according to the test data; executing the main logic of the test case according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; In response to stopping the execution of the test case according to a main logic decision of the test case, a test result of the stream processing application is generated.

[0006] Optionally, the test subgraph is selected in the following manner: if only one operator node is selected, the selected operator node is used as the test subgraph; if multiple operator nodes are selected, a minimum subgraph including the multiple operator nodes is determined from the data flow graph as the test subgraph.

[0007] Optionally, determining a minimum subgraph including the multiple operator nodes from the data flow graph comprises: performing a forward topological sorting on the operator nodes of the data flow graph to obtain a first node set; performing a reverse topological sorting on the operator nodes of the data flow graph to obtain a second node set; obtaining an exclusion point set based on the first node set and the second node set; and removing the exclusion point set from the operator nodes of the data flow graph to obtain a minimum subgraph including the multiple operator nodes.

[0008] Optionally, after obtaining the minimum subgraph including the multiple operator nodes, it also includes: obtaining each node included in the minimum subgraph including the multiple operator nodes; for each node, in response to the input node of the node not being included in the minimum subgraph, adding the input node of the node to the minimum subgraph.

[0009] Optionally, obtaining test data according to the operator nodes included in the test subgraph includes: obtaining test data from a test data set according to the test node identifiers corresponding to the operator nodes included in the test subgraph, the test data set storing the association between the test case identifier, the test node identifier and the test data row number.

[0010] Optionally, the test data includes test resource configuration information and test case data; generating an executable file of the test case based on the test data, including: generating a resource configuration code for the test case based on resource configuration logic and the test resource configuration information; generating a data simulation code and a data display code for the test case based on a data simulation operator, a data display operator and the test case data; generating an executable file of the test case based on the resource configuration code, the data simulation code and the data display code.

[0011] Optionally, the added test data is stored in a test data set; and the main logic of the test case is executed based on the added test data, including: continuously acquiring test data from the test data set through the data simulation code to acquire the added test data, and executing the main logic of the test case based on the added test data.

[0012] Optionally, continuously acquiring test data from the test data set through the data simulation code to acquire the added test data includes: continuously acquiring test data from the test data set through the data simulation code, and recording the number of test data items acquired; in response to the number of test data items acquired reaching an upper limit value or the execution duration reaching a duration threshold, or all added test data having been acquired, using the acquired test data as the added test data.

[0013] Optionally, after using the acquired test data as the added test data, it also includes: modifying the state of the test task to a terminated state; in response to stopping the execution of the test case according to the main logic of the test case, generating a test result of the stream processing application, including: in response to the state of the test task being a terminated state, stopping the execution of the test case according to the main logic of the test case, and generating a test result of the stream processing application according to the data display code.

[0014] According to another aspect of an embodiment of the present invention, a testing device for a stream processing application is provided, comprising: A test subgraph acquisition module, configured to acquire a test subgraph according to a test instruction of a stream processing application, wherein the test subgraph includes at least one operator node selected from a data flow graph of the stream processing application; An executable file generation module, used to obtain test data according to the operator nodes included in the test subgraph, and generate an executable file of the test case according to the test data; a test case execution module, configured to execute the main logic of the test case according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; The test result generating module is used for generating a test result of the stream processing application in response to stopping the execution of the test case according to the main logic of the test case.

[0015] According to another aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the testing method for the stream processing application provided by an embodiment of the present invention.

[0016] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for testing a stream processing application provided by an embodiment of the present invention is implemented.

[0017] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the test method for the stream processing application provided by the embodiment of the present invention is implemented.

[0018] An embodiment of the above invention has the following advantages or beneficial effects: by obtaining a test subgraph according to a test instruction of a stream processing application, the test subgraph includes no less than one operator node selected from a data flow graph of the stream processing application; obtaining test data according to the operator nodes included in the test subgraph, and generating an executable file of a test case according to the test data; executing the main logic of the test case according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; in response to stopping the execution of the test case in response to a determination according to the main logic of the test case, a technical solution for generating a test result of the stream processing application is provided, by dividing the data flow graph of the stream processing application into individual operator nodes, and then selecting some operator nodes therefrom to form a test subgraph, and performing testing based on the test subgraph, thereby realizing fine-grained test case splitting of the test process of an application developed based on a stream processing framework, flexibly performing stream processing testing, and avoiding the problem of negative test effects caused by test case errors. At the same time, in the process of performing stream processing tests based on the test cases corresponding to the test subgraphs, test data can be flexibly added, and the test can be performed based on the added test data, thereby simulating the scenario of continuously generating new data during the stream processing test, and solving the problem of difficult test scenario simulation in the existing stream processing application tests. In addition, in other embodiments of the present invention, the number of test data obtained or the execution time of the test task can be controlled to achieve boundary control of the stream processing test task and reasonably allocate test resources.

[0019] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention. Figure 1 is a schematic diagram of main steps of a method for testing a stream processing application according to an embodiment of the present invention; Figure 2 It is a schematic diagram of the test task execution flow of an embodiment of the present invention; Figure 3 It is a schematic diagram of a test flow of a stream processing application according to an embodiment of the present invention; Figure 4 is a schematic diagram of main modules of a testing device for a stream processing application according to an embodiment of the present invention; Figure 5is an exemplary system architecture diagram to which embodiments of the present invention may be applied; Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0021] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0022] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution disclosed in the present invention are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0023] In order to solve the problems existing in the prior art, the present invention provides a testing method for stream processing applications, which can be based on a low-code drag-and-drop data application development platform (also known as a "data flow platform") to build an automated unit testing system based on a stream processing framework, and the data flow graph of the stream processing application can be divided into operator nodes, and then some operator nodes are selected from them to form a test subgraph, and the test is performed based on the test subgraph, so as to realize the fine-grained test case splitting of the test process of the application developed based on the stream processing framework, and flexibly perform stream processing tests to avoid the problem of negative test effects caused by errors in test cases. At the same time, in the process of stream processing testing based on the test case corresponding to the test subgraph, test data can also be flexibly added, and the test is performed based on the added test data, thereby simulating the scenario of continuously generating new data in the stream processing test process, and solving the problem of difficult test scenario simulation in the existing stream processing application test. In addition, in other embodiments of the present invention, the number of test data obtained or the execution time of the test task can be controlled to achieve boundary control of the stream processing test task and reasonably allocate test resources.

[0024] Figure 1 FIG. 1 is a schematic diagram of the main steps of a method for testing a stream processing application according to an embodiment of the present invention. Figure 1 As shown, the test method of the stream processing application in the embodiment of the present invention mainly includes the following steps S101 to S104.

[0025] Step S101: According to the test instruction of the stream processing application, a test subgraph is obtained, and the test subgraph includes at least one operator node selected from the data flow graph of the stream processing application. According to the technical solution of the present invention, before testing the stream processing application, a data flow graph of the stream processing application can be generated in advance according to the implementation logic of the stream processing application, and the data flow graph includes multiple operator nodes and connection relationships between the operator nodes.

[0026] When users need to test stream processing applications, they first build a data flow graph on the data flow platform. The output of each node in the graph is a data frame, and the connecting line indicates that the output data frame is passed as an input parameter to the downstream node. When testing stream processing applications, you can select the operator nodes that need to be tested from the data flow graph according to the test requirements and submit a test request. After receiving the test request, the test system will generate a test instruction. After that, the test subgraph corresponding to this test is obtained according to the test instruction.

[0027] According to an embodiment of the present invention, the test subgraph is selected in the following manner: if only one operator node is selected, the selected operator node is used as the test subgraph; if multiple operator nodes are selected, the minimum subgraph including multiple operator nodes is determined from the data flow graph as the test subgraph. If the user only selects one operator node when submitting a test request, it means that only the selected operator node needs to be tested, and the operator node is used as the test subgraph. If the user selects multiple operator nodes, it is necessary to determine the minimum subgraph including these operator nodes from the data flow graph as the test subgraph.

[0028] According to one embodiment of the present invention, determining a minimum subgraph including multiple operator nodes from a data flow graph may specifically include: performing forward topological sorting on the operator nodes of the data flow graph to obtain a first node set; performing reverse topological sorting on the operator nodes of the data flow graph to obtain a second node set; obtaining an exclusion point set based on the first node set and the second node set; removing the exclusion point set from the operator nodes of the data flow graph to obtain a minimum subgraph including multiple operator nodes. In one embodiment of the present invention, the specific process of determining the minimum subgraph is, for example: 1. Performing forward topological sorting on the entire data flow graph, traversing layer by layer from top to bottom according to the topological sorting level, and placing nodes that cannot be touched by the selected node set Vs into D1; 2. Performing reverse topological sorting on the entire data flow graph, with the same rule as 1, placing nodes that cannot be touched by Vs into D2; 3. Taking the union of D1 and D2 as the nodes that need to be finally excluded from the original data flow graph, removing these nodes to obtain the final subgraph, if there are multiple graphs in the final subgraph, the construction fails, and the user needs to reselect the node.

[0029] According to another embodiment of the present invention, after obtaining a minimum subgraph including multiple operator nodes, it may also include: obtaining each node included in the minimum subgraph including multiple operator nodes; for each node, in response to the input node of the node not being included in the minimum subgraph, adding the input node of the node to the minimum subgraph. In an embodiment of the present invention, for the obtained minimum subgraph, each node is also traversed to see whether the input nodes of these nodes are all covered in the subgraph. If the input node of a node is not in the subgraph, but in a set of nodes that have been deleted (the union of D1 and D2), the input node will become a node that needs to be simulated, and the input node will be added to the minimum subgraph; if the current node has no input node, it means that the node is a data source node, and the node itself will become a node that needs to be simulated.

[0030] Step S102: Acquire test data according to the operator nodes included in the test subgraph, and generate an executable file of the test case according to the test data. According to an embodiment of the present invention, some test data can be created in advance, and the test data can be uniformly stored in a database (e.g., HBase database) so that it can be read as initial test data when the test case is run next time. The test data created in the present invention is, for example, data in a string format.

[0031] According to an embodiment of the present invention, obtaining test data according to the operator nodes included in the test subgraph may specifically include: obtaining test data from a test data set according to the test node identifier corresponding to the operator node included in the test subgraph, and the test data set stores the association relationship between the test case identifier, the test node identifier and the test data row number. In an embodiment of the present invention, the constructed test data are uniformly stored in HBase. The reason for selecting HBase is that HBase supports fuzzy query and data persistence storage, and can achieve sub-second reading performance under a data volume of tens of billions, which provides convenience for reading and displaying test data. The row key construction rule of HBase is ${test case unique ID}|${test record unique ID}|${test node ID}|${data row number}. Among them, the test case unique ID is a universally unique identifier (Universally Unique Identifier, referred to as UUID) automatically generated by the system, and the test record unique ID is also the same. However, a test record belongs to a test case, so the unique ID of the test record theoretically only needs to be unique under a single test case. The test node ID is the unique ID of a node in a subgraph, and a test record corresponds to a subgraph. Therefore, a node in a test record can be accurately identified by the combination of ${test case unique ID}|${test record unique ID}|${test node ID}. The data row numbers are accumulated sequentially starting from 0. For example, when the user creates a case, two initial data are constructed, and the data row numbers are 0 and 1 respectively; and when the test case is run, two more data are added, and the row numbers of the newly added data will be accumulated on the basis of 1, becoming 2 and 3. Such a row key construction method is convenient for directly obtaining all or part of the test data of a test node under a test record. Since the test data constructed by the present invention is only used for testing, only the functional logic is measured but not the performance, the amount of data that can be constructed by each test data construction node when each test record is run can be controlled within 100. And due to the strong timeliness of the unit test function, that is, the running result of a unit test is only valid within a shorter time range, the expiration time of the test data can be uniformly adjusted to half a year, which effectively prevents the excessive expansion of data and the reduction of query efficiency caused by data tilt.

[0032] According to one embodiment of the present invention, the test data includes test resource configuration information and test case data. Furthermore, generating an executable file of the test case based on the test data may specifically include: generating a resource configuration code of the test case based on the resource configuration logic and the test resource configuration information; generating a data simulation code and a data display code of the test case based on the data simulation operator, the data display operator and the test case data; and generating an executable file of the test case based on the resource configuration code, the data simulation code and the data display code.

[0033] According to an embodiment of the present invention, when an executable file of a test case is generated according to test data, specifically, a resource configuration code of the test case can be generated according to resource configuration logic and test resource configuration information. When a user submits a stream processing unit test task to a test system, it is necessary to specify resources and generate test resource configuration information. Afterwards, a resource configuration code is generated according to the test resource configuration information. All configurations here are automatically generated by the system, and the user does not need to perceive them. In the present invention, the minimum resource configuration will be selected, and the parallelism of all operators will be set to 1, thereby avoiding all risks brought by concurrent computing. The reason why concurrent computing is not used is that unit testing only tests user computing logic and does not test performance. At the same time, the checkpoint and state backend of the stream processing framework (taking Flink as an example) will be closed, no state will be stored, and the retry mode will be adjusted to no retry (that is, if the stream processing test task fails to run, an error will be thrown immediately and the task will be stopped) to improve test efficiency.

[0034] In an embodiment of the present invention, when generating an executable file of a test case, the node information of the test subgraph and the connection relationship between the nodes are also stored through the operators element. Among them, the field parameters included in the operators element and their meanings are as follows: opName stores the English name of the current operator node, input stores the set of English names (i.e., opName) of the upstream nodes of the current operator node, and opClass represents the Java class name corresponding to the underlying layer of the operator. The underlying layer establishes the execution order of the operator through a topological sorting algorithm, then reflects and reads the class corresponding to opClass, and executes the execution method therein. In an embodiment of the present invention, most of the operators in the subgraph are retained, and only the data source nodes are replaced with their corresponding data simulation nodes, and some leaf nodes that will be written to the external database are pruned, and then a data output node is added to the tail of the pruned leaf node for data display. The data output node is not displayed on the front end of the platform and is only used for underlying calculations. The final data view is also viewed by clicking the data output node on the front end. The current data stream platform has two types of operators: Stream API and Table API, and the underlying layers correspond to Flink's DataStream API and TableAPI, respectively. To adapt to the two APIs, a Stream API data simulation operator, a Stream API data display operator, and a Table API data simulation operator are developed in the embodiments of the present invention.

[0035] First is the Stream API data simulation operator, which implements the RichSourceFunction interface of the data flow framework Flink at the bottom. The HBase connection is opened in the open method to ensure that the test data in HBase can be continuously read during the operation of the entire Flink stream processing test task. In addition to the HBase connection, the open method also establishes a connection with the back-end database of the data flow platform (for example: MySQL) for reporting the status of the Flink task. The present invention implements only two states: running and terminated. At this time, because the open function is called when the Flink task just starts running, and the call timing is before the invoke method, that is, the data manufacturing method, it can be selected to adjust the task status to "running" in the open method. In the invoke method, it is necessary to continuously read the latest test data from HBase to simulate the production of streaming data. The implementation method is as follows: The present invention establishes a while loop to read data from HBase in batches every 1 second through specific query conditions. The query condition logic is as follows: Set a variable x, and the initial value is empty. If x is empty, then use ${test case unique ID}|${test record unique ID}|${test node ID} as the prefix to directly query all the initial data under the current test case, and then extract their respective data row numbers from the row keys of these data, and let x be equal to the largest data row number; if x is not empty, then use ${test case unique ID}|${test record unique ID}|${test node ID}|${x} as the starting point value of the fuzzy query to query all data prefixed with ${test case unique ID}|${test record unique ID}|${test node ID} and larger than the starting point value. In an embodiment of the present invention, when the number of read data exceeds the upper limit (for example, 100) or the running time exceeds the limit (for example, 10 minutes), the while loop in the invoke method will be jumped out, the test data manufacturing method will be terminated, and then the HBase connection will be closed in the close method, and the task status will be updated to "terminated", so that the entire Flink task enters the completion state.

[0036] Then there is the Stream API data display operator. In the present invention, only the data display operator of the Stream API mode is developed, and the data is uniformly converted into unstructured data in the JSON (JS object notation, a text data format) format. If the upstream operator is a Stream API, the upstream output data is directly displayed; if it is a Table API, a JSON similar to {f1: v1, f2: v2} will be generated accordingly. Among them, f1 and f2 are the field names of the Flink virtual table in the Table API, which are uniformly in String format; v1 and v2 are the field values ​​corresponding to the fields, and the Java objects corresponding to the field values ​​are directly obtained and extracted into JSON. The data display operator is a target source node, so the present invention implements the RichSinkFunction interface of Flink. The interface still has three methods: open, invoke, and close. The present invention also establishes an HBase connection for data reading in the open method, but unlike the data simulation operator, the present invention also creates a timed thread. The reasons for creating this thread are as follows: frequently requesting the HBase write data interface and writing only one piece of data each time is an inefficient behavior. HBase can be written in batches, and the efficiency is significantly better than single writing. Therefore, in the embodiment of the present invention, a cache is established. When a piece of data arrives, it is not directly written to the database, but it is determined whether the upper limit of the cache (100) is reached. If the upper limit of the cache is reached, all the data in the cache will be written to HBase and then the cache will be cleared. The triggering time of the invoke method is triggered when a piece of data arrives. This triggering mechanism has a disadvantage, that is, when the amount of cached data does not reach the upper limit, but the upstream node does not generate data, the write operation cannot be triggered at this time. This scenario is very common in unit testing of stream processing. For example, the user simulates two pieces of data at the beginning, and the most common operation must be to check the execution result. At this time, the two pieces of data are far from the upper limit of the cache, and the user has not simulated new data at this time, so the execution result will not be written to HBase, and the front end will not display the execution result. Therefore, this timing thread is used to write the data in the cache to HBase on a timing basis (executed every 1 second). In short, in the embodiment of the present invention, there are two triggering conditions for writing the data in the cache to the database: 1. When the amount of cached data reaches the upper limit (100); 2. The time from the last data write exceeds the specified time interval (1 second). In the invoke method, the present invention adds data to the cache, and when the cache data reaches the upper limit, writes data to HBase. In order to prevent the writing logic of the timing thread and the invoke function from conflicting and causing duplicate data to be written, object locks are added to both data writing functions. The thread that seizes the lock will first perform a judgment to determine whether the cache is empty.If it is not empty, data will be written to HBase and then the cache will be cleared. To prevent excessive data expansion, each display node only supports the display of the first 100 data. Therefore, if the current data written to HBase has reached 100, the next data entering the invoke method will be directly ignored. In the close method, the HBase connection will be closed and the process will end.

[0037] Finally, there is the Table API data simulation operator. Currently, this data simulation operator only supports simulating Kafka message queue data. In the Kafka data source of the data flow platform, users will configure some configurations supported by the Flink Kafka table connector (TableConnector), such as defining the virtual table field structure and adding some table attributes of the virtual table. To design the corresponding data simulation operator, it is necessary to eliminate some logic that is not related to data testing, such as Kafka sites and consumption-related configuration items. Configurations related to data processing, such as the logic of deserializing source messages, should be retained to simulate the processing of source messages in real consumption scenarios to the greatest extent. The underlying layer also develops a connector according to the Flink table connector standard, and implements the Flink DynamicTableSourceFactory class. The factory class implemented by the present invention retains the definition of fields and field types of Kafka's own table connector, and also retains the relevant logic for message serialization and deserialization operations. On this basis, some configurations that interact with the data flow platform are added, such as HBase configuration (for reading data) and MySQL configuration (for status updates). The underlying DataStream operator logic is consistent with the Stream API data simulation operator, and only the logic of the original Kafka connector is maintained in the stage of deserializing messages. The Table connector implemented in this invention also supports the Flink SQL standard syntax.

[0038] Step S103: Execute the main logic of the test case according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data. In an embodiment of the present invention, test data can also be constructed when the test case is running. The test data constructed at this time will affect the test case currently being run. The test data constructed by the user at this stage, once submitted and saved, will be consumed by the running test case. This scenario is to simulate the running scenario of the stream processing test task, and the messages are sent, read and consumed in real time.

[0039] According to one embodiment of the present invention, the added test data is stored in a test data set; executing the main logic of the test case based on the added test data may specifically include: continuously acquiring test data from the test data set through data simulation code to acquire the added test data, and executing the main logic of the test case based on the added test data.

[0040] Among them, continuously acquiring test data from the test data set through the data simulation code to acquire the added test data can specifically include: continuously acquiring test data from the test data set through the data simulation code, and recording the number of test data items acquired; in response to the number of test data items acquired reaching an upper limit value or the execution duration reaching a duration threshold, or all added test data having been acquired, using the acquired test data as added test data.

[0041] According to the embodiment of the present invention, when executing the main logic of the test case, it can be mainly divided into two stages, the first stage is the test task submission stage, and the second stage is the test task execution stage.

[0042] In the test task submission stage, the task scheduling platform is used to schedule and deploy the stream processing test task. The data flow platform uploads the compressed package of the executable file to the task scheduling platform, and then submits the task startup parameters (such as the test resource configuration information in the test data) and executes the task. Since the resources of the stream processing development framework are relatively tight, the operation of the test case is controlled in the embodiment of the present invention, and it is stipulated that: a data flow task can create multiple test cases, but only one unit test task will be created, and only one test case is allowed to occupy the task resources for operation at the same time. If you want to run other test cases, you need to stop the current test case before you can proceed to the next step. In the present invention, each test record has the following states: submitting / subgraph generation, submitting / script uploading, submitting / task publishing, submitting / task running preparation, submission failure, submission timeout, running, and termination. The state flow process under normal circumstances is: after submitting the task startup parameters, the test task will execute the subgraph generation, script uploading, task publishing, and task running preparation stages in sequence to complete the task submission. Among them, in these stages (subgraph generation, script upload, task release, task run preparation), if the subtask of the corresponding stage fails to complete due to timeout, the status of the test task will be changed to submission timeout; otherwise, if the subtask of the corresponding stage fails to execute without timeout, the status of the test task will be changed to submission failure. If the subtask of the corresponding stage is executed successfully without timeout, the status of the test task will be changed to submitting / subgraph generation, submitting / script upload, submitting / task release, submitting / task run preparation, until the running logic ends (that is, the main logic of the test case determines that the test task has been executed or stopped), and the status of the test task will be changed to running; if the running logic fails to end, it means that the task submission has failed, and the status of the test task will be changed to terminated.

[0043] According to one embodiment of the present invention, if there is a test record in the submitting or running state, the user is not allowed to run other test cases. The test task in the submitting state cannot be stopped, because the submission means that the data flow platform is sending task parameters and executing scripts to the task scheduling platform. At this time, no Flink cluster is started, so the stop operation cannot be performed. The running task can be stopped at any time. The task is running, which means that the Flink cluster corresponding to the stream processing test task has been started. Submission failure, submission timeout, and termination are three termination states. If the test records of all test cases are in these three states, the user can execute any test case. Among them, submission failure means that there is an exception in the process of transmitting task data from the data flow platform to the task scheduling platform, which has nothing to do with the running of the stream processing test task; submission timeout means that a certain link exceeds the preset time when transmitting data to the task scheduling platform; termination is the state that will be reached when the stream processing test task is completed or abnormally terminated.

[0044] When the user manually executes the test case in the data flow platform interface, the "Start" link will be triggered, and the subgraph selection link will be executed. At this time, the status will be changed to "Submitting / Subgraph Generating". If the subgraph is successfully generated, the execution script will be submitted to the task scheduling platform and the "Submitting / Script Uploading" link will be entered. This link is related to the principle of running unit test tasks at the bottom layer. The principle of running the test task is as follows: the data flow platform has a ready-made engine package, which will read the test resource configuration information, and then execute the corresponding resource configuration code generated according to the test resource configuration information. In the present invention, the resource configuration information that needs to be executed each time will be uploaded to the remote storage and read during execution. The process of uploading to the remote storage is faster, and because the engine package is relatively large, it will be very time-consuming to upload a new engine package every time a task is released. The back-end MySQL database can be used to record the engine package version. Each time the engine package is uploaded, the version number of the engine package is recorded (the MySQL library has a special table to maintain the engine package version information) and the executable file ID of the corresponding task scheduling platform after uploading. The next time the engine package needs to be uploaded, first search the MySQL library to find out whether the corresponding engine package version number exists. If it exists, the corresponding executable file of the task scheduling platform is directly used to publish or run the test case corresponding to this test task; if it cannot be found, it proves that it is a new version of the engine package, and it is inevitable to upload it. This optimization item significantly improves the efficiency of the scenario where users conduct repeated tests in a short period of time, and each test can save 2-5 minutes of environment preparation time. In the subsequent task release and task running preparation, the task running parameters are released to the Flink cluster of the task scheduling platform.

[0045] After the test task is submitted, the test task execution phase will begin. Figure 2It is a schematic diagram of the test task execution flow of an embodiment of the present invention. When the test task is executed, the topological sorting is used to specify the execution order of each node. In the data simulation code, the "record start state" link (i.e., the task state is changed to "running") and the upper limit of the running time and the upper limit of the number of input test data are judged, and the completion / failure state is recorded (the task state is changed to "terminated"), and the "read test data" logic is executed. After reading the test data, the test case will be executed according to the test data. Specifically, the main logic of the test case will be executed node by node. During the execution of the test case, it will be judged whether there is a next node. If so, the node logic is executed and it is judged whether the execution is successful. If the execution is successful, when it is determined that the test result is to be output, the test result is written to the cache through the data display code, and it is further judged whether there is a next node; if it is determined that the test result does not need to be output, it is judged whether there is a next node. If the execution fails, the failure state is recorded and the test task is terminated. Among them, when it is determined that there is no next node, the execution of this test data is completed, and the upper limit of the running time and the upper limit of the number of input test data are jumped to until the completion / failure state is recorded.

[0046] In the embodiment of the present invention, as to how to monitor the failure status, since the stream processing test task will call the close method in all RichFunctions in sequence when it fails abnormally, the data simulation code can also successfully update the task status to "terminated" when it fails abnormally. The data display code executes the "write test results" link in the figure.

[0047] Step S104: In response to stopping the execution of the test case according to the main logic of the test case, a test result of the stream processing application is generated.

[0048] According to an embodiment of the present invention, after the acquired test data is used as the added test data, the method further includes: modifying the state of the test task to a terminated state. Furthermore, in response to stopping the execution of the test case according to the main logic of the test case, generating the test result of the stream processing application, which may specifically include: in response to the state of the test task being a terminated state, stopping the execution of the test case according to the main logic of the test case, and generating the test result of the stream processing application according to the data display code.

[0049] In an embodiment of the present invention, after generating the test results of the stream processing application, the test results can also be viewed. When the current test case is in operation or in a terminated state, the user can enter the running test record at any time to view the calculation results of a certain node. The test results are written to HBase by the data display code. On the system side, HBase is requested through the backend interface, and all calculation results of the current test node (up to 100) are fuzzy queried with ${test case unique ID}|${test record unique ID}|${test node ID} as the prefix, and displayed on the front end.

[0050] Figure 3 FIG. 1 is a schematic diagram of a test flow of a stream processing application according to an embodiment of the present invention. Figure 3 As shown, in an embodiment of the present invention, the test process of the stream processing application is mainly as follows: after starting the test, first determine whether to use an existing test case. If so, determine whether to modify the initial test data. Otherwise, when the existing test case is not used, a test subgraph will be selected.

[0051] When it is determined that the initial test data needs to be modified, the test data will be constructed and saved, and then the test case will be saved to generate an executable file based on the test case, and the main logic of the test case can be executed based on the executable file later. When it is determined that the initial test data does not need to be modified, the executable file is directly generated based on the initial test data, and the main logic of the test case is executed based on the executable file.

[0052] When a test subgraph needs to be selected, it will be determined whether initial test data needs to be constructed based on the selected test subgraph. If initial test data needs to be constructed, the test data is constructed and saved, and then the test case is saved to generate an executable file based on the test case, and the main logic of the test case can be executed based on the executable file later. If initial test data does not need to be constructed, the initial test data is directly used as the test data corresponding to the test case, and the test case is saved to generate an executable file based on the test case, and the main logic of the test case can be executed based on the executable file later.

[0053] During the execution of the main logic of the test case, if it is determined that the test case should be stopped, the test task of the stream processing application is terminated. Otherwise, it is determined whether to add test data. If it is necessary to add test data, the test data is constructed and saved to execute the main logic of the test case according to the constructed test data; otherwise, the main logic of the test case continues to be executed until the test task of the stream processing application is terminated.

[0054] Figure 4 FIG. 1 is a schematic diagram of the main modules of a test device for a stream processing application according to an embodiment of the present invention. Figure 4As shown, the testing device 400 for stream processing applications according to the embodiment of the present invention mainly includes a test subgraph acquisition module 401 , an executable file generation module 402 , a test case execution module 403 and a test result generation module 404 .

[0055] A test subgraph acquisition module 401 is used to acquire a test subgraph according to a test instruction of a stream processing application, where the test subgraph includes at least one operator node selected from a data flow graph of the stream processing application; An executable file generation module 402 is used to obtain test data according to the operator nodes included in the test subgraph, and generate an executable file of the test case according to the test data; A test case execution module 403, configured to execute the main logic of the test case according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; The test result generation module 404 is configured to generate a test result of the stream processing application in response to stopping the execution of the test case according to the main logic of the test case.

[0056] According to one embodiment of the present invention, the testing device 400 for the stream processing application may further include a test subgraph selection module (not shown in the figure) for selecting a test subgraph, and the test subgraph is selected in the following manner: if only one operator node is selected, the selected operator node is used as the test subgraph; if multiple operator nodes are selected, a minimum subgraph including multiple operator nodes is determined from the data flow graph as the test subgraph.

[0057] According to another embodiment of the present invention, the test subgraph selection module (not shown in the figure) can also be used to: perform forward topological sorting on the operator nodes of the data flow graph to obtain a first node set; perform reverse topological sorting on the operator nodes of the data flow graph to obtain a second node set; obtain an exclusion point set based on the first node set and the second node set; remove the exclusion point set from the operator nodes of the data flow graph to obtain a minimum subgraph including multiple operator nodes.

[0058] According to another embodiment of the present invention, the test subgraph selection module (not shown in the figure) can also be used to: after obtaining a minimum subgraph including multiple operator nodes, obtain each node included in the minimum subgraph including multiple operator nodes; for each node, in response to the input node of the node not being included in the minimum subgraph, add the input node of the node to the minimum subgraph.

[0059] According to another embodiment of the present invention, the executable file generation module 402 can also be used to obtain test data from a test data set according to the test node identifier corresponding to the operator node included in the test subgraph, and the test data set stores the association relationship between the test case identifier, the test node identifier and the test data row number.

[0060] According to another embodiment of the present invention, the test data includes test resource configuration information and test case data; the executable file generation module 402 can also be used to: generate resource configuration code for the test case based on resource configuration logic and test resource configuration information; generate data simulation code and data display code for the test case based on data simulation operators, data display operators and test case data; generate an executable file for the test case based on resource configuration code, data simulation code and data display code.

[0061] According to another embodiment of the present invention, the added test data is stored in the test data set; the test case execution module 403 can also be used to: continuously obtain test data from the test data set through data simulation code to obtain the added test data, and execute the main logic of the test case based on the added test data.

[0062] According to another embodiment of the present invention, the test case execution module 403 can also be used to: continuously acquire test data from the test data set through the data simulation code, and record the number of test data items acquired; in response to the number of test data items acquired reaching an upper limit or the execution duration reaching a duration threshold, or all added test data having been acquired, use the acquired test data as added test data.

[0063] According to another embodiment of the present invention, the test case execution module 403 can also be used to: after the acquired test data is used as the added test data, modify the state of the test task to a terminated state. The test result generation module 404 can also be used to: in response to the state of the test task being a terminated state, stop executing the test case according to the main logic of the test case, and generate the test result of the stream processing application according to the data display code.

[0064] According to the technical solution of the embodiment of the present invention, a test subgraph is obtained according to the test instructions of the stream processing application, and the test subgraph includes no less than one operator node selected from the data flow graph of the stream processing application; test data is obtained according to the operator nodes included in the test subgraph, and an executable file of the test case is generated according to the test data; the main logic of the test case is executed according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; in response to stopping the execution of the test case in response to the main logic of the test case, the technical solution of generating the test result of the stream processing application is achieved by dividing the data flow graph of the stream processing application into individual operator nodes, and then selecting some operator nodes therefrom to form a test subgraph, and testing based on the test subgraph, thereby realizing fine-grained test case splitting of the test process of the application developed based on the stream processing framework, flexibly performing stream processing testing, and avoiding the problem of negative test effects caused by test case errors. At the same time, in the process of performing stream processing tests based on the test cases corresponding to the test subgraphs, test data can be flexibly added, and the test can be performed based on the added test data, thereby simulating the scenario of continuously generating new data during the stream processing test, and solving the problem of difficult test scenario simulation in the existing stream processing application tests. In addition, in other embodiments of the present invention, the number of test data obtained or the execution time of the test task can be controlled to achieve boundary control of the stream processing test task and reasonably allocate test resources.

[0065] Figure 5 An exemplary system architecture 500 is shown to which a method for testing a stream processing application or a device for testing a stream processing application according to an embodiment of the present invention can be applied.

[0066] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0067] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as software testing applications, testing framework applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0068] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0069] The server 505 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using terminal devices 501, 502, and 503. The background management server may perform processing such as test requests of received stream processing applications according to the test instructions of the stream processing applications, obtain a test subgraph, and the test subgraph includes at least one operator node selected from the data flow graph of the stream processing application; obtain test data according to the operator nodes included in the test subgraph, and generate an executable file of the test case according to the test data; execute the main logic of the test case according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; in response to stopping the execution of the test case according to the main logic of the test case, generate the test result of the stream processing application, and feed back the processing result (such as the test result of the stream processing application - only an example) to the terminal device.

[0070] It should be noted that the test method for the stream processing application provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the test device for the stream processing application is generally disposed in the server 505 .

[0071] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0072] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 6 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0073] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0074] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0075] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0076] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0077] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0078] The units or modules involved in the embodiments of the present invention may be implemented in software or hardware. The units or modules described may also be provided in a processor. For example, they may be described as: a processor including a test subgraph acquisition module, an executable file generation module, a test case execution module, and a test result generation module. Among them, the names of these units or modules do not constitute limitations on the units or modules themselves in certain circumstances. For example, the test result generation module may also be described as "a module for generating test results of the stream processing application in response to stopping the execution of the test case according to the main logic judgment of the test case".

[0079] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining a test subgraph according to a test instruction of a stream processing application, wherein the test subgraph includes at least one operator node selected from a data flow graph of the stream processing application; obtaining test data according to the operator nodes included in the test subgraph, and generating an executable file of a test case according to the test data; executing the main logic of the test case according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; in response to stopping the execution of the test case according to the main logic of the test case, a test result of the stream processing application is generated.

[0080] According to the technical solution of the embodiment of the present invention, a test subgraph is obtained according to the test instructions of the stream processing application, and the test subgraph includes no less than one operator node selected from the data flow graph of the stream processing application; test data is obtained according to the operator nodes included in the test subgraph, and an executable file of the test case is generated according to the test data; the main logic of the test case is executed according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; in response to stopping the execution of the test case in response to the main logic of the test case, the technical solution of generating the test result of the stream processing application is achieved by dividing the data flow graph of the stream processing application into individual operator nodes, and then selecting some operator nodes therefrom to form a test subgraph, and testing based on the test subgraph, thereby realizing fine-grained test case splitting of the test process of the application developed based on the stream processing framework, flexibly performing stream processing testing, and avoiding the problem of negative test effects caused by test case errors. At the same time, in the process of performing stream processing tests based on the test cases corresponding to the test subgraphs, test data can be flexibly added, and the test can be performed based on the added test data, thereby simulating the scenario of continuously generating new data during the stream processing test, and solving the problem of difficult test scenario simulation in the existing stream processing application tests. In addition, in other embodiments of the present invention, the number of test data obtained or the execution time of the test task can be controlled to achieve boundary control of the stream processing test task and reasonably allocate test resources.

[0081] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for testing a stream processing application, characterized in that: include: According to a test instruction of a stream processing application, a test subgraph is obtained, wherein the test subgraph includes at least one operator node selected from a data flow graph of the stream processing application; Acquire test data according to the operator nodes included in the test subgraph, and generate an executable file of the test case according to the test data; executing the main logic of the test case according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; In response to stopping the execution of the test case according to a main logic decision of the test case, a test result of the stream processing application is generated.

2. The method according to claim 1, characterized in that The test subgraph is selected in the following manner: If only one operator node is selected, the selected operator node is used as the test subgraph; If multiple operator nodes are selected, a minimum subgraph including the multiple operator nodes is determined from the data flow graph as the test subgraph.

3. The method according to claim 2, characterized in that Determining a minimum subgraph including the plurality of operator nodes from the data flow graph comprises: Performing forward topological sorting on the operator nodes of the data flow graph to obtain a first node set; Performing reverse topological sorting on the operator nodes of the data flow graph to obtain a second node set; Obtaining an exclusion point set according to the first node set and the second node set; The exclusion point set is removed from the operator nodes of the data flow graph to obtain a minimum subgraph including the multiple operator nodes.

4. The method according to claim 3, characterized in that After obtaining the minimum subgraph including the plurality of operator nodes, the method further includes: Acquire each node included in the minimum subgraph including the plurality of operator nodes; For each node, in response to an input node of the node not being included in the minimum subgraph, adding the input node of the node to the minimum subgraph.

5. The method according to claim 1, characterized in that: Acquiring test data according to the operator nodes included in the test subgraph includes: The test data is acquired from the test data set according to the test node identifier corresponding to the operator node included in the test subgraph, and the test data set stores the association relationship between the test case identifier, the test node identifier and the test data row number.

6. The method according to claim 1, characterized in that The test data includes test resource configuration information and test case data; Generate an executable file of a test case according to the test data, including: Generate resource configuration code for the test case based on the resource configuration logic and the test resource configuration information; Generate data simulation code and data display code for the test case based on the data simulation operator, the data display operator and the test case data; An executable file of a test case is generated based on the resource configuration code, the data simulation code and the data presentation code.

7. The method according to claim 6, characterized in that The added test data is stored in the test data set; Execute the main logic of the test case based on the added test data, including: The data simulation code continuously obtains test data from the test data set to obtain the added test data, and executes the main logic of the test case based on the added test data.

8. The method according to claim 7, characterized in that Continuously acquiring test data from the test data set by the data simulation code to acquire the added test data includes: Continuously acquiring test data from the test data set through the data simulation code, and recording the number of acquired test data; In response to the number of the acquired test data reaching an upper limit or the execution duration reaching a duration threshold, or all the added test data being acquired, the acquired test data is used as the added test data.

9. The method according to claim 8, characterized in that After the acquired test data is used as the added test data, the method further includes: Change the status of the test task to the terminated state; In response to stopping the execution of the test case according to the main logic of the test case, generating a test result of the stream processing application, including: In response to the state of the test task being a termination state, stopping the execution of the test case according to a main logic determination of the test case, and generating a test result of the stream processing application according to the data presentation code.

10. A testing device for a stream processing application, characterized in that: include: A test subgraph acquisition module, configured to acquire a test subgraph according to a test instruction of a stream processing application, wherein the test subgraph includes at least one operator node selected from a data flow graph of the stream processing application; An executable file generation module, used to obtain test data according to the operator nodes included in the test subgraph, and generate an executable file of the test case according to the test data; a test case execution module, configured to execute the main logic of the test case according to the executable file, wherein, in response to adding test data during the execution of the main logic of the test case, the main logic of the test case is executed based on the added test data; The test result generating module is used for generating a test result of the stream processing application in response to stopping the execution of the test case according to the main logic of the test case.

11. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.

12. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.