CN114816965A - Data verification method and device - Google Patents

Data verification method and device Download PDF

Info

Publication number
CN114816965A
CN114816965A CN202110064476.1A CN202110064476A CN114816965A CN 114816965 A CN114816965 A CN 114816965A CN 202110064476 A CN202110064476 A CN 202110064476A CN 114816965 A CN114816965 A CN 114816965A
Authority
CN
China
Prior art keywords
test
test case
data
target
case
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110064476.1A
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110064476.1A priority Critical patent/CN114816965A/en
Publication of CN114816965A publication Critical patent/CN114816965A/en
Pending 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/3684Test management for test design, e.g. generating new test cases

Abstract

The application provides a data verification method and device, wherein a test case is received, environment data of the current environment where test equipment is located are obtained, field values of test fields matched with the environment data in the test case are updated according to the environment data to obtain a target test case, the target test case is sent to the test equipment, test data generated when the target test case is used in the test equipment by a virtual test account are obtained, and the test data are used for verifying data verification conditions to achieve the purpose that the data verification conditions are verified according to the target test case matched with the environment data. The test case is generated according to the attribute and the attribute value in the data verification condition, which means that the target test case is generated at least according to the attribute and the attribute value in the data verification condition, so that the target test case for verifying the data verification condition is constructed according to the attribute and the attribute value in the data verification condition, the generation efficiency is improved, and the time and the labor consumption in the data verification process are reduced.

Description

Data verification method and device
Technical Field
The present application belongs to the technical field of data processing, and in particular, to a data verification method and apparatus.
Background
The current data verification condition is at least used for controlling the preset operation matched with the data verification condition, if the currently acquired data accords with the data verification condition, the preset operation matched with the data verification condition is indicated to be successful, and the data verification condition is effective; and if the currently acquired data does not accord with the data verification condition, indicating that the preset operation matched with the data verification condition fails and the data verification condition is invalid. However, at present, the verification of the data verification conditions is realized by manually constructing a data verification rule matched with the data verification conditions by a user, verifying the data verification conditions by the data verification rule, and manually modifying the data verification rule by the user to rebuild the data verification conditions after the data verification conditions are updated, so that the data verification process is time-consuming and labor-consuming.
Disclosure of Invention
In view of this, an object of the present application is to provide a data verification method and apparatus, which are used to solve the problem of time and labor consumption in the data verification process.
In one aspect, the present application provides a data verification method, including:
receiving a test case, wherein the test case is generated according to attributes and attribute values in the data verification conditions;
obtaining environmental data of the current environment of the test equipment;
updating the field value of a test field matched with the environmental data in the test case according to the environmental data to obtain a target test case;
sending the target test case to the test equipment;
and obtaining test data generated when the target test case is used in the test equipment by the virtual test account, wherein the test data is used for verifying the data verification condition.
Optionally, the updating, according to the environment data, a field value of a test field matched with the environment data in the test case to obtain a target test case includes:
determining a target test field matched with the meaning of the target parameter in the test case according to the target parameter in the environment data, wherein the target parameter comprises at least one of a time parameter, a position parameter and a network parameter;
and updating the field value of the target test field by using the parameter value of the target parameter so that the target test case contains the field value matched with the parameter value of the target parameter.
Optionally, the method further includes:
logging in a test case management interface by using a management account;
displaying each test field in the test case and the field value of the test field in the test case management interface;
receiving an updating instruction of the test case, wherein the updating instruction is used for indicating that the test case is updated;
updating the field value of the test field matched with the environment data in the test case according to the environment data to obtain a target test case, wherein the target test case comprises:
responding to the updating instruction, determining a target test field appointed by the updating instruction from the test case, obtaining a field value of the target test field input by a management user based on the environment data, and obtaining the target test case, wherein the target test field is a test field matched with the environment data.
Optionally, the method further includes:
in the process of monitoring the logging-in of the test case management interface, performing anti-serialization processing on serialized data representing the test case to obtain each test field in the test case and the field value of the test field;
after the target test case is obtained, the target test case is serialized to obtain serialized data representing the target test case, so that the serialized data representing the target test case is sent to the test equipment.
In another aspect, the present application provides a data verification method, including:
obtaining each attribute and attribute value of the attribute in the data verification condition;
obtaining test case data according to each attribute and attribute value of the attribute in the data verification condition;
generating at least one test case according to the test fields in the test case data and the field values of the test fields;
and sending the at least one test case.
Optionally, the method further includes: carrying out serialization processing on the at least one test case to obtain serialization data for representing the at least one test case;
packaging the serialized data by a preset protocol to obtain a test request representing the at least one test case;
the sending the at least one test case includes: and sending a test request for representing the at least one test case by using the request sending script.
In yet another aspect, the present application provides a data verification apparatus, the apparatus comprising:
the receiving unit is used for receiving a test case, and the test case is generated according to the attribute and the attribute value in the data verification condition;
the obtaining unit is used for obtaining environmental data of the current environment of the test equipment;
the updating unit is used for updating the field value of the test field matched with the environment data in the test case according to the environment data to obtain a target test case;
a sending unit, configured to send the target test case to the test device;
and the verification unit is used for obtaining test data generated when the target test case is used in the test equipment by the virtual test account, and the test data is used for verifying the data verification condition.
In yet another aspect, the present application provides a data verification apparatus, the apparatus comprising:
the attribute obtaining unit is used for obtaining each attribute and the attribute value of the attribute in the data verification condition;
the case obtaining unit is used for obtaining test case data according to each attribute and the attribute value of the attribute in the data verification condition;
the generating unit is used for generating at least one test case according to the test field in the test case data and the field value of the test field;
and the case sending unit is used for sending the at least one test case.
In yet another aspect, the present application provides an apparatus comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the data validation method described above.
In still another aspect, the present application provides a storage medium having computer program code stored therein, where the computer program code is executed to implement the data verification method.
The data verification method and the device receive the test case, obtain the environmental data of the current environment of the test equipment, update the field value of the test field matched with the environmental data in the test case according to the environmental data to obtain the target test case, send the target test case to the test equipment, and obtain the test data generated when the target test case is used in the test equipment by the virtual test account, wherein the test data is used for verifying the data verification condition, so that the data verification condition is verified according to the target test case matched with the environmental data. The test case is generated according to the attribute and the attribute value in the data verification condition, which means that the target test case is generated at least according to the attribute and the attribute value in the data verification condition, so that the target test case for verifying the data verification condition is constructed through the attribute and the attribute value in the data verification condition, and compared with the situation that a user manually constructs a data verification rule corresponding to the data verification condition, the generation efficiency of the target test case is improved, and the time and the labor consumption in the data verification process are reduced.
After the data verification condition is updated, the test fields in the test cases and the field values of the test fields are adjusted according to the attributes and the attribute values in the data verification condition, and compared with the method for reconstructing the data verification rule, the modification of the test cases is simplified, and time and labor consumption in the data verification process is further reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be 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 application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a system architecture diagram corresponding to a data verification method provided in an embodiment of the present application;
fig. 2 is a signaling diagram of a data verification method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of setting a card punching rule according to an embodiment of the present application;
FIG. 4 is a schematic diagram of another example of setting a card punching rule provided by the embodiment of the present application;
FIG. 5 is a schematic diagram of another setting of a card punching rule provided by an embodiment of the present application;
FIG. 6 is a schematic diagram of another setting of a card punching rule provided by an embodiment of the present application;
fig. 7 is a signaling diagram of another data verification method provided in an embodiment of the present application;
fig. 8 is a schematic structural diagram of a data verification apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of another data verification apparatus according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. 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 application.
Referring to fig. 1, a system architecture diagram corresponding to a data verification method provided in an embodiment of the present application is shown, where the system architecture diagram may include: a use case generating apparatus 100, a use case managing apparatus 200, and a testing apparatus 300, wherein the use case generating apparatus 100 and the use case managing apparatus 200 have at least an input function, a display function, and an output function, for example, the use case generating device 100 and the use case managing device 200 may be a computer, a monitoring platform, or the like, the testing device 300 has at least an input function, an output function, and a testing function, for example, the test equipment 300 may be dependent on data verification conditions, such as data verification conditions for verifying the punch-card data, to verify whether to punch the card according to the punching time of the data verification condition and whether the punching success is matched with the punching time of the data verification condition, the testing device 300 may be a card punch or an electronic device installed with card punching software, for example, the testing device 300 may be a card punch for punching a card through biometric information or a mobile phone installed with card punching software, etc.
A use case generating device 100 for generating a test use case matching the data verification condition; the use case management device 200 is configured to update a test field in the test case after receiving the test case, so as to obtain a target test case matched with an environment where the test device is located, where a manner of updating the test field in the test case may be, but is not limited to, updating a field value of the test field in the test case according to environment data of the environment where the test device is currently located.
The test device 300 is configured to use/run/execute the target test case to obtain test data for verifying the data verification condition, where one expression form of the test data is a verification result of the data verification condition, and send the verification result of the data verification condition to the case management device 200, so that the verification result of the data verification condition is stored by the case management device 200, and thus the verification results of different data verification conditions can be checked by the case management device 200; or another manifestation of the test data is: the test equipment determines the verification result of the data verification condition by comparing the running data with the data verification condition by using the running data generated in the target test case process, and for the expression form of the test data, the test equipment 300 can send the test data to the case management equipment 200, and the case management equipment 200 determines the verification result of the data verification condition.
For example, one data verification condition is a verification condition related to a card punching rule, a preset card punching time of the card punching rule is set in the data verification condition, and if the preset on-duty card punching time and the preset off-duty card punching time are set in the data verification condition, the target test case is used as an on-duty card punching case, and the test device 300 is used/operated/executed on-duty card punching case to obtain card punching data as test data. The card punching data can be the working card punching time and the working card punching time (namely running data) obtained in the process of using/running/executing the working card punching cases, the working card punching success or failure is determined through the working card punching time and the preset working card punching time, or the card punching data is the verification result of the working card punching success/failure.
The above-mentioned use case generating device 100, use case managing device 200 and testing device 300 may perform data interaction through at least one of a wireless and a wired manner, but the present embodiment is not limited thereto. The case management device 200 and the test device 300 may be integrated in one device, for example, integrated in one server, the test case generated by the case generation device 100 is sent to the server integrated with the case management device 200 and the test device 300, the environment data of the current environment of the server is obtained, the server updates the test case to generate a target test case, and then the server calls the virtual test account to obtain the test data corresponding to the virtual test account.
Please refer to fig. 2, which shows a signaling diagram of a data verification method provided in an embodiment of the present application, and the signaling diagram may include the following steps:
s101: and the use case generating equipment obtains each attribute and the attribute value of the attribute in the data verification condition.
The data verification condition is at least used for controlling a preset operation matched with the data verification condition, such as whether the test equipment can execute the preset operation matched with the data verification condition, and whether the preset operation is successful or failed can be determined. For example, one expression of a data validation condition is a validation condition that relates the data validation condition to a card punching rule, the data validation condition includes an on-duty card punching condition and an off-duty card punching condition, and at least one of the on-duty card punching condition and the off-duty card punching condition includes: at least one of a time, a location, and a network parameter, the defined condition for controlling a card punch operation. At least one of the on-duty card-punching condition and the off-duty card-punching condition includes a parameter determined as an attribute, and a parameter value determined as an attribute value.
Taking the on-duty card punching condition as an example, the time can be the on-duty card punching time, the on-duty card punching is carried out before a certain preset time or between certain preset time periods through the on-duty card punching time limit, or the time which does not need to be carried out is limited through the on-duty card punching time; the position can be the position where the card is punched on duty, so as to define which position to punch the card on duty; the network parameters are used for limiting the network where the electronic equipment is located when the electronic equipment is used for punching a card on duty, and are mainly used for limiting the network where the electronic equipment is located in the process of performing online punching on the electronic equipment provided with the punching software. The at least one of the time, location and network parameters defining conditions may be considered environment data associated with the environment, and in addition to these defining conditions, the at least one of the on-duty card printing conditions and the off-duty card printing conditions may further include: the identification of the electronic equipment and/or the identification of the card punch person, the identification of the electronic equipment is used for limiting the electronic equipment used when the card punch operation is performed, for example, at least one of a mobile phone number and a social software account (such as a WeChat account) of the electronic equipment can be used as the identification of the electronic equipment, the identification of the card punch person is used for limiting the user identity when the card punch operation is performed, for example, the identification of the card punch person can be represented by a virtual test account, for the following reasons:
during the verification process, session information needs to be used, and the session information can be obtained only by logging in the test equipment through a normal account (i.e. an account of a real-existing object, such as an account of an employee of a company), for example, after logging in through a WeChat account/a mobile phone number. However, it takes a lot of time and resources (such as a WeChat account/a mobile phone number) for the test equipment to bind a normal account for login for each real object, and login can be performed only by authorization of each real object or cooperation of each real object, which all affect the verification process.
S102: and the case generating equipment obtains the test case data according to each attribute and the attribute value of the attribute in the data verification condition. One possible way is: and determining each attribute in the data verification condition as a test field, and determining the attribute value of the attribute as the field value of the test field, thereby obtaining the test case data. The test fields in the test case data and the field values of the test fields can be obtained by processing the data verification conditions such as natural semantic analysis, or manually input by a user according to each attribute and the attribute value of the attribute in the data verification conditions.
S103: and the case generating equipment generates at least one test case according to the test field in the test case data and the field value of the test field.
After the test case data is obtained, at least one test case is obtained by pairing the test fields in the test case data and the field values of the test fields, for example, at least one test case is obtained by pairing the field values of the test fields and the test fields through but not limited to a pairing test method (Pairwise Testing), wherein the pairing test method is also called a pairing test method or a Pairwise test method, and is a test technology of orthogonal analysis, and at least one test path is covered through the pairing test method, so that at least one test case is obtained. In this embodiment, all test paths covered by the test fields and the field values of the test fields can be covered by the pairing test method, so that one test case corresponding to each test path is obtained, and the comprehensive test on the test fields and the field values of the test fields is realized.
For example, the test fields in the test case data and the field values of the test fields are as follows:
A:1、2、3;
B:true、false;
C:4、5、6。
the data verification condition is to execute pict xx.txt > yy.txt to input the data into xx.txt, and the corresponding yy.txt obtained by the pairing test method is as follows:
Figure BDA0002903608410000081
obtaining yy.txt line 1 test case data "3 true 4", wherein the corresponding test case is as follows: proto example a ═ 1, proto example B ═ false, proto example C ═ 4.
For example, the data verification condition is used to define "synchronized chinese holidays" in the card punching rule, and as shown in fig. 3, the card punching rule is provided with an attribute of "synchronized chinese holidays". The attribute of "synchronous chinese holiday" can be used as a test field in the test case data — a "sync _ holidabys" field, and the check state of the attribute of "synchronous chinese holiday" indicates the value (True or False) of the "sync _ holidabys" field, so that the obtained test case data is ". sync _ holidabys: true, False ", can be entered by a user manually input,". sync _ holiys: true, False ". The test field is spliced with the field value in the assignment script to form a character string in the form of a proto instance, wherein the field name is a value, and the assignment of the test field is completed by utilizing the characteristic of exec in python, such as obtaining proto instance, sync _ holideas, True or proto instance, sync _ holideas, False.
For another example, one attribute of the data verification condition includes a sub-attribute, as shown in fig. 4, and the card-punching rule includes a "date on which a card must be punched" attribute, and the attribute includes at least one sub-attribute, as shown in fig. 5, under which a card-punching time corresponding to the card-punching date can be added. The attribute value of the "date that must be punched" attribute in fig. 4 can be essentially divided into 2 types: with (True) and without (False), i.e., click on the "add" button and not click on the "add" button. The test case data thus obtained is ". spe _ workdays: true, False ", if there are child attributes, the test case data also includes the test field corresponding to the child attribute and the field value of the test field corresponding to the child attribute, such as". spe _ workdaystuses: the test cases are obtained by splicing the test fields with the field values through an assignment script, and then assigning, for example, obtaining proto instances.
For another example, two attributes in the data verification condition are related, and the card punching rule includes an attribute of "card punching place" as shown in fig. 6, and the "card punching place" can be divided into three settings: the method comprises the steps of setting only the position, only the WIFI and simultaneously setting the position and the WIFI, wherein attribute values of two attributes of the position and the WIFI are characterized by the contents of the position and the WIFI, and a value is additionally added to represent attribute types, if the position represents the attribute type through 1, and the WIFI represents the attribute type through 2. Since the card punching place has the three settings, the present embodiment can define which setting is performed by an input instruction for such a case with a plurality of settings. For a card punch-out location, for example, the input instruction is used to indicate which of the location and WIFI is set, for example, the input instruction is in the form of ". WIFI _ or _ loc: 1, 2, 3 ", the field value of the generated test case on the wifi _ or _ loc test field is one of 1, 2 and 3. If the phase of the field value and the phase of 1 is 1, assigning a value to the test field of the WIFI; and if the field value is 1 in the sum of 2, assigning the test field of the position. Therefore, three settings of "card punch place" can be expressed using three field values of 1, 2, and 3.
Assume that the input command is ". wifi _ or _ loc: if the result is null (or 0), and 3 ″, if the phase 3 and the phase 1 are 1, and the phase 3 and the phase 2 are 1, the value is assigned to the test field of the WIFI through the assignment script, and the value is also assigned to the test field of the position; assume that the input command is ". wifi _ or _ loc: null (or 0), 2, null (or 0) ", 2 and 1 being 0, 2 and 2 being 1, then the assignment script assigns a value to the test field of the location.
S104: and the case generating equipment sends at least one test case to the case management equipment.
And a transmission channel is established between the case generation equipment and the case management equipment, and at least one test case is sent to the case management equipment through the transmission channel.
In this embodiment, in order to facilitate transmission of the test cases, after obtaining at least one test case, at least one test case is serialized to obtain serialized data representing the at least one test case; packaging the serialized data by a preset protocol to obtain a test request representing at least one test case; correspondingly sending at least one test case, comprising: and sending a test request for representing at least one test case by using the request sending script.
After serialization processing and packaging, a test request is more reliable and safer to transmit compared with a test case, for example, the test case is represented by proto, the test case is compiled into a py file through protoc, serialization processing is performed by defining SerializeToString in the py file, and if the test case needs to be updated, deserialization processing is performed on serialized data through ParseFromString defined in the py file, so that the test case is obtained.
After the test cases are serialized, the serialized data can be encapsulated through a Common Gateway Interface (CGI) protocol to obtain a test request capable of representing at least one test case, for example, the test request obtained through encapsulation represents all the test cases, so that after a request sending script is used for sending the test request to the case management equipment, the case management equipment can obtain all the test cases through deserialization to realize batch sending of the test cases.
S105: the case management equipment obtains the environmental data of the current environment of the test equipment. The purpose of obtaining the environmental data of the current environment of the test equipment by the use case management equipment is as follows: and modifying the test case to enable the content in the test case to be matched with the environment data.
The environment data contains various environment parameters, such as position, time, network environment, climate and the like, and some of the environment parameters in the aspects are irrelevant to the test case, so that after the environment data of the current environment of the test equipment is obtained, target parameters can be screened from the environment data, and the target parameters are used for updating the test case, for example, the target parameters comprise at least one of time parameters, position parameters and network parameters; or, in the process of obtaining the environmental data, determining the environmental parameters related to the test case, and obtaining only the data corresponding to the environmental parameters related to the test case in the current environment where the test device is located, that is, obtaining only the target parameters related to the test case in the current environment where the test device is located.
If the case management device receives a test request representing at least one test case, after the test request is received, the test request is subjected to deserialization processing to obtain the test case, so that the test case can be updated (or corrected), and the deserialization processing can be performed through the ParseFromString.
S106: and updating the field value of the test field matched with the environmental data in the test case by the case management equipment according to the environmental data to obtain a target test case, so that the target test case is matched with the environmental data. One way of updating is as follows:
determining a target test field matched with the meaning of a target parameter in the test case according to the target parameter in the environment data, wherein the target parameter comprises at least one of a time parameter, a position parameter and a network parameter; and updating the field value of the target test field by using the parameter value of the target parameter so that the target test case contains the field value matched with the parameter value of the target parameter.
For example, the field values of the test fields related to time, location and network in the test case are modified so that the field values of the test fields of these types match the parameter values of the target parameters. For example, the field value of the test field representing the time in the test case is modified to be close to the time in the target parameter or the same as the time in the target parameter, so that the time in the target test case is modified to be close to or the same as the current time of the test equipment. Similarly, for the position and the network parameter, the field value of the test field representing the position in the target test case can be modified to be close to or the same as the position in the target parameter, and the field value of the test field representing the network parameter in the target test case is modified to be the same as the network parameter in the target parameter, so that verification failure caused by the fact that the field value of the test field in the target test case is not matched with the environment data is avoided.
S107: and the case management equipment sends the target test case to the test equipment.
After the target test case is obtained, the target test case can be serialized to obtain serialized data representing the target test case; packaging the serialized data by a preset protocol to obtain a test request representing a target test case; the corresponding sending target test case comprises the following steps: and sending a test request for representing the target test case by using the request sending script.
For example, after the target test case is compiled into a py file through protoc, serialization processing is performed by defining serializtostring in the py file, after the target test case is serialized, serialized data can be encapsulated through a CGI protocol to obtain a test request capable of representing the target test case, and the test request capable of representing the target test case is sent to test equipment.
S108: the case management equipment obtains test data generated when the virtual test account uses the target test case in the test equipment, and the test data is used for verifying data verification conditions.
After receiving a test request for representing a target test case, the test equipment logs in by using the virtual test account, and after the login succeeds, test data generated in the process that the virtual test account executes an operation process indicated by the target test case is acquired, wherein the operation indicated by the target test case is a preset operation corresponding to a data verification condition. Taking the data verification condition related to the card punching rule as an example, the operation corresponding to the data verification condition is a card punching operation, and the operation indicated by the corresponding target test case is also a card punching operation, so that the test equipment is triggered to punch a card by using the virtual test accounts, test data is generated in the card punching process, if the generated test data is used for indicating when the virtual test accounts are used for punching the card, then the data verification condition is verified based on the test data, and whether the test data is matched with the operation corresponding to the data verification condition is mainly verified.
Still taking the above-mentioned card punching rule as an example, the data verification condition of the card punching rule indicates the card punching time, the test data contains the card punching time, and whether the virtual test account punches the card at the card punching time indicated by the data verification condition can be determined by comparing the two card punching times, if so, the verification is successful, the data verification condition is valid, otherwise, the card punching is failed, and the data verification condition is invalid. The verification process for the data verification conditions corresponding to different preset operations may be different, and this embodiment is not described one by one.
The data verification method comprises the steps of receiving a test case, obtaining environment data of the current environment of the test equipment, updating the field value of a test field matched with the environment data in the test case according to the environment data to obtain a target test case, sending the target test case to the test equipment, obtaining test data generated when the target test case is used in the test equipment by a virtual test account, and verifying data verification conditions by the test data, so that the data verification conditions are verified according to the target test case matched with the environment data. The test case is generated according to the attribute and the attribute value in the data verification condition, which means that the target test case is generated at least according to the attribute and the attribute value in the data verification condition, so that the target test case for verifying the data verification condition is constructed through the attribute and the attribute value in the data verification condition, and compared with the situation that a user manually constructs a data verification rule corresponding to the data verification condition, the generation efficiency of the target test case is improved, and the time and the labor consumption in the data verification process are reduced.
After the data verification condition is updated, the test fields in the test cases and the field values of the test fields are adjusted according to the attributes and the attribute values in the data verification condition, and compared with the method for reconstructing the data verification rule, the modification of the test cases is simplified, and time and labor consumption in the data verification process is further reduced.
In this embodiment, the process of obtaining the target test case by the case management device may be implemented by using a test case management interface, and the process is shown in fig. 7, and may include the following steps:
s201: and the use case generating equipment obtains each attribute and the attribute value of the attribute in the data verification condition.
S202: and the case generating equipment obtains the test case data according to each attribute and the attribute value of the attribute in the data verification condition.
S203: and the case generating equipment generates at least one test case according to the test field in the test case data and the field value of the test field.
S204: and the case generating equipment sends at least one test case to the case management equipment.
S205: the case management equipment obtains the environmental data of the current environment of the test equipment.
S206: and the case management equipment logs in the test case management interface by using the management account. The management account has the authority to manage and correct the test case, and the test case may need to be managed and corrected after the test case is obtained, so the test case management interface is logged in by using the management account in the embodiment, and the form of the test case management interface is not limited in the embodiment.
S207: the case management equipment displays each test field in the test case and the field value of the test field in the test case management interface so as to visually check and correct the test case through the test case management interface.
If the case management device receives the test request obtained after the serialization processing, the case management device conducts the deserialization processing on the serialized data representing the test case in the process of monitoring the login of the test case management interface so as to obtain each test field and the field value of the test field in the test case, and therefore the field value of each test field and the field value of the test field in the test case can be displayed in the test case management interface.
S208: the case management equipment receives an updating instruction of the test case, and the updating instruction is used for indicating the updating of the test case. The update instruction may be automatically generated after the test case is displayed on the test case management interface to trigger the case management device to update the test case, or the update instruction is related to a management user to which the management account is directed, and is generated after monitoring that the management user performs a specific operation, for example, when monitoring that the management user specifies a test field in the test case, the update instruction is generated or the management user performs a preset action, and the like. The test field designated by the management user can be used as a target test field, and the field value of the target test field needs to be updated/corrected.
S209: and the case management equipment responds to the updating instruction, determines a target test field appointed by the updating instruction from the test case, and obtains a field value of the target test field input by the management user based on the environmental data to obtain the target test case, wherein the target test field is a test field matched with the environmental data. The designation of the target test field may be obtained through environmental data analysis or may be designated by an administrative user.
The field value of the target test field input by the administrative user based on the environment data may refer to the above-mentioned process of updating the test field according to the environment data, such as modifying the field value of the target test field indicating the time to the time or the time interval close to the current time.
After the target test case is obtained, the target test case is serialized to obtain serialized data representing the target test case, so that the serialized data representing the target test case is sent to the test equipment, and transmission of the target test case is facilitated.
S210: and the case management equipment sends the target test case to the test equipment.
S211: the case management equipment obtains test data generated when the virtual test account uses the target test case in the test equipment, and the test data is used for verifying data verification conditions.
The data verification method comprises the steps of logging in a test case management interface by using a management account; displaying each test field in the test case and the field value of the test field in the test case management interface; receiving an updating instruction of the test case, wherein the updating instruction is used for indicating the updating of the test case; and responding to the updating instruction, determining a target test field appointed by the updating instruction from the test case, obtaining a field value of the target test field input by a management user based on the environmental data, and obtaining the target test case, wherein the target test field is a test field matched with the environmental data, so that the test case is updated by virtue of a test case management interface to obtain the target test case matched with the environmental data, and the test case management interface and the management user are introduced in the updating process, so that the test case is updated simply and the accuracy is improved.
While, for purposes of simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present application is not limited by the order of acts or acts described, as some steps may occur in other orders or concurrently with other steps in accordance with the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Referring to fig. 8, it shows an alternative structure of a data verification apparatus provided in the embodiments of the present application, which may include: a receiving unit 10, an obtaining unit 20, an updating unit 30, a sending unit 40 and a verifying unit 50.
A receiving unit 10, configured to receive a test case, where the test case is generated according to an attribute and an attribute value in a data verification condition; for the generation process of the test case, please refer to the above embodiment.
An obtaining unit 20, configured to obtain environment data of an environment where the test device is currently located; the purpose of the obtaining unit 20 to obtain the environmental data of the environment in which the test equipment is currently located is: and modifying the test case to enable the content in the test case to be matched with the environment data.
The environment data contains various environment parameters, such as position, time, network environment, climate and the like, and some of the environment parameters in the aspects are irrelevant to the test case, so that after the environment data of the current environment of the test equipment is obtained, target parameters can be screened from the environment data, and the target parameters are used for updating the test case, for example, the target parameters comprise at least one of time parameters, position parameters and network parameters; or, in the process of obtaining the environmental data, determining the environmental parameters related to the test case, and obtaining only the data corresponding to the environmental parameters related to the test case in the current environment where the test device is located, that is, obtaining only the target parameters related to the test case in the current environment where the test device is located.
And the updating unit 30 is configured to update a field value of a test field matched with the environment data in the test case according to the environment data to obtain a target test case, so that the target test case is matched with the environment data. One way of updating is as follows:
determining a target test field matched with the meaning of a target parameter in the test case according to the target parameter in the environment data, wherein the target parameter comprises at least one of a time parameter, a position parameter and a network parameter; the field value of the target test field is updated by using the parameter value of the target parameter, so that the target test case contains the field value matched with the parameter value of the target parameter.
A sending unit 40, configured to send a target test case to a test device;
and the verification unit 50 is configured to obtain test data generated when the target test case is used in the test device by the virtual test account, where the test data is used to verify the data verification condition. Such as verifying whether the test data matches the operation corresponding to the data verification condition.
The data verification device receives the test case, obtains the environmental data of the current environment of the test equipment, updates the field value of the test field matched with the environmental data in the test case according to the environmental data to obtain the target test case, sends the target test case to the test equipment, and obtains the test data generated when the target test case is used in the test equipment by the virtual test account, wherein the test data is used for verifying the data verification condition, so that the data verification condition is verified according to the target test case matched with the environmental data. The test case is generated according to the attribute and the attribute value in the data verification condition, which means that the target test case is generated at least according to the attribute and the attribute value in the data verification condition, so that the target test case for verifying the data verification condition is constructed through the attribute and the attribute value in the data verification condition, and compared with the situation that a user manually constructs a data verification rule corresponding to the data verification condition, the generation efficiency of the target test case is improved, and the time and the labor consumption in the data verification process are reduced.
The data verification apparatus shown in fig. 8 may further update the test case by using a test case management interface, and the corresponding data verification apparatus may further include: a login unit and a display unit.
The login unit is used for logging in the test case management interface by using the management account; the display unit is used for displaying each test field in the test case and the field value of the test field in the test case management interface;
the receiving unit 10 is further configured to receive an update instruction for the test case, where the update instruction is used to instruct to update the test case; and the updating unit 30 is configured to determine, in response to the update instruction, a target test field specified by the update instruction from the test case, obtain a field value of the target test field input by the management user based on the environment data, and obtain the target test case, where the target test field is a test field matched with the environment data.
The test case may be sent after serialization processing, and if a display unit in the data verification apparatus displays contents in the test case management interface, the data verification apparatus needs to perform deserialization processing and a target test case also needs to be sent after serialization processing, and correspondingly, the data verification apparatus may further include: the case processing unit is used for performing deserialization processing on the serialized data representing the test case in the process of monitoring the test case management interface to obtain each test field in the test case and the field value of the test field; and the device is used for carrying out serialization processing on the target test case after the target test case is obtained, obtaining serialization data representing the target test case, and sending the serialization data representing the target test case to the test equipment.
Referring to fig. 9, an alternative structure of another data verification apparatus provided in the embodiment of the present application is shown, which may include: an attribute obtaining unit 1000, a use case obtaining unit 2000, a generating unit 3000, and a use case transmitting unit 4000.
An attribute obtaining unit 1000, configured to obtain each attribute and an attribute value of the attribute in the data verification condition; the data verification condition is at least used for controlling a preset operation matched with the data verification condition, such as whether the test equipment can execute the preset operation matched with the data verification condition, and whether the preset operation is successful or failed can be determined. For example, one expression of a data validation condition is a validation condition that relates the data validation condition to a card punching rule, the data validation condition includes an on-duty card punching condition and an off-duty card punching condition, and at least one of the on-duty card punching condition and the off-duty card punching condition includes: at least one of a time, a location, and a network parameter, the defined condition for controlling a card punch operation. At least one of the on-duty card-punching condition and the off-duty card-punching condition includes a parameter determined as an attribute, and a parameter value determined as an attribute value.
A case obtaining unit 2000, configured to obtain test case data according to each attribute and the attribute value of the attribute in the data verification condition; one possible way is: and determining each attribute in the data verification condition as a test field, and determining the attribute value of the attribute as the field value of the test field, thereby obtaining the test case data. The test fields in the test case data and the field values of the test fields can be obtained by processing the data verification conditions such as natural semantic analysis, or manually input by a user according to each attribute and the attribute value of the attribute in the data verification conditions.
The generating unit 3000 is configured to generate at least one test case according to a test field in the test case data and a field value of the test field;
after the test case data is obtained, at least one test case is obtained by pairing the test fields in the test case data and the field values of the test fields, for example, at least one test case is obtained by pairing the field values of the test fields and the test fields through but not limited to a pairing test method (Pairwise Testing), wherein the pairing test method is also called a pairing test method or a Pairwise test method, and is a test technology of orthogonal analysis, and at least one test path is covered through the pairing test method, so that at least one test case is obtained. In the embodiment, all the test paths covered by the test fields and the field values of the test fields can be covered by the pairing test method, so that one test case corresponding to each test path is obtained, and the comprehensive test on the test fields and the field values of the test fields is realized.
The case sending unit 4000 is configured to send at least one test case.
In this embodiment, the data verification apparatus shown in fig. 9 may further include: the serialization unit is used for carrying out serialization processing on at least one test case after the at least one test case is obtained, and obtaining serialization data representing the at least one test case; packaging the serialized data by a preset protocol to obtain a test request representing at least one test case so as to facilitate the transmission of the test case; the corresponding use case sending unit 4000 is configured to send a test request representing at least one test use case by using the request sending script.
An embodiment of the present application provides an apparatus, including: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the data verification method described above.
The embodiment of the application provides a storage medium, wherein a computer program code is stored in the storage medium, and the computer program code realizes the data verification method when being operated.
It should be noted that, various embodiments in this specification may be described in a progressive manner, and features described in various embodiments in this specification may be replaced with or combined with each other, each embodiment focuses on differences from other embodiments, and similar parts between various embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, 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 application. 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 application. Thus, the present application 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 application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (10)

1. A method of data verification, the method comprising:
receiving a test case, wherein the test case is generated according to attributes and attribute values in the data verification conditions;
obtaining environmental data of the current environment of the test equipment;
updating the field value of a test field matched with the environment data in the test case according to the environment data to obtain a target test case;
sending the target test case to the test equipment;
and obtaining test data generated when the target test case is used in the test equipment by the virtual test account, wherein the test data is used for verifying the data verification condition.
2. The method according to claim 1, wherein the updating, according to the environment data, a field value of a test field in the test case that matches the environment data to obtain a target test case comprises:
determining a target test field matched with the meaning of the target parameter in the test case according to the target parameter in the environment data, wherein the target parameter comprises at least one of a time parameter, a position parameter and a network parameter;
and updating the field value of the target test field by using the parameter value of the target parameter so that the target test case contains the field value matched with the parameter value of the target parameter.
3. The method of claim 1, further comprising:
logging in a test case management interface by using a management account;
displaying each test field in the test case and the field value of the test field in the test case management interface;
receiving an updating instruction of the test case, wherein the updating instruction is used for indicating that the test case is updated;
updating the field value of the test field matched with the environment data in the test case according to the environment data to obtain a target test case, wherein the target test case comprises:
responding to the updating instruction, determining a target test field appointed by the updating instruction from the test case, obtaining a field value of the target test field input by a management user based on the environment data, and obtaining the target test case, wherein the target test field is a test field matched with the environment data.
4. The method of claim 3, further comprising:
in the process of monitoring the logging-in of the test case management interface, performing anti-serialization processing on serialized data representing the test case to obtain each test field in the test case and the field value of the test field;
after the target test case is obtained, the target test case is serialized to obtain serialized data representing the target test case, so that the serialized data representing the target test case is sent to the test equipment.
5. A method of data verification, the method comprising:
obtaining each attribute and attribute value of the attribute in the data verification condition;
obtaining test case data according to each attribute and attribute value of the attribute in the data verification condition;
generating at least one test case according to the test fields in the test case data and the field values of the test fields;
and sending the at least one test case.
6. The method of claim 5, further comprising: carrying out serialization processing on the at least one test case to obtain serialization data for representing the at least one test case;
packaging the serialized data by a preset protocol to obtain a test request representing the at least one test case;
the sending the at least one test case includes: and sending a test request for representing the at least one test case by using the request sending script.
7. A data verification apparatus, the apparatus comprising:
the receiving unit is used for receiving a test case, and the test case is generated according to the attribute and the attribute value in the data verification condition;
the obtaining unit is used for obtaining environmental data of the current environment of the test equipment;
the updating unit is used for updating the field value of the test field matched with the environment data in the test case according to the environment data to obtain a target test case;
a sending unit, configured to send the target test case to the test device;
and the verification unit is used for obtaining test data generated when the target test case is used in the test equipment by the virtual test account, and the test data is used for verifying the data verification condition.
8. A data verification apparatus, the apparatus comprising:
the attribute obtaining unit is used for obtaining each attribute and the attribute value of the attribute in the data verification condition;
the case obtaining unit is used for obtaining test case data according to each attribute and the attribute value of the attribute in the data verification condition;
the generating unit is used for generating at least one test case according to the test field in the test case data and the field value of the test field;
and the case sending unit is used for sending the at least one test case.
9. An apparatus, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the data validation method of any of claims 1 to 6.
10. A storage medium, characterized in that the storage medium has stored therein computer program code, which when executed implements a data verification method as claimed in any one of claims 1 to 6.
CN202110064476.1A 2021-01-18 2021-01-18 Data verification method and device Pending CN114816965A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110064476.1A CN114816965A (en) 2021-01-18 2021-01-18 Data verification method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110064476.1A CN114816965A (en) 2021-01-18 2021-01-18 Data verification method and device

Publications (1)

Publication Number Publication Date
CN114816965A true CN114816965A (en) 2022-07-29

Family

ID=82523811

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110064476.1A Pending CN114816965A (en) 2021-01-18 2021-01-18 Data verification method and device

Country Status (1)

Country Link
CN (1) CN114816965A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991713A (en) * 2023-07-17 2023-11-03 上海一谈网络科技有限公司 Method, device, computer equipment and storage medium for executing use cases across environments

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991713A (en) * 2023-07-17 2023-11-03 上海一谈网络科技有限公司 Method, device, computer equipment and storage medium for executing use cases across environments
CN116991713B (en) * 2023-07-17 2024-02-20 上海一谈网络科技有限公司 Method, device, computer equipment and storage medium for executing use cases across environments

Similar Documents

Publication Publication Date Title
CN107733922B (en) Method and apparatus for invoking a service
CN108255730B (en) Software interface testing method, testing equipment, storage medium and device
CN109150828B (en) Verification registration method and system
CN107911222B (en) Digital signature generating method, digital signature verifying method, digital signature generating apparatus, digital signature verifying apparatus, and storage medium storing digital signature verifying program
US10678682B2 (en) Intelligent batch job testing
CN108701309A (en) A kind of distributed user profile authentication system for security of e-commerce transactions
CN109936621B (en) Information security multi-page message pushing method, device, equipment and storage medium
CN109684873B (en) Data access control method and device, computer equipment and storage medium
CN108829838B (en) Batch processing method of account information and server
CN106027644B (en) Service verification method and system
CN111176794A (en) Container management method and device and readable storage medium
CN112597020A (en) Interface testing method and device, computer equipment and storage medium
JP2018517982A (en) Automatic recharge system, method and server
CN111078200A (en) Task construction method, device, equipment, medium and system
CN109726545B (en) Information display method, equipment, computer readable storage medium and device
CN105791249A (en) Third-party application processing method, device and system
CN104158856A (en) Local API calling method dispense with preset of secure session
CN113434254B (en) Client deployment method, client deployment apparatus, computer device, and storage medium
CN111078424A (en) Information interaction method and device, computer equipment and storage medium
CN108418797B (en) Webpage access method and device, computer equipment and storage medium
CN114816965A (en) Data verification method and device
CN114003432A (en) Parameter checking method and device, computer equipment and storage medium
CN112966308A (en) Software delivery method, processing device and storage medium
CN111061637B (en) Interface testing method, interface testing device and storage medium
CN112433935A (en) Test method, test device, electronic equipment and storage medium

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