CN115495368A - Data testing method and device and electronic equipment - Google Patents
Data testing method and device and electronic equipment Download PDFInfo
- Publication number
- CN115495368A CN115495368A CN202211206706.4A CN202211206706A CN115495368A CN 115495368 A CN115495368 A CN 115495368A CN 202211206706 A CN202211206706 A CN 202211206706A CN 115495368 A CN115495368 A CN 115495368A
- Authority
- CN
- China
- Prior art keywords
- data
- target
- script
- test
- field
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 197
- 238000013515 script Methods 0.000 claims abstract description 139
- 230000006870 function Effects 0.000 claims description 28
- 238000000034 method Methods 0.000 claims description 25
- 238000012545 processing Methods 0.000 claims description 24
- 230000004044 response Effects 0.000 claims description 3
- 238000007726 management method Methods 0.000 description 31
- 238000004590 computer program Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 9
- 230000008569 process Effects 0.000 description 6
- 238000013461 design Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 238000012986 modification Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 3
- 238000000605 extraction Methods 0.000 description 3
- 238000013178 mathematical model Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000007792 addition Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000013499 data model Methods 0.000 description 2
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3696—Methods or tools to render software testable
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 disclosure provides a data testing method and device and electronic equipment, and relates to the field of computers. The specific implementation scheme is as follows: determining a query statement generation script matched with the test requirement of the test case based on a multilayer management strategy of the script; running the query statement generation script to generate a query statement; the query statement comprises a target field to be queried; searching target data containing the target field from a data structure layer of the stored data according to the query statement; reading the field value of the target field from the target data to determine test data corresponding to the field value of the target field of the target data; and testing the test case based on the test data corresponding to the target data to obtain a target test result of the test case.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data testing method and apparatus, and an electronic device.
Background
In a system test scenario, a large amount of test data is required, and the test data is generally generated by manual setup. The generation mode of the test data is complex, and the efficiency is low. Currently, in order to improve the testing efficiency of the test data, an automatic test may be adopted. Automated testing refers to execution of automated testing, typically by writing automated scripts to execute automated testing of cases, by a software tool instead of manual testing. However, cases often occur in the writing process of the automation script and need to rely on external associated system test data, so that the execution of the automation script is hindered, and the automation test is usually interrupted or failed.
Disclosure of Invention
The disclosure provides a data testing method and device for automatically testing a test case and electronic equipment.
According to a first aspect of the present disclosure, there is provided a data testing method, comprising:
determining a query statement generation script matched with the test requirement of the test case based on a multi-layer management strategy of the script;
running the query statement generation script to generate a query statement; the query statement comprises a target field to be queried;
searching target data containing the target field from a data structure layer of the stored data according to the query statement;
reading the field value of the target field from the target data to determine test data corresponding to the field value of the target field of the target data;
and testing the test case based on the test data corresponding to the target data to obtain a target test result of the test case.
According to a second aspect of the present disclosure, there is provided a data testing apparatus comprising:
the script determining unit is used for determining a query statement generation script matched with the test requirement of the test case based on the multilayer management strategy of the script;
a statement acquisition unit, configured to run the query statement generation script to generate a query statement; the query statement comprises a target field to be queried;
the data query unit is used for searching target data containing the target field from a data structure layer of the stored data according to the query statement;
the test data unit is used for reading the field value of the target field from the target data so as to determine the test data corresponding to the field value of the target field of the target data;
and the data testing unit is used for testing the test case based on the test data corresponding to the target data to obtain the target test result of the test case.
According to a third aspect of the present disclosure, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect.
According to the technology disclosed by the invention, the query statement generation script matched with the test requirement of the test case can be determined based on the multilayer management strategy of the script, and the query statement containing the target field to be queried can be obtained by running the query statement generation script. The query statement may be automatically obtained by execution of the statement generation script. Target data containing a target field can be searched from a data structure layer of the storage data through a query statement. The field value of the target field is read from the target data, the test data corresponding to the field value of the target field can be obtained, and the automatic generation of the test data is realized. And testing the test case based on the test data corresponding to the target data to obtain a target test result of the test case. The acquisition of the query statement generation script and the automatic generation of the query statement can be realized through a multilayer management strategy, and further, the automatic query of the target data can be realized by utilizing the automatically generated query statement, so that the automatic generation of the test data is realized, the generation efficiency of the test data is improved, and the automatic generation of the data is realized.
It should be understood that the statements in this section are not intended to identify key or critical features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a diagram illustrating an application scenario of a data testing method according to an embodiment of the present disclosure;
FIG. 2 is a flow chart of one embodiment of a data testing method provided by embodiments of the present disclosure;
FIG. 3 is an exemplary diagram of one or more script setting layers provided by an embodiment of the present disclosure;
FIG. 4 is a flow chart of yet another embodiment of a data testing method provided by an embodiment of the present disclosure;
FIG. 5 is a schematic structural diagram of an embodiment of a data testing apparatus according to an embodiment of the present disclosure;
FIG. 6 is a block diagram of an electronic device for implementing a data testing method of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The technical scheme disclosed by the invention can be applied to an automatic test scene of a system, the automatic generation of the query statement generation script is realized through multilayer management test, and the query of the target data participating in the data is automatically completed through the query statement generation script, so that the automatic generation of the test data is realized, and the test efficiency is improved.
In the prior art, in a data testing process, for example, an instant messaging program, a social program and the like need to be tested before being released. At present, in order to improve the automatic testing efficiency, an automatic test can be generally adopted to improve the testing efficiency of the system. The automatic test is generally accomplished through an automatic script case, and during the actual automatic script case compiling process, the case can often encounter non-reusable data, or the data from the case is an external system related to the tested system, which may cause the automatic script compiling failure. The automatic scripts which are compiled in a failure mode may cause the generation failure of the automatic test data, so that the test is failed, the automatic scripts need to be rewritten, the test efficiency is reduced, and the difficulty is increased.
In order to solve the technical problem, in the embodiment of the present disclosure, in an automated testing process, a query statement generation script matching with a testing requirement of a test case may be determined based on a multi-layer management policy of the script. Through the multi-layer management strategy, the query statement generation script can be determined in a hierarchical setting and modularization mode. By running the query statement generation script, a query statement containing a target field to be queried can be generated. Through the query statement, the target data containing the target field can be searched from the data structure layer of the stored data, and the automatic query of the target data is realized. After the target data is obtained, the field value of the target field can be read from the target data to determine the test data corresponding to the field value of the target field of the target data, and the test case can be automatically tested through the test data corresponding to the target data to obtain the target test result of the test case. The script is managed in a hierarchical and modular mode, and the management efficiency and accuracy of the script can be improved. The automatic query of the target data can be realized by using the automatically generated query statement so as to realize the automatic generation of the test data, improve the generation efficiency of the test data and realize the automatic generation of the data.
The technical solution of the present disclosure will be described in detail with reference to the accompanying drawings.
Referring to fig. 1, a diagram of an application scenario of a data testing method according to an embodiment of the present disclosure is shown. A first electronic device 1 and a second electronic device 2 may be included in the scenario. The first electronic device 1 and the second electronic device 2 may establish a wired or wireless communication connection. The first electronic device 1 may establish a connection with at least one database 3. The first electronic device 1 may be configured with the data testing method of the present disclosure, so as to establish the data pool 4 by using at least one database 3, where the data pool 4 may include multiple candidate data, and in addition, the electronic device 1 may also automatically complete a generation script of a query statement and automatically acquire target data from the data pool, and further automatically generate test data by using the target data. The test data generated by the first electronic device 1 may be transmitted to the second electronic device 2. The second electronic device 2 may test the test data to obtain a target test result. The second electronic device 2 may be a test node in a test cluster.
In practical application, the second electronic device 2 may feed back the target test result to the first electronic device 1, the first electronic device 1 outputs the target test result, and the target test result is output through the first electronic device 1, so as to improve the test efficiency.
Fig. 2 is a flowchart of an embodiment of a data testing method provided by an embodiment of the present disclosure, where the method may be applied to an electronic device, and the method may include the following steps:
201: and determining a query statement generation script matched with the test requirement of the test case based on the multilayer management strategy of the script.
The multi-layer management strategy can refer to a script management mechanism set for the functional modules of the system, can realize modularization and hierarchical management of the scripts, improve script management efficiency and realize unified management.
The script may be a program instruction developed by a programming language or a programming tool, and the program instruction may be executed to implement the execution of the script. The query statement generation script may refer to a generation instruction of a written query statement, and may be invoked and run by the data test method configured with the present disclosure.
202: running a query statement generation script to generate a query statement; the query statement includes a target field to be queried.
A Query statement may refer to a program instruction written in a programming Language such as SQl (Structured Query Language), for example, a SQl Query statement.
The query statement generation script can realize the generation of the query statement by setting information such as fields, formats, data and the like of the query statement.
203: and searching target data containing the target field from the data structure layer of the storage data according to the query statement.
A data structure layer may refer to a hierarchy of models that store data and perform data processing.
The data structure layer may be associated with at least one database.
The data structure may specifically refer to a column structure, the column structure may include a plurality of data fields, and a piece of data may refer to field values corresponding to the plurality of data fields, respectively. Taking a debit card data structure as an example, this may include: the card number, the provincial number, the line number, the state, the account number, the account holder identification, the certificate type, the certificate number, the balance and other data fields. A piece of target data may include field values corresponding to a plurality of data fields, respectively.
204: and reading the field value of the target field from the target data to determine the test data corresponding to the target data in the field value of the target field.
The target field may be a partial data field of a plurality of data fields of a data structure to which the target data corresponds. For example, also exemplified by the debit card data structure described above, the destination field may include a province number and a status. That is, the status of use of a debit card for a certain province number can be obtained.
A field value of a target field of the target data may be read. And determining the test data according to the field value of the target field.
205: and testing the test case based on the test data corresponding to the target data to obtain a target test result of the test case.
The test data may be input into the test case to initiate testing of the test data by the test case to obtain a target test result for the test data.
In the embodiment of the disclosure, in the automatic test process, the query statement generation script matched with the test requirement of the test case can be determined based on the multilayer management strategy of the script. Through the multi-layer management strategy, the query statement generation script can be determined in a hierarchical setting and modularization mode. By running the query statement generation script, a query statement containing a target field to be queried can be generated. Through the query statement, the target data containing the target field can be searched from the data structure layer of the stored data, and the automatic query of the target data is realized. After the target data is obtained, the field value of the target field can be read from the target data to determine the test data corresponding to the field value of the target field of the target data, and the test case can be automatically tested through the test data corresponding to the target data to obtain the target test result of the test case. The script is managed in a hierarchical and modular mode, and the management efficiency and accuracy of the script can be improved. The automatic query of the target data can be realized by using the automatically generated query statement so as to realize the automatic generation of the test data, improve the generation efficiency of the test data and realize the automatic generation of the data.
As one embodiment, determining a query statement generation script matching the test requirement of the test case based on a multi-layer management strategy of the script comprises the following steps:
determining a plurality of script setting layers in a multi-layer management strategy of the script;
script setting information corresponding to the script setting layers is obtained on the basis of the test requirements of the test example, and the script setting information corresponding to the plurality of script setting layers is obtained;
and determining the query statement generation script according to script setting information respectively corresponding to the plurality of script setting layers.
The sequence of the levels can be stored among the script setting layers, the script setting layer with the higher level can be set firstly, and then the script setting layer with the lower level can be set.
Determining query statement generation scripts according to script setting information respectively corresponding to the script setting layers, wherein the query statement generation scripts are obtained by performing information combination on the script setting information respectively corresponding to the script setting layers according to the hierarchical sequence respectively corresponding to the script setting layers.
The script setting information may refer to script contents input at a corresponding script setting layer, such as at least one of a hierarchy identification, a hierarchy name, a hierarchy function, and hierarchy transaction information.
In the embodiment of the present disclosure, multiple script setting layers in a multi-layer management policy of a script may be determined, and a query statement generation script may be determined by using script setting information of each script setting layer. The efficient modularized management of the scripts can be realized through the design of the multiple script setting layers, the updating efficiency and the generating efficiency of the scripts are improved, and the query statement generating scripts can be quickly and accurately obtained.
In one possible design, the plurality of script setting layers includes: the system comprises a system setting layer, a module setting layer, a function definition layer, a page definition layer and a data processing layer;
determining query statement generation scripts according to script setting information respectively corresponding to the plurality of script setting layers, wherein the script setting scripts comprise:
based on system setting information corresponding to the system setting layer, module setting information corresponding to the module setting layer, function setting information corresponding to the function definition layer, page setting information corresponding to the page definition layer and transaction setting information corresponding to the data processing layer;
and obtaining a query statement generation script according to the query language code according to the system setting information, the module setting information, the function setting information, the page setting information and the transaction setting information.
For ease of understanding, a plurality of script setting layer example diagrams as shown in FIG. 3. A system setup layer 301, a module setup layer 302, a function definition layer 303, a page definition layer 304, and a data processing layer 305 may be included. Each script setting layer can perform script setting and management respectively.
Optionally, the system setting layer may be used to set a hierarchy of system information, and the corresponding system setting information may include, for example: system number, system name including information such as chinese name, english name, etc. The module setting layer may be configured to divide the system module into the following levels, and the corresponding module setting information may include a module number, a module name, a two-level module name, and other information. The function definition layer may refer to a hierarchy for defining each level of function module, and the corresponding function setting information may include information such as a specific component module of the I-level function module, the 2-level function module, and the 3-level function module. The page definition layer may refer to description information of the function page, and the corresponding page setting information may include, for example, a name of the function page, a function description, and the like. The data processing layer may refer to specific transaction information of the functional module, for example, transaction information such as addition, deletion and modification, and the corresponding transaction setting information may include detailed transaction operations such as defined addition, modification and deletion.
In the embodiment of the disclosure, the script can be automatically managed based on the system setting layer, the module setting layer, the function definition layer, the page definition layer and the data processing layer, so that the management efficiency and the accuracy of the script are improved, and the script can be quickly and accurately generated through the automatic management of the script. Meanwhile, layers are set according to different scripts, and the layers are set by adopting a layer-by-layer progressive relation, so that the generation efficiency and accuracy of the scripts are improved.
In some embodiments, the target fields to be queried in the query statement include at least one; reading a field value of a target field from target data, including:
reading field values respectively corresponding to at least one target field from target data;
determining test data corresponding to the field value of the target data in the target field, wherein the test data comprises the following steps:
and converting the field value corresponding to at least one target field read from the target data according to the data format of the test data to obtain the test data.
The target field may include at least one. The test data may be obtained by converting a data format of the test data using field values respectively corresponding to the at least one target field.
For example, the target field includes a province number field and a status field, and the province number identifier of the province number field and the status identifier of the status field may be read from a piece of target data.
And forming test data of 'province mark-state mark' by combining the province mark of the province mark field and the state mark of the state field. Test data may be input into the test case to obtain a target test result of the test case on the test data.
In the embodiment of the disclosure, the field value corresponding to at least one target field may be read from the target data, so that the field value of each target field is converted into the test data according to the data format of the test data, and the accurate test data may be obtained through format conversion, so that the test data may be accurately tested, and the execution efficiency and accuracy of the data test are improved.
As shown in fig. 4, a flowchart of an embodiment of a data testing method provided in this disclosure, which searches a target data containing a target field from a data structure layer of stored data according to a query statement, may include:
401: a plurality of candidate data stored in a resource pool of a data structure layer storing the data is determined.
402: and acquiring target data containing the target field from the plurality of candidate data by using the target field in the query statement.
The resource pool may be a data storage area in the data structure layer that stores a plurality of pieces of data.
The plurality of candidate data in the resource pool can be extracted in advance or in real time, or a combination of the advance extraction and the real-time extraction can be adopted.
A field in a query statement may be a target field. The target field may be a specific field that needs to be queried.
In the embodiment, the stored candidate data are acquired from the resource pool of the data structure layer for storing the data, so that the candidate data in the resource pool can be quickly used, the target data can be efficiently and accurately acquired, and the acquisition efficiency and accuracy of the target data are improved.
As an embodiment, further comprising:
determining at least one database storing data related to data structure layers of data;
and extracting a plurality of candidate data meeting the use condition from at least one database, and storing the plurality of candidate data in a resource pool of the data structure layer.
Optionally, a database configuration management page may be provided, and data query management is performed on at least one database through the database configuration management page. The configuration management page of the database may provide a setting sub-page corresponding to a query table of the database, where the query table may be as shown in table 1 below.
TABLE 1
The first and second rows in table 1 may be introductory rows of fields and databases. The data model number may refer to a character string obtained by setting a number of the target field, and may be a mathematical model identifier named for a mathematical model corresponding to the target field. The data model name may refer to a function name set for the target field corresponding to the mathematical model number. The associated database may correspond to a query statement based on a database definition. For example, "from sysa, ps _ PA _ AC _ BIND _ INFO word COD _ FN _ ENT ="0101", where" sysa, ps _ PA _ AC _ BIND _ INFO "is a database name," COD _ FN _ ENT "is a target field name, and" 0101 "is a field value of the target field.
The third row in table 1 may be several fields in the data structure of the target data obtained by the query, which may include the target field. The fields may be, for example: the field meanings of the sequence number, the field name, the field meaning, the main attribute, the field type, the data tag and the like can be the same as those of the related technology, and are not described in detail herein.
In the embodiment of the present disclosure, at least one database associated with a data structure layer storing data may be determined, so as to extract a plurality of candidate data satisfying a use condition from the at least one database, and store the plurality of candidate data in a resource pool of the data structure layer. The construction of a resource pool can be realized by extracting a plurality of candidate data from at least one database, and the available candidate data can be acquired through the resource pool, so that the acquisition efficiency and accuracy of the candidate data are improved. The multiplexing of data can be realized through the resource pool, and when the data is required to be inquired, the data can be directly read from the resource pool. In addition, the acquisition range of the resource pool can be improved by uniformly processing the data of at least one database in the resource pool, the data in the resource pool is not limited to a single database, and the processing efficiency and accuracy of the data are improved.
In one possible design, extracting a plurality of candidate data satisfying the usage condition from at least one database includes:
and extracting a plurality of candidate data containing the key fields from at least one database according to the defined key fields.
Alternatively, the key field may be obtained from the query statement. The key field may refer to a field in the query statement that serves as a query identifier. For example, the province field may be a key field, and the status field may not belong to the key field.
Of course, in practical applications, the key fields may also be set by the user. A setting page of the key field may be output, and a field name of the key field input by the user for the setting page may be detected.
Optionally, the field names of different fields in this disclosure are different. For example, the field names of the province number field and the status field are different. The field types of the different fields may be the same. For example, the province number field and the card number field may both be character types.
In the embodiment of the disclosure, a plurality of candidate data can be extracted from at least one database by defining the key field. Efficient and accurate acquisition of data can be achieved by extraction of the key fields.
As another embodiment, extracting a plurality of candidate data including key fields from at least one database according to the defined key fields includes:
in response to a database selection operation for at least one database, a selected target database is determined.
And extracting a plurality of candidate data containing the key fields from the target database according to the key fields.
Optionally, a selection interface for at least one database may be provided. At least one database may be selectively configured through a selection interface of the database. For example, a pull-down menu corresponding to at least one database may be provided, and the detection that the user clicks the pull-down menu may select the target database, and obtain the setting information of the target database input by the user. The setting information may include, for example: IP (Internet Protocol) -port, user name, password, etc. And establishing connection with the target database through the setting information of the target database so as to inquire a plurality of candidate data from the target database. The DataBase may include, for example, various types of databases such as DB2 (DataBase 2 )/ORACLE (ORACLE), MYSQL (My Structured Query Language)/SYBASE (system Adaptive Server Enterprise), and the specific type of DataBase is not limited in this embodiment.
In the embodiment of the disclosure, the target database can be determined through the selection operation of the database, the database can be queried in a targeted manner, and the efficiency and accuracy of data query are effectively improved.
As shown in fig. 5, a schematic structural diagram of an embodiment of a data testing apparatus provided in an embodiment of the present disclosure, the apparatus may be located in an electronic device, and the apparatus 400 may include:
the scenario determination unit 501: the multi-layer management strategy based on the script is used for determining the query statement generation script matched with the test requirement of the test case;
the sentence acquisition unit 502: the query statement generation script is used for operating a query statement generation script to generate a query statement; the query statement comprises a target field to be queried;
the data search unit 503: the query statement is used for searching target data containing a target field from a data structure layer of the stored data;
test data unit 504: the device comprises a data processing module, a data processing module and a data processing module, wherein the data processing module is used for reading a field value of a target field from target data to determine test data corresponding to the field value of the target field of the target data;
the data test unit 505: and the test case is tested based on the test data corresponding to the target data to obtain a target test result of the test case.
As an embodiment, the script determining unit 501 may include:
the level determining module is used for determining a plurality of script setting layers in a multi-layer management strategy of the script;
the layered setting module is used for setting script setting information corresponding to the script setting layers based on the test requirements of the test examples and obtaining script setting information corresponding to the script setting layers respectively;
and the script generation module is used for determining the query statement generation script according to the script setting information respectively corresponding to the plurality of script setting layers.
In some embodiments, the plurality of script setting layers comprises: the system comprises a system setting layer, a module setting layer, a function definition layer, a page definition layer and a data processing layer; the script generation module can include:
the hierarchical setting sub-module is used for setting the information based on the system corresponding to the system setting layer, the module corresponding to the module setting layer, the function corresponding to the function definition layer, the page corresponding to the page definition layer and the transaction corresponding to the data processing layer;
and the script generation sub-module is used for obtaining a query statement generation script according to the query language code according to the system setting information, the module setting information, the function setting information, the page setting information and the transaction setting information.
In one possible design, the target field to be queried in the query statement includes at least one.
A test data unit, which may include:
the data reading module is used for reading field values corresponding to at least one target field from the target data;
and the data conversion module is used for converting the field value corresponding to at least one read target field in the target data according to the data format of the test data to obtain the test data.
As an embodiment, the data query unit includes:
the resource determining module is used for determining a plurality of candidate data stored in a resource pool of a data structure layer for storing the data;
and the data query module is used for acquiring target data containing the target field from the plurality of candidate data by using the target field in the query statement.
Wherein, still include:
the association determining unit is used for determining at least one database storing data structure layer association of data;
and the resource building unit is used for extracting a plurality of candidate data meeting the use condition from at least one database and storing the plurality of candidate data in a resource pool of the data structure layer.
As an embodiment, the data query module includes:
and the key determining submodule is used for extracting a plurality of pieces of candidate data containing the key fields from at least one database according to the defined key fields.
In some embodiments, the key determination submodule may be specifically configured to:
in response to a database selection operation for at least one database, determining a selected target database;
and extracting a plurality of candidate data containing the key fields from the target database according to the key fields.
The steps in the embodiment of the present disclosure may execute the data testing method shown in fig. 2 in the above embodiment, and for specific content executed by each unit and module, reference may be made to the description of the method, which is not described herein again.
In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the personal information of the related user are all in accordance with the regulations of related laws and regulations and do not violate the good customs of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure. The electronic device or the test device related to the embodiments of the present disclosure may be an electronic device, and the specific type of the electronic device is not limited herein, and may include, for example, a computer, a server, a cloud server, and the like.
According to an embodiment of the present disclosure, the present disclosure also provides a computer program product comprising: a computer program, stored in a readable storage medium, from which at least one processor of the electronic device can read the computer program, and the execution of the computer program by the at least one processor causes the electronic device to perform the solutions provided by any of the above embodiments.
FIG. 6 illustrates a schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit implementations of the disclosure described and/or claimed herein.
The device structure of the electronic device or the test device in the foregoing embodiments may be the electronic device shown in fig. 6.
As shown in fig. 6, the apparatus 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 602 or a computer program loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data required for the operation of the device 600 can also be stored. The calculation unit 601, the ROM 602, and the RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
A number of components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, a mouse, and the like; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 601 performs the various methods and processes described above, such as the data testing method. For example, in some embodiments, the data testing method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 602 and/or the communication unit 609. When the computer program is loaded into RAM603 and executed by computing unit 601, one or more steps of the data testing methods described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the data testing method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, 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), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.
Claims (10)
1. A method for testing data, comprising:
determining a query statement generation script matched with the test requirement of the test case based on a multi-layer management strategy of the script;
running the query statement generation script to generate a query statement; the query statement comprises a target field to be queried;
searching target data containing the target field from a data structure layer of the stored data according to the query statement;
reading the field value of the target field from the target data to determine test data corresponding to the field value of the target field of the target data;
and testing the test case based on the test data corresponding to the target data to obtain a target test result of the test case.
2. The method of claim 1, wherein determining the query statement generation script that matches the test requirements of the test case based on the multi-layer management policy for the script comprises:
determining a plurality of script setting layers in a multi-layer management strategy of the script;
script setting information corresponding to the script setting layers is obtained based on the testing requirements of the testing examples, and the script setting information corresponding to the script setting layers is obtained;
and determining the query statement generation script according to script setting information respectively corresponding to the plurality of script setting layers.
3. The method of claim 2, wherein the plurality of scripting layers comprises: the system comprises a system setting layer, a module setting layer, a function definition layer, a page definition layer and a data processing layer;
the determining the query statement generation script according to the script setting information respectively corresponding to the plurality of script setting layers includes:
based on the system setting information corresponding to the system setting layer, the module setting information corresponding to the module setting layer, the function setting information corresponding to the function definition layer, the page setting information corresponding to the page definition layer and the transaction setting information corresponding to the data processing layer;
and obtaining the query statement generation script according to the system setting information, the module setting information, the function setting information, the page setting information and the transaction setting information and the query language code.
4. The method of claim 1, wherein the target fields to be queried in the query statement comprise at least one; the reading of the field value of the target field from the target data includes:
reading field values respectively corresponding to at least one target field from the target data;
the determining the test data corresponding to the field value of the target data in the target field includes:
and converting the field value corresponding to at least one target field read from the target data according to the data format of the test data to obtain the test data.
5. The method of claim 1, wherein searching for target data containing the target field from a data structure layer of stored data according to the query statement comprises:
determining a plurality of candidate data stored in a resource pool of a data structure layer for storing data;
and acquiring target data containing the target field from the plurality of candidate data by using the target field in the query statement.
6. The method of claim 5, further comprising:
determining at least one database associated with a data structure layer of the stored data;
and extracting a plurality of candidate data meeting the use condition from at least one database, and storing the candidate data in a resource pool of the data structure layer.
7. The method of claim 6, wherein said extracting a plurality of candidate data satisfying a usage condition from at least one of said databases comprises:
and extracting a plurality of candidate data containing the key fields from at least one database according to the defined key fields.
8. The method of claim 7, wherein the extracting a plurality of candidate data including a key field from at least one of the databases according to the defined key field comprises:
in response to a database selection operation for at least one of the databases, determining a selected target database;
and extracting a plurality of pieces of candidate data containing the key fields from the target database according to the key fields.
9. A data testing apparatus, comprising:
the script determining unit is used for determining an inquiry statement generation script matched with the test requirement of the test case based on a multilayer management strategy of the script;
the statement acquisition unit is used for operating the query statement generation script to generate a query statement; the query statement comprises a target field to be queried;
the data query unit is used for searching target data containing the target field from a data structure layer of the stored data according to the query statement;
the test data unit is used for reading the field value of the target field from the target data so as to determine the test data corresponding to the field value of the target field of the target data;
and the data testing unit is used for testing the test case based on the test data corresponding to the target data to obtain the target test result of the test case.
10. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211206706.4A CN115495368A (en) | 2022-09-30 | 2022-09-30 | Data testing method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211206706.4A CN115495368A (en) | 2022-09-30 | 2022-09-30 | Data testing method and device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115495368A true CN115495368A (en) | 2022-12-20 |
Family
ID=84472960
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211206706.4A Pending CN115495368A (en) | 2022-09-30 | 2022-09-30 | Data testing method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115495368A (en) |
-
2022
- 2022-09-30 CN CN202211206706.4A patent/CN115495368A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111709527A (en) | Operation and maintenance knowledge map library establishing method, device, equipment and storage medium | |
CN112860811B (en) | Method and device for determining data blood relationship, electronic equipment and storage medium | |
CN112559717B (en) | Search matching method, device, electronic equipment and storage medium | |
CN111767334A (en) | Information extraction method and device, electronic equipment and storage medium | |
CN113722600B (en) | Data query method, device, equipment and product applied to big data | |
CN113609100A (en) | Data storage method, data query method, data storage device, data query device and electronic equipment | |
CN117633194A (en) | Large model prompt data processing method and device, electronic equipment and storage medium | |
CN116401410B (en) | Method, device, storage medium and equipment for accessing map data to multi-scene graph database | |
CN117171296A (en) | Information acquisition method and device and electronic equipment | |
CN116185389A (en) | Code generation method and device, electronic equipment and medium | |
CN116009847A (en) | Code generation method, device, electronic equipment and storage medium | |
CN115328898A (en) | Data processing method and device, electronic equipment and medium | |
CN115495368A (en) | Data testing method and device and electronic equipment | |
CN114579580A (en) | Data storage method and data query method and device | |
CN114443802A (en) | Interface document processing method and device, electronic equipment and storage medium | |
CN118133794B (en) | Table configuration method, apparatus, device and storage medium | |
CN117851575B (en) | Large language model question-answer optimization method and device, electronic equipment and storage medium | |
CN114880242B (en) | Test case extraction method, device, equipment and medium | |
CN116383454B (en) | Data query method of graph database, electronic equipment and storage medium | |
CN114650222B (en) | Parameter configuration method, device, electronic equipment and storage medium | |
CN118132550A (en) | Structured large field data query method and device and electronic equipment | |
CN115981657A (en) | Code generation method and device, electronic equipment and readable medium | |
CN118012897A (en) | Heterogeneous database grammar conversion method, device, equipment and storage medium | |
CN117349312A (en) | Word standardization, query method, device, electronic equipment and storage medium | |
CN116521866A (en) | Training sample construction method and device, electronic equipment and 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 |