CN111858385B - SQL database testing method, device, equipment and storage medium - Google Patents

SQL database testing method, device, equipment and storage medium Download PDF

Info

Publication number
CN111858385B
CN111858385B CN202010773736.8A CN202010773736A CN111858385B CN 111858385 B CN111858385 B CN 111858385B CN 202010773736 A CN202010773736 A CN 202010773736A CN 111858385 B CN111858385 B CN 111858385B
Authority
CN
China
Prior art keywords
test set
test
data
sql database
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.)
Active
Application number
CN202010773736.8A
Other languages
Chinese (zh)
Other versions
CN111858385A (en
Inventor
韦炳钦
熊志强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Hanyun Technology Co ltd
Original Assignee
Shenzhen Hanyun Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Hanyun Technology Co ltd filed Critical Shenzhen Hanyun Technology Co ltd
Priority to CN202010773736.8A priority Critical patent/CN111858385B/en
Publication of CN111858385A publication Critical patent/CN111858385A/en
Application granted granted Critical
Publication of CN111858385B publication Critical patent/CN111858385B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/80Database-specific techniques
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to the field of data analysis and discloses a testing method, device and equipment of an SQL database and a storage medium. 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 a test result of the target SQL database.

Description

SQL database testing method, device, equipment and storage medium
Technical Field
The present invention relates to the field of data analysis, and in particular, to a method, an apparatus, a device, and a storage medium for testing an SQL database.
Background
The database is the basis of various software implementations, so the functional design of the database needs to ensure the reliability thereof. In order to ensure reliability, after the functional design of the database is completed, various tests and verification 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 great deal of functional tests are needed to ensure that each design can accurately realize the functions of the SQL database. The large amount of test data results in long time spent on designing the SQL database each time, and repeated inspection is needed in the use process, so that the SQL database 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 method for testing an SQL database, where the method for testing an SQL database includes:
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 a 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 not, 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 the comparison processing is 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 between the first test set and the second test set to obtain a comparison result includes:
judging whether sequencing instructions exist in the test instructions or not;
if sequencing instructions exist, the first test set and the second test set are compared one by one to generate a comparison result;
if the first test set and the second test set do not exist, comparing the first test set and the second test set according to a preset cycle 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 cycle comparison algorithm, to obtain 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 larger 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 value, a preset second threshold value is obtained, and cyclic redundancy check values in the cyclic redundancy check set are grabbed in the range from the minimum value to the sum of the second threshold value and the minimum value, so that a first record table is generated;
according to a preset increment value N, grabbing cyclic redundancy check values in the cyclic redundancy check set in a range from the sum of the minimum value and the increment value N to the sum of the second threshold value, the minimum value and the increment value N to generate an N+1th record table, wherein N is a positive integer from 1 to the difference value between the maximum value and the minimum value;
and respectively comparing the corresponding prediction result sets in the first record table and the Nth record table according to the output sequence of the data to obtain comparison results.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the generating, according to the obtained comparison result, a test result of the target SQL database includes:
reading the content in the obtained comparison result, and judging whether the content is 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;
and if the content is 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, to obtain 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 are not all the data, judging whether the first test set and the second test set are blank data or not;
if the data are blank data, confirming that the test results of the target SQL database are matched;
if the non-uniformity is blank data, determining that the test result of the target SQL database is unmatched;
if the data content exists, 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, 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 so, 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 the test results are not consistent, the test results of the target SQL database are confirmed to be unmatched with the first test set and the second test set.
The second aspect of the present invention provides a test device for an SQL database, comprising:
the connection module is used for connecting the target SQL database to be tested and the standard SQL database;
the sending and acquiring module is used for simultaneously sending test instructions 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 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 the test result of the target SQL database.
A third aspect of the present invention provides a test apparatus for an SQL database, comprising: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being interconnected by a line; the at least one processor invokes the instructions in the memory to cause 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 instructions stored therein which, when run on a computer, cause the computer to perform the above-described method of testing an SQL database.
Drawings
FIG. 1 is a diagram of a first embodiment of a method for testing an SQL database according to an embodiment of the invention;
FIG. 2 is a diagram of a second embodiment of a method for testing an SQL database according to an embodiment of the invention;
FIG. 3 is a diagram of a third embodiment of a method for testing an SQL database according to an embodiment of the invention;
FIG. 4 is a schematic diagram of an embodiment of a testing apparatus for SQL database according to the present invention;
FIG. 5 is a schematic diagram of another embodiment of a testing apparatus for SQL database according to an embodiment of the invention;
FIG. 6 is a schematic diagram of an embodiment of a test apparatus for SQL database according to an embodiment of the invention.
Detailed Description
The embodiment of the invention provides a test method, a test device, test equipment and a test storage medium of an SQL database.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, 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 or inherent to such process, method, article, or apparatus.
For ease of understanding, the following describes a specific flow of an embodiment of the present invention, referring to fig. 1, a first embodiment of a method for testing an SQL database in an 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 database that has been verified, the instructions and functions in the standard SQL database are templates, and the target SQL database is compared with the functions of the standard SQL database, and whether the target SQL database is consistent is determined by the comparison, if so, the target SQL database is considered to be qualified, and if not, the target SQL database is considered to be 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 student inquiring the student whose academic number is not empty and whose last name is "open" takes the first three in ascending order, specifically { Select/side, sname/from student/white sname like 'open%'/and sid is not null/order by side/limit 3}, wherein the subjects of side and sname are selected, and the subjects of side and sname are "open" and are not empty, and then the order is used by order instruction, and then the data of the first three rows are taken. And the target SQL database processes the student form according to the test instruction to obtain a first test set. And processing the student table by the standard SQL data according to the test instruction 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 a test result of the target SQL database.
In this embodiment, the first test set is { Zhang-one XXX, zhang-two YYY, zhang-three ERS }, the second test set is { Zhang-1 SFX, zhang-two YY, zhang Si SDD }, and the data of the test sets are different after analysis, and the test results of the target SQL database are determined to be not matched. In another embodiment, the first test set is { ERROR 2340}, the second test set is { sheet 1SFx, sheet two YYY, zhang Si SDD }, whether the test set is an invalid equivalence class is first determined, whether the first test set is an invalid equivalence class is found, whether an output comparison result is needed is determined, the comparison is performed according to the output sequence of the output data, the first output is "X" and "sheet" respectively, then whether the "X" and the "sheet" are consistent is determined, and if the "X" and the "sheet" are inconsistent, the test result of the target SQL database is considered as mismatch.
In the embodiment of the invention, the standard SQL database is used for testing and comparing with the target SQL database, and whether the target SQL database 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 compared with the prior art.
Referring to fig. 2, a second embodiment of a method for testing an SQL database according to an 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 procedure in the foregoing method embodiment, which is not described herein.
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 procedure in the foregoing method embodiment, which is not described herein.
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 the first test set is similar to { XDFADAD-! # } 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 an "order" instruction exists in { Select/sed, sname/from student/white name like' sheet%/and sid is not null/order by sed/limit 3}, an order instruction exists if an "order" exists, and no order instruction exists if an "order" instruction does not exist.
205. If sequencing instructions exist, the first test set and the second test set are compared one by one to generate a comparison result;
in this embodiment, when an order instruction exists, the ordering results are compared piece by piece.
206. If the data do not exist, 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 larger 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 z is not greater than the threshold X, the comparison is performed according to the output order.
209. If the total number is larger than the first threshold value, a preset second threshold value is obtained, and cyclic redundancy check values in the cyclic redundancy check set are grabbed in the range from the minimum value to the sum of the second threshold value and the minimum value, so that a first record table is generated;
in this embodiment, if the total number z is greater than the threshold value X, the preset threshold value Y is acquired, and then CRCs of the ranges of n and n+y are read to obtain the first record table.
210. According to a preset increment value N, grabbing cyclic redundancy check values in the cyclic redundancy check set in a range from the sum of the minimum value and the increment value N to the sum of the second threshold value, the minimum value and the increment value N to generate an N+1th record table, wherein N is a positive integer from 1 to the difference value between the maximum value and the minimum value;
in the present embodiment, range CRC data of n+y to n+n+y is read, where n=1, 2,3 … is generated according to the value of N, and the 2 nd, 3 rd, 4 th recording tables ….
211. According to the output sequence of the data, respectively comparing the corresponding prediction result sets in the first record table and the N record table to obtain comparison results;
in this embodiment, the 1 st record table, the 2 nd record table, and the 3 rd record table … are compared to obtain comparison results, and different results are written into the table of comparison results.
212. If yes, judging whether the comparison processing is carried out on the first test set and the second test set;
in the present embodiment, if there is invalid equivalence class data, it will be necessary to determine whether or not matching is set to be required in this case.
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 present embodiment, if the order is not present, the output data "X" and "sheet" of the first test set { one-to-one XXX, one-to-two yyyy, one-to-three ERS } and the second test set { one-to-one XXX, one-to-two yyyy, one-to-three ERS } are compared, and it is determined that the output data "X" and the output data "sheet" are not matched.
214. 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 the data to obtain a comparison result;
in this embodiment, if no comparison is set, the prediction 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 content in the obtained comparison result, and judging whether the content is consistent;
in this embodiment, the output data "X" and "sheet" of the first test set { XXX, YYY, and three ERS } and the second test set { XXX, YYY, and YYY, respectively, are compared, and it is determined whether the comparison of "X" and "sheet" is identical.
216. 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;
in this embodiment, "X" and "sheet" are written into the CSV table, and according to the comparison result of "X" and "sheet", the test result of the target SQL database is obtained as mismatch.
217. If the content is consistent, the first test data and the second test data are recorded into a preset test result frame, and a test result of the target SQL database is generated.
In this embodiment, if the results are consistent, the result frame is written with no different data, and the test result of the target SQL database is confirmed as matching.
In the embodiment of the invention, the standard SQL database is used for testing and comparing with the target SQL database, and whether the target SQL database 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 compared with the prior art.
Referring to fig. 3, a third embodiment of a method for testing an SQL database according to an 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 procedure in the foregoing method embodiment, which is not described herein.
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 procedure in the foregoing method embodiment, which is not described herein.
303. Sequentially extracting first data in a first test set and sequentially extracting 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 or not;
in the present embodiment, if the first data extraction is { XX } and the second data extraction is { XX }, it is judged that none of them exist.
304. If the data are not all the data, judging whether the first test set and the second test set are blank data or not;
in the present embodiment, it is determined whether or not there is first data { } and second data { } both being blank data.
305. If the data are blank data, confirming that the test results of the target SQL database are matched;
in this embodiment, the first data { } and the second data { } are considered to be matched if both are blank, and the first test set and the second test set are considered to be matched when both the extracted first data and the second data are matched.
306. If the non-uniformity is blank data, confirming that the test result of the target SQL database is not matched;
in this embodiment, the first data { XX } and the second data { XX } are considered to be unmatched if the non-uniformities are blank.
307. If the data content exists, sequentially extracting first data in a first test set, sequentially extracting second data in a 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 are identical with the corresponding second data.
308. If the test results are consistent, the first test set and the second test set are matched with each other according to the test results of the target SQL database;
in this embodiment, the first data { XX } and the second data { XJX } are considered to match each other.
309. If the test results are not consistent, the test results of the target SQL database are confirmed to be unmatched between the first test set and the second test set.
In this embodiment, if the first data { ER } and the second data { XX } are identical, and the second first data { EER } and the second data { XXD }, then the first test set and the second test set are considered to be not matched with each other.
In the embodiment of the invention, the standard SQL database is used for testing and comparing with the target SQL database, and whether the target SQL database 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 compared with the prior art.
The method for testing the SQL database in the embodiment of the present invention is described above, and the device for testing the SQL database in the embodiment of the present invention is described below, referring to fig. 4, one embodiment of the device for testing the SQL database in the embodiment of the present invention includes:
the connection module 401 is used for connecting a target SQL database to be tested and a standard SQL database;
the sending and obtaining module 402 is configured to send a test instruction to the target SQL database and the standard SQL database simultaneously, obtain a first test set generated by the target SQL database, and obtain a second test set of the standard SQL database;
and 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 is used for testing and comparing with the target SQL database, and whether the target SQL database 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 compared with the prior art.
Referring to fig. 5, another embodiment of a test apparatus for an SQL database in an embodiment of the present invention includes:
the connection module 401 is used for connecting a target SQL database to be tested and a standard SQL database;
the sending and obtaining module 402 is configured to send a test instruction to the target SQL database and the standard SQL database simultaneously, obtain a first test set generated by the target SQL database, and obtain a second test set of the standard SQL database;
and 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 obtaining module 402 includes:
a first judging unit 4021 configured to judge whether invalid equivalent class data exists in the data in the first test set;
the first comparing unit 4022 is configured to compare the data of the first test set with the data of the second test set if the first test set does not exist, so as to obtain a comparison result;
a second judging unit 4023, configured to judge whether to set a comparison process for the first test set and the second test set if the first test set and the second test set exist;
the second comparing unit 4024 is configured to, if so, compare the first test set with the second test set according to the output sequence of the data, to obtain a comparison result;
the third comparison unit 4025 is configured to obtain a preset prediction result set in the standard SQL database if not set, and compare the first test set with the prediction result set according to the 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 sequencing instructions exist in the test instructions or not;
if sequencing instructions exist, the first test set and the second test set are compared one by one to generate a comparison result;
if the first test set and the second test set do not exist, comparing the first test set and the second test set according to a preset cycle 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 larger 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 value, a preset second threshold value is obtained, and cyclic redundancy check values in the cyclic redundancy check set are grabbed in the range from the minimum value to the sum of the second threshold value and the minimum value, so that a first record table is generated;
according to a preset increment value N, grabbing cyclic redundancy check values in the cyclic redundancy check set in a range from the sum of the minimum value and the increment value N to the sum of the second threshold value, the minimum value and the increment value N to generate an N+1th record table, wherein N is a positive integer from 1 to the difference value between the maximum value and the minimum value;
and respectively comparing the corresponding prediction result sets in the first record table and the Nth record table according to the output sequence of the data to obtain comparison results.
The generating unit 4026 is specifically configured to:
reading the content in the obtained comparison result, and judging whether the content is 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;
and if the content is 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 includes:
the extracting unit 4031 is configured to sequentially extract first data in the first test set and sequentially extract second data in the second test set according to a preset matching algorithm, and determine whether data contents exist in 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 blank data if the first test set and the second test set are not all data;
a first confirmation unit 4033, configured to confirm that the test results of the target SQL database are matched if the data are blank data;
a second confirmation unit 4034, configured to confirm that the test result of the target SQL database is not matched if the non-uniformity is blank data;
and a traversing unit 4035, configured to traverse the first test set and the second test set according to the comparison of the first data and the second data if the data contents exist, so as to obtain a test result of the target SQL database.
Wherein, the traversing 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 so, 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 the test results are not consistent, the test results of the target SQL database are confirmed to be unmatched with the first test set and the second test set.
In the embodiment of the invention, the standard SQL database is used for testing and comparing with the target SQL database, and whether the target SQL database 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 compared with the prior art.
The test device of the SQL database in the embodiment of the present invention is described in detail from the point of view of the modularized functional entity in fig. 4 and fig. 5, and the test equipment of the SQL database in the embodiment of the present invention is described in detail from the point of view of hardware processing.
Fig. 6 is a schematic structural diagram of a test device for an SQL database according to an embodiment of the present invention, where the test device 600 for an SQL database may have a relatively large difference due to different configurations or performances, and may include one or more processors (central processing units, CPU) 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. Wherein the memory 620 and the storage medium 630 may be transitory 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 device 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 of the SQL database.
The SQL database-based test device 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 Serve, mac OS X, unix, linux, freeBSD, and the like. It will be appreciated by those skilled in the art that the test device architecture of the SQL database shown in FIG. 6 does not constitute a limitation of the SQL database-based test device, and may include more or fewer components than shown, or may combine certain components, or may be arranged in 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 may also be a volatile computer readable storage medium, where instructions are stored in the computer readable storage medium, when the instructions are executed on a computer, cause the computer to perform the steps of the method for testing an SQL database.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system or apparatus and unit described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the 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 scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (7)

1. The test method of the SQL database is characterized by comprising the following steps of:
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;
according to a preset matching algorithm, analyzing the matching relation between the first test set and the second test set to obtain a test result of the target SQL database;
the analyzing the matching relation between the first test set and the second test set according to a preset matching algorithm, and obtaining the test result of the target SQL database comprises the following steps:
judging whether invalid equivalence class data exists in the data in the first test set;
if not, 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 the comparison processing is 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;
generating a test result of the target SQL database according to the obtained comparison result;
the step of comparing the data of the first test set with the data of the second test set to obtain a comparison result comprises the following steps:
judging whether sequencing instructions exist in the test instructions or not;
if sequencing instructions exist, the first test set and the second test set are compared one by one to generate a comparison result;
if the first test set and the second test set do not exist, comparing the first test set and the second test set according to a preset cycle comparison algorithm to obtain a comparison result;
the comparing the first test set and the second test set according to a preset cycle comparison algorithm to obtain a 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 larger 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 value, a preset second threshold value is obtained, and cyclic redundancy check values in the cyclic redundancy check set are grabbed in the range from the minimum value to the sum of the second threshold value and the minimum value, so that a first record table is generated;
according to a preset increment value N, grabbing cyclic redundancy check values in the cyclic redundancy check set in a range from the sum of the minimum value and the increment value N to the sum of the second threshold value, the minimum value and the increment value N to generate an N+1th record table, wherein N is a positive integer from 1 to the difference value between the maximum value and the minimum value;
and respectively comparing the corresponding prediction result sets in the first record table and the Nth record table according to the output sequence of the data to obtain comparison results.
2. The method for testing an SQL database according to claim 1, wherein the generating the test result of the target SQL database according to the obtained comparison result comprises:
reading the content in the obtained comparison result, and judging whether the content is consistent;
if the content is inconsistent, analyzing the content, extracting inconsistent data in the first test set and the second test set, generating a test record table, and adding the first test set, the second test set and the test record table into a preset test result frame to generate a test result of the target SQL database;
and if the content is consistent, recording the first test set and the second test set into a preset test result frame, and generating a test result of the target SQL database.
3. The method for testing the 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 are not all the data, judging whether the first test set and the second test set are blank data or not;
if the data are blank data, confirming that the test results of the target SQL database are matched;
if the non-uniformity is blank data, determining that the test result of the target SQL database is unmatched;
if the data content exists, 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.
4. The method for testing an SQL database according to claim 3, 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 so, 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 the test results are not consistent, the test results of the target SQL database are confirmed to be unmatched with the first test set and the second test set.
5. The testing device of the SQL database is characterized by comprising:
the connection module is used for connecting the target SQL database to be tested and the standard SQL database;
the sending and acquiring module is used for simultaneously sending test instructions 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;
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; judging whether invalid equivalence class data exists in the data in the first test set;
if not, 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 the comparison processing is 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;
generating a test result of the target SQL database according to the obtained comparison result;
judging whether sequencing instructions exist in the test instructions or not;
if sequencing instructions exist, the first test set and the second test set are compared one by one to generate a comparison result;
if the first test set and the second test set do not exist, comparing the first test set and the second test set according to a preset cycle comparison algorithm to obtain a comparison result;
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 larger 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 value, a preset second threshold value is obtained, and cyclic redundancy check values in the cyclic redundancy check set are grabbed in the range from the minimum value to the sum of the second threshold value and the minimum value, so that a first record table is generated;
according to a preset increment value N, grabbing cyclic redundancy check values in the cyclic redundancy check set in a range from the sum of the minimum value and the increment value N to the sum of the second threshold value, the minimum value and the increment value N to generate an N+1th record table, wherein N is a positive integer from 1 to the difference value between the maximum value and the minimum value;
and respectively comparing the corresponding prediction result sets in the first record table and the Nth record table according to the output sequence of the data to obtain comparison results.
6. A test device for an SQL database, wherein the test device for an SQL database comprises: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being 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 of any one of claims 1-4.
7. A computer readable storage medium having a computer program stored thereon, wherein the computer program when executed by a processor implements the method of testing an SQL database according to any one of claims 1-4.
CN202010773736.8A 2020-08-04 2020-08-04 SQL database testing method, device, equipment and storage medium Active CN111858385B (en)

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 CN111858385A (en) 2020-10-30
CN111858385B true 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 (8)

* Cited by examiner, † Cited by third party
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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8200655B2 (en) * 2009-01-22 2012-06-12 International Business Machines Corporation Query-based generation of data records

Patent Citations (8)

* Cited by examiner, † Cited by third party
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
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
CN111858385A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
JP3201945B2 (en) How to compare database tables
US8397104B2 (en) Creation of test plans
CN107665171A (en) Automatic regression test method and device
CN107451058B (en) Software development method and device
CN110297767B (en) Automatic execution method, device, equipment and storage medium for test cases
CN111133396B (en) Production facility monitoring device, production facility monitoring method, and recording medium
CN111078510B (en) Task processing progress recording method and device
CN109241163B (en) Electronic certificate generation method and terminal equipment
CN110716843A (en) System fault analysis processing method and device, storage medium and electronic equipment
CN111858385B (en) SQL database testing method, device, equipment and storage medium
CN111124809B (en) Test method and device for server sensor system
US20140281719A1 (en) Explaining excluding a test from a test suite
CN112631852B (en) Macro checking method, macro checking device, electronic equipment and computer readable storage medium
CN116109277A (en) Contract approval method, device, equipment and storage medium
CN110851344B (en) Big data testing method and device based on complexity of calculation formula and electronic equipment
CN112613263B (en) Simulation verification method and device, electronic equipment and computer-readable storage medium
CN111932142A (en) Method, device, equipment and storage medium for scheme grouping and data grouping
US20140088903A1 (en) Manufacturing control system, amnufacturing control method, and manufacturing control program
CN113125780A (en) Sample processing method and device
CN111695829B (en) Index fluctuation period calculation method and device, storage medium and electronic equipment
CN105227333B (en) The method and apparatus of network element device data maintenance
CN107085553B (en) Input box testing method and device
CN113434408B (en) Unit test case sequencing method based on test prediction
CN112363922A (en) Test case generation method and related equipment thereof
US11481379B2 (en) Metadata variance analytics

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