CN114765588A - Test method, computer device, computer-readable storage medium - Google Patents
Test method, computer device, computer-readable storage medium Download PDFInfo
- Publication number
- CN114765588A CN114765588A CN202011624759.9A CN202011624759A CN114765588A CN 114765588 A CN114765588 A CN 114765588A CN 202011624759 A CN202011624759 A CN 202011624759A CN 114765588 A CN114765588 A CN 114765588A
- Authority
- CN
- China
- Prior art keywords
- communication module
- data channel
- data
- test
- target data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000010998 test method Methods 0.000 title claims abstract description 13
- 238000004891 communication Methods 0.000 claims abstract description 373
- 238000012360 testing method Methods 0.000 claims abstract description 175
- 230000005540 biological transmission Effects 0.000 claims description 31
- 238000000034 method Methods 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 15
- 238000011161 development Methods 0.000 abstract description 17
- 230000008569 process Effects 0.000 description 11
- 238000005406 washing Methods 0.000 description 11
- 230000006855 networking Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 5
- 230000000903 blocking effect Effects 0.000 description 4
- 238000004088 simulation Methods 0.000 description 3
- 238000004851 dishwashing Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000007547 defect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/12—Network monitoring probes
-
- G—PHYSICS
- G16—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
- G16Y—INFORMATION AND COMMUNICATION TECHNOLOGY SPECIALLY ADAPTED FOR THE INTERNET OF THINGS [IoT]
- G16Y30/00—IoT infrastructure
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W84/00—Network topologies
- H04W84/02—Hierarchically pre-organised networks, e.g. paging networks, cellular networks, WLAN [Wireless Local Area Network] or WLL [Wireless Local Loop]
- H04W84/10—Small scale networks; Flat hierarchical networks
- H04W84/12—WLAN [Wireless Local Area Networks]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application relates to a test method, computer equipment and a computer readable storage medium, wherein the test method comprises the following steps: acquiring a test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and judging whether a data channel corresponding to the target data exists in the test system or not; when the data channel does not exist in the test system, the data channel is created in the test system; when the data channel is established, target data is transmitted between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module. The serial port connecting line of the first communication module and the serial port connecting line of the second communication module are simulated through the data channel, so that the first communication module and the second communication module transmit target data through the data channel, the data channel can be suitable for transmitting the target data of different programs, and hardware corresponding to the programs is not needed to participate in the development of a serial port communication protocol, so that the development workload is greatly reduced.
Description
Technical Field
The present application relates to the field of data transmission technologies, and in particular, to a test method, a computer device, and a computer-readable storage medium.
Background
With the development of the technology of the internet of things, more and more platforms of the internet of things are formed. When the Internet of things platform is built, a plurality of traditional devices are connected into the Internet of things platform to form the Internet of things device. When accessing the conventional device to the internet of things platform, because the conventional device does not have the networking function, a serial communication protocol needs to be formulated so that the conventional device is connected with the WIFI module and accesses the internet of things platform. In the prior art, after a serial communication protocol is developed, the serial communication protocol needs to be debugged and tested, data are transmitted between the internet of things device and the WIFI module through the serial communication protocol during debugging and testing, and when a plurality of internet of things devices are jointly debugged and tested, the plurality of internet of things devices all need to transmit data, so that the development workload of the serial communication protocol is large.
Therefore, the prior art is in need of improvement.
Disclosure of Invention
The invention aims to solve the technical problem that the development workload of a serial communication protocol is large in the prior art by providing a test method, computer equipment and a computer readable storage medium aiming at overcoming the defects in the prior art.
In one aspect, an embodiment of the present invention provides a test method, which is applied to a test system, where the test system includes: a first communication module and the second communication module; the method comprises the following steps:
acquiring a test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and judging whether a data channel corresponding to the target data exists in the test system or not;
creating the data channel in the test system when the data channel does not exist in the test system;
when the data channel is established, the target data is transmitted between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module.
In a second aspect, an embodiment of the present invention provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the computer program is applied to a test system, where the test system includes: a first communication module and a second communication module; the processor, when executing the computer program, implements the steps of:
acquiring a test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and judging whether a data channel corresponding to the target data exists in the test system or not;
creating the data channel in the test system when the data channel is not present in the test system;
when the data channel is established, the target data is transmitted between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module.
In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and which is applied to a test system, where the test system includes: a first communication module and a second communication module; the computer program when executed by a processor implementing the steps of:
acquiring a test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and judging whether a data channel corresponding to the target data exists in the test system;
creating the data channel in the test system when the data channel is not present in the test system;
when the data channel is established, the target data is transmitted between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module.
Compared with the prior art, the embodiment of the invention has the following advantages: when target data is transmitted between a first communication module and a second communication module in the system, whether a data channel corresponding to the target data exists in the system is judged, if the data channel does not exist in the system, the data channel is created in the system, and the target data is transmitted between the first communication module and the second communication module through the data channel. Through data channel simulation first communication module with the serial ports connecting wire of second communication module makes first communication module with the second communication module can pass through data channel transmission target data, consequently, through during data channel target data transmission, the transmission of the applicable different procedure's of data channel target data does not need the hardware that the procedure corresponds to participate in when serial communication protocol development, thereby greatly reduced development work load.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a diagram of a network access architecture of an internet of things device in a testing method according to an embodiment of the invention;
FIG. 2 is a diagram of a serial port simulation architecture in the system in the testing method according to the embodiment of the present invention;
fig. 3 is a flowchart of a WIFI module in the testing method according to the embodiment of the present invention;
FIG. 4 is a flowchart of an MCU communication module in the testing method according to the embodiment of the present invention;
FIG. 5 is a flow chart of a testing method in an embodiment of the invention;
fig. 6 is an internal structural diagram of a computer device in an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
The inventor discovers through research that the traditional equipment is converted into the Internet of things equipment, and when the Internet of things platform is built, the UART interface on the traditional equipment is connected with the WIFI module, so that the cloud end is accessed through the WIFI module, and the cloud end is in communication connection with the client end, so that the Internet of things platform is formed. Because the conventional equipment does not have the networking function, a serial port communication protocol needs to be formulated, so that the conventional equipment is connected with the WIFI module. After the serial communication protocol is developed, the serial communication protocol needs to be debugged and tested to complete the debugging and testing of the serial communication protocol, and the serial communication protocol can be used. When debugging and testing, through serial communication protocol data transmission between thing networking device and WIFI module, when a plurality of thing networking devices jointly debug the test, a plurality of thing networking devices all need the transmission data, cause serial communication protocol's development work volume great.
In order to solve the above problem, in the embodiment of the present invention, when target data is transmitted between a first communication module and a second communication module in a test system, it is first determined whether a data channel corresponding to the target data exists in the test system, if the data channel does not exist in the test system, the data channel is created in the test system, and the target data is transmitted between the first communication module and the second communication module through the data channel. The serial port connecting line of the first communication module and the serial port connecting line of the second communication module are simulated through the data channel, so that the first communication module and the second communication module can transmit target data through the data channel, therefore, when the target data of the data channel are transmitted, the data channel can be suitable for transmitting the target data of different communication modules, and when a protocol is developed, hardware corresponding to the communication modules is not needed to participate, so that the development workload is greatly reduced.
As shown in fig. 2, in an embodiment of the present invention, a test system is provided, where the test system includes: the communication device comprises a first communication module and a second communication module. The test system refers to a system for testing data transmission between communication modules, and the communication modules refer to modules for transmitting data. The test system can be a desktop computer, a tablet computer, a notebook computer mobile phone, a personal digital assistant or a wearable device and the like.
For example, the first communication module is a WIFI module, the second communication module is a washing machine module, the WIFI module is a module for running a program of the WIFI module, the washing machine module is a module for running a program of the washing machine, that is, the program of the WIFI module is run on the WIFI module of the test system, and the program of the washing machine is run on the washing machine module. For another example, the first communication module is a WIFI module, the second communication module is an air conditioner module, and the WIFI module and the washing machine module are tested through the test system.
It can be understood that, as shown in fig. 1, the first communication module may be a WIFI module, an air conditioner module, a washing machine module, a dishwasher module, a clothes hanger module, a sound box module, a television module, a refrigerator module, a lamp module, etc. The second communication module can also be a WIFI module, an air conditioner module, a washing machine module, a dish washing machine module, a clothes hanger module, a sound box module, a television module, a refrigerator module, a lamp module and the like. The first communication module and the second communication module may be any two modules that need to transmit data, for example, the air conditioner module and the washing machine module may be tested in a test system when data is transmitted between the air conditioner module and the washing machine module.
Various non-limiting embodiments of the present invention are described in detail below with reference to the accompanying drawings.
Referring to fig. 1 and 2, a testing method in an embodiment of the invention is shown. In this embodiment, the testing method may include the following steps:
s1, obtaining a test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and judging whether a data channel corresponding to the target data exists in the test system.
Specifically, the test system refers to a system for testing data transmission between communication modules, and in an implementation manner of this embodiment, the test system employs a linux system, and the communication modules generally employ a linux system. Of course, in other implementations, the test system may also adopt a Unix system or a Windows system. When testing is performed, at least one of the first communication module and the second communication module is a module to be tested, and certainly, both the first communication module and the second communication module may be the module to be tested. For example, when the first communication module needs to be tested, the first communication module sends target data to the second communication module, and the second communication module is tested to determine whether the second communication module can receive the target data, and then, for example, the first communication module and the second communication module are tested, first the first communication module sends first target data to the second communication module, and the second communication module is tested to determine whether the second communication module can receive the first target data, and then the second communication module sends second target data to the first communication module, and the first communication module is tested to determine whether the first communication module can receive the second target data.
And during testing, the first communication module and the second communication module are connected through a data channel and perform data transmission. The data channel refers to a channel for data transmission in the test system, and the data channel is a buffer area with a fixed size. For example, in a Linux system, the size of the buffer is 1 page, i.e., 4 kbytes. The data channel is used for unidirectional data transmission, and the data channel may be one or more, for example, the data channel includes: the transmission direction of the second data channel is opposite to that of the first data channel, and when the first data channel and the second data channel are both connected with the first communication module and the second communication module, the first communication module and the second communication module can exchange data through the first data channel and the second data channel. The data channel has a read side for reading data and a write side for writing data, i.e., data is written from the write side and read from the read side.
In one implementation manner of this embodiment, the data channel includes: named data pipe (or FIFO, First In First Out) and nameless data pipe (pipe), the nameless data pipe refers to the data pipe without naming, the nameless data pipe is used for exchanging data between processes with affinity, therefore does not need naming, the affinity includes: parent-child relationships. For example, a nameless data channel is used between a parent process and a child process, and the data channel is created by using a pipe system call. When the parent process calls fork, all connection, file descriptors are passed from the parent process to the child process. For example, a parent process first writes data to the write side of the data channel, and then a child process reads data from the read side of the data channel.
The named data channel is a named data channel, and is used for exchanging data between any two processes, namely, the named data channel is used for exchanging data between unrelated processes and also used for exchanging data between related processes. For example, the first communication module writes data at a write end of the data channel, and then the second communication module reads data from a read end of the data channel.
The first communication module and the second communication module are used as the transceiving end of the target data. Specifically, when the first communication module is used as a sending end of the target data, the second communication module is used as a receiving end of the target data; when the second communication module is used as the sending end of the target data, the first communication module is used as the receiving end of the target data. Of course, in addition to the first communication module and the second communication module, other communication modules, for example, a third communication module and a fourth communication module, may be included in the test system. The target data may be sent from one communication module to a plurality of communication modules, for example, the first communication module serves as a sending end of the target data, and the second communication module and the third communication module serve as receiving ends of the target data. The target data may be sent to one communication module by a plurality of communication modules, for example, the second communication module and the fourth communication module serve as a sending end of the target data, and the first communication module serves as a receiving end of the target data.
When the first communication module and the second communication module in the test system transmit target data, it is first determined whether the data channel corresponding to the target data exists in the test system, that is, it is determined whether a data channel capable of transmitting the target data exists between the first communication module and the second communication module.
In the Internet of things platform, a plurality of intelligent terminals are connected with the WIFI module, so that the WIFI module and the intelligent terminal module can be debugged and tested during debugging and testing. For example, the second communication module includes: a WIFI module, the WIFI module is a module for running a program of the WIFI module, and the first communication module comprises: and the intelligent terminal module is a module for operating a program of the intelligent terminal.
The target data refers to data transmitted between communication modules, and the communication modules may receive the target data or may transmit the target data, and therefore, the target data includes: the first target data and the second target data are respectively used as the transmitted data and the received data of the first communication module, for example, the first target data may be request data, and the second target data may be response data.
S2, when the data channel does not exist in the test system, creating the data channel in the test system.
Specifically, if the data channel does not exist in the test system, the data channel is created in the test system. In order to facilitate debugging and testing of the communication module, when the data channel is created, the data channel adopts a named data channel, that is, when the data channel is created, the data channel is named so as to pass through the name. When creating the data channel, a data channel file, also called FIFO file, is created, the suffix name of which is ". FIFO".
And S3, when the data channel is established, transmitting the target data between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module.
Specifically, after the data channel is created, the first communication module and the second communication module may use the data channel for transmitting the target data, so as to test the first communication module and the second communication module. For example, the first communication module writes the target data in the write end of the data channel, and then the second communication module reads the target data from the read end of the data channel, so as to transmit the target data from the first communication module to the second communication module.
When a test communication module is debugged on a test system, the first communication module and the second communication module are both to-be-tested modules, and target data needs to be transmitted between the first communication module and the second communication module, so that whether a data channel corresponding to the target data exists in the test system is judged firstly, if the data channel does not exist in the test system, the data channel is created in the test system, and the target data is transmitted through the data channel. The data channel is used as a serial port connecting line to connect the first communication module and the second communication module, so that the first communication module and the second communication module can transmit the target data through the data channel, therefore, when the target data of the data channel is transmitted, the data channel can be used for transmitting the target data of different communication modules, and when a serial port communication protocol is developed, hardware corresponding to the communication modules is not needed to participate, so that the development workload is greatly reduced, namely, the test system does not need to be connected with intelligent terminals such as a washing machine and a dish washing machine, and the development efficiency is improved.
It should be noted that, when a serial port communication protocol is developed, data transmission is performed through the data channel to implement debugging and testing of the serial port communication protocol, and the development of the serial port communication protocol can be implemented without hardware corresponding to a communication module. Due to the development independence, the efficiency of development, debugging and self-testing of the serial port communication protocol to joint debugging is greatly improved. The development time and the debugging and testing time are reduced, and the development cost is reduced.
In one implementation manner of this embodiment, the data channel includes: a first data channel. Step S2, when the data channel does not exist in the test system, creating the data channel in the test system, including:
s21, when the first data channel does not exist in the test system, creating the first data channel in the test system, so that the first communication module and the second communication module are communicatively connected through the first data channel.
Specifically, when the data channel does not exist in the test system, the first data channel F1 is created in the test system, and a first communication module and a second communication module implement communication connection through the first data channel, specifically, a write end of the first data channel is communicatively connected to the first communication module, and a read end of the first data channel is communicatively connected to the second communication module. For example, the write Terminal (TX) of the first data channel may be communicatively connected to the output terminal of the second communication module, and the read terminal (RX) of the first data channel is communicatively connected to the input terminal of the first communication module, so that when the second communication module outputs target data, the target data may be written from the write terminal of the first data channel to the first data channel.
For example, the intelligent terminal usually employs an MCU (micro controller Unit), so that the first communication module may be an MCU communication module, the second communication module is a WIFI module, and the first data channel connects the MCU communication module and the WIFI module. The MCU communication module is a module for running a program of the micro control unit, and the WIFI module is a module for running a program of the WIFI module.
When the first data channel does not exist in the test system, the first data channel is created in the test system, so that the MCU communication module and the WIFI module are in communication connection through the first data channel. Specifically, a write end (TX) of the first data channel is in communication connection with an output end of the WIFI module, and a read end (RX) of the first data channel is in communication connection with an input end of the MCU communication module.
It should be noted that, since one data channel is unidirectional, and one data channel has one write end and one read end, the data channel has a data transmission direction. For example, the transmission direction of the first data channel is a direction in which the first communication module transmits to the second communication module, so that the first communication module may write the first target data into the first data channel, and the second communication module may read the first target data from the first data channel.
The data channel further comprises: a second data channel, wherein a transmission direction of the second data channel is a direction in which the second communication module transmits the data to the first communication module, that is, the transmission direction of the second data channel is opposite to the transmission direction of the first data channel. Two data channels are adopted, target data are written in the first data channel, and the target data are read in the second data channel, the two data channels can be used simultaneously, the safety of the target data between the communication modules can be enhanced, the rapid communication between the communication modules can be improved, and the testing efficiency is improved.
Step S2, when the data channel does not exist in the test system, creating the data channel in the test system, further including:
s22, when the second data channel does not exist in the test system, creating the second data channel in the test system so that the first communication module and the second communication module are in communication connection through the second data channel.
Specifically, on the basis of the creation of the first data channel, the second data channel F2 is created, so that the first communication module and the second communication module are communicatively connected through the second data channel, and then the first communication module and the second communication module can exchange data with each other, that is, the first communication module can send data to the second communication module, and the second communication module can also send data to the first communication module.
Specifically, the write port (TX) of the second data channel may be communicatively connected to the output port of the first communication module, and the read port (RX) of the second data channel is communicatively connected to the input port of the second communication module, so that when the first communication module outputs target data, the target data may be written from the write port of the second data channel to the second data channel.
For example, the first communication module is an MCU communication module, the second communication module is a WIFI module, and the second data channel is connected to the MCU communication module and the WIFI module. When the second data channel does not exist in the test system, the second data channel is created in the test system, so that the second data channel is connected with the MCU communication module and the WIFI module. Specifically, a write-in Terminal (TX) of the second data channel is connected to an output terminal of the MCU communication module, and a read-out terminal (RX) of the second data channel is connected to an input terminal of the WIFI module.
In an implementation manner of this embodiment, in step S3, when the data channel is completely created, the transmitting the target data between the first communication module and the second communication module through the data channel to test the first communication module and the second communication module includes:
s31, when the first data channel is completely created, opening the first data channel, so that the first communication module writes the first target data into the first data channel, and the second communication module reads the first target data from the first data channel.
Specifically, after the first data channel is created, the first target data may be transmitted between the first communication module and the second communication module through the first data channel. Since the write end of the first data channel is communicatively connected to the first communication module and the read end of the first data channel is communicatively connected to the second communication module, the first communication module may write the first target data into the first data channel from the write end of the first data channel and the second communication module reads the first target data from the read end of the first data channel.
For example, the first communication module is an MCU communication module, the second communication module is a WIFI module, and the MCU communication module and the WIFI module are in communication connection through the first data channel. After the first data channel is created, the first data channel is opened, the WIFI module writes the first target data into the first data channel, and then the MCU communication module can read the first target data from the first data channel.
In an implementation manner of this embodiment, the first data channel is a named data channel, the named data channel carries a channel name, the channel name of the first data channel is formed when the first data channel is created, the channel name may be a path name, and the first data channel may be determined by the channel name, so as to access the path. And when the first data channel is established, acquiring the channel name of the first data channel from the test system, determining the first data channel according to the channel name, and opening the first data channel.
Specifically, as shown in fig. 3 and 4, the first communication module is an MCU communication module, the second communication module is a WIFI module, and the MCU communication module and the WIFI module are in communication connection through the first data channel. When the WIFI module runs a program, the WIFI module creates a write-in thread, a write-in end of the first data channel is opened through a channel name of the first data channel, and first target data is written into the write-in end of the first data channel from an output end of the WIFI module. And then when the MCU communication module runs the program, the MCU communication module creates a reading thread, opens a reading end of the first data channel according to the channel name of the first data channel, and reads the first target data from the reading end of the first data channel to the input end of the MCU communication module.
When reading and writing the first target data, adopting a blocking type reading and blocking type writing mode, and because the size of the first data channel is limited, when the first target data is written into the first data channel, if the first data channel is full, the second communication module continues to write again, the second communication module will block. When the first target data in the first data channel is read, if the first data channel is completely read and becomes an empty data channel, the first communication module will block.
Certainly, when the first communication module reads the first target data in the first data channel, whether the first target data is completely read is judged, and if the first target data is not completely read, the first communication module continues to read the first target data in the first data channel; if the first target data is read completely, analyzing the first target data; if the first communication module does not finish the execution, the first communication module continues to read the first target data in the first data channel; and if the execution of the first communication module is finished, finishing the data transmission.
And S32, closing the first data channel after the first target data is transmitted.
Specifically, after the first target data is transmitted, the first data channel is closed, that is, after the first target data is read by the first communication module, the first data channel is closed. It should be noted that, after the first target data is read by the first communication module, the first target data in the first channel is removed.
In one implementation manner of this embodiment, in step S3, when the data channel is completely created, the target data is transmitted between the first communication module and the second communication module through the data channel to test the first communication module and the second communication module, further including:
s33, when the second data channel is completely created, opening the second data channel, so that the second communication module writes the second target data into the second data channel, and the first communication module reads the second target data from the second data channel.
Specifically, after the second data channel is created, the second target data may be transmitted between the first communication module and the second communication module through the second data channel. Since the write end of the second data channel is communicatively connected to the first communication module and the read end of the second data channel is communicatively connected to the second communication module, the first communication module may write the second target data into the second data channel from the write end of the second data channel and the second communication module reads the second target data from the read end of the second data channel.
For example, the first communication module is an MCU communication module, the second communication module is a WIFI module, and the second data channel is connected to the MCU communication module and the WIFI module. After the second data channel is created, the second data channel is opened, the MCU communication module writes the second target data into the second data channel, and then the WIFI module can read the second target data from the second data channel.
In an implementation manner of this embodiment, the second data channel is a named data channel, and when the second data channel is created, a channel name of the second data channel is formed, where the channel name may be a path name, and the second data channel may be determined by the channel name, so as to access the path. And when the second data channel is established, acquiring the channel name of the second data channel from the test system, determining the second data channel according to the channel name, and opening the second data channel.
Specifically, as shown in fig. 3 and 4, the first communication module is an MCU communication module, the second communication module is a WIFI module, and the MCU communication module and the WIFI module are in communication connection through the second data channel. When the MCU communication module runs a program, the MCU communication module creates a write-in thread, opens the write-in end of the second data channel through the channel name of the second data channel, and writes second target data into the write-in end of the second data channel from the output end of the MCU communication module. And then when the WIFI module runs the program, the WIFI module creates a reading thread, a reading end of a second data channel is opened through a channel name of the second data channel, and second target data are read to the input end of the WIFI module from the reading end of the second data channel.
When reading and writing the second target data, adopting a blocking type reading and blocking type writing mode, and because the size of the second data channel is limited, when writing the second target data into the second data channel, if the second data channel is full, the second communication module continues to write again, the second communication module will block. When the second target data in the second data channel is to be read, if the second data channel is completely read and becomes an empty data channel, the second communication module will be blocked.
Certainly, when the second communication module reads the second target data in the second data channel, whether the second target data is completely read is judged, and if the second target data is not completely read, the second communication module continues to read the second target data in the second data channel; if the second target data is read completely, analyzing the second target data; if the second communication module does not complete the execution, the second communication module continues to read second target data in the second data channel; and if the execution of the second communication module is finished, finishing the data transmission.
And S34, closing the second data channel after the second target data is transmitted.
Specifically, after the second target data is transmitted, the second data channel is closed, that is, after the second target data is read by the second communication module, the second data channel is closed. It should be noted that, after the second target data is read by the second communication module, the second target data in the second channel is removed.
It should be noted that the first data channel and the second data channel are independent from each other, that is, the transmission of the first target data and the transmission of the second target data do not affect each other, and in order to improve the data transmission efficiency, the transmission of the first target data and the transmission of the second target data may be performed simultaneously. Of course, in order to improve the security and stability of data transmission, only the first data channel or the second data channel may be opened, that is, only the first target data or the second target data is transmitted.
After the obtaining of the test instruction corresponding to the first communication module, determining the target data corresponding to the test instruction according to the test instruction, and determining whether a data channel corresponding to the target data exists in the test system, the test method may further include the following steps:
s4, when the data channel exists in the test system, transmitting the target data between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module.
Specifically, when the data channel exists in the test system, the first communication module and the second communication module may directly transmit the target data through the data channel, so as to test the first communication module and the second communication module. The data channel may include: a first data channel.
Specifically, when the first data channel exists in the test system, the first data channel is opened, so that the first communication module writes the first target data into the first data channel, and the second communication module reads the first target data from the first data channel.
The data channel may include: a second data channel. When the second data channel exists in the test system, the second data channel is opened, so that the second communication module writes the second target data into the second data channel, and the first communication module reads the second target data in the second data channel.
In summary, the present application discloses a testing method, a computer device, and a computer-readable storage medium, where the testing method includes: acquiring a test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and judging whether a data channel corresponding to the target data exists in the test system or not; creating the data channel in the test system when the data channel is not present in the test system; when the data channel is established, the target data is transmitted between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module. Through the data channel simulation first communication module with the serial ports connecting wire of second communication module, thereby make first communication module with second communication module can pass through data channel transmission target data, consequently, because each thing networking device is based on the same serial ports communication protocol and WIFI module, establish data channel can be suitable for the program of each thing networking device, only need pay close attention to serial ports communication protocol, need not pay close attention to first communication module, second communication module specifically be the program of which thing networking device, that is to say, through during data channel target data transmission, the transmission of the applicable different procedure's of data channel target data to greatly reduced development work load, reduced joint debugging test time.
In one embodiment, the present invention provides a computer device, which may be a terminal, having an internal structure as shown in fig. 6. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement the testing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on a shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the block diagram of FIG. 6 is only a partial block diagram of the structure associated with the inventive arrangements and is not intended to limit the computing devices to which the inventive arrangements may be applied, and that a particular computing device may include more or less components than those shown, or may have some components combined, or may have a different arrangement of components.
In one embodiment, there is provided a computer apparatus comprising a memory and a processor, the memory storing a computer program for application to a test system, the test system comprising: a first communication module and a second communication module; the processor, when executing the computer program, implements the steps of:
acquiring a test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and judging whether a data channel corresponding to the target data exists in the test system or not;
creating the data channel in the test system when the data channel is not present in the test system;
when the data channel is established, the target data is transmitted between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module.
In one embodiment, there is provided a computer-readable storage medium having a computer program stored thereon for use in a test system, the test system comprising: a first communication module and a second communication module; the computer program when executed by a processor implementing the steps of:
acquiring a test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and judging whether a data channel corresponding to the target data exists in the test system;
creating the data channel in the test system when the data channel is not present in the test system;
and when the data channel is established, transmitting the target data between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module.
All possible combinations of the technical features in the above embodiments may not be described for the sake of brevity, but should be considered as being within the scope of the present disclosure as long as there is no contradiction between the combinations of the technical features.
Claims (10)
1. A test method is applied to a test system, and the test system comprises the following steps: a first communication module and a second communication module; the method comprises the following steps:
acquiring a test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and judging whether a data channel corresponding to the target data exists in the test system;
creating the data channel in the test system when the data channel is not present in the test system;
when the data channel is established, the target data is transmitted between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module.
2. The method of claim 1, wherein the data channel comprises: a first data channel;
the creating the data channel in the test system when the data channel does not exist in the test system comprises:
when the first data channel does not exist in the test system, the first data channel is created in the test system, so that the first communication module and the second communication module are in communication connection through the first data channel.
3. The test method according to claim 2, wherein the transmission direction of the first data channel is a direction in which the first communication module transmits to the second communication module; the target data includes: first target data, which is data sent by the first communication module to the second communication module; when the data channel is completely created, transmitting the target data between the first communication module and the second communication module through the data channel to test the first communication module and the second communication module, including:
when the first data channel is established, the first data channel is opened, so that the first communication module writes the first target data into the first data channel, and the second communication module reads the first target data from the first data channel.
4. The test method of claim 3, wherein the first data channel is a named data channel, and the named data channel carries a channel name; when the creation of the first data channel is completed, the opening of the first data channel so that the first communication module writes the first target data into the first data channel and the second communication module reads the first target data in the first data channel includes:
and when the first data channel is established, acquiring the channel name from the test system, determining the first data channel according to the channel name, and opening the first data channel.
5. The method of claim 2, wherein the data channel further comprises: a second data channel, wherein a transmission direction of the second data channel is a direction in which the second communication module transmits to the first communication module;
when the data channel does not exist in the test system, creating the data channel in the test system, further comprising:
when the second data channel does not exist in the test system, the second data channel is created in the test system, so that the first communication module and the second communication module are in communication connection through the second data channel.
6. The testing method of claim 5, wherein the target data further comprises: second target data, which is data sent by the second communication module to the first communication module; when the creation of the data channel is completed, the target data is transmitted between the first communication module and the second communication module through the data channel to test the first communication module and the second communication module, and the method further includes:
and when the second data channel is completely created, opening the second data channel so that the second communication module writes the second target data into the second data channel and the first communication module reads the second target data from the second data channel.
7. The method according to claim 1, wherein after obtaining the test instruction corresponding to the first communication module, determining target data corresponding to the test instruction according to the test instruction, and determining whether a data channel corresponding to the target data exists in the test system, the method further comprises:
when the data channel exists in the test system, the target data is transmitted between the first communication module and the second communication module through the data channel so as to test the first communication module and the second communication module.
8. The test method according to any one of claims 1 to 7, wherein the test system comprises: the linux system, and/or the second communication module comprises: wireless communication module or intelligent terminal communication module, first communication module includes: and the intelligent terminal communication module.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the test method of any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the testing method according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011624759.9A CN114765588A (en) | 2020-12-30 | 2020-12-30 | Test method, computer device, computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011624759.9A CN114765588A (en) | 2020-12-30 | 2020-12-30 | Test method, computer device, computer-readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114765588A true CN114765588A (en) | 2022-07-19 |
Family
ID=82363772
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011624759.9A Pending CN114765588A (en) | 2020-12-30 | 2020-12-30 | Test method, computer device, computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114765588A (en) |
Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101309223A (en) * | 2008-07-02 | 2008-11-19 | 中兴通讯股份有限公司 | Data channel establishing method and system |
CN101400141A (en) * | 2008-10-15 | 2009-04-01 | 中兴通讯股份有限公司 | Method and system for keeping data channel synchronization in WIMAX service |
CN101483646A (en) * | 2009-01-22 | 2009-07-15 | 浙江大学 | Method and interface for high-speed communication on bus |
CN101990227A (en) * | 2009-08-07 | 2011-03-23 | 中兴通讯股份有限公司 | Method and device for establishing data channel between network elements of access service network |
CN103200606A (en) * | 2013-03-18 | 2013-07-10 | 东莞宇龙通信科技有限公司 | Terminal and data service processing method |
CN105101294A (en) * | 2015-07-10 | 2015-11-25 | 努比亚技术有限公司 | Data transmission device and method |
CN105934970A (en) * | 2014-02-19 | 2016-09-07 | 宇龙计算机通信科技(深圳)有限公司 | Network data channel allocation method and allocation device, and terminal |
WO2016180220A1 (en) * | 2015-08-27 | 2016-11-17 | 中兴通讯股份有限公司 | Conversation setup method and apparatus |
CN106161130A (en) * | 2015-04-14 | 2016-11-23 | 阿里巴巴集团控股有限公司 | The performance monitoring device of sing on web Socket agreement, system and method |
US20170366309A1 (en) * | 2014-11-19 | 2017-12-21 | Nec Corporation | Information processing system, information processing method, and information processing device |
CN107682882A (en) * | 2017-09-29 | 2018-02-09 | 努比亚技术有限公司 | Data transmission method, mobile terminal and computer-readable recording medium |
CN108401081A (en) * | 2017-02-04 | 2018-08-14 | 中兴通讯股份有限公司 | A kind of VOLTE network performance test methods and device |
CN111586098A (en) * | 2020-04-01 | 2020-08-25 | 腾讯科技(深圳)有限公司 | Data transmission method, device, equipment and computer readable storage medium |
-
2020
- 2020-12-30 CN CN202011624759.9A patent/CN114765588A/en active Pending
Patent Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101309223A (en) * | 2008-07-02 | 2008-11-19 | 中兴通讯股份有限公司 | Data channel establishing method and system |
CN101400141A (en) * | 2008-10-15 | 2009-04-01 | 中兴通讯股份有限公司 | Method and system for keeping data channel synchronization in WIMAX service |
CN101483646A (en) * | 2009-01-22 | 2009-07-15 | 浙江大学 | Method and interface for high-speed communication on bus |
CN101990227A (en) * | 2009-08-07 | 2011-03-23 | 中兴通讯股份有限公司 | Method and device for establishing data channel between network elements of access service network |
CN103200606A (en) * | 2013-03-18 | 2013-07-10 | 东莞宇龙通信科技有限公司 | Terminal and data service processing method |
CN105934970A (en) * | 2014-02-19 | 2016-09-07 | 宇龙计算机通信科技(深圳)有限公司 | Network data channel allocation method and allocation device, and terminal |
US20170366309A1 (en) * | 2014-11-19 | 2017-12-21 | Nec Corporation | Information processing system, information processing method, and information processing device |
CN106161130A (en) * | 2015-04-14 | 2016-11-23 | 阿里巴巴集团控股有限公司 | The performance monitoring device of sing on web Socket agreement, system and method |
CN105101294A (en) * | 2015-07-10 | 2015-11-25 | 努比亚技术有限公司 | Data transmission device and method |
WO2016180220A1 (en) * | 2015-08-27 | 2016-11-17 | 中兴通讯股份有限公司 | Conversation setup method and apparatus |
CN108401081A (en) * | 2017-02-04 | 2018-08-14 | 中兴通讯股份有限公司 | A kind of VOLTE network performance test methods and device |
CN107682882A (en) * | 2017-09-29 | 2018-02-09 | 努比亚技术有限公司 | Data transmission method, mobile terminal and computer-readable recording medium |
CN111586098A (en) * | 2020-04-01 | 2020-08-25 | 腾讯科技(深圳)有限公司 | Data transmission method, device, equipment and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100565472C (en) | A kind of adjustment method that is applicable to multiprocessor karyonide system chip | |
US6934937B1 (en) | Multi-channel, multi-service debug on a pipelined CPU architecture | |
WO2019134706A1 (en) | Vehicle diagnostic method, device, apparatus, and system, and connection diagnostic apparatus | |
US7908522B2 (en) | Network card testing method | |
CN112749113A (en) | Data interaction method, system, device and medium | |
CN115374046B (en) | Multiprocessor data interaction method, device, equipment and storage medium | |
CN110209605A (en) | The register reading/writing method and calculating equipment of PCIE Cardbus NIC Cardbus | |
CN109510740A (en) | A kind of method, apparatus, terminal and the storage medium of automatic monitoring network interface card MTU value | |
CN114765588A (en) | Test method, computer device, computer-readable storage medium | |
CN110765060B (en) | MDIO bus-to-parallel bus conversion method and device, equipment and medium | |
CN113259264A (en) | Data transmission method and device, computer equipment and storage medium | |
CN113364690A (en) | Method, device, terminal and storage medium for determining network transmission path of receiving card | |
CN113533941B (en) | Chip interface testing method and device, computer equipment and storage medium | |
CN113391931B (en) | Remote control method and device based on Bluetooth, computer equipment and storage medium | |
CN116436540A (en) | LED display screen receiving card testing method and device, testing card and storage medium | |
JPH08221293A (en) | Emulator device | |
JP2015011363A (en) | Cooperation verification device and cooperation verification method | |
CN111143218A (en) | Log debugging method and device suitable for 5G embedded equipment and readable storage medium | |
CN110109819A (en) | Using processing method, device, equipment and the readable storage medium storing program for executing debugged extremely | |
CN111142873A (en) | Browser access method and device, computer equipment and storage medium | |
CN114444423B (en) | Data processing method and system based on verification platform and electronic equipment | |
JPH1083318A (en) | Electronic circuit analyzing device | |
CN111240908B (en) | Verification method and verification system for processor interface, electronic equipment and storage medium | |
WO2023123278A1 (en) | Vehicle diagnosis method, diagnosis connector and diagnosis device | |
CN109213673A (en) | A kind of development approach and device based on serial ports simulation software |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |