CN106892134B - Virtual instrument testing method and device - Google Patents

Virtual instrument testing method and device Download PDF

Info

Publication number
CN106892134B
CN106892134B CN201710166394.1A CN201710166394A CN106892134B CN 106892134 B CN106892134 B CN 106892134B CN 201710166394 A CN201710166394 A CN 201710166394A CN 106892134 B CN106892134 B CN 106892134B
Authority
CN
China
Prior art keywords
data
test
control
item
virtual instrument
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.)
Active
Application number
CN201710166394.1A
Other languages
Chinese (zh)
Other versions
CN106892134A (en
Inventor
唐瑶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Runke General Technology Co Ltd
Original Assignee
Beijing Runke General Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Runke General Technology Co Ltd filed Critical Beijing Runke General Technology Co Ltd
Priority to CN201710166394.1A priority Critical patent/CN106892134B/en
Publication of CN106892134A publication Critical patent/CN106892134A/en
Application granted granted Critical
Publication of CN106892134B publication Critical patent/CN106892134B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Testing And Monitoring For Control Systems (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The invention provides a test method and a test device of a virtual instrument, which are characterized in that test data corresponding to a control to be tested is read from a test file, the test data is sent to the control to be tested corresponding to the data in the virtual instrument, and result data returned by the control to be tested of the virtual instrument is received, so that a closed loop between a test system and the virtual instrument is formed. And comparing whether each item of sent data is the same as each item of received data, if so, passing the test, otherwise, the to-be-tested control of the virtual instrument is abnormal. The virtual instrument can be tested without comparing whether the input data and the output data of each control of the virtual instrument are the same or not by a tester one by one, so that the testing efficiency and the accuracy of a testing result are improved.

Description

Virtual instrument testing method and device
Technical Field
The invention belongs to the technical field of testing, and particularly relates to a testing method and device of a virtual instrument.
Background
The virtual instrument is widely applied to the field of aerospace and is used for displaying a large amount of information such as flight states, flight characteristics and the like in real time. With the wide application of the virtual instrument, how to carry out efficient test on the virtual instrument is very important.
At present, a test method for a virtual instrument is to establish connection between the virtual instrument and a flight simulator system through a communication interface, the flight simulator system sends display data to the virtual instrument, the virtual instrument displays the data on a corresponding display control after receiving the display data, and then a tester judges whether the display control of the virtual instrument can accurately display the data in real time by checking the data displayed by the display control of the virtual instrument; the virtual instrument sends control data to the flight simulator system, the flight simulator displays the control data or executes corresponding actions after receiving the control data, and then a tester judges whether the control of the virtual instrument can accurately output the control data in real time by checking the control data or the executed actions displayed by the flight simulator.
In the existing test method for the virtual instrument, a tester needs to manually compare whether the display data of each display control of the virtual instrument is the same as the display data sent by the flight simulator system, and whether the control data of each control of the virtual instrument is the same as the control data received by the flight simulator system, so that the test period is long and errors are easy to occur.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for testing a virtual meter, which are used to improve the efficiency and accuracy of testing the virtual meter.
The technical scheme is as follows:
the invention provides a test method of a virtual instrument, which comprises the following steps:
reading test data from the test file; the test data comprises at least one item of data, each item of data has a unique data field, and each data field corresponds to one to-be-tested control in the virtual instrument;
sending the test data to a to-be-tested control corresponding to the data field of each item of data in the test data;
receiving result data returned by a to-be-tested control of the virtual instrument; wherein the result data comprises at least one item of data, and each item of data has a unique data field;
sequentially comparing each item of data included in the test data with each item of data included in the result data to determine whether the items of data are the same;
if each item of data included in the test data is the same as each item of data included in the result data, the test is passed.
Preferably, if the control to be tested is a display control, the test data includes at least one item of display data,
the sending the test data to the to-be-tested control respectively corresponding to the data field of each item of data in the test data comprises:
sending the test data to display controls respectively corresponding to the data fields of each item of display data in the test data;
the receiving of the result data returned by the to-be-tested control of the virtual instrument includes:
and receiving display result data output by the display control of the virtual instrument through an output plug-in having an output relation with the display control.
Preferably, if the control to be tested is a control, the test data includes at least one item of control data,
the sending the test data to the to-be-tested control respectively corresponding to the data field of each item of data in the test data comprises:
sending the test data to a control which has an input relation with the input plug-in and corresponds to a data field of each item of control data in the test data through the input plug-in of the virtual instrument;
the receiving of the result data returned by the to-be-tested control of the virtual instrument includes:
and receiving control result data output by the control of the virtual instrument.
Preferably, after receiving result data returned by the to-be-tested control of the virtual meter, the method further includes:
writing the result data into a result file;
wherein sequentially comparing each item of data included in the test data with each item of data included in the result data, if they are the same, comprises:
and comparing the data corresponding to each data field in the test file with the data corresponding to each data field in the result file to determine whether the data are the same.
Preferably, reading the test data from the test file comprises:
sequentially reading data stored in a data line corresponding to a time line according to time stored in the time line included in the test data;
and taking all data read at the same time as test data of the same test.
The invention also provides a testing device of the virtual instrument, which comprises:
the reading unit is used for reading the test data from the test file; the test data comprises at least one item of data, each item of data has a unique data field, and each data field corresponds to one to-be-tested control in the virtual instrument;
the sending unit is used for sending the test data to the to-be-tested control corresponding to the data domain of each item of data in the test data;
the receiving unit is used for receiving result data returned by the to-be-tested control of the virtual instrument; wherein the result data comprises at least one item of data, and each item of data has a unique data field;
a comparing unit for sequentially comparing each item of data included in the test data with each item of data included in the result data;
if each item of data included in the test data is the same as each item of data included in the result data, the test is passed.
Preferably, if the control to be tested is a display control, the test data includes at least one item of display data,
the sending unit is used for sending the test data to display controls respectively corresponding to the data fields of each item of display data in the test data;
the receiving unit is used for receiving display result data output by the display control of the virtual instrument through the output plug-in having an output relation with the display control.
Preferably, if the control to be tested is a control, the test data includes at least one item of control data,
the sending unit is used for sending the test data to a control which has an input relation with the input plug-in and corresponds to a data field of each item of control data in the test data through the input plug-in of the virtual instrument;
and the receiving unit is used for receiving the control result data output by the control of the virtual instrument.
Preferably, the test apparatus further comprises:
a writing unit for writing the result data into a result file;
the comparison unit is further configured to compare whether data corresponding to each data field in the test file is the same as data corresponding to each data field in the result file.
Preferably, the reading unit includes:
the reading subunit is used for sequentially reading the data stored in the data line corresponding to the time line according to the time stored in the time line included in the test data;
and taking all data read at the same time as test data of the same test.
Compared with the prior art, the technical scheme provided by the invention has the following advantages:
according to the technical scheme, in the testing method of the virtual instrument, the testing data corresponding to the to-be-tested control is read from the testing file, the testing data is sent to the to-be-tested control corresponding to the data in the virtual instrument, the result data returned by the to-be-tested control of the virtual instrument is received, and a closed loop between the testing system and the virtual instrument is formed. And comparing whether each item of sent data is the same as each item of received data, if so, passing the test, otherwise, the to-be-tested control of the virtual instrument is abnormal. The virtual instrument can be tested without comparing whether the input data and the output data of each control of the virtual instrument are the same or not by a tester one by one, so that the testing efficiency and the accuracy of a testing result are improved.
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 introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow chart of a method for testing a virtual meter according to an embodiment of the present invention;
FIG. 2 is a flow chart of another testing method for a virtual meter according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a testing apparatus of a virtual meter according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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 some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention discloses a test method of a virtual instrument, which is applied to a built test simulation model, and the embodiment is described by taking the test simulation model built in simulink as an example, and referring to fig. 1, the embodiment comprises the following steps:
s101, reading test data from a test file; the test data comprises at least one item of data, each item of data has a unique data field, and each data field corresponds to one to-be-tested control in the virtual instrument;
and creating a test file, wherein the test file comprises a time line and a data line, the data line is used for storing data, the test file can be set by a tester according to the characteristics of a control to be tested on the virtual instrument, the time line is used for storing time, and the time for reading the data in the data line by the test simulation model can be obtained according to the time stored in the time line.
Alternatively, multiple items of data may correspond to the same time, and one time corresponds to one test, that is, when one test is performed, all data at one time are read at the same time. For example, time lines 1-3 store time 1, time lines 4-6 store time 2, and data lines 1-6 store data, respectively, then three data of data lines 1-3 are read at time 1 as test data for a first test, the test data includes three data items, and three data of data lines 4-6 are read at time 2 as test data for a second test. The difference between time 1 and time 2 is the time interval between the two tests.
The number of data items included in the test data is determined by the number of the controls to be tested. And each item of data may be a different form of data, such as an array, floating point data, etc. The form of the specific data is determined by the performance of the control to be tested. For example, if the control to be tested is used to display an array, the data corresponding to the control to be tested is in the form of an array.
The simulation model based on the simulink realizes the collection of time From the test File by using a self-contained 'From File' module of the simulink system, namely, realizes the reading of data in a data line From the test File according to the time in the time line.
The simulation step length of the test simulation model is set by setting the sampling period of the From File module. Wherein the sampling period is equal to the simulation step length. The simulation step size is the same as the interval between the times stored in the time row in the test file.
Each item of data in the test data has a unique data field, the data field is used for identifying the attribute of the data, each data field corresponds to one control to be tested in the virtual instrument, and therefore, which control of the virtual instrument is used for testing can be known through the data field.
For example, the first data in the read test data has only one data field 1, where the data field 1 represents the flying height, and then the first data in the test data is the test performed on the control of the virtual instrument corresponding to the flying height. The second data in the read test data has only one data field 2, and the data field 2 represents the flight speed, so that the second data in the test data is the test of the control corresponding to the flight speed in the virtual instrument.
S102, sending the test data to a to-be-tested control corresponding to a data domain of each item of data included in the test data;
the test simulation model sends the test data to the virtual instrument, after the virtual instrument receives the test data, the test data is analyzed according to a predefined data domain rule so as to obtain a data domain of each item of data included in the test data, and each item of data is sent to the corresponding control to be tested so as to test the control to be tested.
For example, the test data includes two items of data, 3 and 5 respectively, the first item of data has a data field 1, the data field 1 represents the flight height, the second item of data has a data field 2, and the data field 2 represents the flight speed. After the test data 3 and 5 are sent to the virtual instrument, the virtual instrument analyzes the received test data 3 and 5 according to a predefined data field rule that the data field 1 represents the flight altitude and the data field 2 represents the flight speed to obtain the information of the flight altitude 3 and the flight speed 5, then the flight altitude 3 is sent to a control part corresponding to the flight altitude, and the flight speed 5 is sent to the control part corresponding to the flight speed.
Optionally, in this embodiment, the ethernet communication modules "UDP Send" and "UDP Receive" may be used in the simulink-based test simulation model to establish a communication interface between the test simulation model and the virtual instrument, and the communication between the test simulation model and the virtual instrument is realized through an ethernet communication mode.
Optionally, sampling periods of the ethernet communication module "UDP Send" and the ethernet communication module "UDP Receive" are respectively set, and the sampling period of the ethernet communication module is the same as the sampling period of the "From File" module for reading data From the test File.
And the test simulation model sends each item of data to a to-be-tested control of the virtual instrument through an Ethernet communication module 'UDP Send'.
S103, receiving result data returned by a to-be-tested control of the virtual instrument; wherein the result data comprises at least one item of data, and each item of data has a unique data field;
and the to-be-tested control of the virtual instrument receives the test data sent by the test simulation model and responds to the test data, and the to-be-tested control responds to the test data to obtain result data. The virtual instrument returns result data to an Ethernet communication module 'UDP Receive' of the test simulation model through the Ethernet communication module, and the test simulation model receives the result data returned by the to-be-tested control of the virtual instrument.
After the test simulation model receives the result data, the result data are analyzed according to a predefined data domain rule for analyzing the received test data by the virtual instrument, and each item of data in the obtained result data has a unique data domain.
S104, sequentially comparing each item of data included in the test data with each item of data included in the result data to determine whether the items of data are the same;
if each item of data included in the test data is the same as each item of data included in the result data, the test is passed.
The test simulation model compares the test data with the result data one by one according to the sequence. Due to the data field rule of the data in the test data, the same rule as the data field rule of the data in the result data is applied, that is, the sequence of the data field composition of each item of data in the test data is the same as the sequence of the data field composition of each item of data in the result data. And comparing the test data and the result data according to the sequence, so that whether the test data and the result data corresponding to each data field are the same or not can be obtained, and further whether the test data and the result data of the to-be-tested control corresponding to the data field are the same or not can be obtained.
And if the test data and the result data corresponding to each data field are the same, indicating that the function of the control to be tested is normal.
And if the test data and the result data corresponding to one data field are different, indicating that the function of the to-be-tested control corresponding to the data field is abnormal.
Because the fact that which control to be tested is abnormal in the virtual instrument can be known, the reason that the abnormal control to be tested is abnormal can be mainly checked, and the purpose of quickly eliminating the abnormal condition in the virtual instrument is achieved.
According to the technical scheme, in the testing method of the virtual instrument, the testing data corresponding to the to-be-tested control is read from the testing file, the testing data is sent to the to-be-tested control corresponding to the data in the virtual instrument, the result data returned by the to-be-tested control of the virtual instrument is received, and a closed loop between the testing system and the virtual instrument is formed. And comparing whether each item of sent data is the same as each item of received data, if so, passing the test, otherwise, the to-be-tested control of the virtual instrument is abnormal. The virtual instrument can be tested without comparing whether the input data and the output data of each control of the virtual instrument are the same or not by a tester one by one, so that the testing efficiency and the accuracy of a testing result are improved.
In another method for testing a virtual instrument disclosed in the present invention, referring to fig. 2, the embodiment includes the following steps:
s201, reading test data from a test file; the test data comprises at least one item of data, each item of data has a unique data field, and each data field corresponds to one to-be-tested control in the virtual instrument;
the data stored in the data line in the test file comprises two types of data, namely display data and control data, wherein the display data is used for testing the display control in the virtual instrument, and the control data is used for testing the control in the virtual instrument.
Optionally, the display data and the control data are stored in different test files, respectively.
If the control to be tested is a display control and the test data comprises at least one item of display data, executing step S202;
if the control to be tested is a control and the test data comprises at least one item of control data, executing step S204;
s202, sending the test data to display controls respectively corresponding to data fields of each item of display data included in the test data;
because the display control of the virtual instrument has the function of receiving input data from the input interface of the virtual instrument, the test simulation model transmits the display data to the Ethernet communication receiving module of the virtual instrument through the Ethernet communication transmitting module, and the virtual instrument analyzes the display data according to the preset data domain rule, so that the display data can be directly transmitted to the display control corresponding to the data domain of each item of display data, and the display control receives the display data and displays the display data.
S203, receiving display result data output by a display control of the virtual instrument through an output plug-in having an output relation with the display control; executing S206;
because the display control of the virtual instrument does not have a function of outputting data displayed by the display control, in order to output the data displayed by the display control, an output plug-in needs to be inserted into the virtual instrument, the display control is used as an input control, and an output relationship between the output plug-in and the input control is established.
The output relationship is specifically such that the output order of the display control corresponding to one data field is the same as the order of the data field in the predetermined data field rule. For example, if the display control corresponding to the data field 1 is a flight height display control, the established output relationship between the flight height display control and the output plug-in is the first output of the flight height display control.
And after receiving the display result data of the display control output by the output plug-in of the virtual instrument, the Ethernet communication sending module of the virtual instrument sends the display result data to the Ethernet communication receiving module of the test simulation model.
It should be noted that, because the software of the established virtual instrument is different, when the output plug-in is inserted into the virtual instrument and the output relationship between the output plug-in and the display control serving as the input control is established, corresponding operations are required to implement normal interaction of data between the virtual instrument and the test simulation system.
The following description takes Virtual meters established based on Vaps (Virtual Application programming Software, Virtual meter platform) as an example.
The interface of the VAPS software and the external program mainly adopts ncom, and the ncom files needing configuration mainly comprise: dd file, maps file, connection file. Wherein, the dd file mainly specifies the contents of the transmission variable name, the attribute, the transmission quantity and the like; the maps file specifies the incidence relation of the mapping file, and specifies a transmission variable BUFFER and a server; the connection is a transmission mode for defining the ncom port, and mainly comprises two modes of shared memory and network port transmission.
In order to realize data interaction between a virtual instrument and a test simulation model established based on Vaps, when an output relation between an output plug-in and a display control serving as an input control is established, a configuration file needs to be modified correspondingly, and normal transmission of data can be realized. In the Vaps-based virtual meter, the output plug-in is DialCircle. The display control as an input control is SliderHoriz.
The modification to the configuration file includes:
creating a Float1.dd file, editing the name of DataDescription in the file to be Float1, and editing the name of a data element to be OutData;
creating data transmission and data flow, specifically comprising: firstly, setting an I/O Buffer as a Float1Buffer, dragging in a Format of an output plug-in DialCirle to generate an rcvFloat1Buffer, and then establishing Data Flow connection in a Data Flow view;
creating a Connection and using a shared memory of an ncom port or UDP communication;
creating maps, designating the I/O Buffer as Float1Buffer, the speed is the same as the sampling period of each module in the test simulation model, namely the simulation step length, and the Connection is Float1 Buffer.
After the configuration file is modified, data interaction between the virtual instrument and the test simulation model can be realized.
S204, sending the test data to a control which has an input relation with the input plug-in and corresponds to a data field of each item of control data in the test data through the input plug-in of the virtual instrument;
because the control of the virtual instrument does not have a function of receiving input data from the input interface of the virtual instrument, in order to enable the control to receive the control data, an input plug-in needs to be inserted into the virtual instrument, the control is used as an output control, and an input relation between the input plug-in and the output control is established.
The input relationship is specifically such that the receiving order of the control corresponding to one data field is the same as the order of this data field in the predetermined data field rule. For example, if the control corresponding to the data field 1 is a flight height control, the established input relationship between the flight height control and the input plug-in is the first input of the flight height control.
The test simulation model transmits the control data to an Ethernet communication receiving module of the virtual instrument through an Ethernet communication transmitting module, the virtual instrument analyzes the control data according to a preset data domain rule, the analyzed control data are transmitted to a control corresponding to the data domain of each item of control data through an input plug-in, and the control responds to the control data after receiving the control data.
It should be noted that, because the software of the established virtual instrument is different, when the output plug-in is inserted into the virtual instrument and the output relationship between the output plug-in and the display control serving as the input control is established, corresponding operations are required to implement normal interaction of data between the virtual instrument and the test simulation system.
The following description takes Virtual meters established based on Vaps (Virtual Application programming Software, Virtual meter platform) as an example.
The interface of the VAPS software and the external program mainly adopts ncom, and the ncom files needing configuration mainly comprise: dd file, maps file, connection file. Wherein, the dd file mainly specifies the contents of the transmission variable name, the attribute, the transmission quantity and the like; the maps file specifies the incidence relation of the mapping file, and specifies a transmission variable BUFFER and a server; the connection is a transmission mode for defining the ncom port, and mainly comprises two modes of shared memory and network port transmission.
In order to realize data interaction between a virtual instrument and a test simulation model established based on Vaps, when an input relation between an input plug-in and a control serving as an output control is established, a configuration file needs to be modified correspondingly, and normal transmission of data can be realized. In the Vaps-based virtual meter, the control as the output control is DialCircle, and the input plug-in is SliderHoriz.
The modification to the configuration file includes:
creating a Float1.dd file, editing the name of DataDescription in the file to be Float1, and editing the name of a data element to be OutData;
creating data transmission and data flow, specifically comprising: firstly, setting an I/O Buffer as a Float1Buffer, dragging the I/O Buffer in a Format of an input plug-in SliderHoriz to generate a sndFloat1Buffer, and then establishing data flow connection in a DataFlow view;
creating a Connection and using a shared memory of an ncom port or UDP communication;
creating maps, designating the I/O Buffer as Float1Buffer, the speed is the same as the sampling period of each module in the test simulation model, namely the simulation step length, and the Connection is Float1 Buffer.
After the configuration file is modified, data interaction between the virtual instrument and the test simulation model can be realized.
S205, receiving control result data output by the control of the virtual instrument;
because the control of the virtual instrument has the function of outputting data from the output interface of the virtual instrument, after the control of the virtual instrument responds to the received control data, the control of the virtual instrument directly sends the responded data to the Ethernet communication receiving module of the test simulation model through the Ethernet communication sending module of the virtual instrument. And after receiving the data returned by the virtual instrument, the test simulation model analyzes the data according to a preset data domain rule to obtain control result data.
S206, writing the result data into a result file;
and creating a result file, wherein the result file is used for storing the display result data and the control result data returned by the virtual instrument.
Based on the test simulation model of the simulink, the result data is written into the result File according To the preset data domain rule by using a self-contained 'To File' module of the simulink system. Preferably, a write period of the "To File" module may be set, wherein the write period is equal To the simulation step size.
Optionally, the display result data and the control result data are written in different result files, respectively.
S207, comparing whether the data corresponding to each data field in the test file is the same as the data corresponding to each data field in the result file;
if the data corresponding to each data field in the test file is the same as the data corresponding to each data field in the result file, the test is passed.
The comparison of the data stored in the test file and the result file can be manually performed one by one, and the process of performing comparison one by one can also be automatically completed by writing a program.
Optionally, for a data field, if a difference between data included in the test file and data included in the result file does not exceed a preset threshold, it is determined to be the same.
It will be appreciated that different thresholds are preset for different data fields. In this embodiment, after the test of the virtual meter is completed, the inserted input plug-in and output plug-in can be deleted without affecting other functions of the virtual meter.
According to the technical scheme, in the testing method of the virtual instrument, the testing data corresponding to the to-be-tested control is read from the testing file, the testing data is sent to the to-be-tested control corresponding to the data in the virtual instrument, the result data returned by the to-be-tested control of the virtual instrument is received, and a closed loop between the testing system and the virtual instrument is formed. And comparing whether each item of sent data is the same as each item of received data, if so, passing the test, otherwise, the to-be-tested control of the virtual instrument is abnormal. The virtual instrument can be tested without comparing whether the input data and the output data of each control of the virtual instrument are the same or not by a tester one by one, so that the testing efficiency and the accuracy of a testing result are improved.
Meanwhile, a time row is set in the test file, and the setting of the simulation step length of the test simulation model is realized by reasonably setting the time in the time row, so that the test data can be sent to the virtual instrument according to the simulation step length, the real-time dynamic test of the virtual instrument is realized, and whether the to-be-tested control of the virtual instrument can be refreshed in real time can be tested.
Corresponding to the testing method of the virtual instrument, the present invention further provides a testing apparatus of the virtual instrument, and a schematic structural diagram of the testing apparatus is shown in fig. 3, where the testing apparatus of the virtual instrument provided in this embodiment includes:
a reading unit 11, a transmitting unit 12, a receiving unit 13 and a comparing unit 14.
The reading unit 11 is configured to read test data from a test file; the test data comprises at least one item of data, each item of data has a unique data field, and each data field corresponds to one to-be-tested control in the virtual instrument;
alternatively, the reading unit 11, including a reading sub-unit,
the reading subunit is used for sequentially reading the data stored in the data line corresponding to the time line according to the time stored in the time line included in the test data;
and taking all data read at the same time as test data of the same test.
The sending unit 12 is configured to send each item of data to a control to be tested corresponding to a data field of each item of data;
optionally, when the control to be tested is a display control, the test data includes at least one item of display data, and the sending unit 12 is configured to send the test data to the display controls respectively corresponding to the data fields of each item of display data in the test data;
when the control to be tested is a control, the test data includes at least one item of control data, and the sending unit 12 is configured to send the test data to the control, which has an input relationship with the input plug-in and corresponds to a data field of each item of control data included in the test data, through the input plug-in of the virtual instrument.
The receiving unit 13 is configured to receive result data returned by a control to be tested of the virtual instrument; wherein the result data comprises at least one item of data, and each item of data has a unique data field;
optionally, when the control to be tested is a display control, the test data includes at least one item of display data, and the receiving unit 13 is configured to receive display result data output by the display control of the virtual instrument through an output plug-in having an output relationship with the display control;
when the control to be tested is a control, the test data includes at least one item of control data, and the receiving unit 13 is configured to receive control result data output by the control of the virtual instrument.
The comparing unit 14 is configured to sequentially compare whether each item of data included in the test data is the same as each item of data included in the result data;
if each item of data included in the test data is the same as each item of data included in the result data, the test is passed.
Optionally, the testing apparatus further comprises: a write unit 15;
the writing unit 15 is configured to write the result data into a result file;
the comparing unit 14 is further configured to compare whether the data corresponding to each data field in the test file is the same as the data corresponding to each data field in the result file.
According to the technical scheme, in the embodiment, the reading unit reads the test data corresponding to the to-be-tested control from the test file, the sending unit sends the test data to the to-be-tested control corresponding to the data in the virtual instrument, and the receiving unit receives the result data returned by the to-be-tested control of the virtual instrument, so that a closed loop between the test system and the virtual instrument is formed. And the comparison unit compares whether each item of sent data is the same as each item of received data, if so, the test is passed, otherwise, the to-be-tested control of the virtual instrument is abnormal. The virtual instrument can be tested without comparing whether the input data and the output data of each control of the virtual instrument are the same or not by a tester one by one, so that the testing efficiency and the accuracy of a testing result are improved.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for testing a virtual instrument, comprising:
reading test data from the test file; the test data comprises at least one item of data, each item of data has a unique data field, and each data field corresponds to one to-be-tested control in the virtual instrument;
sending the test data to a to-be-tested control corresponding to the data field of each item of data in the test data;
receiving result data returned by a to-be-tested control of the virtual instrument; wherein the result data comprises at least one item of data, and each item of data has a unique data field;
sequentially comparing each item of data included in the test data with each item of data included in the result data to determine whether the items of data are the same;
if each item of data included in the test data is the same as each item of data included in the result data, the test is passed;
the sending the test data to the to-be-tested control respectively corresponding to the data field of each item of data in the test data comprises:
and sending the test data to a virtual instrument, so that after the virtual instrument receives the test data, the test data is analyzed according to a predefined data domain rule to obtain a data domain of each item of data included in the test data, and each item of data is sent to a corresponding control to be tested.
2. The testing method of claim 1, wherein if the control under test is a display control, the test data comprises at least one item of display data,
the sending the test data to the to-be-tested control respectively corresponding to the data field of each item of data in the test data comprises:
sending the test data to display controls respectively corresponding to the data fields of each item of display data in the test data;
the receiving of the result data returned by the to-be-tested control of the virtual instrument includes:
and receiving display result data output by the display control of the virtual instrument through an output plug-in having an output relation with the display control.
3. The testing method of claim 1, wherein if the control under test is a control, the test data comprises at least one item of control data,
the sending the test data to the to-be-tested control respectively corresponding to the data field of each item of data in the test data comprises:
sending the test data to a control which has an input relation with the input plug-in and corresponds to a data field of each item of control data in the test data through the input plug-in of the virtual instrument;
the receiving of the result data returned by the to-be-tested control of the virtual instrument includes:
and receiving control result data output by the control of the virtual instrument.
4. The testing method according to any one of claims 1-3, wherein after receiving result data returned by the to-be-tested control of the virtual meter, the method further comprises:
writing the result data into a result file;
wherein sequentially comparing each item of data included in the test data with each item of data included in the result data, if they are the same, comprises:
and comparing the data corresponding to each data field in the test file with the data corresponding to each data field in the result file to determine whether the data are the same.
5. A method according to any one of claims 1 to 3, wherein reading test data from a test file comprises:
sequentially reading data stored in a data line corresponding to a time line according to time stored in the time line included in the test data;
and taking all data read at the same time as test data of the same test.
6. A test apparatus for a virtual meter, comprising:
the reading unit is used for reading the test data from the test file; the test data comprises at least one item of data, each item of data has a unique data field, and each data field corresponds to one to-be-tested control in the virtual instrument;
the sending unit is used for sending the test data to the to-be-tested control corresponding to the data domain of each item of data in the test data;
the receiving unit is used for receiving result data returned by the to-be-tested control of the virtual instrument; wherein the result data comprises at least one item of data, and each item of data has a unique data field;
a comparing unit for sequentially comparing each item of data included in the test data with each item of data included in the result data;
if each item of data included in the test data is the same as each item of data included in the result data, the test is passed;
the sending the test data to the to-be-tested control respectively corresponding to the data field of each item of data in the test data comprises:
and sending the test data to a virtual instrument, so that after the virtual instrument receives the test data, the test data is analyzed according to a predefined data domain rule to obtain a data domain of each item of data included in the test data, and each item of data is sent to a corresponding control to be tested.
7. The testing device of claim 6, wherein if the control under test is a display control, the testing data comprises at least one item of display data,
the sending unit is used for sending the test data to display controls respectively corresponding to the data fields of each item of display data in the test data;
the receiving unit is used for receiving display result data output by the display control of the virtual instrument through the output plug-in having an output relation with the display control.
8. The testing apparatus of claim 6, wherein if the control under test is a control, the test data comprises at least one item of control data,
the sending unit is used for sending the test data to a control which has an input relation with the input plug-in and corresponds to a data field of each item of control data in the test data through the input plug-in of the virtual instrument;
and the receiving unit is used for receiving the control result data output by the control of the virtual instrument.
9. The test device of any one of claims 6-8, further comprising:
a writing unit for writing the result data into a result file;
the comparison unit is further configured to compare whether data corresponding to each data field in the test file is the same as data corresponding to each data field in the result file.
10. The test device according to any one of claims 6 to 8, wherein the reading unit comprises:
the reading subunit is used for sequentially reading the data stored in the data line corresponding to the time line according to the time stored in the time line included in the test data;
and taking all data read at the same time as test data of the same test.
CN201710166394.1A 2017-03-20 2017-03-20 Virtual instrument testing method and device Active CN106892134B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710166394.1A CN106892134B (en) 2017-03-20 2017-03-20 Virtual instrument testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710166394.1A CN106892134B (en) 2017-03-20 2017-03-20 Virtual instrument testing method and device

Publications (2)

Publication Number Publication Date
CN106892134A CN106892134A (en) 2017-06-27
CN106892134B true CN106892134B (en) 2020-03-03

Family

ID=59193620

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710166394.1A Active CN106892134B (en) 2017-03-20 2017-03-20 Virtual instrument testing method and device

Country Status (1)

Country Link
CN (1) CN106892134B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109739767A (en) * 2018-12-29 2019-05-10 北京润科通用技术有限公司 A kind of human-computer interaction interface logic function test method and device
CN111006687A (en) * 2019-10-15 2020-04-14 惠州市德赛西威汽车电子股份有限公司 Vehicle-mounted instrument and central control interactive control testing system and method based on LabVIEW
CN113282494B (en) * 2021-05-25 2023-09-15 中国航空无线电电子研究所 Method for testing code generated by VAPS

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101004438A (en) * 2006-11-09 2007-07-25 天津理工大学 Excitation test system based on virtual instrument
CN102523052B (en) * 2011-12-01 2014-07-09 无锡中星微电子有限公司 Testing method and testing device
US9317415B2 (en) * 2013-06-03 2016-04-19 Google Inc. Application analytics reporting
CN105759785A (en) * 2016-02-16 2016-07-13 珠海格力电器股份有限公司 Test equipment control method and device
CN106326127A (en) * 2016-08-29 2017-01-11 浪潮电子信息产业股份有限公司 Automatic test method

Also Published As

Publication number Publication date
CN106892134A (en) 2017-06-27

Similar Documents

Publication Publication Date Title
CN107480039B (en) Small file read-write performance test method and device for distributed storage system
CN106892134B (en) Virtual instrument testing method and device
CN109302522A (en) Test method, device and computer system and medium
CN103927255A (en) Software testing method based on cloud testing system, cloud testing system and client side of cloud testing system
CN113009845B (en) Simulation test system and method for satellite software
WO2018201615A1 (en) Testing method and system for use with battery management unit
CN112148580B (en) Test method and device and electronic equipment
WO2013158788A2 (en) Devices for indicating a physical layer error
CN113791605A (en) Test method, device, equipment and storage medium
CN105187608A (en) Method and device obtaining power consumption of application program in mobile terminal
CN101114405A (en) Digitization experimental laboratory system and data control method thereof
CN109951494A (en) Emulate data processing method, device, emulator and storage medium
CN109783752A (en) Page loading method and device, electronic equipment and computer readable storage medium
CN112347650A (en) Hardware-in-loop simulation test method and system for automatic driving
CN104714787B (en) The generation method and device of MDF formatted files
CN114281624A (en) Method, system, device and equipment for testing I2C signal integrity
CN109101419A (en) A kind of test method, device, equipment and computer readable storage medium
CN106257257B (en) A kind of method, apparatus and virtual vector analyzer detecting optical module planisphere
CN104678292B (en) A kind of complex programmable logic device (CPLD) test method and device
CN111258828A (en) I2C bus test method, test device and computer readable storage medium
US20230035673A1 (en) Information processing system, information processing apparatus, use method of information processing apparatus, user terminal, and program therefor
CN109710547A (en) It is a kind of industry Internet of Things in buffer memory management design and implementation method
CN103838477A (en) Simulator text display method and device
CN107590076A (en) Obtain method, the method and device in generation business datum source of business datum
EP3014562A1 (en) Simulating sensors

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant