CN111858385A - Test method, device, equipment and storage medium of SQL database - Google Patents
Test method, device, equipment and storage medium of SQL database Download PDFInfo
- Publication number
- CN111858385A CN111858385A CN202010773736.8A CN202010773736A CN111858385A CN 111858385 A CN111858385 A CN 111858385A CN 202010773736 A CN202010773736 A CN 202010773736A CN 111858385 A CN111858385 A CN 111858385A
- Authority
- CN
- China
- Prior art keywords
- test
- sql database
- data
- test set
- result
- 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.)
- Granted
Links
- 238000010998 test method Methods 0.000 title claims abstract description 15
- 238000012360 testing method Methods 0.000 claims abstract description 370
- 238000000034 method Methods 0.000 claims abstract description 34
- 125000004122 cyclic group Chemical group 0.000 claims description 39
- 238000012545 processing Methods 0.000 claims description 6
- 238000012163 sequencing technique Methods 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims 1
- 238000007405 data analysis Methods 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 7
- 238000013461 design Methods 0.000 description 6
- 206010009944 Colon cancer Diseases 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 238000013075 data extraction Methods 0.000 description 2
- 230000001174 ascending effect Effects 0.000 description 1
- 238000012938 design process Methods 0.000 description 1
- 238000011990 functional testing Methods 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
- 238000012795 verification Methods 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/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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2201/00—Indexing scheme relating to error detection, to error correction, and to monitoring
- G06F2201/80—Database-specific techniques
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
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)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to the field of data analysis, and discloses a test method, a test device, test equipment and a storage medium of an SQL database. The method comprises the following steps: connecting a target SQL database to be tested and a standard SQL database; simultaneously sending a test instruction to the target SQL database and the standard SQL database, acquiring a first test set generated by the target SQL database and acquiring a second test set of the standard SQL database; and analyzing the matching relation between the first test set and the second test set according to a preset matching algorithm to obtain the test result of the target SQL database.
Description
Technical Field
The invention relates to the field of data analysis, in particular to a test method, a test device, test equipment and a storage medium of an SQL database.
Background
The database is the basis for various software implementations, so the reliability of the database needs to be ensured in the functional design. In order to ensure reliability, after the functional design of the database is completed, various tests and verifications are required to verify the functions of the database.
In the design process of the SQL database, because SQL is a flexible language for calling the database, when a new design structure appears, a large number of functional tests are needed to ensure that each design can accurately realize the functions. The large amount of test data causes that a long time is spent for each SQL database design, and repeated inspection is needed in the using process, so that the SQL design becomes complicated, and a method for efficiently and accurately verifying the SQL database is needed.
Disclosure of Invention
The invention mainly aims to solve the technical problems of low testing efficiency and low accuracy of the SQL database.
The first aspect of the present invention provides a test method for an SQL database, which comprises:
connecting a target SQL database to be tested and a standard SQL database;
simultaneously sending a test instruction to the target SQL database and the standard SQL database, acquiring a first test set generated by the target SQL database and acquiring a second test set of the standard SQL database;
and analyzing the matching relation between the first test set and the second test set according to a preset matching algorithm to obtain the test result of the target SQL database.
Optionally, in a first implementation manner of the first aspect of the present invention, the analyzing, according to a preset matching algorithm, a matching relationship between the first test set and the second test set to obtain a test result of the target SQL database includes:
judging whether invalid equivalence class data exists in the data in the first test set;
if the first test set does not exist, comparing the data of the first test set with the data of the second test set to obtain a comparison result;
if yes, judging whether comparison processing is set to be carried out on the first test set and the second test set;
if so, comparing the first test set with the second test set according to the output sequence of the data to obtain a comparison result;
if not, acquiring a preset prediction result set in the standard SQL database, and comparing the first test set with the prediction result set according to the output sequence of data to obtain a comparison result;
and generating a test result of the target SQL database according to the obtained comparison result.
Optionally, in a second implementation manner of the first aspect of the present invention, the comparing the data of the first test set with the data of the second test set to obtain a comparison result includes:
judging whether the test instructions all have sequencing instructions;
if the first test set and the second test set have ordering instructions, comparing the first test set and the second test set one by one to generate comparison results;
if not, comparing the first test set with the second test set according to a preset cyclic comparison algorithm to obtain a comparison result.
Optionally, in a third implementation manner of the first aspect of the present invention, the comparing the first test set and the second test set according to a preset cyclic comparison algorithm, and obtaining a comparison result includes:
calculating a cyclic redundancy check value corresponding to each data in the first test set, and combining all the cyclic redundancy check values to generate a cyclic redundancy check set;
analyzing to obtain the total number, the minimum value and the maximum value of the cyclic redundancy check set, obtaining a preset first threshold value, and judging whether the total number is greater than the first threshold value;
if the total number is not greater than the first threshold value, comparing the first test set with the second test set according to the output sequence of the data to obtain a comparison result;
if the total number is larger than the first threshold, acquiring a preset second threshold, and capturing cyclic redundancy check values in the cyclic redundancy check set in the range from the minimum value to the sum of the second threshold and the minimum value to generate a first record table;
according to a preset increasing value N, capturing cyclic redundancy check values in the cyclic redundancy check set in the range from the sum of the minimum value and the increasing value N to the sum of the second threshold value, the minimum value and the increasing value N, and generating an N +1 record table, wherein the value of N is from 1 to the difference value between the maximum value and the minimum value, and N is a positive integer;
and according to the output sequence of the data, comparing the corresponding predicted result set in the first record table and the Nth record table respectively to obtain comparison results.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the generating a test result of the target SQL database according to the obtained comparison result includes:
reading the contents in the obtained comparison result, and judging whether the contents are consistent;
if the content is inconsistent, analyzing the content, extracting inconsistent data in the first test data and the second test data, generating a test record table, and adding the first test data, the second test data and the test record table into a preset test result frame to generate a test result of the target SQL database;
if the contents are consistent, recording the first test data and the second test data into a preset test result frame, and generating a test result of the target SQL database.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the analyzing, according to a preset matching algorithm, a matching relationship between the first test set and the second test set, and obtaining a test result of the target SQL database includes:
sequentially extracting first data in the first test set and second data in the second test set according to a preset matching algorithm, and judging whether the first data and the second data have data contents or not;
if the data does not exist in the first test set and the second test set, judging whether the first test set and the second test set are blank data or not;
if the data are blank data, the test result of the target SQL database is determined to be matched;
if the data are not blank data, determining that the test result of the target SQL database is not matched;
and if the data contents exist, traversing the first test set and the second test set according to the comparison of the first data and the second data to obtain the test result of the target SQL database.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the traversing the first test set and the second test set according to the comparison between the first data and the second data to obtain the test result of the target SQL database includes:
sequentially extracting first data in the first test set, sequentially extracting second data in the second test set, and judging whether all the first data are consistent with the corresponding second data;
if yes, the test result of the target SQL database is confirmed to be that the first test set and the second test set are matched with each other;
if not, the test result of the target SQL database is confirmed to be that the first test set and the second test set are not matched with each other.
The second aspect of the present invention provides a testing apparatus for an SQL database, comprising:
the connection module is used for connecting a target SQL database to be tested and a standard SQL database;
the sending and acquiring module is used for sending a test instruction to the target SQL database and the standard SQL database at the same time, acquiring a first test set generated by the target SQL database and acquiring a second test set of the standard SQL database;
and the matching module is used for analyzing the matching relation between the first test set and the second test set according to a preset matching algorithm to obtain a test result of the target SQL database.
A third aspect of the present invention provides a test apparatus for an SQL database, including: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line; the at least one processor calls the instructions in the memory to enable the test equipment of the SQL database to execute the test method of the SQL database.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-described test method of the SQL database.
Drawings
FIG. 1 is a diagram of a first embodiment of a method for testing an SQL database according to the embodiment of the invention;
FIG. 2 is a diagram of a second embodiment of a method for testing an SQL database according to the embodiment of the invention;
FIG. 3 is a diagram of a third embodiment of the test method for the SQL database according to the embodiment of the invention;
FIG. 4 is a diagram of an embodiment of a device for testing an SQL database according to the embodiment of the invention;
FIG. 5 is a schematic diagram of another embodiment of a test apparatus for an SQL database according to the embodiment of the invention;
fig. 6 is a schematic diagram of an embodiment of a test device for an SQL database according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a test method, a test device, test equipment and a storage medium of an SQL database.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of the embodiment of the present invention is described below, and referring to fig. 1, a first embodiment of the method for testing an SQL database according to the embodiment of the present invention includes:
101. connecting a target SQL database to be tested and a standard SQL database;
in this embodiment, the standard SQL database is a verified database, the instructions and functions in the standard SQL database are templates, and the functions of the target SQL database and the standard SQL database are compared to determine whether they are consistent, if they are consistent, the target SQL database is qualified, and if they are not consistent, the target SQL database is unqualified.
102. Simultaneously sending a test instruction to a target SQL database and a standard SQL database, acquiring a first test set generated by the target SQL database and acquiring a second test set of the standard SQL database;
in this embodiment, the test instruction may be: the students with non-empty school numbers and surname ' sheet ' are inquired, the first three students are taken according to ascending order, specifically, the students can be { Select/sid, name/from student/where name sheet '%/and sidi not null/order by sid/limit 3}, wherein the subjects of sid and name are selected, the students have ' sheet ' and are not empty, then the students are sorted by using an order instruction, and the data of the first three ranks are taken. And the target SQL database processes the student table according to the test instruction to obtain a first test set. And processing the student table according to the test instruction by the standard SQL data to obtain a second test set.
103. And analyzing the matching relation between the first test set and the second test set according to a preset matching algorithm to obtain the test result of the target SQL database.
In this embodiment, the first test set is { one-sheet XXX, two-sheet YYY, three-sheet ERS }, the second test set is { one-sheet 1SFx, two-sheet YYY, four-sheet SDD }, and if the data of the test sets are analyzed to be different, it is determined that the test result of the target SQL database is not matched. In another embodiment, the first test set is { ERROR 2340}, the second test set is { tension 1SFx, tension two YYY, tension four SDD }, whether the test set is an invalid equivalence class is judged first, if the first test set is found to be the invalid equivalence class, whether a comparison result needs to be output is judged, comparison is performed according to the output sequence of output data, the first output is "X" and "tension", whether the "X" and the "tension" are consistent is judged, if the "X" and the "tension" are inconsistent is judged, the test result of the target SQL database is considered to be unmatched.
In the embodiment of the invention, the standard SQL database and the target SQL database are used for testing and comparing, and whether the target SQL database is found or not is judged according to the comparison result, so that the target SQL database is tested efficiently and accurately, the testing steps are reduced, the testing time is shortened, and the testing speed is higher than that of the prior art.
Referring to fig. 2, a second embodiment of the test method for the SQL database according to the embodiment of the present invention includes:
201. connecting a target SQL database to be tested and a standard SQL database;
the method embodiment described in this embodiment is similar to the first embodiment, and reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
202. Simultaneously sending a test instruction to a target SQL database and a standard SQL database, acquiring a first test set generated by the target SQL database and acquiring a second test set of the standard SQL database;
the method embodiment described in this embodiment is similar to the first embodiment, and reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
203. Judging whether invalid equivalence class data exists in the data in the first test set;
in this embodiment, a determination is made as to whether a first test set exists that is similar { XDFADAD! The @ # } or normal data is interspersed with invalid equivalence class data.
204. If not, judging whether the test instructions all have sequencing instructions;
in this embodiment, it is determined whether there is an "order" command { Select/sid, name/from student/where name like "%"/and side is not null/order by side/limit 3}, if there is an "order", there is a sort command, and if there is no "order" command, there is no sort command.
205. If the sorting instructions exist, comparing the first test set with the second test set one by one to generate comparison results;
in this embodiment, if the order command exists, the sorting results are compared one by one.
206. If not, calculating a cyclic redundancy check value corresponding to each data in the first test set, and combining all the cyclic redundancy check values to generate a cyclic redundancy check set;
in this embodiment, a CRC corresponding to each data in the first test set is calculated, and each CRC is written into a corresponding folder, so as to obtain a cyclic redundancy check set.
207. Analyzing to obtain the total number, the minimum value and the maximum value of the cyclic redundancy check set, obtaining a preset first threshold value, and judging whether the total number is greater than the first threshold value;
in this embodiment, the maximum value m, the minimum value n, and the total number z of CRCs in the cyclic redundancy check set are read, the set threshold value X is read, and whether the total number z is greater than the threshold value X is determined.
208. If the total number is not greater than the first threshold value, comparing the first test set with the second test set according to the output sequence of the data to obtain a comparison result;
in the present embodiment, if the total number z is not greater than the threshold value X, the comparison is performed according to the output order.
209. If the total number is larger than the first threshold, acquiring a preset second threshold, and capturing cyclic redundancy check values in the cyclic redundancy check set in the range from the minimum value to the sum of the second threshold and the minimum value to generate a first record table;
in this embodiment, if the total number z is greater than the threshold X, a preset threshold Y is obtained, and then CRCs in the ranges of n and n + Y are read to obtain a first record table.
210. According to a preset increasing value N, capturing cyclic redundancy check values in the cyclic redundancy check set in the range from the sum of the minimum value and the increasing value N to the sum of the second threshold value, the minimum value and the increasing value N, and generating an N +1 record table, wherein the value of N is from 1 to the difference value between the maximum value and the minimum value, and N is a positive integer;
in the present embodiment, CRC data in a range of N + Y to N + Y, where N is 1,2, and 3 …, and the 2 nd, 3 rd, and 4 th record tables … are generated according to the value of N.
211. According to the output sequence of the data, comparing the corresponding predicted result set in the first record table and the Nth record table respectively to obtain comparison results;
in this embodiment, the comparison results are obtained by comparing the 1 st record table, the 2 nd record table and the 3 rd record table …, and different results are written in the table of the comparison results.
212. If yes, judging whether comparison processing is set to be carried out on the first test set and the second test set;
in this embodiment, if there is invalid equivalence class data, it will need to be determined whether the settings in this case need to be matched.
213. If so, comparing the first test set with the second test set according to the output sequence of the data to obtain a comparison result;
in this embodiment, in the absence of the "order" instruction, the output data "X" and "sheet" of the first test set { zhang-first XXX, zhang-second YYY, zhang-third ERS } and the second test set { XXX zhang-first, YYY, zhang-third ERS } are compared to determine that there is no match.
214. If not, acquiring a preset prediction result set in a standard SQL database, and comparing the first test set with the prediction result set according to the output sequence of the data to obtain a comparison result;
in this embodiment, if no comparison is set, the predicted result set C of the standard SQL database is compared with the first test result of the target SQL test set according to the output time sequence.
215. Reading the contents in the obtained comparison result, and judging whether the contents are consistent;
in this embodiment, the output data "X" and "sheet" of the first test set { XXX, yyyy, three ERS } and the second test set { XXX X, YYY, two ERS, three ERS } are compared, and it is determined whether the comparison between "X" and "sheet" is consistent.
216. If the contents are inconsistent, analyzing the contents, extracting inconsistent data in the first test data and the second test data, generating a test record table, and adding the first test data, the second test data and the test record table into a preset test result frame to generate a test result of the target SQL database;
in this embodiment, "X" and "sheets" are written into the CSV table, and according to the comparison result of "X" and "sheets", it is found that the test result of the target SQL database is not matched.
217. And if the contents are consistent, recording the first test data and the second test data into a preset test result frame, and generating a test result of the target SQL database.
In this embodiment, if the results are consistent, it is determined that there is no different data written in the result frame, and the test result of the target SQL database is determined to be a match.
In the embodiment of the invention, the standard SQL database and the target SQL database are used for testing and comparing, and whether the target SQL database is found or not is judged according to the comparison result, so that the target SQL database is tested efficiently and accurately, the testing steps are reduced, the testing time is shortened, and the testing speed is higher than that of the prior art.
Referring to fig. 3, a third embodiment of the test method for the SQL database according to the embodiment of the present invention includes:
301. connecting a target SQL database to be tested and a standard SQL database;
the method embodiment described in this embodiment is similar to the first embodiment, and reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
302. Simultaneously sending a test instruction to a target SQL database and a standard SQL database, acquiring a first test set generated by the target SQL database and acquiring a second test set of the standard SQL database;
the method embodiment described in this embodiment is similar to the first embodiment, and reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
303. Sequentially extracting first data in a first test set and second data in a second test set according to a preset matching algorithm, and judging whether the first data and the second data have data contents;
in this embodiment, if the first data extraction is { } and the second data extraction is { XX }, it is determined that both exist.
304. If the data does not exist in the first test set and the second test set, judging whether the first test set and the second test set are blank data or not;
in this embodiment, it is determined whether there is blank data for both the first data { } and the second data { }.
305. If the data are blank data, the test result of the target SQL database is determined to be matched;
in this embodiment, if both the first data { } and the second data { } are blank, it is considered that the first test set and the second test set are matched, and when both the extracted first data and the extracted second data are matched, it is considered that the first test set and the second test set are matched.
306. If the data are not blank data, the test result of the target SQL database is determined to be mismatching;
in this embodiment, if the unevenness is blank, the first data { } and the second data { XX } are considered as mismatch, and the test result of the target SQL database is considered as not matching.
307. If the data content exists, sequentially extracting first data in the first test set, sequentially extracting second data in the second test set, and judging whether all the first data are consistent with the corresponding second data;
in this embodiment, it is determined whether the first data { ER } and the second data { XX } are identical, whether the second first data { EER } and the second data { XXD } are identical, and whether all the first data and the corresponding second data are identical.
308. If yes, determining that the first test set and the second test set are matched with each other according to the test result of the target SQL database;
in this embodiment, the first data { XX } and the second data { XX }, and the second data { XJX }, are considered to match each other.
309. If not, the test result of the target SQL database is determined that the first test set and the second test set are not matched with each other.
In this embodiment, if the first data { ER } and the second data { XX } are consistent, and the second first data { EER } and the second data { XXD } are consistent, the first test set and the second test set are considered to be mismatched.
In the embodiment of the invention, the standard SQL database and the target SQL database are used for testing and comparing, and whether the target SQL database is found or not is judged according to the comparison result, so that the target SQL database is tested efficiently and accurately, the testing steps are reduced, the testing time is shortened, and the testing speed is higher than that of the prior art.
In the above description of the test method of the SQL database in the embodiment of the present invention, the following description describes the test apparatus of the SQL database in the embodiment of the present invention, please refer to fig. 4, and an embodiment of the test apparatus of the SQL database in the embodiment of the present invention includes:
a connection module 401, configured to connect a target SQL database to be tested and a standard SQL database;
a sending and acquiring module 402, configured to send a test instruction to the target SQL database and the standard SQL database at the same time, acquire a first test set generated by the target SQL database, and acquire a second test set of the standard SQL database;
the matching module 403 is configured to analyze a matching relationship between the first test set and the second test set according to a preset matching algorithm, so as to obtain a test result of the target SQL database.
In the embodiment of the invention, the standard SQL database and the target SQL database are used for testing and comparing, and whether the target SQL database is found or not is judged according to the comparison result, so that the target SQL database is tested efficiently and accurately, the testing steps are reduced, the testing time is shortened, and the testing speed is higher than that of the prior art.
Referring to fig. 5, another embodiment of the testing apparatus for the SQL database according to the embodiment of the present invention includes:
a connection module 401, configured to connect a target SQL database to be tested and a standard SQL database;
a sending and acquiring module 402, configured to send a test instruction to the target SQL database and the standard SQL database at the same time, acquire a first test set generated by the target SQL database, and acquire a second test set of the standard SQL database;
the matching module 403 is configured to analyze a matching relationship between the first test set and the second test set according to a preset matching algorithm, so as to obtain a test result of the target SQL database.
Wherein the sending and acquiring module 402 includes:
a first determining unit 4021, configured to determine whether data in the first test set has invalid equivalent class data;
the first comparing unit 4022 is configured to compare data of the first test set with data of the second test set if the first test set does not exist, so as to obtain a comparison result;
a second determining unit 4023, configured to determine whether to perform comparison processing on the first test set and the second test set if the first test set and the second test set exist;
a second comparing unit 4024, configured to compare the first test set with the second test set according to an output order of data to obtain a comparison result if the comparison result is set;
a third comparing unit 4025, configured to obtain a preset prediction result set in the standard SQL database if the preset prediction result set is not set, and compare the first test set and the prediction result set according to an output sequence of data to obtain a comparison result;
the generating unit 4026 is configured to generate a test result of the target SQL database according to the obtained comparison result.
The first comparing unit 4022 is specifically configured to:
judging whether the test instructions all have sequencing instructions;
if the first test set and the second test set have ordering instructions, comparing the first test set and the second test set one by one to generate comparison results;
if not, comparing the first test set with the second test set according to a preset cyclic comparison algorithm to obtain a comparison result.
The first comparing unit 4022 may be further specifically configured to:
calculating a cyclic redundancy check value corresponding to each data in the first test set, and combining all the cyclic redundancy check values to generate a cyclic redundancy check set;
analyzing to obtain the total number, the minimum value and the maximum value of the cyclic redundancy check set, obtaining a preset first threshold value, and judging whether the total number is greater than the first threshold value;
if the total number is not greater than the first threshold value, comparing the first test set with the second test set according to the output sequence of the data to obtain a comparison result;
if the total number is larger than the first threshold, acquiring a preset second threshold, and capturing cyclic redundancy check values in the cyclic redundancy check set in the range from the minimum value to the sum of the second threshold and the minimum value to generate a first record table;
according to a preset increasing value N, capturing cyclic redundancy check values in the cyclic redundancy check set in the range from the sum of the minimum value and the increasing value N to the sum of the second threshold value, the minimum value and the increasing value N, and generating an N +1 record table, wherein the value of N is from 1 to the difference value between the maximum value and the minimum value, and N is a positive integer;
and according to the output sequence of the data, comparing the corresponding predicted result set in the first record table and the Nth record table respectively to obtain comparison results.
The generating unit 4026 is specifically configured to:
reading the contents in the obtained comparison result, and judging whether the contents are consistent;
if the content is inconsistent, analyzing the content, extracting inconsistent data in the first test data and the second test data, generating a test record table, and adding the first test data, the second test data and the test record table into a preset test result frame to generate a test result of the target SQL database;
if the contents are consistent, recording the first test data and the second test data into a preset test result frame, and generating a test result of the target SQL database.
Wherein the matching module 403 comprises:
an extracting unit 4031, configured to sequentially extract, according to a preset matching algorithm, first data in the first test set, sequentially extract second data in the second test set, and determine whether data content exists in both the first data and the second data;
a blank comparing unit 4032, configured to determine whether the first test set and the second test set are both blank data if the first test set and the second test set do not both have data;
a first determining unit 4033, configured to determine that the test result of the target SQL database is a match if the test results are blank data;
a second determining unit 4034, configured to determine that the test result of the target SQL database is determined to be unmatched if the unevenness is blank data;
and a traversal unit 4035, configured to, if there are data contents in both cases, traverse the first test set and the second test set according to a comparison between the first data and the second data, to obtain a test result of the target SQL database.
Wherein the traversal unit 4035 is specifically configured to:
sequentially extracting first data in the first test set, sequentially extracting second data in the second test set, and judging whether all the first data are consistent with the corresponding second data;
if yes, the test result of the target SQL database is confirmed to be that the first test set and the second test set are matched with each other;
if not, the test result of the target SQL database is confirmed to be that the first test set and the second test set are not matched with each other.
In the embodiment of the invention, the standard SQL database and the target SQL database are used for testing and comparing, and whether the target SQL database is found or not is judged according to the comparison result, so that the target SQL database is tested efficiently and accurately, the testing steps are reduced, the testing time is shortened, and the testing speed is higher than that of the prior art.
Fig. 4 and 5 describe the test apparatus of the SQL database in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the test apparatus of the SQL database in the embodiment of the present invention in detail from the perspective of the hardware processing.
Fig. 6 is a schematic structural diagram of a test apparatus for an SQL database according to an embodiment of the present invention, where the test apparatus 600 for the SQL database may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 610 (e.g., one or more processors) and a memory 620, and one or more storage media 630 (e.g., one or more mass storage devices) storing applications 633 or data 632. Memory 620 and storage medium 630 may be, among other things, transient or persistent storage. The program stored on the storage medium 630 may include one or more modules (not shown), each of which may include a series of instruction operations in the test equipment 600 for an SQL database. Still further, the processor 610 may be configured to communicate with the storage medium 630 to execute a series of instruction operations in the storage medium 630 on the test device 600 for an SQL database.
The SQL database-based test equipment 600 may also include one or more power supplies 640, one or more wired or wireless network interfaces 650, one or more input-output interfaces 660, and/or one or more operating systems 631, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, and so forth. Those skilled in the art will appreciate that the test equipment structure of the SQL database shown in fig. 6 does not constitute a limitation of the test equipment based on the SQL database, and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and which may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the method for testing an SQL database.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses, and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A test method of an SQL database is characterized by comprising the following steps:
connecting a target SQL database to be tested and a standard SQL database;
simultaneously sending a test instruction to the target SQL database and the standard SQL database, acquiring a first test set generated by the target SQL database and acquiring a second test set of the standard SQL database;
and analyzing the matching relation between the first test set and the second test set according to a preset matching algorithm to obtain the test result of the target SQL database.
2. The method for testing an SQL database according to claim 1, wherein the analyzing the matching relationship between the first test set and the second test set according to a preset matching algorithm to obtain the test result of the target SQL database comprises:
judging whether invalid equivalence class data exists in the data in the first test set;
if the first test set does not exist, comparing the data of the first test set with the data of the second test set to obtain a comparison result;
if yes, judging whether comparison processing is set to be carried out on the first test set and the second test set;
if so, comparing the first test set with the second test set according to the output sequence of the data to obtain a comparison result;
if not, acquiring a preset prediction result set in the standard SQL database, and comparing the first test set with the prediction result set according to the output sequence of data to obtain a comparison result;
and generating a test result of the target SQL database according to the obtained comparison result.
3. The method for testing an SQL database according to claim 2, wherein the comparing the first test set with the second test set to obtain the comparison result comprises:
judging whether the test instructions all have sequencing instructions;
if the first test set and the second test set have ordering instructions, comparing the first test set and the second test set one by one to generate comparison results;
if not, comparing the first test set with the second test set according to a preset cyclic comparison algorithm to obtain a comparison result.
4. The method for testing an SQL database according to claim 3, wherein the comparing the first test set and the second test set according to a preset cyclic comparison algorithm to obtain the comparison result comprises:
calculating a cyclic redundancy check value corresponding to each data in the first test set, and combining all the cyclic redundancy check values to generate a cyclic redundancy check set;
analyzing to obtain the total number, the minimum value and the maximum value of the cyclic redundancy check set, obtaining a preset first threshold value, and judging whether the total number is greater than the first threshold value;
if the total number is not greater than the first threshold value, comparing the first test set with the second test set according to the output sequence of the data to obtain a comparison result;
if the total number is larger than the first threshold, acquiring a preset second threshold, and capturing cyclic redundancy check values in the cyclic redundancy check set in the range from the minimum value to the sum of the second threshold and the minimum value to generate a first record table;
according to a preset increasing value N, capturing cyclic redundancy check values in the cyclic redundancy check set in the range from the sum of the minimum value and the increasing value N to the sum of the second threshold value, the minimum value and the increasing value N, and generating an N +1 record table, wherein the value of N is from 1 to the difference value between the maximum value and the minimum value, and N is a positive integer;
and according to the output sequence of the data, comparing the corresponding predicted result set in the first record table and the Nth record table respectively to obtain comparison results.
5. The method for testing the SQL database according to any one of claims 2 to 4, wherein the generating the test result of the target SQL database according to the obtained comparison result comprises:
reading the contents in the obtained comparison result, and judging whether the contents are consistent;
if the content is inconsistent, analyzing the content, extracting inconsistent data in the first test data and the second test data, generating a test record table, and adding the first test data, the second test data and the test record table into a preset test result frame to generate a test result of the target SQL database;
if the contents are consistent, recording the first test data and the second test data into a preset test result frame, and generating a test result of the target SQL database.
6. The method for testing an SQL database according to claim 1, wherein the analyzing the matching relationship between the first test set and the second test set according to a preset matching algorithm to obtain the test result of the target SQL database comprises:
sequentially extracting first data in the first test set and second data in the second test set according to a preset matching algorithm, and judging whether the first data and the second data have data contents or not;
if the data does not exist in the first test set and the second test set, judging whether the first test set and the second test set are blank data or not;
if the data are blank data, the test result of the target SQL database is determined to be matched;
if the data are not blank data, determining that the test result of the target SQL database is not matched;
and if the data contents exist, traversing the first test set and the second test set according to the comparison of the first data and the second data to obtain the test result of the target SQL database.
7. The method for testing an SQL database according to claim 6, wherein traversing the first test set and the second test set according to the comparison of the first data and the second data to obtain the test result of the target SQL database comprises:
sequentially extracting first data in the first test set, sequentially extracting second data in the second test set, and judging whether all the first data are consistent with the corresponding second data;
if yes, the test result of the target SQL database is confirmed to be that the first test set and the second test set are matched with each other;
if not, the test result of the target SQL database is confirmed to be that the first test set and the second test set are not matched with each other.
8. The SQL database testing device is characterized by comprising the following components:
the connection module is used for connecting a target SQL database to be tested and a standard SQL database;
the sending and acquiring module is used for sending a test instruction to the target SQL database and the standard SQL database at the same time, acquiring a first test set generated by the target SQL database and acquiring a second test set of the standard SQL database;
and the matching module is used for analyzing the matching relation between the first test set and the second test set according to a preset matching algorithm to obtain a test result of the target SQL database.
9. A test apparatus for an SQL database, the test apparatus comprising: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invoking the instructions in the memory to cause the test equipment of the SQL database to perform the test method of the SQL database according to any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements a method of testing an SQL database according to any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010773736.8A CN111858385B (en) | 2020-08-04 | 2020-08-04 | SQL database testing method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010773736.8A CN111858385B (en) | 2020-08-04 | 2020-08-04 | SQL database testing method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111858385A true CN111858385A (en) | 2020-10-30 |
CN111858385B CN111858385B (en) | 2024-02-20 |
Family
ID=72953206
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010773736.8A Active CN111858385B (en) | 2020-08-04 | 2020-08-04 | SQL database testing method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111858385B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101330446A (en) * | 2007-06-21 | 2008-12-24 | 中兴通讯股份有限公司 | Analysis method for enhancing protocol layer frame of special transmission channel |
US20100185694A1 (en) * | 2009-01-22 | 2010-07-22 | Shady Copty | Query-Based Generation of Data Records |
CN104598883A (en) * | 2015-01-21 | 2015-05-06 | 西安理工大学 | Method for re-recognizing target in multi-camera monitoring network |
CN106155014A (en) * | 2016-06-23 | 2016-11-23 | 北京东土科技股份有限公司 | A kind of industry internet field layer wideband bus real-time implementation method |
CN107730087A (en) * | 2017-09-20 | 2018-02-23 | 平安科技(深圳)有限公司 | Forecast model training method, data monitoring method, device, equipment and medium |
CN108009087A (en) * | 2017-11-29 | 2018-05-08 | 广州品唯软件有限公司 | Data library test method, device and computer-readable recording medium |
CN109344056A (en) * | 2018-09-07 | 2019-02-15 | 武汉达梦数据库有限公司 | A kind of test method and test device |
CN109726136A (en) * | 2019-01-28 | 2019-05-07 | 上海达梦数据库有限公司 | Test method, device, equipment and the storage medium of database |
CN110209584A (en) * | 2019-06-03 | 2019-09-06 | 广东电网有限责任公司 | A kind of automatic generation of test data and relevant apparatus |
-
2020
- 2020-08-04 CN CN202010773736.8A patent/CN111858385B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101330446A (en) * | 2007-06-21 | 2008-12-24 | 中兴通讯股份有限公司 | Analysis method for enhancing protocol layer frame of special transmission channel |
US20100185694A1 (en) * | 2009-01-22 | 2010-07-22 | Shady Copty | Query-Based Generation of Data Records |
CN104598883A (en) * | 2015-01-21 | 2015-05-06 | 西安理工大学 | Method for re-recognizing target in multi-camera monitoring network |
CN106155014A (en) * | 2016-06-23 | 2016-11-23 | 北京东土科技股份有限公司 | A kind of industry internet field layer wideband bus real-time implementation method |
CN107730087A (en) * | 2017-09-20 | 2018-02-23 | 平安科技(深圳)有限公司 | Forecast model training method, data monitoring method, device, equipment and medium |
CN108009087A (en) * | 2017-11-29 | 2018-05-08 | 广州品唯软件有限公司 | Data library test method, device and computer-readable recording medium |
CN109344056A (en) * | 2018-09-07 | 2019-02-15 | 武汉达梦数据库有限公司 | A kind of test method and test device |
CN109726136A (en) * | 2019-01-28 | 2019-05-07 | 上海达梦数据库有限公司 | Test method, device, equipment and the storage medium of database |
CN110209584A (en) * | 2019-06-03 | 2019-09-06 | 广东电网有限责任公司 | A kind of automatic generation of test data and relevant apparatus |
Also Published As
Publication number | Publication date |
---|---|
CN111858385B (en) | 2024-02-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Sánchez et al. | A comparison of test case prioritization criteria for software product lines | |
CN111767350A (en) | Data warehouse testing method and device, terminal equipment and storage medium | |
CN107665171A (en) | Automatic regression test method and device | |
US20180181620A1 (en) | Metadata-driven program code generation for clinical data analysis | |
CN110474900B (en) | Game protocol testing method and device | |
CN110109824B (en) | Big data autoregression test method and device, computer equipment and storage medium | |
CN109685668B (en) | Order batch processing method, device, computer equipment and storage medium | |
CN109344060A (en) | A kind of analysis method and device of automatic test | |
CN110737689A (en) | Data standard conformance detection method, device, system and storage medium | |
CN111752846A (en) | Interface testing method and device | |
CN109241163B (en) | Electronic certificate generation method and terminal equipment | |
CN110413596A (en) | Field processing method and processing device, storage medium, electronic device | |
CN111858385A (en) | Test method, device, equipment and storage medium of SQL database | |
CN115658620B (en) | Data authorization sharing method and system based on big data | |
US20140281719A1 (en) | Explaining excluding a test from a test suite | |
CN110851344B (en) | Big data testing method and device based on complexity of calculation formula and electronic equipment | |
CN112631852A (en) | Macro checking method, macro checking device, electronic equipment and computer readable storage medium | |
CN111932142A (en) | Method, device, equipment and storage medium for scheme grouping and data grouping | |
CN113127003A (en) | Code abnormity warning method, device, equipment and storage medium | |
CN113125780A (en) | Sample processing method and device | |
CN107085553B (en) | Input box testing method and device | |
CN113434408B (en) | Unit test case sequencing method based on test prediction | |
CN111666301B (en) | Service interface testing method, computer device and storage medium | |
CN117238423A (en) | Method, system, equipment and medium for uploading virus detection result | |
CN112363922A (en) | Test case generation method and related equipment thereof |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |