Disclosure of Invention
The application provides a network application identification method and device, which are used for solving the problems that in the prior art, each CAN bus needs to be written with a respective test case, so that a large amount of workload is brought and the efficiency is low.
In order to solve the technical problems, the embodiment of the application discloses the following technical scheme:
in a first aspect, the present application provides a controller area network bus test system comprising:
the data combination module is configured to acquire a test field and acquire a variation method of the test field;
the interaction module is configured to acquire interaction data and interaction flow, wherein the interaction flow refers to the sequence of data transmission in the interaction process;
the parameter module is configured to acquire test parameters, wherein the test parameters comprise test times and test periods;
and the test module is configured to generate test data according to the test field, the mutation method, the interaction data and the test parameters and send the test data to a controller area network bus, wherein the test data is used for testing the controller area network bus.
Optionally, the data combining module includes:
a data input unit configured to receive initial test data input by a user;
a field dividing unit configured to divide initial test data input by a user into a plurality of test fields;
and a variation specifying unit configured to receive a variation method of each test field specified by the user.
Optionally, the interaction module includes:
the interactive flow unit is configured to receive an interactive flow appointed by a user according to a controller local area network bus protocol;
and the interactive data unit is configured to receive interactive data appointed by a user according to the controller area network bus protocol.
Optionally, the parameter module includes:
the test frequency unit is configured to receive the test frequency of the controller area network bus test designated by a user;
a test period unit configured to receive a test period of the controller area network bus test specified by the user;
and a data interface unit configured to determine the data encapsulation structure.
Optionally, the test module includes:
the data generating unit is configured to generate data to be tested according to initial test data input by a user and interaction data designated by the user;
the data mutation unit is configured to compile each test field of the data to be tested according to the mutation method of each test field to obtain test data;
and the data receiving and transmitting unit is configured to transmit the test data to the controller area network bus so as to test the controller area network bus.
Optionally, the method further comprises:
and the monitoring module is configured to monitor the test state of the controller area network bus after the data receiving and transmitting unit transmits the test data to the controller area network bus.
Optionally, the method further comprises:
and the test report generation module is configured to receive the test result sent by the controller area network bus and generate a test report according to the test result so as to be displayed to a user.
In a second aspect, the present application provides a method for testing a bus of a controller area network, including:
acquiring a test field and a variation method of the test field;
acquiring interaction data and an interaction flow, wherein the interaction flow refers to the sequence of data transmission in the interaction process;
obtaining test parameters, wherein the test parameters comprise test times and test periods;
generating test data according to the test field, the mutation method, the interaction data and the test parameters, and sending the test data to a controller area network bus, wherein the test data is used for testing the controller area network bus.
In a third aspect, the present application provides a computer readable storage medium storing one or more programs executable by one or more processors to implement steps in a controller area network bus testing method as described above.
As can be seen from the above technical solutions, the present application provides a system and a method for testing a bus of a controller area network, where the system includes: the data combination module is configured to acquire a test field and acquire a variation method of the test field; the interaction module is configured to acquire interaction data and interaction flow; the parameter module is configured to acquire test parameters; the test module is configured to generate test data according to the test field, the mutation method, the interaction data and the test parameters and send the test data to the controller area network bus for testing the controller area network bus. The user only needs to input relevant parameters, the system can automatically generate test data, and respective test cases do not need to be written for each CANBUS bus, so that a large amount of time is saved, and the test efficiency of the CANBUS bus is improved.
Detailed Description
Reference will now be made in detail to the embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The embodiments described in the examples below do not represent all embodiments consistent with the application. Merely exemplary of systems and methods consistent with aspects of the application as set forth in the claims.
Based on the exemplary embodiments described herein, all other embodiments that may be obtained by one of ordinary skill in the art without making any inventive effort are within the scope of the appended claims. Furthermore, while the present disclosure has been described in terms of an exemplary embodiment or embodiments, it should be understood that each aspect of the disclosure can be practiced separately from the other aspects.
It should be noted that the brief description of the terminology in the present application is for the purpose of facilitating understanding of the embodiments described below only and is not intended to limit the embodiments of the present application. Unless otherwise indicated, these terms should be construed in their ordinary and customary meaning.
The terms first, second, third and the like in the description and in the claims and in the above-described figures are used for distinguishing between similar or similar objects or entities and not necessarily for describing a particular sequential or chronological order, unless otherwise indicated (Unless otherwise indicated). It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application are, for example, capable of operation in sequences other than those illustrated or otherwise described herein.
Furthermore, the terms "comprise" and "have," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a product or apparatus that comprises a list of elements is not necessarily limited to those elements expressly listed, but may include other elements not expressly listed or inherent to such product or apparatus.
The term "module" as used in this disclosure refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and/or software code that is capable of performing the function associated with that element.
The CAN BUS refers to the controller area network BUS technology CANBUS (Controller Area Networks-BUS). When the CAN bus is detected, the prior art generally adopts a test case to detect, and the CAN bus is tested by writing the test case, and the working principle of the CAN bus is that a large amount of variation data is sent to a detected object, whether the detected object generates an abnormality is monitored, the data causing the abnormality is recorded, and the unknown loopholes are found. However, when testing different CAN buses, since the content of each CAN bus may be very different, each CAN bus needs to write a respective test case, thereby bringing a lot of workload and being inefficient.
In order to solve the above-mentioned problems, an embodiment of the present application provides a controller area network bus test system, as shown in fig. 1, specifically, the controller area network bus test system includes a data combination module 10, an interaction module 20, a parameter module 30 and a test module 40.
The data combination module is configured to acquire a test field and acquire a mutation method of the test field. The data combination module is mainly responsible for outputting data and mutation strategies appointed by a user, and can receive contents such as some data input by the user. Specifically, the data combination module includes: a data input unit, a field dividing unit and a variance designating unit.
Wherein the data input unit is configured to receive initial test data input by a user. The data input unit may receive the canID and data. The canID is divided into 11 bits or 29 bits, and the data is an eight-byte data field. The data input unit can be a data model which is constructed by a user according to a protocol and meets the requirements of the protocol.
The field dividing unit is configured to divide initial test data input by a user into a plurality of test fields, and may particularly divide the input data into specified fields according to a protocol and a user's requirement.
The mutation specifying unit is configured to receive a mutation method of each test field specified by a user, the user may specify a mutation method of each field, and the mutation methods of different fields may be different.
The interaction module is configured to acquire interaction data and interaction flow, and may specifically include an interaction flow unit and an interaction data unit.
The interaction module is mainly responsible for controlling the interaction state of the CANBUS protocol. For example, most services of the CANBUS protocol do not allow subsequent interactions until a fixed connection is completed during an initial connection establishment interaction. Thus, the entire interaction procedure needs to be set.
The interactive flow unit is configured to receive an interactive flow designated by a user according to a controller area network bus protocol, wherein the interactive flow refers to the sequence of data transmission in the interactive process. For example, in the connection establishment process, data is sent first and then received, or data is sent first and then received last, and then the subsequent interaction can be performed.
The interactive data unit is configured to receive interactive data specified by a user according to a controller area network bus protocol, i.e. data that the user needs to receive or send in a connection process according to the protocol. Interactive data may refer to the type of data and not to the specific data itself. For example, in the connection establishment process, the designated data is sent first and then received, and then the subsequent interaction can be entered.
The parameter module is configured to obtain test parameters, which may include a number of tests and a test period. Specifically, the parameter module may include a test frequency unit, a test period unit, and a data interface unit. The method is mainly responsible for setting the test times, test delay intervals, data interfaces and reflecting the current test state.
The test times unit is configured to receive the test times of the controller area network bus test specified by the user, namely, the user can specify the operation test times according to the requirement.
The test period unit is configured to receive a user-specified test period of the controller area network bus test. The test period is the time interval of the test module packet.
The data interface unit is configured to determine a data encapsulation structure. For example, the CANBUS and OBD, and the canid and data in UDS may be different ranges.
It should be noted that, the data combination module, the interaction module and the parameter module together form a man-machine interaction interface of the system, and the user can input related data and specify some parameter information through the man-machine interaction interface. The user can log in the man-machine interaction interface through a browser or special software and the like.
The test module is configured to generate test data according to the test field, the mutation method, the interaction data and the test parameters and send the test data to the controller area network bus, wherein the test data can be used for testing the controller area network bus.
Specifically, the test module may generate a test data packet according to data and parameters input by the human-computer interface, and send the test data packet to the tested object for testing. The test module comprises a data generation unit, a data mutation unit and a data receiving and transmitting unit.
The data generating unit is configured to generate data to be tested according to initial test data input by a user and interaction data specified by the user. Specifically, a required data type can be determined according to the interactive data, and the initial test data is screened through the data type to obtain the data to be tested. Test data meeting protocol requirements can be generated according to the data of the human-computer interface.
The data mutation unit is configured to compile each test field of the data to be tested according to the mutation method of each test field to obtain the test data. Specifically, test fields corresponding to the data to be tested can be obtained, and mutation processing is performed on the test fields. According to the data of the human-computer interface, the appointed field in the normal test data is mutated according to the appointed mutation strategy, and the mutated data can be different each time.
The data transceiver unit is configured to transmit the test data to the controller area network bus to test the controller area network bus. And the method can be responsible for transmitting and receiving data and can filter the transmitted and received data according to the data of a human-computer interface.
The controller area network bus test system provided by the embodiment of the application can also comprise a monitoring module.
The monitoring module is configured to monitor a test state of the controller area network bus after the data receiving and transmitting unit transmits the test data to the controller area network bus. After the test data is sent to the tested device or system, the state of the tested object can be monitored, and the result is transmitted to the human-machine interface through the test engine.
The monitoring scheme used will also be different for the CANBUS protocol different services. It includes UDS, OBD, etc.
The controller area network bus test system provided by the embodiment of the application can also comprise a test report generation module.
The test report generating module is configured to receive the test result sent by the controller area network bus and generate a test report according to the test result so as to be displayed to a user. Test reports include, but are not limited to: number of tests, data of failure point, mutation method, and the like
The embodiment of the application also provides a method for testing the controller local area network bus, as shown in fig. 2, which comprises the following steps:
acquiring a test field and a variation method of the test field;
acquiring interaction data and an interaction flow, wherein the interaction flow refers to the sequence of data transmission in the interaction process;
obtaining test parameters, wherein the test parameters comprise test times and test periods;
generating test data according to the test field, the mutation method, the interaction data and the test parameters, and sending the test data to a controller area network bus, wherein the test data is used for testing the controller area network bus.
The embodiment of the application also provides a computer storage medium, wherein the computer storage medium can store a program, and the program can execute part or all of the steps in each embodiment of the controller area network bus testing method provided by the embodiment of the application. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
Since the foregoing embodiments are all described in other modes by reference to the above, the same parts are provided between different embodiments, and the same and similar parts are provided between the embodiments in the present specification. And will not be described in detail herein.
It will be apparent to those skilled in the art that the techniques of embodiments of the present application may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present application may be embodied essentially or in parts contributing to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method of the embodiments or some parts of the embodiments of the present application.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.
The foregoing description, for purposes of explanation, has been presented in conjunction with specific embodiments. However, the illustrative discussions above are not intended to be exhaustive or to limit the embodiments to the precise forms disclosed above. Many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles and the practical application, to thereby enable others skilled in the art to best utilize the embodiments and various embodiments with various modifications as are suited to the particular use contemplated. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims. The embodiments of the present application described above do not limit the scope of the present application.