Disclosure of Invention
Aiming at the technical problems in the prior art, the invention provides a gateway routing data testing method and a testing system, which can save a large amount of labor and time and can ensure the quality of gateway data routing function testing.
According to a first aspect of the present invention, there is provided a gateway routing data testing method, including:
acquiring all routing messages of a project to form a message matrix, wherein the message matrix comprises the routing messages of each network segment;
according to the accessed source network segment and the target network segment which need to be tested, screening out a routing message of the source network segment and a routing message of the target network segment from the message matrix;
recording the response time of the routing message of the source network segment and the response time of the routing message of the target network segment;
judging whether the routing message of the source network segment and the routing message of the target network segment are synchronous or not based on the response time of the routing message of the source network segment and the response time of the routing message of the target network segment, if so, executing data comparison operation of the routing message of the source network segment and the routing message of the target network segment, testing the routing message of the source network segment and the routing message of the target network segment, and outputting a test result.
On the basis of the technical scheme, the invention can be improved as follows.
Optionally, the obtaining all routing messages of the project forms a message matrix, which includes:
acquiring an input project routing table, wherein the project routing table comprises routing messages of all network segments;
and forming a message matrix by using the routing messages of each network segment, wherein the message matrix comprises the corresponding relation between each network segment and the routing messages and the acquisition sequence of each routing message.
Optionally, the method further includes:
based on Canoe software, writing an automatic test program of gateway routing data by using a CAPL script;
configuring CAN/CANFD parameters of a test project under a Hardware configuration page according to corresponding source network segment information, target network segment information and Canoe Hardware information, and selecting a Canoe test Channel for a source network segment and a target network segment to be tested in Channel Mapping;
and testing the routing message of the source network segment and the routing message of the target network segment through the Canoe test channel.
Optionally, the screening, according to the accessed source network segment and the accessed target network segment to be tested, a routing packet from the source network segment and a routing packet from the target network segment from the packet matrix includes:
configuring source network segment information and target network segment information in an on message response event in the CAPL;
and screening out the routing message of the source network segment and the routing message of the target network segment from the message matrix as messages to be tested according to the configured source network segment information and target network segment information.
Optionally, the determining whether the routing packet of the source network segment and the routing packet of the target network segment are synchronous based on the response time of the routing packet of the source network segment and the response time of the routing packet of the target network segment includes:
and when the time difference between the response time of the routing message of the source network segment and the response time of the routing message of the target network segment is smaller than a first set time threshold, judging that the routing message of the source network segment is synchronous with the routing message of the target network segment, otherwise, judging that the routing message of the source network segment is asynchronous with the routing message of the target network segment.
Optionally, if the synchronization is performed, executing a data comparison operation between the routing packet of the source network segment and the packet of the target network segment, testing the routing packet of the source network segment and the packet of the target network segment, and outputting a test result, where the data comparison operation includes:
on the basis of synchronization of a routing message of a source network segment and a routing message of a target network segment, if the routing message of the source network segment is equal to the routing message of the target network segment, the routing is successful;
and if the routing message of the source network segment is not equal to the message of the target network segment, the data routing is in error.
Optionally, the determining whether the routing packet of the source network segment and the routing packet of the target network segment are synchronous based on the response time of the routing packet of the source network segment and the response time of the routing packet of the target network segment further includes:
if the routing message of the source network segment and the routing message of the target network segment are judged to be asynchronous, when the time difference value between the response time of the routing message of the source network segment and the response time of the routing message of the target network segment is greater than a first set time threshold value and smaller than a second set time threshold value, judging that the routing delay is overtime, wherein the second set time threshold value is greater than the first set time threshold value;
and when the time difference between the response time of the routing message of the source network segment and the response time of the routing message of the target network segment is greater than a second set time threshold, judging that the routing frame is missed.
According to a second aspect of the present invention, there is provided a gateway routing data testing system, comprising:
the acquisition module is used for acquiring all routing messages of the project to form a message matrix, and the message matrix comprises the routing messages of each network segment;
the screening module is used for screening out routing messages of the source network segment and routing messages of the target network segment from the message matrix according to the accessed source network segment and the target network segment which need to be tested;
the recording module is used for recording the response time of the routing message of the source network segment and the response time of the routing message of the target network segment;
the judging module is used for judging whether the routing message of the source network segment and the routing message of the target network segment are synchronous or not based on the response time of the routing message of the source network segment and the response time of the routing message of the target network segment;
and the comparison test module is used for executing the data comparison operation of the routing message of the source network segment and the target network segment message if the synchronization is realized, testing the routing message of the source network segment and the target network segment message and outputting a test result.
According to a third aspect of the present invention, there is provided an electronic device comprising a memory, a processor for implementing the steps of the gateway routing data testing method when executing a computer management class program stored in the memory.
According to a fourth aspect of the present invention, there is provided a computer readable storage medium having stored thereon a computer management class program, which when executed by a processor implements the steps of a gateway routing data testing method.
According to the gateway routing data test method and the gateway routing data test system, before the testing of the routing message of the source network segment and the routing message of the target network segment, whether the two routing messages are synchronous in terms of time efficiency is judged, and when the two routing messages are synchronous, the comparison of the data messages is executed, so that invalid comparison operation of quality inspection of message data with different time efficiencies is avoided, and the efficiency of gateway function testing is improved.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention, but are not intended to limit the scope of the invention.
Example one
A gateway routing data testing method, referring to fig. 1, the method mainly includes the following steps:
s1, obtaining all routing messages of a project to form a message matrix, wherein the message matrix comprises the routing messages of each network segment.
As an embodiment, the obtaining all the routing messages of the item to form a message matrix includes: acquiring an input project routing table, wherein the project routing table comprises routing messages of all network segments; and forming a message matrix by using the routing messages of the network segments, wherein the message matrix comprises the corresponding relation between each network segment and the routing messages and the acquisition sequence of each routing message.
It can be understood that for a project currently in progress, the gateway routing of the project needs to be functionally tested, and routing messages are organized according to input documents. The input document is an item routing table, and the item routing table includes all routing messages of different network segments of the item.
And organizing a message matrix according to all routing messages of the project, wherein the message matrix comprises the corresponding relation between each network segment and the routing messages, namely which routing messages exist in each network segment. For example, routing messages corresponding to a network segment from a source network segment a to a target network segment b, which routing messages exist on the network segment a, which routing messages exist on the network segment b, and the relationship between the network segments and the routing messages is correspondingly stored in a message matrix. In a network segment, there are usually many routing messages, and then the routing messages need to be sorted according to the collection time sequence of the routing messages.
And S2, screening out the routing message of the source network segment and the routing message of the target network segment from the message matrix according to the accessed source network segment and the accessed target network segment which need to be tested.
As an embodiment, writing an automatic test program of gateway routing data by using a CAPL script based on Canoe software; configuring CAN/CANFD parameters of a test project under a Hardware configuration page according to corresponding source network segment information, target network segment information and Canoe Hardware information, and selecting a Canoe test Channel for a source network segment and a target network segment to be tested in Channel Mapping; and testing the routing message of the source network segment and the routing message of the target network segment through the Canoe test channel.
It can be understood that the functional test program for the gateway routing in the embodiment of the present invention is mainly written based on the Canoe software by using CAPL scripts. According to Network segment information (including source Network segment information and target Network segment information) and Canoe Hardware information which need to be accessed, under a Hardware configuration page of engineering, CAN/CANFD parameters of a test engineering are configured in Network Hardware, canoe Channel selection is carried out in Channel Mapping, and routing messages of a source Network segment and a target Network segment which need to be tested are tested based on the selected Canoe Channel.
As an embodiment, the screening out a routing packet from a source network segment and a routing packet from a target network segment from the packet matrix according to an accessed source network segment and an accessed target network segment which need to be tested includes: configuring source network segment information and target network segment information in an on message response event in the CAPL; and screening out the routing message of the source network segment and the routing message of the target network segment from the message matrix as messages to be tested according to the configured source network segment information and target network segment information.
It can be understood that, according to the source network segment information and the target network segment information which are accessed to the network segment to be tested, the routing message of the source network segment and the routing message of the target network segment are screened from the message matrix, specifically, the message which needs to be routed in the project routing table is responded through an on message response event in the CAPL, and the source network segment routing message and the target network segment routing message are screened through the Channel to be used as the subsequent routing message which needs to be tested.
S3, recording the response time of the routing message of the source network segment and the response time of the routing message of the target network segment; and S4, judging whether the routing message of the source network segment and the routing message of the target network segment are synchronous or not based on the response time of the routing message of the source network segment and the response time of the routing message of the target network segment, if so, executing data comparison operation of the routing message of the source network segment and the routing message of the target network segment, testing the routing message of the source network segment and the routing message of the target network segment, and outputting a test result.
It can be understood that, for the source network segment routing message and the target network segment routing message screened from the message matrix, the source network segment routing message and the target network segment routing message are stored in corresponding memory spaces, and the response times of the source network segment routing message and the target network segment routing message are respectively recorded.
And determining whether the acquired data are synchronous or not by judging the size relationship between the difference value of the target network segment message response time and the source network segment message response time and the gateway routing timeliness. And when the response time difference is larger than the gateway routing timeliness, the data is considered to be asynchronous, and the comparison is not carried out.
Referring to fig. 2, for example, if the difference between the response time of the target network segment message and the response time of the source network segment message is less than 2ms (a first set time threshold), the source network segment message and the target network segment message are considered to be synchronous, at this time, data comparison operation between the source network segment routing message and the target network segment routing message is executed, a function test result of the gateway is obtained according to the comparison result, and when the source network segment routing message is the same as the target network segment routing message, the routing is successful; if not, the data routing is in error.
And when the difference value between the target network segment message response time and the source network segment message response time is more than 2ms, the data comparison operation is not executed. In this case, if the difference between the target network segment message response time and the source network segment message response time is greater than 2ms and less than one period of the current routing message, determining that the routing delay time is overtime; and if the difference value between the target network segment message response time and the source network segment message response time is larger than one period of the current routing message, determining that the current routing frame is missed.
It should be noted that, the embodiment of the present invention is based on the Canoe software to perform the gateway function Test, and can implement the automatic Test, specifically, click the engineering Test toolbar Test, jump out of the Test operation interface, and click the operation button to start the Test. And after the set test time is finished, automatically generating a test report and outputting a result.
The method effectively improves huge data acquisition and comparison work, saves a large amount of manpower and material resources, can solve the problem that whether the acquired data are synchronous or not, which cannot be solved by the traditional manual test, and improves qualitative leap for gateway data routing function test.
Example two
A gateway routing data testing system, referring to fig. 3, the system includes an obtaining module 31, a screening module 32, a recording module 33, a determining module 34, and a comparison testing module 35, wherein:
the acquiring module 31 is configured to acquire all routing messages of a project to form a message matrix, where the message matrix includes routing messages of each network segment;
the screening module 32 is used for screening out a routing message from the source network segment and a routing message from the target network segment from the message matrix according to the accessed source network segment and the target network segment which need to be tested;
the recording module 33 is used for recording the response time of the routing message of the source network segment and the response time of the routing message of the target network segment;
the judging module 34 is configured to judge whether the routing packet of the source network segment and the routing packet of the target network segment are synchronous based on the response time of the routing packet of the source network segment and the response time of the routing packet of the target network segment;
and the comparison test module 35 is configured to, if the synchronization is performed, execute data comparison operation between the routing packet of the source network segment and the target network segment packet, test the routing packet of the source network segment and the target network segment packet, and output a test result.
It can be understood that the gateway routing data test system provided by the present invention corresponds to the gateway routing data test method provided by each of the foregoing embodiments, and the relevant technical features of the gateway routing data test system may refer to the relevant technical features of the gateway routing data test method, which are not described herein again.
EXAMPLE III
Referring to fig. 4, fig. 4 is a schematic diagram of an embodiment of an electronic device according to an embodiment of the invention. As shown in fig. 4, an embodiment of the present invention provides anelectronic device 400, which includes amemory 410, aprocessor 420, and acomputer program 411 stored in thememory 410 and executable on theprocessor 420, and when theprocessor 420 executes thecomputer program 411, the steps of the gateway routing data testing method according to the first embodiment are implemented.
Example four
Referring to fig. 5, fig. 5 is a schematic diagram of an embodiment of a computer-readable storage medium according to the present invention. As shown in fig. 5, the present embodiment provides a computer-readable storage medium 500, on which acomputer program 511 is stored, and when being executed by a processor, thecomputer program 511 implements the steps of the gateway routing data testing method according to the first embodiment.
The gateway routing data test method and the test system provided by the embodiment of the invention have the following advantages:
1. the automatic test system realizes the synchronous acquisition of routing data of the automobile gateway and the automatic test of data comparison, improves the efficiency of testing the gateway function, and reduces the human input.
2. The whole vehicle can be accessed to collect data in real time and automatically output test results.
3. The method can flexibly meet different routing requirements of each item according to the change of the routing table.
4. The gateway routing function test method can accurately and synchronously acquire data routed by the gateway, ensure the accuracy of the data, ensure the qualitative change of the gateway data routing function test from uncertainty to certainty, and ensure the accuracy of the gateway function test result.
It should be noted that, in the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to relevant descriptions of other embodiments for parts that are not described in detail in a certain embodiment.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.