Vehicle testing method and computer readable storage medium
By combining composite use cases and sending them to the Kafka platform, the problem of low Kafka message sending efficiency in the existing technology is solved, and efficient testing and maintenance costs are achieved in complex scenarios.
Patent Information
- Application Number
- CN202411251004.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-11-08
AI Technical Summary
The existing Kafka message sending methods are mainly single message and single scenarios, which cannot meet the needs of composite scenarios, resulting in low operation efficiency and long time, and requires multiple encodings during the project life cycle, which is high maintenance costs.
Provides a vehicle testing method, displays a combination page through the message use case library, receives the message use case identifier input by the user, finds and combines it into a composite use case, and sends it to a distributed processing platform, such as the Kafka platform, to conduct testing of test scenarios.
It realizes the reduction of workload and improvement of work efficiency in complex scenarios, and meets the needs of multiple scenarios by combining message use cases, reducing the number of encodings and reducing maintenance costs.
Smart Images

Figure CN118913718A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automobile testing technology, and in particular to a vehicle testing method and a computer-readable storage medium. Background Art
[0002] In the field of big data processing, Kafka can be used as a platform for real-time data stream processing, collecting and transmitting real-time data from various data sources (such as databases, APIs, social media, etc.) to Hadoop. Through Kafka's distributed message queue function, high-speed data streams can be efficiently processed and passed to Hadoop for subsequent processing.
[0003] Currently, the commonly used Kafka message sending methods are basically single-message single-scenario message sending methods. They can only meet the needs of single message sending. By specifying the TOPIC and message body to directly send a single message, if there are multiple message body scenarios, the operation efficiency is extremely low and time-consuming.
[0004] In actual business, messages combining multiple TOPICs may appear, and specific business logic may be triggered in specific scenarios. If they are sent separately through sending tools, the execution efficiency is extremely low and inflexible. In addition, there is no customized tool for sending Kafka messages in composite scenarios, and multiple coding is required during the project life cycle, which is very time-consuming and cannot be reused and shared. The cost of maintaining scripts for project developers and testers is too high. Summary of the invention
[0005] The present application provides a vehicle testing method and a computer-readable storage medium, which can meet the needs of complex business scenarios, reduce workload and improve work efficiency.
[0006] The present application provides a vehicle testing method, comprising:
[0007] Based on a message use case library, displaying a combination page; the message use case library includes a plurality of message use cases representing test scenarios of the vehicle;
[0008] Receiving identifiers of multiple message use cases input by a user in the combination page;
[0009] According to each identifier, searching the message use case corresponding to each identifier in the message use case library as an alternative use case;
[0010] Combine alternative use cases into composite use cases;
[0011] sending the composite use case to a distributed processing platform;
[0012] The test scenario represented by the composite use case is tested.
[0013] Optionally, the distributed processing platform includes a Kafka platform, and sending the composite use case to the distributed processing platform includes: sending each candidate use case to the Kafka platform in sequence;
[0014] The testing of the test scenario represented by the composite use case includes: pulling each alternative use case from the kafka platform, and testing the test scenarios represented by each alternative use case in sequence.
[0015] Optionally, the testing method further includes:
[0016] receiving the interval time of each alternative use case input by the user in the combination page;
[0017] The sending the composite use case to the distributed processing platform includes: sending each candidate use case to the kafka platform in sequence according to the interval time;
[0018] The testing of the test scenario represented by the composite use case includes:
[0019] Pull each candidate use case from the kafka platform, and test the test scenario represented by each candidate use case according to the test scenario that occurs sequentially at the interval time.
[0020] Optionally, the distributed processing platform includes a Kafka platform, and sending the composite use case to the distributed processing platform includes: sending each candidate use case to the Kafka platform at the same time;
[0021] The testing of the test scenario represented by the composite use case includes: pulling each alternative use case from the kafka platform, and testing the test scenario in which the test scenarios represented by each alternative use case occur simultaneously.
[0022] Optionally, the distributed processing platform includes a Kafka platform, and the testing method further includes:
[0023] receiving the sending times of each alternative use case input by the user in the combination page;
[0024] The sending of the composite use case to the distributed processing platform includes: sending each candidate use case to the Kafka platform according to the sending times;
[0025] The testing of the test scenario represented by the composite use case includes:
[0026] Pull each alternative use case from the kafka platform, and test the test scenario represented by each alternative use case according to the test scenario occurring at the number of sending times.
[0027] Optionally, the distributed processing platform includes a Kafka platform, and the testing method further includes: receiving a sending time of each alternative use case input by a user in the combination page;
[0028] The sending of the composite use case to the distributed processing platform includes: sending each candidate use case to the kafka platform according to the sending time;
[0029] The testing of the test scenario represented by the composite use case includes:
[0030] Pull each candidate use case from the kafka platform, and test the test scenario represented by each candidate use case according to the test scenario occurring at the sending time.
[0031] Optionally, the distributed processing platform includes a Kafka platform, and the testing of the test scenario represented by the composite use case includes:
[0032] Pull the composite use case from the kafka platform;
[0033] Triggering preset business logic for the test scenario represented by the composite use case;
[0034] Verify the business logic.
[0035] Optionally, the method for generating the message use case library includes:
[0036] Presentation of data collection template;
[0037] receiving a plurality of message use cases input by a user in the data collection template;
[0038] The multiple message use cases are batch processed to form the message use case library.
[0039] Optionally, the data collection template includes a file in CSV format or XLS format.
[0040] The present application also provides a computer-readable storage medium having a program stored thereon, and when the program is executed by a processor, the vehicle testing method described in any one of the above items is implemented.
[0041] In some embodiments, the message case library includes multiple message cases representing vehicle test scenarios; based on the message case library, a combination page is displayed; multiple message case identifiers entered by the user in the combination page are received; according to each identifier, the message case corresponding to each identifier is searched in the message case library as an alternative case; each alternative case is combined into a composite case; the composite case is sent to the distributed processing platform; and the test scenario represented by the composite case is tested. By inputting data on the combination page, multiple message cases can be conveniently combined into a composite case to meet the needs of complex scenarios, which can reduce workload and improve work efficiency.
[0042] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0044] Figure 1 Shown is a flow chart of an embodiment of a vehicle testing method of the present application.
[0045] Figure 2 Shown Figure 1 A schematic diagram of an embodiment of a combination page is shown.
[0046] Figure 3 Shown is a schematic diagram of an embodiment of the composite use case library of the present application.
[0047] Figure 4 Shown is a schematic diagram of an embodiment of a data collection template of the present application.
[0048] Figure 5 Shown is a structural block diagram of an embodiment of the test system of the present application. DETAILED DESCRIPTION
[0049] The present application provides a vehicle testing method and a computer-readable storage medium. The vehicle testing method and the computer-readable storage medium of the present application are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the features of the following embodiments and implementations can be combined with each other.
[0050] Figure 1 FIG. 1 is a flow chart of an embodiment of a vehicle testing method 10 of the present application. Figure 1 As shown, the vehicle testing method 10 includes: steps 11 to 16.
[0051] Step 11: Based on the message use case library, a combination page is displayed. The message use case library includes a plurality of message use cases representing vehicle test scenarios.
[0052] The message case library is a pre-built collection of multiple message cases. The message case library can be stored in MySQL or other types of databases. Each message case represents a test scenario for a vehicle. Different vehicles can have different test scenarios. For example, the fatigue of a vehicle can be characterized by vehicle speed, tire wear, etc. The collision event of a vehicle can be characterized by the probability of a collision.
[0053] Figure 2 Shown Figure 1 A schematic diagram of an embodiment of a combination page is shown.
[0054] The combination page allows users to combine message use cases and combine multiple message use cases into a new composite use case. For example, message A indicates the fatigue condition of the vehicle, and message B indicates the collision event of the vehicle. When the user wants to test the alarm mechanism triggered when the vehicle is in a fatigue condition and a collision may occur, the user needs to combine message A and message B into a new message C. The test scenario represented by message C is: the vehicle is in a fatigue condition and a collision event may occur. Figure 2 As shown, the combination page includes a composite use case name field and a composite use case field. The composite use case name field is used for users to define the name of the composite use case to distinguish multiple composite use cases. For example, users can define the name of the composite use case as C message. The composite use case field is used for users to enter message use cases that need to be combined, such as A message and B message.
[0055] Step 12: receiving identifiers of multiple message use cases input by the user in the combination page.
[0056] refer to Figure 2 , users can enter the identifiers of multiple message use cases in the Combined Use Case field on the Combine page. For example, enter the name of the message use case or the ID of the message use case. Users need to let the system know which message use cases they want to combine.
[0057] The combination page may provide a drop-down list for the user to select a specific message use case in the message use case library, or may provide an input box for the user to directly input an identifier of the message use case.
[0058] Step 13: According to each identifier, search for the message use case corresponding to each identifier in the message use case library as an alternative use case.
[0059] After receiving the identifiers input by the user, the message use cases corresponding to the identifiers are searched in the message use case library as alternative use cases through the identifiers. The alternative use cases are the message use cases that the user wants to combine. The alternative use cases can be searched by traversing the message use case library or by directly searching the identifiers.
[0060] Step 14: Combine the alternative use cases into a composite use case.
[0061] After finding the alternative use cases, combine the alternative use cases into a composite use case. The composite use case contains the test scenarios of the alternative use cases. The test scenario of the composite use case is the superposition of the test scenarios of the alternative use cases. The test scenario of the composite use case can be a scenario in which the test scenarios of the alternative use cases occur simultaneously, or a scenario in which the test scenarios of the alternative use cases occur in sequence.
[0062] Figure 3 Shown is a schematic diagram of an embodiment of the composite use case library of the present application.
[0063] A composite use case library can be built in advance, and the assembled composite use cases can be saved in the composite use case library so that the composite use case can be directly called when the test scenario is needed.
[0064] like Figure 3 As shown in the figure, the composite use case library includes a use case ID field, a message topic field, a message body field, an associated topic field, a custom parameter field, and an operation field. The use case ID field is used to identify each composite use case. The message topic field is the topic to which each composite use case belongs. The message body field is the message body of each composite use case. The associated topic field is the topic associated with each composite use case, that is, each composite use case can belong to a topic other than the message topic. Each composite use case can be associated with one or more topics, or no topic. The custom parameter user customizes the parameters of each composite use case. The operation field includes view, edit, and delete operations. "View" is used to view the specific information of each composite use case, such as the specific information of the message body. "Edit" is used to edit the composite use case, such as adding, modifying, or deleting the message use cases contained in the composite use case. "Delete" is used to delete the composite use case from the composite use case library. The composite use case library page also includes a query button and a reset button for users to query the corresponding composite use case based on the message topic and the associated topic, so as to facilitate users to find use cases.
[0065] Step 15: Send the composite use case to the distributed processing platform.
[0066] In some embodiments, the distributed processing platform includes a Kafka platform. The Kafka platform is a platform that can process real-time data streams. After the production end sends a message to the Kafka platform, different consumer ends can call the message from the Kafka platform to trigger different business logics.
[0067] The composite use case is sent to the distributed processing platform, and other applications can call the composite use case from the distributed processing platform as needed.
[0068] Step 16: Test the test scenario represented by the composite use case.
[0069] After the composite use case is sent to the distributed processing platform, the consumer side receives the composite use case from the distributed processing platform according to demand, and performs corresponding functional tests on the test scenarios represented by the composite use case.
[0070] In some embodiments, step 16 includes: pulling a composite use case from the Kafka platform; triggering a preset business logic for a test scenario represented by the composite use case; and verifying the business logic.
[0071] For example, the composite use case is the C message mentioned above. The test scenario represented by the C message is: the vehicle is in a fatigued state and a collision event may occur. After the vehicle's alarm controller receives the C message from the Kafka platform, it triggers the alarm mechanism of the vehicle in a fatigued state and a collision event may occur, so as to verify whether the alarm mechanism is correct and test the alarm function of the vehicle. Other applications of the vehicle can also receive C messages from the Kafka platform to test other functions of the vehicle in this scenario. Composite use cases can be used multiple times to improve work efficiency.
[0072] In some embodiments, by inputting data on the combination page, multiple message use cases can be conveniently combined into a composite use case to meet the needs of complex scenarios, thereby reducing workload and improving work efficiency.
[0073] In some embodiments, step 15 includes: sending each alternative use case to the Kafka platform in sequence; step 16 includes: pulling each alternative use case from the Kafka platform, and testing the test scenarios represented by each alternative use case in sequence.
[0074] Take the A message, B message, and C message mentioned above as an example. If the user enters the identifiers of the A message and the B message in sequence on the combination page, the test scenario of the C message is the test scenario in which the A message and the B message occur in sequence. The consumer side pulls the C message from the Kafka platform and tests the scenario in which the vehicle is first in a fatigue state and then a collision occurs. If the user enters the identifiers of the B message and the A message in sequence on the combination page, the test scenario of the C message is the test scenario in which the B message and the A message occur in sequence. The consumer side pulls the C message from the Kafka platform and tests the scenario in which the vehicle first has a collision event and then is in a fatigue state.
[0075] In some embodiments, the testing method 10 also includes: receiving the interval time of each alternative use case entered by the user in the combination page; step 15 includes: sending each alternative use case to the Kafka platform in sequence according to the interval time; step 16 includes: pulling each alternative use case from the Kafka platform, and testing the test scenarios represented by each alternative use case according to the test scenarios that occur in sequence according to the interval time.
[0076] refer to Figure 2 , the combination page also includes an interval time field for the user to enter the interval time for sending each alternative use case. The specific interval time between each alternative use case can be the same or different. The user can enter an interval time in the interval time field to indicate that each alternative use case follows the interval time, or specify the interval time between two alternative fields. After the user sets the interval time, each alternative use case is sent to the Kafka platform in sequence according to the interval time and the order of the message use cases entered in the combination use case field. Take the A message, B message, and C message mentioned above as an example. If the user enters the identifiers of the A message and the B message in the combination page in sequence, the interval time is 5S. When sending a composite use case, the A message is sent first, and then the B message is sent after 5S. The consumer end pulls the C message from the Kafka platform. The test scenario of the C message is: the vehicle is first in a fatigue state, and after 5S, the vehicle has a collision event, and the vehicle is tested for this scenario.
[0077] In some embodiments, step 15 includes: sending each alternative use case to the Kafka platform at the same time; step 16 includes: pulling each alternative use case from the Kafka platform, and testing the test scenarios represented by each alternative use case that occur simultaneously.
[0078] Take the A, B, and C messages mentioned above as an example. If the user enters the identifiers of the A and B messages on the combination page and limits the simultaneous sending of the A and B messages, the test scenario of the C message is the test scenario where the A and B messages occur simultaneously. The consumer side pulls the C message from the Kafka platform and tests the scenario where the vehicle is in a fatigue state and a collision event occurs at the same time.
[0079] In some embodiments, the test method 10 also includes: receiving the number of times each alternative use case is sent entered by the user in the combination page; step 15 includes: sending each alternative use case to the Kafka platform according to the number of times it is sent; step 16 includes: pulling each alternative use case from the Kafka platform, and testing the test scenarios represented by each alternative use case according to the test scenarios that occur according to the number of times it is sent.
[0080] refer to Figure 2 , the combination page also includes a sending number field for the user to enter the number of times each alternative use case is sent. The specific sending number of each alternative use case can be the same or different. The user can enter a number in the sending number field to indicate that each alternative use case follows the sending number, or can enter the sending number of each alternative use case. After the user sets the sending number, each alternative use case is sent to the Kafka platform in sequence according to the sending number and the order of the message use cases entered in the combination use case field. Take the A message, B message, and C message mentioned above as an example. If the user enters the identifiers of the A message and the B message in the combination page in sequence, the sending number is 2. When sending a composite use case, first send the A message twice, and then send the B message twice. The consumer end pulls the C message from the Kafka platform. The test scenario of the C message is: the vehicle has two fatigue events, and then the vehicle has two collision events. The vehicle is tested for this scenario.
[0081] In some embodiments, the test method 10 also includes: receiving the sending time of each alternative use case entered by the user in the combination page; step 15 includes: sending each alternative use case to the Kafka platform according to the sending time; step 16 includes: pulling each alternative use case from the Kafka platform, and testing the test scenario represented by each alternative use case according to the test scenario occurring at the sending time.
[0082] refer to Figure 2, the combination page also includes a sending time field for the user to enter the time when each alternative use case is sent. Specifically, the sending time of each alternative use case can be the same or different. The user can enter a time in the sending time field to indicate that each alternative use case follows the sending time, or can enter the sending time of each alternative use case. After the user sets the sending time, each alternative use case is sent to the Kafka platform in sequence according to the sending time and the order of the message use cases entered in the combination use case field. Take the A message, B message, and C message mentioned above as an example. If the user enters the identifiers of the A message and the B message in the combination page in sequence, and the sending time of the A message is 8:00, and the sending time of the B message is 9:00. When sending the composite use case, the A message is sent at 8:00 and the B message is sent at 9:00. The consumer end pulls the C message from the Kafka platform. The test scenario of the C message is: the vehicle is fatigued at 8:00, and then the vehicle has a collision event at 9:00. The vehicle is tested for this scenario. Scheduled delivery of composite use cases can be achieved through the Flask-APScheduler extension class.
[0083] In some embodiments, after step 16, the test method 10 further includes: saving the message sending record to a sending log, so that the sending result can be easily queried.
[0084] In some embodiments, a method for generating a message use case library includes: displaying a data collection template; receiving multiple message use cases input by a user in the data collection template; and batch processing multiple message use cases to form a message use case library.
[0085] Figure 4 Shown is a schematic diagram of an embodiment of a data collection template of the present application.
[0086] exist Figure 4 In the illustrated embodiment, the data collection template includes a message ID field, a message topic field, a message type field, a message body field, and a custom parameter field.
[0087] The message ID field is used to enter the message identifier to distinguish each message use case. The message topic field is used to enter the topic to which the message belongs. The message type field is used to enter the type of the message. In the same topic, multiple message types can be included. The message body field is used to enter the specific content of the message. The custom parameter field is used to enter the custom parameters of the message.
[0088] In some embodiments, a method for generating a message use case library includes: generating an identifier of the message use case based on a message ID field; classifying the message use case into the topic to which it belongs based on a message topic field; generating a message body of the message use case based on a message body field; and batch processing the message use cases input into a data collection template to form a message use case library.
[0089] In some embodiments, the data collection template includes a visualization page. The user enters corresponding content in a corresponding field of the visualization page to maintain the message use case.
[0090] In some embodiments, the data collection template includes a file in CSV format or XLS format. The file in CSV format or XLS format is convenient for batch processing and quickly forms a message case library.
[0091] In some embodiments, batch processing of message use cases inputted into the data collection template forms a message use case library, including: traversing the fields of the data collection template; traversing the row data and column data of the data collection template; and inserting the row data and column data into corresponding positions of the message use case library according to the fields.
[0092] In some embodiments, Python can be used to batch process the data of the data collection template. The openpyxl library is used to traverse the fields of the data collection template file, the fields are processed for data integration, and the integrated data is spliced with mysql statements and inserted into the database table of the message use case library in a loop.
[0093] Figure 5 Shown is a structural block diagram of an embodiment of the test system of the present application.
[0094] like Figure 5 As shown, the test system includes one or more processors 21 for implementing the vehicle test method 10 as described above.
[0095] In some embodiments, the test system may include a computer-readable storage medium 22, which may store a program that can be called by the processor 21 and may include a non-volatile storage medium. In some embodiments, the test system may include a memory 23 and an interface 24. In some embodiments, the test system may also include other hardware according to actual applications.
[0096] The test system of the present application can be developed using the Flask+Vue framework. The front-end and back-end of the test system are separated. The front-end page includes a combination page, a data collection template, etc., and the back-end system includes an add, delete, modify, and query interface for composite use cases.
[0097] The computer-readable storage medium 22 of the embodiment of the present application stores a program thereon, and when the program is executed by the processor 21, it is used to implement the vehicle testing method 10 described above.
[0098] The present application may take the form of a computer program product implemented on one or more computer-readable storage media 22 (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. The computer-readable storage medium 22 includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be a computer-readable instruction, a data structure, a module of a program, or other data. Examples of computer-readable storage media 22 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, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassette, tape disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
Claims
1. A vehicle testing method, It is characterized in that include: Based on a message use case library, displaying a combination page; the message use case library includes a plurality of message use cases representing test scenarios of the vehicle; Receiving identifiers of multiple message use cases input by a user in the combination page; According to each identifier, searching the message use case corresponding to each identifier in the message use case library as an alternative use case; Combine alternative use cases into composite use cases; sending the composite use case to a distributed processing platform; The test scenario represented by the composite use case is tested.
2. The vehicle testing method according to claim 1, It is characterized in that The distributed processing platform includes a Kafka platform, and sending the composite use case to the distributed processing platform includes: sending each candidate use case to the Kafka platform in sequence; The testing of the test scenario represented by the composite use case includes: pulling each alternative use case from the kafka platform, and testing the test scenarios represented by each alternative use case in sequence.
3. The vehicle testing method according to claim 2, It is characterized in that The test method also includes: receiving the interval time of each alternative use case input by the user in the combination page; The sending the composite use case to the distributed processing platform includes: sending each candidate use case to the kafka platform in sequence according to the interval time; The testing of the test scenario represented by the composite use case includes: Pull each candidate use case from the kafka platform, and test the test scenario represented by each candidate use case according to the test scenario that occurs sequentially at the interval time.
4. The vehicle testing method according to claim 1, It is characterized in that The distributed processing platform includes a Kafka platform, and sending the composite use case to the distributed processing platform includes: sending each candidate use case to the Kafka platform at the same time; The testing of the test scenario represented by the composite use case includes: pulling each alternative use case from the kafka platform, and testing the test scenario in which the test scenarios represented by each alternative use case occur simultaneously.
5. The vehicle testing method according to claim 1, It is characterized in that The distributed processing platform includes a Kafka platform, and the testing method further includes: receiving the sending times of each alternative use case input by the user in the combination page; The sending of the composite use case to the distributed processing platform includes: sending each candidate use case to the Kafka platform according to the sending times; The testing of the test scenario represented by the composite use case includes: Pull each alternative use case from the kafka platform, and test the test scenario represented by each alternative use case according to the test scenario occurring at the number of sending times.
6. The vehicle testing method according to claim 1, It is characterized in that The distributed processing platform includes a Kafka platform, and the testing method further includes: receiving a sending time of each alternative use case input by a user in the combination page; The sending of the composite use case to the distributed processing platform includes: sending each candidate use case to the kafka platform according to the sending time; The testing of the test scenario represented by the composite use case includes: Pull each candidate use case from the kafka platform, and test the test scenario represented by each candidate use case according to the test scenario occurring at the sending time.
7. The vehicle testing method according to claim 1, It is characterized in that The distributed processing platform includes a Kafka platform, and the testing of the test scenario represented by the composite use case includes: Pull the composite use case from the kafka platform; Triggering preset business logic for the test scenario represented by the composite use case; Verify the business logic.
8. The vehicle testing method according to claim 1, It is characterized in that The method for generating the message use case library includes: Presentation of data collection template; receiving a plurality of message use cases input by a user in the data collection template; The multiple message use cases are batch processed to form the message use case library.
9. The vehicle testing method according to claim 8, It is characterized in that The data collection template includes a file in CSV format or XLS format.
10. A computer-readable storage medium, It is characterized in that A program is stored thereon, and when the program is executed by a processor, the vehicle testing method according to any one of claims 1 to 9 is implemented.
