CN112631916A - Data verification method and device and electronic equipment - Google Patents

Data verification method and device and electronic equipment Download PDF

Info

Publication number
CN112631916A
CN112631916A CN202011553655.3A CN202011553655A CN112631916A CN 112631916 A CN112631916 A CN 112631916A CN 202011553655 A CN202011553655 A CN 202011553655A CN 112631916 A CN112631916 A CN 112631916A
Authority
CN
China
Prior art keywords
data
data item
frame
data frame
log
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.)
Withdrawn
Application number
CN202011553655.3A
Other languages
Chinese (zh)
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.)
Mobai Beijing Information Technology Co Ltd
Original Assignee
Mobai Beijing Information 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 Mobai Beijing Information Technology Co Ltd filed Critical Mobai Beijing Information Technology Co Ltd
Priority to CN202011553655.3A priority Critical patent/CN112631916A/en
Publication of CN112631916A publication Critical patent/CN112631916A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a data verification method, a data verification device and electronic equipment, wherein the method comprises the following steps: acquiring a data frame to be verified; acquiring log data corresponding to the data frame, wherein the log data comprises log data generated in the process of encoding to obtain the data frame; and verifying the correctness of the coding processing aiming at the data frame according to the semantic corresponding relation between the log data and the data in the data frame. When the method is used for verifying the correctness of the coding processing aiming at the data frame, the data can be verified quickly and accurately by the electronic equipment according to the semantic corresponding relation between the data in the data frame and the corresponding log data without depending on manual work.

Description

Data verification method and device and electronic equipment
Technical Field
The invention relates to the field of software testing, in particular to a data verification method and device and electronic equipment.
Background
Currently, in a software system, electronic devices, for example, a terminal device and a server, may generally communicate using a communication protocol to ensure stability and security of data transmission, where the communication protocol may be a general communication protocol, for example, a Modbus protocol, or may also be a custom communication protocol.
When communication is performed based on a communication protocol, due to manual reasons or other reasons, there is a possibility that a Data Frame (Data Frame), also called a Data encoding error in the protocol Frame, may occur; for this situation, in the software testing process, a tester is often required to manually compare whether data in a data frame is consistent with corresponding data in a test log to verify whether the encoding process for the data frame is correct.
In the process of implementing the invention, the inventor finds that a data verification method for verifying whether the coding processing of the data frame is correct or not in a manual mode needs to consume a large amount of manpower and material resources on one hand; on the other hand, in the manual comparison process, a comparison error may also occur, so that the existing data verification method has at least the problems of complicated steps and low accuracy.
Disclosure of Invention
An object of the embodiments of the present invention is to provide a new technical solution for data verification.
According to a first aspect of the present invention, there is provided a data verification method, the method comprising:
acquiring a data frame to be verified;
acquiring log data corresponding to the data frame, wherein the log data comprises log data generated in the process of encoding to obtain the data frame;
and verifying the correctness of the coding processing aiming at the data frame according to the semantic corresponding relation between the log data and the data in the data frame.
Optionally, the data frame comprises at least one data item;
verifying the correctness of the encoding processing aiming at the data frame according to the semantic correspondence between the log data and the data in the data frame comprises the following steps:
acquiring a first data item, and acquiring a numerical type corresponding to the first data item, wherein the first data item is any one of the at least one data item;
acquiring a first log data item corresponding to the first data item from the log data;
verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type.
Optionally, the value type includes a first preset value type, and the first preset value type includes a fixed value type;
the verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type includes:
under the condition that the numerical value type is a first preset numerical value type, comparing whether the numerical values of the first data item and the first log data item are the same or not to obtain a comparison result;
under the condition that the comparison result represents that the first data item is different from the first log data item, performing data system conversion processing on the first log data item according to a data system type corresponding to the first data item to obtain a first semantic extension data item;
determining that the encoding process for the data frame is correct in the event that the first data item and the first semantic extension data item are the same value.
Optionally, the value type includes a second preset value type, and the first preset value type includes a fluctuation value type;
the verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type includes:
acquiring an absolute value of a difference value between the first data item and the first log data item when the numerical type is a second preset numerical type;
acquiring a preset difference threshold corresponding to the first data item;
determining that the encoding process for the data frame is correct if the absolute value of the difference is not greater than the preset difference threshold.
Optionally, the value type includes a third preset value type, and the first data item includes a plurality of values;
the verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type includes:
if the value type is a third preset data type, verifying whether the plurality of values in the first data item are contained in the first log data item;
determining that the encoding process for the data frame is correct in a case where the plurality of numerical values are contained in the first log data item.
Optionally, the method further comprises:
obtaining the retransmission times of the data frame in a preset time length from the log data;
and determining the correctness of the transmission processing of the data frame according to the retransmission times.
Optionally, the determining the correctness of the transmission processing for the data frame according to the retransmission times includes:
acquiring the frame type of the data frame;
and determining that the transmission processing for the data frame is correct when the frame type is a preset frame type and the retransmission times are not more than a preset retransmission times, wherein the preset retransmission times correspond to the preset frame type.
Optionally, the method is applied to a shared vehicle system, and the data in the data frame includes state data characterizing the working state of the shared vehicle.
According to a second aspect of the present invention, there is also provided a data verification apparatus comprising:
the data frame acquisition module is used for acquiring a data frame to be verified;
a log data obtaining module, configured to obtain log data corresponding to the data frame, where the log data includes log data generated in a process of obtaining the data frame by encoding;
and the data verification module is used for verifying the correctness of the coding processing aiming at the data frame according to the corresponding relation between the log data and the data in the data frame.
According to a third aspect of the present invention, there is also provided an electronic device comprising the apparatus according to the second aspect of the present invention; alternatively, the first and second electrodes may be,
the electronic device includes: a memory for storing executable instructions; a processor configured to execute the electronic device according to the control of the instruction to perform the method according to the first aspect of the present invention.
The method has the advantages that when the correctness of the coding processing for the data frame is verified, the electronic equipment can acquire the data frame to be verified without depending on manual work, log data generated in the process of obtaining the data frame through coding is obtained, and whether the coding processing is correct or not can be quickly and accurately verified according to the semantic corresponding relation between the log data and the data in the data frame.
Other features of the present invention and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a schematic block diagram showing a hardware configuration of a data verification system that may be used to implement the data verification method of one embodiment;
fig. 2 is a schematic flow chart of a data verification method provided by an embodiment of the present disclosure;
fig. 3 is a schematic block diagram of a data verification apparatus according to an embodiment of the present disclosure.
Fig. 4 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
In all examples shown and discussed herein, any particular value should be construed as merely illustrative, and not limiting. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
< hardware configuration >
Fig. 1 is a block diagram of a hardware configuration of a data verification system 100 that may be used to implement a data verification method according to one embodiment.
As shown in fig. 1, the data verification system 100 includes a server 1100, a terminal apparatus 1200, and a network 1300.
The server 1100 may be, for example, a blade server, a rack server, or the like, and the server 1100 may also be a server cluster deployed in a cloud, which is not limited herein.
As shown in FIG. 1, server 1100 may include a processor 1110, a memory 1120, an interface device 1130, a communication device 1140, a display device 1150, and an input device 1160. The processor 1110 may be, for example, a central processing unit CPU or the like. The memory 1120 includes, for example, a ROM (read only memory), a RAM (random access memory), a nonvolatile memory such as a hard disk, and the like. The interface device 1130 includes, for example, a USB interface, a serial interface, and the like. The communication device 1140 is capable of wired or wireless communication, for example. The display device 1150 is, for example, a liquid crystal display panel. Input devices 1160 may include, for example, a touch screen, a keyboard, and the like.
In this embodiment, the server 1100 may be used to participate in implementing a data validation method according to any embodiment of the present disclosure.
As applied to any embodiment of the present disclosure, the memory 1120 of the server 1100 is configured to store instructions for controlling the processor 1110 to operate in support of implementing a method according to any embodiment of the present invention. The skilled person can design the instructions according to the disclosed solution. How the instructions control the operation of the processor is well known in the art and will not be described in detail herein.
Those skilled in the art will appreciate that although a number of devices are shown in FIG. 1 for the server 1100, the server 1100 of embodiments of the present disclosure may refer to only some of the devices therein, e.g., only the processor 1110 and the memory 1120.
As shown in fig. 1, the terminal apparatus 1200 may include a processor 1210, a memory 1220, an interface device 1230, a communication device 1240, a display device 1250, an input device 1260, an audio output device 1270, an audio input device 1280, and the like. The processor 1210 may be a central processing unit CPU, a microprocessor MCU, or the like. The memory 1220 includes, for example, a ROM (read only memory), a RAM (random access memory), a nonvolatile memory such as a hard disk, and the like. The interface device 1230 includes, for example, a USB interface, a headphone interface, and the like. The communication device 1240 can perform wired or wireless communication, for example. The display device 1250 is, for example, a liquid crystal display, a touch display, or the like. The input device 1260 may include, for example, a touch screen, a keyboard, and the like. The terminal apparatus 1200 may output the audio information through the audio output device 1270, the audio output device 1270 including a speaker, for example. The terminal apparatus 1200 may pick up voice information input by the user through the audio pickup device 1280, and the audio pickup device 1280 includes, for example, a microphone.
The terminal device 1200 may be a smart phone, a laptop computer, a desktop computer, a tablet computer, etc., and is not limited herein.
It should be understood by those skilled in the art that although a plurality of means of the terminal device 1200 are shown in fig. 1, the terminal device 1200 of the embodiments of the present disclosure may refer to only some of the means therein, for example, only the processor 1210, the memory 1220, and the like.
The communication network 1300 may be a wireless network or a wired network, and may be a local area network or a wide area network.
It should be noted that the data validation system 1000 shown in fig. 1 is merely illustrative and is in no way intended to limit the present disclosure, its application, or uses. For example, although fig. 1 shows only one server 1100 and one terminal apparatus 1200, it is not meant to limit the respective numbers, and a plurality of servers 1100 and/or a plurality of terminal apparatuses 1200 may be included in the data verification system 100.
< method examples >
In a software system, such as a shared vehicle system, a shared vehicle, such as a shared bicycle, a shared electric bicycle, etc., when communicating with a server, status data characterizing the operating status of the vehicle, such as voltage data, current data, vehicle positioning data, billing data, etc., may be sent to the server in the form of data frames for the server to manage and monitor the shared vehicle, typically based on a custom communication protocol.
As described in the background, due to human or other reasons, there is a possibility that data encoding in a data frame is erroneous, and the use of the data verification method based on manual comparison has at least the problems of complicated steps and low accuracy, and to solve the problems, an embodiment of the present disclosure provides a data verification method, please refer to fig. 2, which is a flowchart of the data verification method provided by the embodiment of the present disclosure, and the method can be implemented by a data verification server, for example, the server 1100 in fig. 1.
As shown in fig. 2, the method of the present embodiment may include the following steps S2100-S2300, which will be described in detail below.
In step S2100, a data frame to be verified is obtained.
The data frame (DataFrame) generally includes three parts, i.e., a frame header, a data part and a frame trailer, where the frame header and the frame trailer include some necessary control information, such as synchronization information, address information, error control information, etc., and the data part includes specific values of data items to be actually transmitted, such as status data of a shared vehicle, voltage data, current data, vehicle positioning data, etc.
In this embodiment, if no special description is given, the method is applied to a shared vehicle system, and data in a data frame is taken as state data representing the working state of a shared vehicle for example; of course, the method can also be applied to other systems, and is not particularly limited herein.
In a specific implementation, the obtaining of the data frame to be verified may be specifically that, in a software testing process, a user controls sending of the data frame generated when the terminal device communicates with the application server to a server implementing the method, that is, a data verification server, and the data verification server verifies whether the encoding processing of the data frame is correct according to the data frame.
The data frame may be obtained from a log file generated by the terminal device, that is, the data frame may be written into the log file when the terminal device communicates with the application server.
It should be noted that, the obtaining of the data frame to be verified may also be that the user directly deploys the application program for performing the encoding processing on the data verification server, and the data verification server automatically obtains the data frame in the process of communication between the application program and the application server, and the detailed processing process is not described here again.
Step S2200 is to obtain log data corresponding to the data frame, where the log data includes log data generated in a process of encoding to obtain the data frame.
In specific implementation, in order to verify the correctness of the encoding process of the data frame, the terminal device may generally write the actual value or the related value of each data item in the data frame into the log file for data verification process while generating the data frame by encoding.
Therefore, after the data verification server obtains the data frame to be verified in step S2100, the log data corresponding to the data frame may also be obtained from the log file of the terminal device, so that the data verification server may quickly and accurately verify whether the encoding process for the data frame is correct based on the log data.
The method for acquiring log data corresponding to a data frame from log data may be that, in the process of generating the data frame, a terminal device marks a start position and an end position of the corresponding log data in a log file in advance by a frame identifier of the data frame, and a data verification server obtains the log data from the log file according to the frame identifier of the data frame to be verified; of course, other methods may be used to obtain the log data, and the description is omitted here.
Step S2300, verifying the correctness of the encoding process for the data frame according to the semantic correspondence between the log data and the data in the data frame.
After obtaining the data frame to be verified and the log data corresponding to the data frame, the data verification server may verify whether the encoding process for the data frame is correct according to the data frame and the log data, which will be described in detail below.
In particular implementations, the data frame includes at least one data item; verifying the correctness of the encoding processing aiming at the data frame according to the semantic correspondence between the log data and the data in the data frame comprises the following steps: acquiring a first data item, and acquiring a numerical type corresponding to the first data item, wherein the first data item is any one of the at least one data item; acquiring a first log data item corresponding to the first data item from the log data; verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type.
As described in step S2100, the data portion of the data frame may often include at least one data item, for example, may include a voltage, a current, and the like, and therefore, when verifying whether the encoding process of the data frame is correct, it is usually necessary to verify whether the value of each data item is consistent with the actual value of the data item in the log data, i.e., the value of the log data item.
In particular, the values of the data items in the data frame and the values of the log data items do not correspond to each other, for example, the values of the data items in the data frame are stored in hexadecimal format, and the values of the log data items may be stored in decimal or binary format.
For another example, in the data frame, the value of the data item may have a certain error with the corresponding data in the log data item, for example, for the vehicle positioning data, the log data may only write the positioning data of the shared vehicle at the beginning and ending time of a preset time duration, for example, the time duration of one minute being 15:00:00-15:01:00, and in the data frame, any one or more vehicle positioning data within the time duration may be written.
For another example, in the data frame, the values in the data items may be only a subset of the values in the log data items, for example, when the shared vehicle is precisely located, a first preset number, for example, the positioning data of 24 satellites, may be used simultaneously, and at this time, the log data items may include the 24 positioning data, and even may include a plurality of positioning data of the same satellite; due to the format limitation of the communication protocol corresponding to the data frame, only a second predetermined number, for example, 12 positioning data, may be written into the data frame.
In order to solve the problem that the numerical values of the data items in the data frame may not correspond to the numerical values in the log data items one to one in the data verification process, the embodiment of the disclosure verifies the data in the data frame by acquiring the numerical value types corresponding to the data items in the data frame and performing semantic extension, context expansion and other processing on the log data according to the semantic correspondence between the log data items and the data in the data frame, thereby verifying the correctness of the encoding processing for the data frame.
In one embodiment, the value type comprises a first preset value type, the first preset value type comprises a fixed value type; the verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type includes: under the condition that the numerical value type is a first preset numerical value type, comparing whether the numerical values of the first data item and the first log data item are the same or not to obtain a comparison result; under the condition that the comparison result represents that the first data item is different from the first log data item, performing data system conversion processing on the first log data item according to a data system type corresponding to the first data item to obtain a first semantic extension data item; determining that the encoding process for the data frame is correct in the event that the first data item and the first semantic extension data item are the same value.
The fixed numerical type is a numerical value with accurate numerical value and no fluctuation; the data items of the fixed execution value type may be, for example, a lock fault code, a component identification, and the like.
Specifically, when a first data item whose value type is a first preset data type is compared with a corresponding first log data item, the comparison may be performed once, that is, the value in the first data item is directly compared with the value of the first log data item, and if the values are the same, the processing is ended; and if not, performing automatic semantic extension processing to perform secondary comparison.
In this embodiment, when the comparison result indicates that the two values are different, the number system type corresponding to the first data item may be obtained first, that is, the number system corresponding to the value in the data item is obtained, and according to the value type, the number system in the first log data item is subjected to number system conversion, so that comparison is performed again under the same number system, and further, the accuracy of encoding processing for the data frame may be determined under the condition that encoding processing for other data items is also correct.
For example, the value in the first data item may be "0 a", and the value in its first log data item may be "10"; the two values can be found to be obviously different through one comparison; at this time, a number system corresponding to the first data item may be obtained first, that is, the number system is hexadecimal, and then the number system conversion may be performed on the value "10" in the first log data item to obtain the first semantic extension data item, and the value is "0 a"; and comparing the first data item with the first semantic extension data item to obtain the same data item and the same semantic extension data item.
In this embodiment, when two values of a comparison representation are different at a time, semantic extension processing is performed, that is, value conversion processing is performed on a first log data item; in a specific implementation, when performing the first alignment, an absolute value of a difference between the first data item and the first log data item may be acquired, and when the absolute value of the difference is greater than a certain threshold, the semantic extension processing may be performed, which is not particularly limited herein.
In the above, how to verify the data item when the value type corresponding to the first data item is the first preset value type is described in detail; hereinafter, a description will be given of how to verify the first data item when the value type corresponding to the data item is another type.
In one embodiment, the value type includes a second preset value type, and the first preset value type includes a fluctuation value type; the verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type includes: acquiring an absolute value of a difference value between the first data item and the first log data item when the numerical type is a second preset numerical type; acquiring a preset difference threshold corresponding to the first data item; determining that the encoding process for the data frame is correct if the absolute value of the difference is not greater than the preset difference threshold.
The fluctuation numerical value type means that the numerical value of the data item is variable and the fluctuation situation exists; the data items of the fluctuation value type have, for example, time stamps, signal strengths, etc.
In specific implementation, when the numerical value in the first data item is of the second preset data type, the absolute value of the difference value between the first data item and the first log data item is obtained, and a preset difference threshold corresponding to the first data item is obtained, wherein the preset difference threshold represents the fluctuation range of the numerical value of the data item; by comparing the absolute value of the difference with the preset difference threshold, it can be determined whether the value of the first data item is correct, and further, the correctness of the encoding process for the data frame can be determined under the condition that the encoding process of other data items is also correct.
In addition, the value type is a third preset value type, that is, a type in which a plurality of values are simultaneously contained in the data item, for example, the values in the data item are positioning data of different satellites for a shared vehicle; in this case, the verifying, according to the value type, the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item specifically includes: if the value type is a third preset data type, verifying whether the plurality of values in the first data item are contained in the first log data item; determining that the encoding process for the data frame is correct in a case where the plurality of numerical values are contained in the first log data item.
That is, in the implementation, for a type in which a plurality of values are included in a data item, after a first log data item corresponding to the type is obtained from log data, it is possible to directly verify whether or not the plurality of values in the first data item are a subset of the plurality of values in the first log data item, and if so, it is determined that the encoding process for the values in the data item is correct, and further, it is possible to determine that the encoding process for the data frame is correct in a case where the encoding process for other data items is also correct.
In addition, when the step of verifying whether the first log data item includes the plurality of values in the first data item is performed, whether the first log data item includes the plurality of values in the first data item may be verified by performing comparison processing in the corresponding type according to whether the plurality of values are of the first preset value type or the second preset value type, and according to the value type, and a detailed processing procedure thereof is not repeated here.
In the above, how to verify the encoding process for the data frame when the value in the data item in the data frame does not correspond to the value in the log data item corresponding to the data item is explained; in the present invention, the method of the first embodiment may be used in combination with the method of the second embodiment, or the method of the first embodiment may be used in combination with other methods.
In addition, it should be noted that, in the software system, when some types of data frames, for example, data frames related to charging, fail to be transmitted, retransmission processing is often designed for the types of data frames; however, when the encoding implements the retransmission process, there may be a possibility of errors, for example, the retransmission process is not designed, or the number of retransmissions is incorrect, and for this case, in implementation, the data verification method provided in this embodiment further includes: obtaining the retransmission times of the data frame in a preset time length from the log data; and determining the correctness of the transmission processing of the data frame according to the retransmission times.
That is, for each data frame, the retransmission times of the data frame within the preset time length can be calculated according to the corresponding log data, and the correctness of the transmission processing for the data frame is determined according to the retransmission times; the preset time duration may be, for example, a preset timeout duration, and the value of the preset time duration may be determined according to the type of the data frame, which is not particularly limited herein.
The retransmission times of the data frame in the preset time length can be counted from the log data according to the frame identifier of the data frame, and the preset time length can be calculated according to the transmission timestamp of the data frame; of course, in order to facilitate data verification, during the process of sending each data frame, the corresponding retransmission times may also be directly recorded in the log data, and the detailed processing procedure is not described herein again.
In a specific implementation, the determining the correctness of the transmission processing for the data frame according to the retransmission times includes: acquiring the frame type of the data frame; and determining that the transmission processing for the data frame is correct when the frame type is a preset frame type and the retransmission times are not more than a preset retransmission times, wherein the preset retransmission times correspond to the preset frame type.
Specifically, different frame types are often associated with different numbers of retransmissions, and therefore, a correspondence relationship between a frame type and a number of retransmissions may be stored in advance, and when a transmission process of a data frame is verified, after the number of retransmissions of the data frame is obtained from log data, a preset number of retransmissions corresponding to the data frame to be verified may be obtained from the correspondence relationship between the frame type and the number of retransmissions according to the frame type of the data frame, and it may be determined whether the transmission process is correct or not according to the preset number of retransmissions and an actual number of retransmissions of the data frame.
It should be noted that, in this embodiment, in the case where the number of retransmissions is not greater than the preset number of retransmissions, it is determined that the transmission process for the data frame is correct; in specific implementation, the condition may also be set according to specific needs, which is not described herein again.
In summary, when verifying the correctness of the encoding process for the data frame, the data frame to be verified can be acquired by the electronic device without relying on manual work, the log data generated in the process of acquiring the data frame by encoding is obtained, and whether the encoding process is correct or not can be quickly and accurately verified according to the semantic correspondence between the log data and the data in the data frame; moreover, the retransmission times of the data frame are obtained from the log data, and the correctness of the transmission processing aiming at the data frame can be verified, so that the data verification efficiency is further improved, manpower and material resources are saved, and the user experience is improved.
< apparatus embodiment >
Corresponding to the above method embodiments, this embodiment further provides a data verification apparatus, and as shown in fig. 3, the apparatus 3000 may include a data frame obtaining module 3100, a log data obtaining module 3200, and a data verification module 3300.
The data frame acquiring module 3100 is configured to acquire a data frame to be verified.
The log data obtaining module 3200 is configured to obtain log data corresponding to the data frame, where the log data includes log data generated in a process of obtaining the data frame by encoding.
The data verification module 3300 is configured to verify correctness of encoding processing for the data frame according to a correspondence between the log data and data in the data frame.
In one embodiment, the data frame includes at least one data item, and the data verification module 3300, when verifying correctness of the encoding process for the data frame according to the semantic correspondence between the log data and the data in the data frame, may be configured to: acquiring a first data item, and acquiring a numerical type corresponding to the first data item, wherein the first data item is any one of the at least one data item; acquiring a first log data item corresponding to the first data item from the log data; verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type.
In one embodiment, the value type comprises a first preset value type, the first preset value type comprises a fixed value type; the data verification module 3300, when verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type, may be configured to: under the condition that the numerical value type is a first preset numerical value type, comparing whether the numerical values of the first data item and the first log data item are the same or not to obtain a comparison result; under the condition that the comparison result represents that the first data item is different from the first log data item, performing data system conversion processing on the first log data item according to a data system type corresponding to the first data item to obtain a first semantic extension data item; determining that the encoding process for the data frame is correct in the event that the first data item and the first semantic extension data item are the same value.
In one embodiment, the value type includes a second preset value type, and the first preset value type includes a fluctuation value type; the data verification module 3300, when verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type, may be configured to: acquiring an absolute value of a difference value between the first data item and the first log data item when the numerical type is a second preset numerical type; acquiring a preset difference threshold corresponding to the first data item; determining that the encoding process for the data frame is correct if the absolute value of the difference is not greater than the preset difference threshold.
In one embodiment, the value type includes a third preset value type, and the first data item includes a plurality of values; the data verification module 3300, when verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type, may be configured to: if the value type is a third preset data type, verifying whether the plurality of values in the first data item are contained in the first log data item; determining that the encoding process for the data frame is correct in a case where the plurality of numerical values are contained in the first log data item.
In one embodiment, the apparatus 3000 further comprises a transmission process verification module configured to: obtaining the retransmission times of the data frame in a preset time length from the log data; and determining the correctness of the transmission processing of the data frame according to the retransmission times.
In this embodiment, the transmission process verifying module, when determining the correctness of the transmission process for the data frame according to the retransmission times, may be configured to: acquiring the frame type of the data frame; and determining that the transmission processing for the data frame is correct when the frame type is a preset frame type and the retransmission times are not more than a preset retransmission times, wherein the preset retransmission times correspond to the preset frame type.
< apparatus embodiment >
Corresponding to the above embodiments, in this embodiment, there is also provided an electronic device, which may include the data verification apparatus 3000 according to any embodiment of the present invention, for implementing the data verification method according to any embodiment of the present invention.
As shown in fig. 4, the electronic device 4000 may further comprise a processor 4200 and a memory 4100, the memory 4100 being configured to store executable instructions; the processor 4200 is configured to operate the electronic device under the control of instructions to perform a data verification method according to any embodiment of the present invention.
The various modules of the above apparatus 3000 may be implemented by the processor 4200 executing the instructions to perform a data verification method according to any embodiment of the present invention.
The electronic device 4000 may be a server, or may be other types of devices, such as a terminal device, and the like, which is not limited herein, and for example, the electronic device 4000 may be the server 1100 in fig. 1, and the like.
The present invention may be a system, method and/or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied therewith for causing a processor to implement various aspects of the present invention.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present invention may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, aspects of the present invention are implemented by personalizing an electronic circuit, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA), with state information of computer-readable program instructions, which can execute the computer-readable program instructions.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. It is well known to those skilled in the art that implementation by hardware, by software, and by a combination of software and hardware are equivalent.
Having described embodiments of the present invention, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein. The scope of the invention is defined by the appended claims.

Claims (10)

1. A method of data validation, comprising:
acquiring a data frame to be verified;
acquiring log data corresponding to the data frame, wherein the log data comprises log data generated in the process of encoding to obtain the data frame;
and verifying the correctness of the coding processing aiming at the data frame according to the semantic corresponding relation between the log data and the data in the data frame.
2. The method of claim 1, the data frame comprising at least one data item;
verifying the correctness of the encoding processing aiming at the data frame according to the semantic correspondence between the log data and the data in the data frame comprises the following steps:
acquiring a first data item, and acquiring a numerical type corresponding to the first data item, wherein the first data item is any one of the at least one data item;
acquiring a first log data item corresponding to the first data item from the log data;
verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type.
3. The method of claim 2, the value type comprising a first preset value type, the first preset value type comprising a fixed value type;
the verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type includes:
under the condition that the numerical value type is a first preset numerical value type, comparing whether the numerical values of the first data item and the first log data item are the same or not to obtain a comparison result;
under the condition that the comparison result represents that the first data item is different from the first log data item, performing data system conversion processing on the first log data item according to a data system type corresponding to the first data item to obtain a first semantic extension data item;
determining that the encoding process for the data frame is correct in the event that the first data item and the first semantic extension data item are the same value.
4. The method of claim 2, the value type comprising a second preset value type, the first preset value type comprising a fluctuating value type;
the verifying the correctness of the encoding process for the data frame by verifying the consistency between the first data item and the first log data item according to the value type includes:
acquiring an absolute value of a difference value between the first data item and the first log data item when the numerical type is a second preset numerical type;
acquiring a preset difference threshold corresponding to the first data item;
determining that the encoding process for the data frame is correct if the absolute value of the difference is not greater than the preset difference threshold.
5. The method of claim 2, the value type comprising a third preset value type, the first data item comprising a plurality of values;
the verifying whether the encoding process for the data frame is correct by verifying consistency between the first data item and the first log data item according to the value type includes:
if the value type is a third preset data type, verifying whether the plurality of values in the first data item are contained in the first log data item;
determining that the encoding process for the data frame is correct in a case where the plurality of numerical values are contained in the first log data item.
6. The method of claim 1, further comprising:
obtaining the retransmission times of the data frame in a preset time length from the log data;
and determining the correctness of the transmission processing of the data frame according to the retransmission times.
7. The method of claim 6, wherein said determining the correctness of the transmission process for the data frame based on the number of retransmissions comprises:
acquiring the frame type of the data frame;
and determining that the transmission processing for the data frame is correct when the frame type is a preset frame type and the retransmission times are not more than a preset retransmission times, wherein the preset retransmission times correspond to the preset frame type.
8. The method of claim 1 applied to a shared vehicle system, the data in the data frame including status data characterizing the operating status of the shared vehicle.
9. A data verification apparatus, comprising:
the data frame acquisition module is used for acquiring a data frame to be verified;
a log data obtaining module, configured to obtain log data corresponding to the data frame, where the log data includes log data generated in a process of obtaining the data frame by encoding;
and the data verification module is used for verifying the correctness of the coding processing aiming at the data frame according to the corresponding relation between the log data and the data in the data frame.
10. An electronic device comprising the apparatus of claim 9; alternatively, the first and second electrodes may be,
the electronic device includes:
a memory for storing executable instructions;
a processor configured to execute the electronic device to perform the method according to the control of the instruction, wherein the method is as claimed in any one of claims 1 to 8.
CN202011553655.3A 2020-12-24 2020-12-24 Data verification method and device and electronic equipment Withdrawn CN112631916A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011553655.3A CN112631916A (en) 2020-12-24 2020-12-24 Data verification method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011553655.3A CN112631916A (en) 2020-12-24 2020-12-24 Data verification method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN112631916A true CN112631916A (en) 2021-04-09

Family

ID=75324713

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011553655.3A Withdrawn CN112631916A (en) 2020-12-24 2020-12-24 Data verification method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112631916A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107015991A (en) * 2016-01-28 2017-08-04 阿里巴巴集团控股有限公司 Self checking method, device, system and the service apparatus of data consistency
CN107317723A (en) * 2017-05-27 2017-11-03 北京金山安全软件有限公司 Data processing method and server
CN108111464A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of data verification method and device
CN108268354A (en) * 2016-12-30 2018-07-10 腾讯科技(深圳)有限公司 Data safety monitoring method, background server, terminal and system
CN110188113A (en) * 2019-05-09 2019-08-30 厦门市美亚柏科信息股份有限公司 Method, device and storage medium for comparing data by using complex expression
CN111027977A (en) * 2019-11-22 2020-04-17 中汇信息技术(上海)有限公司 Data verification method and device and electronic equipment
CN111352760A (en) * 2020-02-27 2020-06-30 深圳市腾讯网域计算机网络有限公司 Data processing method and related device
CN111666193A (en) * 2019-03-08 2020-09-15 阿里巴巴集团控股有限公司 Method and system for monitoring and testing terminal function based on real-time log analysis
CN111885051A (en) * 2020-07-22 2020-11-03 微医云(杭州)控股有限公司 Data verification method and device and electronic equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107015991A (en) * 2016-01-28 2017-08-04 阿里巴巴集团控股有限公司 Self checking method, device, system and the service apparatus of data consistency
CN108111464A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of data verification method and device
CN108268354A (en) * 2016-12-30 2018-07-10 腾讯科技(深圳)有限公司 Data safety monitoring method, background server, terminal and system
CN107317723A (en) * 2017-05-27 2017-11-03 北京金山安全软件有限公司 Data processing method and server
CN111666193A (en) * 2019-03-08 2020-09-15 阿里巴巴集团控股有限公司 Method and system for monitoring and testing terminal function based on real-time log analysis
CN110188113A (en) * 2019-05-09 2019-08-30 厦门市美亚柏科信息股份有限公司 Method, device and storage medium for comparing data by using complex expression
CN111027977A (en) * 2019-11-22 2020-04-17 中汇信息技术(上海)有限公司 Data verification method and device and electronic equipment
CN111352760A (en) * 2020-02-27 2020-06-30 深圳市腾讯网域计算机网络有限公司 Data processing method and related device
CN111885051A (en) * 2020-07-22 2020-11-03 微医云(杭州)控股有限公司 Data verification method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN111159049B (en) Automatic interface testing method and system
CN108959068B (en) Software interface testing method, device and storage medium
CN110825411B (en) Upgrading method and device for TWS (two way satellite System) earphone system and computer-readable storage medium
CN110941942A (en) Method, device and system for checking circuit schematic diagram
CN110674047A (en) Software testing method and device and electronic equipment
CN111708557A (en) Method, device and storage medium for updating configuration file
CN114579379A (en) Test method and device, electronic equipment and storage medium
CN113572560B (en) Method, electronic device, and storage medium for determining clock synchronization accuracy
CN109032956B (en) Interface testing method and device
CN108540344B (en) Router upgrading test method and system
KR101792864B1 (en) System and Method for verifying application
CN114647572A (en) Method and system for software application component testing
CN109582524A (en) A kind of test method, system and electronic equipment and storage medium
CN112527678A (en) Method, apparatus, device and storage medium for testing protocol
CN112631916A (en) Data verification method and device and electronic equipment
CN107562629B (en) Method and device for testing
CN110717315A (en) System data batch modification method and device, storage medium and electronic equipment
CN107678917B (en) Test machine automation management method, device, equipment and storage medium
CN112948195B (en) Interface testing method, device, electronic equipment and storage medium
CN112995254B (en) Method, equipment, system, device and component for transmitting heartbeat information
CN114296757A (en) Software upgrading method and device for wearable equipment, wearable equipment and medium
CN114564381A (en) Complete machine production and test method for Internet of things equipment
CN113515447A (en) System automation test method and device
CN110795338A (en) Automatic testing method and device based on front-end and back-end interaction and electronic equipment
CN114371866A (en) Version reconfiguration test method, device and equipment of service system

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20210409

WW01 Invention patent application withdrawn after publication