Vehicle automatic test method, device and equipment and storage medium
Through the automatic testing method, the problems of low efficiency and high cost of vehicle gateway testing are solved, efficient and reliable testing of real vehicles are achieved, and the testing efficiency and effect are improved.
Patent Information
- Application Number
- CN202411372250.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2024-12-27
AI Technical Summary
The prior art is inefficient and costly in vehicle gateway testing, and it is impossible to effectively conduct actual vehicle testing, resulting in unsatisfactory testing.
Provides an automatic vehicle testing method, by determining the target network segment and message cycle types, monitoring the message and obtaining count values, comparing non-zero values, if consistent, it is determined that the test passes, without building a complex platform, and using algorithm logic to detect communication Line, realize the real test of the real vehicle.
It improves testing efficiency, reduces costs, ensures high efficiency and reliability of testing, and is suitable for real-vehicle communication testing.
Smart Images

Figure CN119199333A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle testing technology, and in particular to a vehicle automatic testing method, device, equipment and storage medium. Background Art
[0002] At present, with the development of vehicle technology, there are more and more intelligent components in vehicles. The communication between various components may be carried out in different network segments. Once the communication is disordered, it will affect the operation of the vehicle. Therefore, it is very important to test the gateway that controls each network segment in the vehicle.
[0003] Automobile testing is generally carried out on a hardware-in-the-loop (HIL) bench test. The bench test scheme is relatively rigid, with poor inter-platform compatibility and high cost, and is basically not suitable for real vehicle testing. However, gateway testing requires testing on a real vehicle to achieve better results. Therefore, the current testing of vehicle gateways is generally performed manually, which has low overall efficiency, high cost, and unsatisfactory actual test results. Summary of the invention
[0004] The main purpose of the present invention is to provide a vehicle automatic testing method, device, equipment and storage medium, aiming to solve the technical problem that the test effect of gateway testing on real vehicles in the prior art is not ideal.
[0005] To achieve the above object, the present invention provides a vehicle automatic testing method, the method comprising the following steps:
[0006] Determine multiple target network segments and message cycle types according to the test configuration to be executed, wherein the target network segment is a communication network segment used when the vehicle is actually running, and the target network segment includes a message sending network segment and at least one message receiving network segment;
[0007] If the message period type is a cyclic type, the messages in each target network segment are monitored for a preset time period;
[0008] At the end of monitoring, the message count value corresponding to each target network segment is obtained, and the message count value is used to represent the number of messages appearing in the target network segment during the monitoring process;
[0009] If the sum of the message count values corresponding to each target network segment is not 0, then comparing the non-zero values in the message count values;
[0010] If the non-zero values in the message count values are all consistent, the test is determined to be passed.
[0011] Optionally, after obtaining the message count value corresponding to each target network segment at the end of monitoring, the method further includes:
[0012] If the sum of the message count values corresponding to each target network segment is 0, the message information is determined according to the test configuration to be executed;
[0013] Sending a simulated message in the message sending network segment based on the message information, and detecting whether the simulated message appears in all the message receiving network segments;
[0014] If the simulated message appears in each message receiving network segment, the test is determined to be passed.
[0015] Optionally, sending the simulated message in the message sending network segment based on the message information, and detecting whether the simulated message appears in all the message receiving network segments, includes:
[0016] Obtain the network segment flag corresponding to the network segment where the message is sent;
[0017] Determine the protocol type and the message sending method according to the network segment flag bit;
[0018] Generate a simulation message according to the message information and the protocol type;
[0019] The simulated message is sent in the message sending network segment based on the message sending mode, and it is detected whether the simulated message appears in all the message receiving network segments.
[0020] Optionally, the generating a simulation message according to the message information and the protocol type includes:
[0021] Extracting a message number from the message information;
[0022] Compare the message number with a preset number threshold to determine the message type, where the message type includes a standard frame type and an extended frame type;
[0023] A simulation message is generated according to the message type, the message information and the protocol type.
[0024] Optionally, if the non-zero values in the message count values are all consistent, determining that the test passes includes:
[0025] If the non-zero values in the message count values are all consistent, then the appearance time of each message in each target network segment is obtained;
[0026] Calculate the sum of the appearance times of the messages in each target network segment respectively, and obtain the sum of the appearance times corresponding to each target network segment;
[0027] Determine the average message time corresponding to each target network segment according to the sum of the appearance time corresponding to each target network segment and the message count value;
[0028] The target network segment with the smallest corresponding message time average value is used as the network segment to be detected;
[0029] If the network segment to be detected is a message sending network segment, the test is determined to be passed.
[0030] Optionally, after determining multiple target network segments and message cycle types according to the test configuration to be executed, the method further includes:
[0031] If the message period type is an event type, determining the message information according to the test configuration to be executed;
[0032] Sending a simulated message in the message sending network segment based on the message information, and detecting whether the simulated message appears in all the message receiving network segments;
[0033] If the simulated message appears in each message receiving network segment, the test is determined to be passed.
[0034] Optionally, determining multiple target network segments and message cycle types according to the test configuration to be executed includes:
[0035] Read data in the test file to be executed to obtain at least one test configuration string;
[0036] Each test configuration character string is segmented according to a preset separator to obtain at least one test configuration data;
[0037] Traversing the at least one test configuration data, and using the traversed test configuration data as the test configuration to be executed;
[0038] If the non-zero values in the message count values are all consistent, after determining that the test is passed, the method further includes:
[0039] Detect whether there is any test configuration data that has not been traversed. If so, return to the step of traversing the at least one test configuration data and using the traversed test configuration data as the test configuration to be executed.
[0040] In addition, to achieve the above-mentioned purpose, the present invention also provides a vehicle automatic testing device, the vehicle automatic testing device comprising:
[0041] A determination module, used to determine multiple target network segments and message cycle types according to the test configuration to be executed, wherein the target network segment is a communication network segment used when the vehicle is actually running, and the target network segment includes a message sending network segment and at least one message receiving network segment;
[0042] A monitoring module, for monitoring the messages in each target network segment for a preset time period if the message period type is a cyclic type;
[0043] A counting module, used to obtain the message count value corresponding to each target network segment at the end of monitoring, wherein the message count value is used to characterize the number of messages appearing in the target network segment during the monitoring process;
[0044] A comparison module, configured to compare non-zero values in the message count values if the sum of the message count values corresponding to the target network segments is not zero;
[0045] The determination module is used to determine that the test is passed if the non-zero values in the message count values are all consistent.
[0046] In addition, to achieve the above-mentioned purpose, the present invention also proposes a vehicle automatic testing device, which includes: a processor, a memory, and a vehicle automatic testing program stored in the memory and executable on the processor, and the vehicle automatic testing program, when executed by the processor, implements the steps of the vehicle automatic testing method as described above.
[0047] In addition, to achieve the above-mentioned purpose, the present invention also proposes a computer-readable storage medium, on which a vehicle automatic test program is stored, and when the vehicle automatic test program is executed, the steps of the vehicle automatic test method described above are implemented.
[0048] The present invention determines multiple target network segments and message cycle types according to the test configuration to be executed; if the message cycle type is a cyclic type, the messages in each target network segment are monitored for a preset time; at the end of the monitoring, the message count values corresponding to each target network segment are obtained; if the sum of the message count values corresponding to each target network segment is not 0, the non-zero values in the message count values are compared; if the non-zero values in the message count values are consistent, the test is determined to be passed. Since the test process is detected through various algorithm logics, it is ensured that there is no need to build a complex test bench, the communication line design is efficient and reliable, and the test can be performed normally for the real state of the real vehicle. Compared with the existing method of manually testing the real vehicle communication, the test efficiency is greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a schematic diagram of the structure of an electronic device in a hardware operating environment involved in an embodiment of the present invention;
[0050] Figure 2 A schematic diagram of a flow chart of a first embodiment of a vehicle automatic testing method of the present invention;
[0051] Figure 3 A schematic diagram of the file structure of a test file to be executed according to an embodiment of the present invention;
[0052] Figure 4 A schematic diagram of a flow chart of a second embodiment of a vehicle automatic testing method of the present invention;
[0053] Figure 5 It is a structural block diagram of the first embodiment of the vehicle automatic testing device of the present invention.
[0054] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0055] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0056] Reference Figure 1 , Figure 1 The figure is a schematic diagram of the structure of the vehicle automatic test equipment in the hardware operating environment involved in the embodiment of the present invention.
[0057] like Figure 1 As shown, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0058] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0059] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a vehicle automatic test program.
[0060] exist Figure 1In the electronic device shown, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the electronic device of the present invention can be set in a vehicle automatic testing device, and the electronic device calls the vehicle automatic testing program stored in the memory 1005 through the processor 1001, and executes the vehicle automatic testing method provided in an embodiment of the present invention.
[0061] The embodiment of the present invention provides a vehicle automatic testing method, referring to Figure 2 , Figure 2 The figure is a flow chart of a first embodiment of a vehicle automatic testing method according to the present invention.
[0062] In this embodiment, the vehicle automatic testing method includes the following steps:
[0063] Step S10: Determine multiple target network segments and message cycle types according to the test configuration to be executed.
[0064] It should be noted that the executor of this embodiment may be the vehicle automatic testing equipment, and the vehicle automatic testing equipment may be an electronic device that can be connected to the vehicle for testing the vehicle, such as a smart computer, a server, etc., or a controller arranged in the vehicle, such as an ECU controller, or other devices that can achieve the same or similar functions. In this embodiment and the following embodiments, the vehicle automatic testing equipment is taken as an example to illustrate the vehicle automatic testing method of the present invention.
[0065] It should be noted that the test configuration to be executed may include message information, target network segment, etc.; the message information may include message number, message cycle type, message sending cycle, message data length code (Data Length Code, DLC) and other information.
[0066] Among them, the message cycle type can be divided into two categories: cycle type and event type. The target network segment is the communication network segment used by the vehicle during actual operation, such as BD2CAN, BD1CAN, PTCAN, CHACAN, etc. The target network segment includes a message sending network segment and at least one message receiving network segment, wherein the message sending network segment is a network segment configured to send messages in the communication network segment used by the vehicle; the message receiving network segment can be a network segment configured to receive messages in the communication network segment used by the vehicle. In addition, the target network segment can also include a blank network segment, that is, a network segment that is neither configured to receive messages nor configured to receive messages.
[0067] In actual use, the test configuration to be executed can be parsed to determine the network segment involved in the current test, that is, the target network segment, and the message number and message period type of the test message.
[0068] Step S20: If the message period type is a cyclic type, the messages in each target network segment are monitored for a preset time period.
[0069] In actual use, if the message cycle type is a cyclic type, it means that the vehicle will periodically use the network segment to transmit specific messages. At this time, the messages in each target network segment can be monitored and continued for a preset time.
[0070] The preset time length may be set in advance by a manager of the vehicle automatic test equipment, such as setting the preset time length to 10S.
[0071] Step S30: When monitoring is finished, the message count value corresponding to each target network segment is obtained.
[0072] It should be noted that the message count value is used to represent the number of messages appearing in the target network segment during the monitoring process.
[0073] In actual use, each target network segment corresponds to a message count value. During the monitoring process, if a specific message is detected in a target network segment (such as a message with the same message number as the test message), the message count value corresponding to the target network segment will be increased by one. After the monitoring is completed, the message count value corresponding to the target network segment can be used to represent the number of messages that appeared in the target network segment during the monitoring process.
[0074] Step S40: If the sum of the message count values corresponding to the target network segments is not 0, then compare the non-zero values in the message count values.
[0075] It should be noted that if the sum of the message count values corresponding to each target network segment is not 0, it means that for this type of cyclic message, at least one specific message appears in the target network segment. At this time, it is necessary to continue to detect whether the number of sends and receives of each network is consistent. At this time, the non-zero value in the message count value can be compared.
[0076] Before comparing the non-zero values in the message count value, it is also possible to first detect whether the message count values corresponding to the message sending network segment and the message receiving network segment are both non-zero values. If the message count value corresponding to any message sending network segment or message receiving network segment is 0, it can be determined that the test fails.
[0077] At the same time, if the message count value corresponding to any blank network segment in the target network segment is non-zero, it means that a specific message appears in the network segment that should not receive or send the specific message at this time, and the test can also be judged as failed at this time;
[0078] If the message count values corresponding to the message sending network segment and the message receiving network segment are both non-zero values, the non-zero values in the message count values may be further compared.
[0079] Step S50: If the non-zero values in the message count values are all consistent, it is determined that the test has passed.
[0080] It should be noted that if the non-zero values in the message count values are all consistent, it means that the number of specific messages appearing in each message sending segment and message receiving segment is consistent at this time, so it can be determined that the test has passed;
[0081] If the non-zero values in the message count values are not all consistent, it means that the number of specific messages appearing in a message sending segment or a message receiving segment in the target network segment is more or less than the number of specific messages appearing in other message sending segments or message receiving segments. At this time, it can be determined that the sent and received messages are inconsistent, and therefore, the test can be determined to have failed.
[0082] Specifically, in order to quickly and accurately determine whether the non-zero values in the message count values are all consistent, the message count values corresponding to each target network segment can be traversed to obtain the first non-zero value (at this time, it is also possible to detect whether the first non-zero value is the last message count value. If so, no subsequent actions are performed, and the test is directly judged to have failed; if it is not the last message count value, the traversal continues), and then the traversal continues, and the traversed non-zero value is compared with the first non-zero value. If any non-zero value inconsistent with the first non-zero value is traversed, the traversal can be terminated and the test is judged to have failed (that is, the test is NG).
[0083] In a specific implementation, in order to ensure that it is possible to further determine whether the message is sent from the message sending network segment, step S50 in this embodiment may include:
[0084] If the non-zero values in the message count values are all consistent, then the appearance time of each message in each target network segment is obtained;
[0085] Calculate the sum of the appearance times of the messages in each target network segment respectively, and obtain the sum of the appearance times corresponding to each target network segment;
[0086] Determine the average message time corresponding to each target network segment according to the sum of the appearance time corresponding to each target network segment and the message count value;
[0087] The target network segment with the smallest corresponding message time average value is used as the network segment to be detected;
[0088] If the network segment to be detected is a message sending network segment, the test is determined to be passed.
[0089] It should be noted that the appearance time of each message is the time when the message can be detected in the target network segment.
[0090] In actual use, the appearance time of each message in the target network segment can be added, and the sum obtained can be used as the sum of the appearance times corresponding to the target network segment. Calculation can be performed for each target network segment separately to obtain the sum of the appearance times corresponding to each target network segment.
[0091] In actual application, the sum of the appearance times corresponding to the target network segment can be divided by the message count value to obtain the average message time corresponding to the target network segment. The average message time corresponding to each target network segment can be obtained by performing calculations for each target network segment.
[0092] It should be noted that because there will be a certain delay (such as 1ms delay) in the process of the hybrid gateway forwarding the message from the message sending network segment to other target network segments, the corresponding target network segment with the smallest average message time value should be the source network segment of the message, that is, the network segment that sends the message. Therefore, the target network segment with the smallest corresponding average message time value can be used as the network segment to be detected.
[0093] It can be understood that if the network segment to be tested is the message sending network segment, it means that the message is correctly sent from the message sending network segment and forwarded to other target network segments. Therefore, it can be determined that the test has passed;
[0094] If the network segment to be detected is not the network segment for sending messages, it means that the source network segment of the message determined based on the monitored data is not the network segment for sending messages, that is, the monitored message is not sent from the network segment for sending messages. Therefore, it can be determined that the test fails.
[0095] In a specific implementation, in order to ensure that the automatic test can be executed in batches, before step S10 in this embodiment, the following steps may be included:
[0096] Read data in the test file to be executed to obtain at least one test configuration string;
[0097] Each test configuration character string is segmented according to a preset separator to obtain at least one test configuration data;
[0098] Traversing the at least one test configuration data, and using the traversed test configuration data as the test configuration to be executed;
[0099] Correspondingly, after step S50, the following steps may also be included:
[0100] Detect whether there is any test configuration data that has not been traversed. If so, return to the step of traversing the at least one test configuration data and using the traversed test configuration data as the test configuration to be executed.
[0101] It should be noted that the test file to be executed can be a CSV file or an EXCEL file, or other files of similar formats. When the vehicle automatic test equipment reads data from the test file to be executed, it will splice the data in each column of a row of data using a preset delimiter, so as to read one row of data as a test configuration string, thereby obtaining at least one test configuration string. Among them, the preset delimiter can be pre-set by the administrator of the vehicle automatic test equipment, for example: "," is used as the preset delimiter.
[0102] After obtaining the test configuration character string, the vehicle automatic test equipment may segment each test configuration character string according to a preset separator, thereby obtaining at least one test configuration data, wherein one test configuration character string may correspond to one test configuration data.
[0103] For example, if the test configuration string is "ms1,Cycle,100,8,,,,T,,R,R,R," then it can be split with "," to split into usable string data "ms1" "Cycle" "100" "8" "space" "space" "space" "space" "space" "T" "R", among which the space between the two commas "R" and "R" also needs to be split out. The usable string data obtained at this time is a test configuration data.
[0104] Or, get the index of each position of the string "ms1,Cycle,100,8,,,,T,,R,R,R," because the position index of each "," has been confirmed, and the string or "space" between two "," can be intercepted by the character index. The implementation code can be as follows:
[0105]
[0106] It can be understood that after acquiring at least one test configuration data, the at least one test configuration data can be traversed, and the traversed test configuration data can be used as the test configuration to be executed.
[0107] After step S50, it is also possible to detect whether there is any test configuration data that has not been traversed. If so, the step of returning to traverse the at least one test configuration data and using the traversed test configuration data as the test configuration to be executed;
[0108] If it does not exist, the traversal of at least one test configuration data is terminated, and the obtained test results are displayed.
[0109] The traversal of at least one test configuration data may be performed using traversal methods such as forward order traversal and reverse order traversal. Of course, other traversal methods may also be used, which is not limited in this embodiment.
[0110] For ease of understanding, now combined Figure 3 This is for illustration only, but not for limitation. Figure 3 Schematic diagram of the file structure of the test file to be executed in this embodiment.
[0111] like Figure 3 As shown, the test file to be executed can be a CSV file or an EXCEL file, which contains multiple fields, and the AD fields are respectively information such as the message number (ID), the message cycle type (Type), the message sending cycle (Period), the message data length code (DLC), and the segment identifier (T, R or empty) corresponding to each target segment (segment 1-segment 8), wherein, if the segment identifier is T, it means that the target segment is a message sending segment, if the segment identifier is R, it means that the target segment is a message receiving segment, and if the segment identifier is empty "", it means that the target segment is a blank segment.
[0112] This embodiment determines multiple target network segments and message cycle types according to the test configuration to be executed; if the message cycle type is a cyclic type, the messages in each target network segment are monitored for a preset time; at the end of the monitoring, the message count values corresponding to each target network segment are obtained; if the sum of the message count values corresponding to each target network segment is not 0, the non-zero values in the message count values are compared; if the non-zero values in the message count values are consistent, the test is determined to be passed. During the test, various algorithm logics are used for detection, ensuring that there is no need to build a complex test bench, the communication line design is efficient and reliable, and the test can be performed normally under the actual state of the real vehicle. Compared with the existing manual test method of real vehicle communication, the test efficiency is greatly improved.
[0113] refer to Figure 4 , Figure 4 The figure is a flow chart of a second embodiment of a vehicle automatic testing method according to the present invention.
[0114] Based on the first embodiment, the vehicle automatic testing method of this embodiment further includes, after step S30:
[0115] Step S40': if the sum of the message count values corresponding to each target network segment is 0, the message information is determined according to the test configuration to be executed.
[0116] It should be noted that if the sum of the message count values corresponding to each target network segment is 0, it means that for this type of cyclic message, there is no specific message on any route in the target network segment. This may be due to some abnormal functions in the vehicle or some functions are not turned on, resulting in the message not being sent. At this time, in order to ensure that the test can continue, it is necessary to actively send a simulated message to ensure that subsequent tests can proceed normally. In order to send a simulated message, the message information can be read from the test configuration to be executed.
[0117] Step S50': sending a simulated message in the message sending network segment based on the message information, and detecting whether the simulated message appears in all the message receiving network segments.
[0118] In actual use, a simulated message that is consistent with the message format and content that the actual vehicle should theoretically send can be constructed based on the message information, and the constructed simulated message can be sent in the message sending network segment. At this time, theoretically, this simulated message should appear in each message receiving network segment. In order to confirm whether the test passes, while sending a simulated message in the message sending network segment, it can be detected whether the simulated message appears in all message receiving network segments.
[0119] Step S60': if the simulated message appears in each message receiving network segment, it is determined that the test is passed.
[0120] It can be understood that if the simulated message appears in each message receiving network segment, it means that the message forwarding and message response can be carried out normally at this time, so it can be determined that the test has passed.
[0121] If no simulated message appears in any message receiving network segment, it means that there is a problem with the forwarding or response of the message at this time. Therefore, it can be determined that the test fails.
[0122] In a specific implementation, in order to ensure that the test can still be performed normally for the case of a mixed protocol, step S50' in this embodiment may include:
[0123] Obtain the network segment flag corresponding to the network segment where the message is sent;
[0124] Determine the protocol type and the message sending method according to the network segment flag bit;
[0125] Generate a simulation message according to the message information and the protocol type;
[0126] The simulated message is sent in the message sending network segment based on the message sending mode, and it is detected whether the simulated message appears in all the message receiving network segments.
[0127] It should be noted that multiple network segments in a vehicle may actually use different protocols. For example, some network segments use the CAN protocol, while others use the CANFD protocol. Different protocols may have different message formats, contents, and encoding methods.
[0128] In actual use, each target network segment can correspond to a network segment flag bit, and the network segment flag bit is used to ensure the protocol type used by the network segment. For example: if the flag bit corresponding to network segment A is 0, it means that the protocol type used is the CAN protocol; if the flag bit corresponding to network segment A is 1, it means that the protocol type used is the CANFD protocol.
[0129] The above examples are for illustration only and do not mean that there are only two protocols. There may be more protocols, and different flag bit values correspond to different protocol types.
[0130] In actual application, the vehicle automatic test equipment may be pre-set with a variety of message sending modes and message building modes of different protocol types, wherein the message sending mode may be a function that should be called when the message is sent, and the message building mode may be a function that should be called when the message is built.
[0131] In actual use, you can find the message construction method corresponding to the protocol type, build a simulated message based on the message information and the message construction method, and then send the simulated message in the message sending segment through the function recorded in the message sending method. At the same time, check whether the simulated message appears in the message receiving segment.
[0132] In a specific implementation, in order to ensure that the simulation message can be correctly generated, the step of generating the simulation message according to the message information and the protocol type in this embodiment may include:
[0133] Extracting a message number from the message information;
[0134] Compare the message number with a preset number threshold to determine the message type;
[0135] A simulation message is generated according to the message type, the message information and the protocol type.
[0136] It should be noted that the simulation message can be divided into a variety of different message types, and the message type can at least include a standard frame type and an extended frame type. The generation methods of messages of the same protocol type but different message types are also different.
[0137] In actual use, message types can be distinguished by message numbers, and the preset number threshold can be pre-set by the manager of the vehicle automatic test equipment. For example: assuming that the message type includes two types: standard frame type and extended frame type, the preset number threshold is ms1. If the message number is less than ms8, the message type can be determined to be a standard frame type; if the message number is greater than or equal to ms8, the message type can be determined to be an extended frame type.
[0138] Among them, when comparing the sizes of message numbers, only the numerical part of the message numbers can be compared. For example, when comparing ms1 and ms8, the sizes of 1 and 8 are actually compared. The above examples are only illustrative for easy understanding and do not limit the specific message types and the format of the message numbers. According to actual needs, more message types and message formats can also be included, which is not limited in this embodiment.
[0139] In actual use, the corresponding message construction method can be found according to the message type and protocol type, and the function corresponding to the message construction method is called to construct a simulation message according to the message information.
[0140] In a specific implementation, in order to ensure that messages of event type can also be tested normally, after step S10 in this embodiment, the following may also be included:
[0141] If the message period type is an event type, determining the message information according to the test configuration to be executed;
[0142] Sending a simulated message in the message sending network segment based on the message information, and detecting whether the simulated message appears in all the message receiving network segments;
[0143] If the simulated message appears in each message receiving network segment, the test is determined to be passed.
[0144] It should be noted that if the message cycle type is an event type, it means that the message generally needs to trigger a specific event before it can be sent. During the test process, the event may not be triggered, that is, the specific message may not be sent immediately. At this time, simulation can be used to generate simulated messages, and testing can be performed by sending simulated messages.
[0145] Among them, the construction and sending of the simulation message can refer to the above description content, which will not be repeated here.
[0146] In this embodiment, if the sum of the message count values corresponding to each target network segment is 0, the message information is determined according to the test configuration to be executed; based on the message information, a simulated message is sent in the message sending network segment, and it is detected whether the simulated message appears in the message receiving network segment; if the simulated message appears in each message receiving network segment, the test is determined to be passed. Since the simulated message can be used to simulate the real message for testing, it is ensured that even if the vehicle is abnormal and the cyclically sent message cannot be triggered, the subsequent message forwarding process can still be triggered by the simulated message, ensuring that the vehicle gateway can be tested.
[0147] In addition, an embodiment of the present invention further proposes a storage medium, on which a vehicle automatic test program is stored. When the vehicle automatic test program is executed by a processor, the steps of the vehicle automatic test method described above are implemented.
[0148] Reference Figure 5 , Figure 5 It is a structural block diagram of the first embodiment of the vehicle automatic testing device of the present invention.
[0149] like Figure 5 As shown, the vehicle automatic testing device proposed in the embodiment of the present invention includes:
[0150] A determination module 10, configured to determine a plurality of target network segments and message cycle types according to the test configuration to be executed, wherein the target network segment is a communication network segment used when the vehicle is actually running, and the target network segment includes a message sending network segment and at least one message receiving network segment;
[0151] A monitoring module 20, configured to monitor the messages in each target network segment for a preset time period if the message period type is a cyclic type;
[0152] A counting module 30, used to obtain a message count value corresponding to each target network segment at the end of monitoring, wherein the message count value is used to characterize the number of messages appearing in the target network segment during the monitoring process;
[0153] A comparison module 40, configured to compare non-zero values in the message count values if the sum of the message count values corresponding to the target network segments is not zero;
[0154] The determination module 50 is used to determine that the test is passed if the non-zero values in the message count values are all consistent.
[0155] This embodiment determines multiple target network segments and message cycle types according to the test configuration to be executed; if the message cycle type is a cyclic type, the messages in each target network segment are monitored for a preset time; at the end of the monitoring, the message count values corresponding to each target network segment are obtained; if the sum of the message count values corresponding to each target network segment is not 0, the non-zero values in the message count values are compared; if the non-zero values in the message count values are consistent, the test is determined to be passed. During the test, various algorithm logics are used for detection, ensuring that there is no need to build a complex test bench, the communication line design is efficient and reliable, and the test can be performed normally under the actual state of the real vehicle. Compared with the existing manual test method of real vehicle communication, the test efficiency is greatly improved.
[0156] Furthermore, the comparison module 40 is also used to determine the message information according to the test configuration to be executed if the sum of the message count values corresponding to each target network segment is 0; send a simulated message in the message sending network segment based on the message information, and detect whether the simulated message appears in all the message receiving network segments; if the simulated message appears in all the message receiving network segments, the test is determined to have passed.
[0157] Furthermore, the comparison module 40 is also used to obtain the network segment flag corresponding to the message sending network segment; determine the protocol type and the message sending method according to the network segment flag; generate a simulation message according to the message information and the protocol type; send the simulation message in the message sending network segment based on the message sending method, and detect whether the simulation message appears in the message receiving network segment.
[0158] Furthermore, the comparison module 40 is also used to extract a message number from the message information; compare the message number with a preset number threshold to determine the message type, the message type including a standard frame type and an extended frame type; and generate a simulation message based on the message type, the message information and the protocol type.
[0159] Furthermore, the determination module 50 is also used to obtain the appearance time of each message in each target network segment if the non-zero values in the message count values are all consistent; calculate the sum of the appearance time of the messages in each target network segment respectively to obtain the sum of the appearance time corresponding to each target network segment; determine the average message time value corresponding to each target network segment according to the sum of the appearance time corresponding to each target network segment and the message count value; use the target network segment with the smallest corresponding message time average value as the network segment to be detected; if the network segment to be detected is the message sending network segment, the test is determined to be passed.
[0160] Furthermore, the monitoring module 20 is also used to determine the message information according to the test configuration to be executed if the message cycle type is an event type; send a simulated message in the message sending network segment based on the message information, and detect whether the simulated message appears in all the message receiving network segments; if the simulated message appears in all the message receiving network segments, the test is determined to have passed.
[0161] Further, the determination module 10 is also used to read the data in the test file to be executed to obtain at least one test configuration string; split each test configuration string according to a preset separator to obtain at least one test configuration data; traverse the at least one test configuration data, and use the traversed test configuration data as the test configuration to be executed;
[0162] The determination module 50 is further configured to detect whether there is any test configuration data that has not been traversed, and if so, return to the step of traversing the at least one test configuration data and using the traversed test configuration data as the test configuration to be executed.
[0163] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.
[0164] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0165] In addition, for technical details that are not described in detail in this embodiment, reference can be made to the vehicle automatic testing method provided in any embodiment of the present invention, and will not be repeated here.
[0166] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0167] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0168] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0169] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A vehicle automatic testing method, characterized in that: The vehicle automatic testing method comprises: Determine multiple target network segments and message cycle types according to the test configuration to be executed, wherein the target network segment is a communication network segment used when the vehicle is actually running, and the target network segment includes a message sending network segment and at least one message receiving network segment; If the message period type is a cyclic type, the messages in each target network segment are monitored for a preset time period; At the end of monitoring, the message count value corresponding to each target network segment is obtained, and the message count value is used to represent the number of messages appearing in the target network segment during the monitoring process; If the sum of the message count values corresponding to each target network segment is not 0, then comparing the non-zero values in the message count values; If the non-zero values in the message count values are all consistent, the test is determined to be passed.
2. The vehicle automatic testing method according to claim 1, characterized in that: After obtaining the message count value corresponding to each target network segment at the end of monitoring, the method further includes: If the sum of the message count values corresponding to each target network segment is 0, the message information is determined according to the test configuration to be executed; Sending a simulated message in the message sending network segment based on the message information, and detecting whether the simulated message appears in all the message receiving network segments; If the simulated message appears in each message receiving network segment, the test is determined to be passed.
3. The vehicle automatic testing method according to claim 2, characterized in that: The sending of the simulated message in the message sending network segment based on the message information, and detecting whether the simulated message appears in all the message receiving network segments, comprises: Obtain the network segment flag corresponding to the network segment where the message is sent; Determine the protocol type and the message sending method according to the network segment flag bit; Generate a simulation message according to the message information and the protocol type; The simulated message is sent in the message sending network segment based on the message sending mode, and it is detected whether the simulated message appears in all the message receiving network segments.
4. The vehicle automatic testing method according to claim 3, characterized in that: The generating a simulation message according to the message information and the protocol type includes: Extracting a message number from the message information; Compare the message number with a preset number threshold to determine the message type, where the message type includes a standard frame type and an extended frame type; A simulation message is generated according to the message type, the message information and the protocol type.
5. The vehicle automatic testing method according to claim 1, characterized in that: If the non-zero values in the message count values are all consistent, then the test is determined to be passed, including: If the non-zero values in the message count values are all consistent, then the appearance time of each message in each target network segment is obtained; Calculate the sum of the appearance times of the messages in each target network segment respectively, and obtain the sum of the appearance times corresponding to each target network segment; Determine the average message time corresponding to each target network segment according to the sum of the appearance time corresponding to each target network segment and the message count value; The target network segment with the smallest corresponding message time average value is used as the network segment to be detected; If the network segment to be detected is a message sending network segment, the test is determined to be passed.
6. The vehicle automatic testing method according to claim 1, characterized in that: After determining a plurality of target network segments and message cycle types according to the test configuration to be executed, the method further includes: If the message period type is an event type, determining the message information according to the test configuration to be executed; Sending a simulated message in the message sending network segment based on the message information, and detecting whether the simulated message appears in all the message receiving network segments; If the simulated message appears in each message receiving network segment, the test is determined to be passed.
7. The vehicle automatic testing method according to any one of claims 1 to 6, characterized in that: The step of determining a plurality of target network segments and message cycle types according to the test configuration to be executed includes: Read data in the test file to be executed to obtain at least one test configuration string; Each test configuration character string is segmented according to a preset separator to obtain at least one test configuration data; Traversing the at least one test configuration data, and using the traversed test configuration data as the test configuration to be executed; If the non-zero values in the message count values are all consistent, after determining that the test is passed, the method further includes: Detect whether there is any test configuration data that has not been traversed. If so, return to the step of traversing the at least one test configuration data and using the traversed test configuration data as the test configuration to be executed.
8. A vehicle automatic testing device, characterized in that: The vehicle automatic testing device comprises: A determination module, used to determine multiple target network segments and message cycle types according to the test configuration to be executed, wherein the target network segment is a communication network segment used when the vehicle is actually running, and the target network segment includes a message sending network segment and at least one message receiving network segment; A monitoring module, for monitoring the messages in each target network segment for a preset time period if the message period type is a cyclic type; A counting module, used to obtain the message count value corresponding to each target network segment at the end of monitoring, wherein the message count value is used to characterize the number of messages appearing in the target network segment during the monitoring process; A comparison module, configured to compare non-zero values in the message count values if the sum of the message count values corresponding to the target network segments is not zero; The determination module is used to determine that the test is passed if the non-zero values in the message count values are all consistent.
9. A vehicle automatic testing device, characterized in that: The vehicle automatic testing equipment comprises: a processor, a memory, and a vehicle automatic testing program stored in the memory and executable on the processor. When the vehicle automatic testing program is executed by the processor, the steps of the vehicle automatic testing method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a vehicle automatic test program, and when the vehicle automatic test program is executed, the steps of the vehicle automatic test method according to any one of claims 1 to 7 are implemented.