CN113238926A - Database script detection method and device, electronic equipment and storage medium - Google Patents

Database script detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113238926A
CN113238926A CN202110400017.6A CN202110400017A CN113238926A CN 113238926 A CN113238926 A CN 113238926A CN 202110400017 A CN202110400017 A CN 202110400017A CN 113238926 A CN113238926 A CN 113238926A
Authority
CN
China
Prior art keywords
database
detected
script
database script
scripts
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
Application number
CN202110400017.6A
Other languages
Chinese (zh)
Other versions
CN113238926B (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.)
Beijing Infosec Technologies Co Ltd
Original Assignee
Beijing Infosec Technologies 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 Beijing Infosec Technologies Co Ltd filed Critical Beijing Infosec Technologies Co Ltd
Priority to CN202110400017.6A priority Critical patent/CN113238926B/en
Publication of CN113238926A publication Critical patent/CN113238926A/en
Application granted granted Critical
Publication of CN113238926B publication Critical patent/CN113238926B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Abstract

The invention discloses a database script detection method, a database script detection device, electronic equipment and a storage medium, which solve the problem of low test efficiency of the conventional database script test mode and comprise the following steps: acquiring each database script to be detected corresponding to the appointed software application, and acquiring attribute information of each database script to be detected; grouping the database scripts to be detected according to the attribute information of the database scripts to be detected to obtain at least one grouped database script set to be detected; determining respective weight according to the number of the database scripts to be detected in the database script set to be detected aiming at each database script set to be detected; sequentially selecting one database script to be detected from at least one database script set to be detected according to the sequence of the weight from high to low to detect; and determining the detection result of each other database script to be detected in the database script set to be detected according to the detection result of the selected database script to be detected.

Description

Database script detection method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of software testing, in particular to a database script detection method and device, electronic equipment and a storage medium.
Background
At present, for testing database scripts, a test scheme is generally generated according to project requirement documents and development design documents, the generated test scheme is used for testing the database scripts one by one to obtain respective test results, each database script is executed to obtain execution results, the test results and the execution results of each database script are compared, and the database scripts with consistent test results and execution results pass the test. However, it is not sufficient for a single database script to meet the requirements of the user, and the database script is finally used for serving the software application, and the software application stores data through a database table structure created by the database script. In the prior art, one set of software application often supports multiple types of databases, each type of database contains multiple database scripts, and by using the existing database script test mode, each database script can be tested only by acquiring the requirement document and the development design document of each database script contained in the software application, so that the detection efficiency is low.
Disclosure of Invention
In order to solve the problem that the existing database script testing mode is low in detection efficiency, the embodiment of the invention provides a database script detection method and device, electronic equipment and a storage medium.
In a first aspect, an embodiment of the present invention provides a database script detection method, including:
acquiring each database script to be detected supported by a specified software application, and acquiring attribute information of each database script to be detected;
grouping each database script to be detected according to the attribute information of each database script to be detected to obtain at least one grouped database script set to be detected;
determining the weight of each database script set to be detected according to the number of the database scripts to be detected in the database script set to be detected;
sequentially selecting one database script to be detected from the at least one database script set to be detected according to the sequence of the weight from high to low to detect;
and determining the detection result of each other database script to be detected in the database script set to be detected according to the detection result of the selected database script to be detected.
Preferably, grouping the database scripts to be detected according to the attribute information of the database scripts to be detected specifically includes:
the database scripts to be detected with the same attributes and the database scripts to be detected with the same attributes, which are only different in designated attributes and the same in other attributes and can be mutually converted in the designated attributes are divided into a group.
Preferably, for the database scripts to be detected with only different specified attributes, it is determined that the specified attributes can be mutually converted by the following method:
aiming at any database script to be detected with different specified attributes, acquiring a convertible target attribute corresponding to the specified attribute of the database script to be detected according to a preset database difference list, wherein the database difference list stores mutually convertible attribute information in database scripts of different types of databases;
comparing the target attribute with the specified attributes of other database scripts to be detected only with different specified attributes;
and determining that the designated attributes of the database scripts to be detected are consistent with each other according to the comparison result, and converting the designated attributes of the database scripts to be detected.
Preferably, the specified attribute comprises at least a data type of the field; the database difference list at least comprises a corresponding relation of data types, and the corresponding relation of the data types represents the corresponding relation of the data types of the fields which can be mutually converted;
acquiring a convertible target attribute corresponding to the specified attribute of the database script to be detected according to a preset database difference list, specifically comprising:
searching a target data type corresponding to the data type of the field of the database script to be detected from the corresponding relation of the data types;
comparing the target attribute with the specified attributes of other database scripts to be detected only with different specified attributes, specifically comprising:
and comparing the target data type with the data types of the fields of the database scripts to be detected, which are different from the data types of other fields only.
Preferably, the detecting the selected database script to be detected includes:
carrying out library building integrity verification on the selected database script to be detected; and are
And performing compatibility verification on the selected database script to be detected and the specified software application.
Preferably, the library building integrity verification of the selected database script to be detected specifically includes:
aiming at each selected database script to be detected, the following steps are executed:
acquiring database building information, wherein the database building information is the same as the attribute information category of the database script to be detected;
connecting corresponding database clients according to preset database configuration information so that the database clients execute the database scripts to be detected to establish a database;
acquiring attribute information of the executed database script to be detected;
comparing the database building information with the acquired attribute information of the executed database script to be detected;
and when the comparison result is consistent, determining that the database building integrity of the database script to be detected passes verification.
Preferably, the compatibility verification of the selected database script to be detected and the designated software application specifically includes:
and for each selected database script to be detected, loading the specified software application in corresponding application service deployment equipment according to preset software application automatic deployment information so that the application service deployment equipment is connected with a database established by executing the database script to be detected according to the database configuration information, initializing the specified software application, and automatically testing a functional module in the specified software application through preset software application automatic testing information.
In a second aspect, an embodiment of the present invention provides a database script detection apparatus, including:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring each database script to be detected corresponding to a specified software application and acquiring attribute information of each database script to be detected;
the grouping unit is used for grouping the database scripts to be detected according to the attribute information of the database scripts to be detected to obtain at least one grouped database script set to be detected;
the first determining unit is used for determining the weight of each database script set to be detected according to the number of the database scripts to be detected in the database script set to be detected;
the detection unit is used for sequentially selecting one database script to be detected from the at least one database script set to be detected according to the sequence of the weight from high to low to detect;
and the second determining unit is used for determining the detection result of each other database script to be detected in the database script set to be detected to which the selected database script to be detected belongs according to the detection result of the selected database script to be detected.
Preferably, the grouping unit is specifically configured to group database scripts to be detected, which have the same attributes, and database scripts to be detected, which have only different specified attributes and the same other attributes and have mutually convertible specified attributes, into a group.
Preferably, the grouping unit is specifically configured to determine, for a database script to be detected that only has different specified attributes, that the specified attributes can be converted into each other by: aiming at any database script to be detected with different specified attributes, acquiring a convertible target attribute corresponding to the specified attribute of the database script to be detected according to a preset database difference list, wherein the database difference list stores mutually convertible attribute information in database scripts of different types of databases; comparing the target attribute with the specified attributes of other database scripts to be detected only with different specified attributes; and determining that the designated attributes of the database scripts to be detected are consistent with each other according to the comparison result, and converting the designated attributes of the database scripts to be detected.
Preferably, the specified attribute comprises at least a data type of the field; the database difference list at least comprises a corresponding relation of data types, and the corresponding relation of the data types represents the corresponding relation of the data types of the fields which can be mutually converted;
the grouping unit is specifically used for searching a target data type corresponding to the data type of the field of the database script to be detected from the corresponding relation of the data types;
and comparing the target data type with the data types of the fields of the database scripts to be detected, which are different from the data types of other fields only.
Preferably, the detection unit is specifically configured to perform library construction integrity verification on the selected database script to be detected; and performing compatibility verification on the selected database script to be detected and the specified software application.
Preferably, the detection unit is specifically configured to execute the following steps for each selected database script to be detected: acquiring database building information, wherein the database building information is the same as the attribute information category of the database script to be detected; connecting corresponding database clients according to preset database configuration information so that the database clients execute the database scripts to be detected to establish a database; acquiring attribute information of the executed database script to be detected; comparing the database building information with the acquired attribute information of the executed database script to be detected; and when the comparison result is consistent, determining that the database building integrity of the database script to be detected passes verification.
Preferably, the detection unit is specifically configured to load, for each selected database script to be detected, the specified software application in corresponding application service deployment equipment according to preset software application automated deployment information, so that the application service deployment equipment connects, according to the database configuration information, to the database that is established by executing the database script to be detected, initializes the specified software application, and performs automated testing on a function module in the specified software application through preset software application automated testing information.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the database script detection method according to the present invention when executing the computer program.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps in the database script detection method according to the present invention.
The embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, database script detection equipment firstly groups database scripts to be detected supported by appointed software application according to attribute information of the database scripts to obtain at least one grouped database script set to be detected (namely, transverse detection), then weights are given to each database script set to be detected according to the number of the database scripts to be detected contained in each grouped database script set to be detected, one database script to be detected is respectively selected from each database script set to be detected in sequence from high to low according to the weights to carry out detection (namely, longitudinal detection), after the selected database script to be detected in each database script set to be detected is detected, the detection results of other database scripts to be detected in the database script set to be detected can be obtained according to the detection results of the database scripts to be detected, therefore, the detection times of the database script are greatly reduced, and the detection efficiency of the database script is improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a schematic flow chart of an implementation of a database script detection method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart illustrating an implementation process for determining that only specified attributes are different and other attributes correspond to the same specified attributes of the to-be-detected database script and are capable of being converted with each other according to the embodiment of the present invention;
fig. 3 is a schematic diagram of an implementation flow of performing library building integrity verification on a selected database script to be detected according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a database script detection apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to solve the problem that the existing database script testing mode is low in detection efficiency, the embodiment of the invention provides a database script detection method and device, electronic equipment and a storage medium.
The preferred embodiments of the present invention will be described below with reference to the accompanying drawings of the specification, it being understood that the preferred embodiments described herein are merely for illustrating and explaining the present invention, and are not intended to limit the present invention, and that the embodiments and features of the embodiments in the present invention may be combined with each other without conflict.
As shown in fig. 1, which is a schematic implementation flow diagram of a database script detection method provided in an embodiment of the present invention, the method may include the following steps:
and S11, the database script detection equipment acquires each database script to be detected corresponding to the appointed software application, and acquires the attribute information of each database script to be detected.
In specific implementation, the database script detection device may be a server or a terminal, each to-be-detected database script corresponding to the specified software application refers to each to-be-detected database script supported by the specified software application that needs to be detected, the specified software application may support one or more types of databases, each type of database includes a plurality of database scripts, the database related in the embodiment of the present invention may be a relational database, the relational database is a database that organizes data by using a relational model and stores data in the form of rows and columns, the series of rows and columns are referred to as tables, and a group of tables constitutes a database. The databases involved in the embodiments of the present invention may include, but are not limited to, the following types of databases: my SQL database, Oracle database, DB2 database, Sybase database, etc.
Specifically, after acquiring each database script to be detected corresponding to the specified software application, the database script detection device acquires attribute information of each database script to be detected, where the attribute information of the database script to be detected at least includes: and attribute information such as the number of tables, the names of the tables, the number of fields, the names of the fields, the data types of the fields, the lengths of the fields, indexes, the number of the indexes and the like contained in the database script to be detected.
And S12, grouping the database scripts to be detected according to the attribute information of the database scripts to be detected to obtain at least one grouped database script set to be detected.
In specific implementation, the database script detection device groups each database script to be detected according to the acquired attribute information of each database script to be detected, so as to obtain at least one grouped database script set to be detected.
Specifically, the database script detection device divides the database scripts to be detected, which have the same attributes, and the database scripts to be detected, which have only different specified attributes and the same other attributes and can be mutually converted by the specified attributes, into a group, wherein the specified attributes at least include: the data type of the field may further include: the length of the field.
The inventor considers that in a software application, no matter which type of database is used, some attributes in the database script need to be consistent, such as: the method comprises the steps of storing attribute information which is different and can be mutually converted between database scripts of different types of databases in a database difference list which is created locally in advance for the basis of grouping database scripts to be detected subsequently.
In the specific implementation process, the database script detection device divides the database scripts to be detected, which are contained in the database script detection device, into a group, wherein the database scripts to be detected are corresponding to the same table number, table name, field number, field data type, field length, index and index number, and the database scripts to be detected are corresponding to the same table number, table name, field number, field name, index and index number, and the data types of the fields can be mutually converted.
Specifically, it may be determined according to the flow shown in fig. 2 that only the specified attributes of the database scripts to be detected that are different in the specified attributes and the other attributes are the same as each other, can be mutually converted:
and S21, aiming at any database script to be detected with different specified attributes, obtaining a convertible target attribute corresponding to the specified attribute of the database script to be detected according to a preset database difference list.
In a specific implementation, the database difference list stores attribute information that can be converted into each other in database scripts of different types of databases, and specifically, the database difference list at least includes a correspondence relationship of data types, where the correspondence relationship of data types represents a correspondence relationship of data types of fields that can be converted into each other between database scripts of different types of databases, and preferably, the database difference list also stores a data length conversion algorithm for converting data lengths between different data types. The database script detection equipment searches a target data type corresponding to the data type of the field in any database script to be detected from the corresponding relation of the data types contained in a database difference list stored locally according to any database script to be detected with the same table number, table name, field number, field name, index and index number and different field data types (and field length), wherein the target data type is the data type into which the data type of the field in any database script to be detected can be converted.
And S22, comparing the target attribute with the specified attributes of the database scripts to be detected, which only have the specified attributes different from each other.
In specific implementation, the database script detection device compares the target data type with the data types of the fields of the database scripts to be detected, which are different from the data types of other fields only, to obtain comparison results.
And S23, determining that the designated attributes of the database scripts to be detected are consistent with each other according to the comparison result, and converting the designated attributes of the database scripts to be detected.
For example, assuming that two database scripts to be detected for comparison, one of which is of My SQL type and one of which is of Oracle type, contain the same number of tables, table names, field numbers, field names, indexes and index numbers, and the data types of the same field contained in the respective corresponding tables are different, for example, in the database scripts to be detected of My SQL type, the data type of the field with the field name "rotable" in the table with the table name "CARD _ INFO" created is "VARCHAR", the length of the field is "100", and in the database scripts to be detected of Oracle type, the data type of the field with the field name "rotable" in the table with the table name "CARD _ INFO" is "VARCHAR 2", the length of the field is "100", and the corresponding relation of the data types is searched for "VARCHAR" to be converted into the data type, if the data type corresponding to the 'VARCHAR' is found to be 'VARCHAR 2', the fact that the 'VARCHAR' and the 'VARCHAR 2' can be mutually converted is shown, the two data types are the same in nature, whether the data types of the same fields of the two database scripts to be detected, which correspond to the same table, can be mutually converted is determined based on the same mode, if yes, the comparison result is determined to be consistent, and the two database scripts to be detected are divided into one group.
And S13, determining the weight of each database script set to be detected according to the number of the database scripts to be detected in the database script set to be detected.
In specific implementation, the database script detection device may determine the number of the database scripts to be detected included in the database script set to be detected as the weight of the database script set to be detected. For example, there are 7 database scripts to be detected, the database scripts are divided into three sets according to the comparison result, the number of the database scripts to be detected in the three sets is 4, 2, and 1 in sequence, and the weights of the three sets can be set to be 4, 2, and 1 in sequence.
And S14, sequentially selecting one database script to be detected from the at least one database script set to be detected from high to low according to the weight sequence, and detecting.
During specific implementation, the database script detection equipment only needs to randomly select one database script to be detected from each database script set to be detected in sequence from high to low according to the weight of the database script set to be detected, so that the detection time can be greatly reduced, and the detection efficiency is improved.
Specifically, for each selected database script to be detected, the following steps can be executed for detection:
carrying out library building integrity verification on the selected database script to be detected; and performing compatibility verification on the selected database script to be detected and the specified software application.
In a specific implementation process, library construction integrity verification can be performed on each selected database script to be detected according to the flow shown in fig. 3, and the method may include the following steps:
and S31, obtaining library establishing information, wherein the library establishing information is the same as the attribute information category of the database script to be detected.
In a specific implementation process, a database script building mode can be adopted for building a database, and the database script detection device can obtain attribute information of the database script to be detected by analyzing the database script to be detected, take the obtained database script to be detected as database building information, and take the database building information as a basis for verifying the integrity of the database script to be detected in the database building process.
The database building information is the same as the category of the attribute information of the database script to be detected, and the database building information at least comprises the following attribute information: and the database script to be detected comprises attribute information such as the number of tables, the names of the tables, the number of fields, the names of the fields, the data types of the fields, the lengths of the fields, indexes, the number of the indexes and the like.
And S32, connecting corresponding database clients according to preset database configuration information so that the database clients execute the database scripts to be detected to establish a database.
In specific implementation, the database script detection device sets data configuration information in advance, where the database configuration information may include: and the IP address, the port number, the user name, the password, the database type identification and other information of the database client side are connected with the database. And the database script detection equipment is connected with a corresponding database client according to the database configuration information, and the database client completes the establishment of the database in a mode of executing the database script to be detected.
And S33, acquiring the executed attribute information of the database script to be detected.
In specific implementation, the database script detection device obtains attribute information, such as the number of tables, the name of the tables, the number of fields, the name of the fields, the data type of the fields, the length of the fields, the number of indexes and indexes of the database script to be detected, which is obtained after the database client executes the database script to be detected.
And S34, comparing the library establishing information with the acquired attribute information of the database script to be detected after execution.
In specific implementation, the database script detection device compares each category in the acquired library building information with the category corresponding to the executed attribute information of the database script to be detected one by one to obtain a comparison result.
And S35, when the comparison result is consistent, determining that the database building integrity of the database script to be detected passes verification.
In specific implementation, when determining that each category in the acquired database building information is consistent with a category corresponding to the executed attribute information of the database script to be detected, the database script detection device determines that the database building integrity of the database script to be detected passes verification and generates a detection report, and if the acquired database building information has attribute information inconsistent with the executed attribute information of the database script to be detected, determines that the database building integrity of the database script to be detected does not pass verification and generates a difference comparison report.
According to the embodiment of the invention, a database building integrity verification mode is adopted for the database scripts to be detected, the requirement document and the development design document of each selected database script to be detected do not need to be acquired, the database building information only needs to be acquired by analyzing the database scripts to be detected, the database building information is used as the basis for verifying the database building integrity, the database is built by executing the database scripts to be detected, and the database building integrity of the database scripts to be detected is verified by comparing the attribute information and the database building information of the executed database scripts to be detected, so that the detection efficiency is further improved.
In a specific implementation process, in order to further improve the applicability of the database scripts, the compatibility between the database scripts to be detected, which pass the database integrity verification, in the selected database scripts to be detected, and the specified software application can be further verified.
Specifically, for each selected database script to be detected, the compatibility of the database script to be detected and the designated software application is verified in the following manner: and loading the specified software application in corresponding application service deployment equipment according to preset software application automatic deployment information so that the application service deployment equipment is connected with a database which is established by executing the database script to be detected according to the database configuration information, initializing the specified software application, and automatically testing a functional module in the specified software application through preset software application automatic test information.
Specifically, the preset software application automation deployment information at least includes the following information: the preset software application automation test information at least comprises the following information: configuration information (including IP, port number and the like) of the software application, automatic test driving, automatic test scenes, automatic test cases and the like. In the specific implementation process, the database script detection device instructs the corresponding application service deployment device to load the specified software application according to the software application automatic deployment information, the application service deployment device connects with the database executing the database script to be detected according to the database configuration information, and further, initializing the specified software application, automatically testing the function modules associated with the data in the specified software application through the software application automatic test information, collecting the test result for each function module, judging whether the functions of the database script to be detected and the appointed software application are consistent or not according to the test result corresponding to each functional module, and if the data base scripts to be detected are consistent, the data base scripts to be detected meet the application functions of the specified software.
And S15, determining the detection result of each other database script to be detected in the database script set to be detected according to the detection result of the selected database script to be detected.
In specific implementation, the database script detection device determines the detection result of the selected to-be-detected database script to be the same as the detection result of each other to-be-detected database script in the to-be-detected database script set to which the database script detection device belongs. That is to say, for each set of database scripts to be detected obtained after grouping, only one database script needs to be selected from each set for detection, and the detection results of all the database scripts to be detected in each set are consistent. Further, the generating of the detection report based on the detection result of each step may include: the database script detection method comprises the steps of differential comparison reporting (namely, reporting generated when library building integrity verification of a database script to be detected does not pass), transverse detection reporting (namely, grouping results of the database script to be detected), and longitudinal detection reporting (namely, compatibility verification results of the database script to be detected and the specified software application), so as to provide visual detection results for developers.
Because a set of software application usually does not support multiple types of databases at the same time in the initial development stage in the existing software development environment, because the databases are updated in an iteration mode and new database manufacturers grow up rapidly, the supported data types are increased in the updating iteration process of the software application, if the database scripts are tested only by a test scheme generated by a project document and a development design document and usually are lagged to be compared, the database script detection method provided by the application firstly compares the difference between the database scripts supported in the software application in a transverse comparison mode, and for the software application which has no function change and only adds the new database types, only needs to transversely compare the newly established database scripts with the originally existing database scripts once to determine the to-be-detected script set to which the newly added database scripts belong, and according to the detection result obtained from the set, whether the newly added database script conforms to the software application can be known.
Based on the same inventive concept, the embodiment of the invention also provides a database script detection device, and as the principle of solving the problems of the database script detection device is similar to the database script detection method, the implementation of the device can refer to the implementation of the method, and repeated parts are not described again.
As shown in fig. 4, which is a schematic structural diagram of a database script detection apparatus according to an embodiment of the present invention, the database script detection apparatus may include:
an obtaining unit 41, configured to obtain each database script to be detected corresponding to a specified software application, and obtain attribute information of each database script to be detected;
the grouping unit 42 is configured to group each database script to be detected according to the attribute information of each database script to be detected, so as to obtain at least one grouped database script set to be detected;
a first determining unit 43, configured to determine, for each to-be-detected database script set, a weight of the to-be-detected database script set according to the number of to-be-detected database scripts in the to-be-detected database script set;
the detection unit 44 is configured to sequentially select one database script to be detected from the at least one database script set to be detected according to a sequence from high weight to low weight for detection;
and a second determining unit 45, configured to determine, according to the detection result of the selected database script to be detected, a detection result of each other database script to be detected in the database script set to be detected to which the selected database script to be detected belongs.
Preferably, the grouping unit 42 is specifically configured to group database scripts to be detected, which have the same attributes, and database scripts to be detected, which have only different specified attributes and have the same other attributes and the specified attributes can be mutually converted, into a group.
Preferably, the grouping unit 42 is specifically configured to determine, for a database script to be detected with only different specified attributes, that the specified attributes can be converted into each other by: aiming at any database script to be detected with different specified attributes, acquiring a convertible target attribute corresponding to the specified attribute of the database script to be detected according to a preset database difference list, wherein the database difference list stores mutually convertible attribute information in database scripts of different types of databases; comparing the target attribute with the specified attributes of other database scripts to be detected only with different specified attributes; and determining that the designated attributes of the database scripts to be detected are consistent with each other according to the comparison result, and converting the designated attributes of the database scripts to be detected.
Preferably, the specified attribute comprises at least a data type of the field; the database difference list at least comprises a corresponding relation of data types, and the corresponding relation of the data types represents the corresponding relation of the data types of the fields which can be mutually converted;
the grouping unit 42 is specifically configured to search for a target data type corresponding to the data type of the field of the database script to be detected from the corresponding relationship of the data types;
and comparing the target data type with the data types of the fields of the database scripts to be detected, which are different from the data types of other fields only.
Preferably, the detecting unit 44 is specifically configured to perform library construction integrity verification on the selected database script to be detected; and performing compatibility verification on the selected database script to be detected and the specified software application.
Preferably, the detecting unit 44 is specifically configured to, for each selected database script to be detected, execute the following steps: acquiring database building information, wherein the database building information is the same as the attribute information category of the database script to be detected; connecting corresponding database clients according to preset database configuration information so that the database clients execute the database scripts to be detected to establish a database; acquiring attribute information of the executed database script to be detected; comparing the database building information with the acquired attribute information of the executed database script to be detected; and when the comparison result is consistent, determining that the database building integrity of the database script to be detected passes verification.
Preferably, the detecting unit 44 is specifically configured to, for each selected database script to be detected, load the specified software application in corresponding application service deployment equipment according to preset software application automatic deployment information, so that the application service deployment equipment connects with the database established by executing the database script to be detected according to the database configuration information, initializes the specified software application, and automatically tests a function module in the specified software application through preset software application automatic test information.
Based on the same technical concept, an embodiment of the present invention further provides an electronic device 500, and referring to fig. 5, the electronic device 500 is configured to implement the database script detection method described in the foregoing method embodiment, where the electronic device 500 of this embodiment may include: a memory 501, a processor 502, and a computer program, such as a database script detection program, stored in the memory and executable on the processor. The processor, when executing the computer program, implements the steps in the above-described embodiments of the database script detection method, such as step S11 shown in fig. 1. Alternatively, the processor, when executing the computer program, implements the functions of the modules/units in the above-described device embodiments, for example, 41.
The embodiment of the present invention does not limit the specific connection medium between the memory 501 and the processor 502. In the embodiment of the present application, the memory 501 and the processor 502 are connected by the bus 503 in fig. 5, the bus 503 is represented by a thick line in fig. 5, and the connection manner between other components is merely illustrative and is not limited thereto. The bus 503 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
The memory 501 may be a volatile memory (volatile memory), such as a random-access memory (RAM); the memory 501 may also be a non-volatile memory (non-volatile memory) such as, but not limited to, a read-only memory (rom), a flash memory (flash memory), a Hard Disk Drive (HDD) or a solid-state drive (SSD), or any other medium which can be used to carry or store desired program code in the form of instructions or data structures and which can be accessed by a computer. The memory 501 may be a combination of the above memories.
The processor 502 is configured to implement a database script detection method shown in fig. 1, and includes:
the processor 502 is configured to call a computer program stored in the memory 501 to execute the database script detection method shown in fig. 1.
The embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions required to be executed by the processor, and includes a program required to be executed by the processor.
In some possible embodiments, various aspects of the database script detection method provided by the present invention may also be implemented in the form of a program product, which includes program code for causing an electronic device to perform the steps in the database script detection method according to various exemplary embodiments of the present invention described above in this specification when the program product runs on the electronic device, for example, the electronic device may perform the database script detection method as shown in fig. 1.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (16)

1. A database script detection method is characterized by comprising the following steps:
acquiring each database script to be detected corresponding to the appointed software application, and acquiring attribute information of each database script to be detected;
grouping each database script to be detected according to the attribute information of each database script to be detected to obtain at least one grouped database script set to be detected;
determining the weight of each database script set to be detected according to the number of the database scripts to be detected in the database script set to be detected;
sequentially selecting one database script to be detected from the at least one database script set to be detected according to the sequence of the weight from high to low to detect;
and determining the detection result of each other database script to be detected in the database script set to be detected according to the detection result of the selected database script to be detected.
2. The method according to claim 1, wherein grouping the database scripts to be detected according to the attribute information of the database scripts to be detected specifically comprises:
the database scripts to be detected with the same attributes and the database scripts to be detected with the same attributes, which are only different in designated attributes and the same in other attributes and can be mutually converted in the designated attributes are divided into a group.
3. The method of claim 2,
for the database scripts to be detected with only different designated attributes, determining that the designated attributes can be mutually converted through the following method:
aiming at any database script to be detected with different specified attributes, acquiring a convertible target attribute corresponding to the specified attribute of the database script to be detected according to a preset database difference list, wherein the database difference list stores mutually convertible attribute information in database scripts of different types of databases;
comparing the target attribute with the specified attributes of other database scripts to be detected only with different specified attributes;
and determining that the designated attributes of the database scripts to be detected are consistent with each other according to the comparison result, and converting the designated attributes of the database scripts to be detected.
4. The method of claim 3, wherein the specified attributes include at least a data type of a field; the database difference list at least comprises a corresponding relation of data types, and the corresponding relation of the data types represents the corresponding relation of the data types of the fields which can be mutually converted;
acquiring a convertible target attribute corresponding to the specified attribute of the database script to be detected according to a preset database difference list, specifically comprising:
searching a target data type corresponding to the data type of the field of the database script to be detected from the corresponding relation of the data types;
comparing the target attribute with the specified attributes of other database scripts to be detected only with different specified attributes, specifically comprising:
and comparing the target data type with the data types of the fields of the database scripts to be detected, which are different from the data types of other fields only.
5. The method according to any one of claims 1 to 4, wherein the detecting the selected database script to be detected comprises:
carrying out library building integrity verification on the selected database script to be detected; and are
And performing compatibility verification on the selected database script to be detected and the specified software application.
6. The method according to claim 5, wherein performing library construction integrity verification on the selected database script to be detected specifically comprises:
aiming at each selected database script to be detected, the following steps are executed:
acquiring database building information, wherein the database building information is the same as the attribute information category of the database script to be detected;
connecting corresponding database clients according to preset database configuration information so that the database clients execute the database scripts to be detected to establish a database;
acquiring attribute information of the executed database script to be detected;
comparing the database building information with the acquired attribute information of the executed database script to be detected;
and when the comparison result is consistent, determining that the database building integrity of the database script to be detected passes verification.
7. The method according to claim 6, wherein the verifying compatibility of the selected database script to be detected and the specified software application specifically comprises:
and for each selected database script to be detected, loading the specified software application in corresponding application service deployment equipment according to preset software application automatic deployment information so that the application service deployment equipment is connected with a database established by executing the database script to be detected according to the database configuration information, initializing the specified software application, and automatically testing a functional module in the specified software application through preset software application automatic testing information.
8. A database script detection apparatus, comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring each database script to be detected corresponding to a specified software application and acquiring attribute information of each database script to be detected;
the grouping unit is used for grouping the database scripts to be detected according to the attribute information of the database scripts to be detected to obtain at least one grouped database script set to be detected;
the first determining unit is used for determining the weight of each database script set to be detected according to the number of the database scripts to be detected in the database script set to be detected;
the detection unit is used for sequentially selecting one database script to be detected from the at least one database script set to be detected according to the sequence of the weight from high to low to detect;
and the second determining unit is used for determining the detection result of each other database script to be detected in the database script set to be detected to which the selected database script to be detected belongs according to the detection result of the selected database script to be detected.
9. The apparatus of claim 8,
the grouping unit is specifically configured to group database scripts to be detected, which have the same attributes, and database scripts to be detected, which have different specified attributes and the same other attributes and have mutually convertible specified attributes, into a group.
10. The apparatus of claim 9,
the grouping unit is specifically configured to determine, for a to-be-detected database script with only different specified attributes, that the specified attributes can be mutually converted in the following manner: aiming at any database script to be detected with different specified attributes, acquiring a convertible target attribute corresponding to the specified attribute of the database script to be detected according to a preset database difference list, wherein the database difference list stores mutually convertible attribute information in database scripts of different types of databases; comparing the target attribute with the specified attributes of other database scripts to be detected only with different specified attributes; and determining that the designated attributes of the database scripts to be detected are consistent with each other according to the comparison result, and converting the designated attributes of the database scripts to be detected.
11. The apparatus of claim 10, in which the specified attributes comprise at least a data type of a field; the database difference list at least comprises a corresponding relation of data types, and the corresponding relation of the data types represents the corresponding relation of the data types of the fields which can be mutually converted;
the grouping unit is specifically used for searching a target data type corresponding to the data type of the field of the database script to be detected from the corresponding relation of the data types;
and comparing the target data type with the data types of the fields of the database scripts to be detected, which are different from the data types of other fields only.
12. The apparatus according to any one of claims 8 to 11,
the detection unit is specifically used for carrying out library building integrity verification on the selected database script to be detected; and performing compatibility verification on the selected database script to be detected and the specified software application.
13. The apparatus of claim 12,
the detection unit is specifically configured to execute the following steps for each selected database script to be detected: acquiring database building information, wherein the database building information is the same as the attribute information category of the database script to be detected; connecting corresponding database clients according to preset database configuration information so that the database clients execute the database scripts to be detected to establish a database; acquiring attribute information of the executed database script to be detected; comparing the database building information with the acquired attribute information of the executed database script to be detected; and when the comparison result is consistent, determining that the database building integrity of the database script to be detected passes verification.
14. The apparatus of claim 13,
the detection unit is specifically configured to load the specified software application in corresponding application service deployment equipment according to preset software application automated deployment information for each selected database script to be detected, so that the application service deployment equipment is connected with a database established by executing the database script to be detected according to the database configuration information, initializes the specified software application, and automatically tests a function module in the specified software application through preset software application automated test information.
15. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the database script detection method according to any one of claims 1 to 7 when executing the program.
16. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the database script detection method according to any one of claims 1 to 7.
CN202110400017.6A 2021-04-14 2021-04-14 Database script detection method and device, electronic equipment and storage medium Active CN113238926B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110400017.6A CN113238926B (en) 2021-04-14 2021-04-14 Database script detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110400017.6A CN113238926B (en) 2021-04-14 2021-04-14 Database script detection method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113238926A true CN113238926A (en) 2021-08-10
CN113238926B CN113238926B (en) 2023-11-10

Family

ID=77128013

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110400017.6A Active CN113238926B (en) 2021-04-14 2021-04-14 Database script detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113238926B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815147A (en) * 2016-12-29 2017-06-09 东软集团股份有限公司 A kind of test script generation method and device
CN107451063A (en) * 2017-08-14 2017-12-08 凌云天博光电科技股份有限公司 A kind of script method of testing and device
CN108133007A (en) * 2017-12-22 2018-06-08 北京明朝万达科技股份有限公司 A kind of method of data synchronization and system
CN108256334A (en) * 2018-01-26 2018-07-06 平安科技(深圳)有限公司 Loophole test method, device, computer equipment and storage medium
CN108549601A (en) * 2018-04-02 2018-09-18 郑州云海信息技术有限公司 A kind of more browser compatibility automated testing methods
CN109325014A (en) * 2018-08-23 2019-02-12 北京信安世纪科技股份有限公司 A kind of relational database builds library integrality effect method and device
CN110659209A (en) * 2019-09-19 2020-01-07 北京达佳互联信息技术有限公司 Automatic testing method, device and system based on interface calling
CN111666217A (en) * 2020-06-05 2020-09-15 百度在线网络技术(北京)有限公司 Method and apparatus for testing code

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815147A (en) * 2016-12-29 2017-06-09 东软集团股份有限公司 A kind of test script generation method and device
CN107451063A (en) * 2017-08-14 2017-12-08 凌云天博光电科技股份有限公司 A kind of script method of testing and device
CN108133007A (en) * 2017-12-22 2018-06-08 北京明朝万达科技股份有限公司 A kind of method of data synchronization and system
CN108256334A (en) * 2018-01-26 2018-07-06 平安科技(深圳)有限公司 Loophole test method, device, computer equipment and storage medium
CN108549601A (en) * 2018-04-02 2018-09-18 郑州云海信息技术有限公司 A kind of more browser compatibility automated testing methods
CN109325014A (en) * 2018-08-23 2019-02-12 北京信安世纪科技股份有限公司 A kind of relational database builds library integrality effect method and device
CN110659209A (en) * 2019-09-19 2020-01-07 北京达佳互联信息技术有限公司 Automatic testing method, device and system based on interface calling
CN111666217A (en) * 2020-06-05 2020-09-15 百度在线网络技术(北京)有限公司 Method and apparatus for testing code

Also Published As

Publication number Publication date
CN113238926B (en) 2023-11-10

Similar Documents

Publication Publication Date Title
CN107665171A (en) Automatic regression test method and device
CN105589706B (en) A kind of upgrade package generation method and device
CN109344056B (en) Test method and test device
CN110096434A (en) A kind of interface test method and device
CN109344055B (en) Test method and test device
CN107741903A (en) Application compatibility method of testing, device, computer equipment and storage medium
CN106649412B (en) Data processing method and equipment
CN113239365B (en) Vulnerability repairing method based on knowledge graph
US11086906B2 (en) System and method for reconciliation of data in multiple systems using permutation matching
CN111767350A (en) Data warehouse testing method and device, terminal equipment and storage medium
CN112364024A (en) Control method and device for batch automatic comparison of table data
CN112328499A (en) Test data generation method, device, equipment and medium
CN114490375B (en) Performance test method, device, equipment and storage medium of application program
CN111581236A (en) Data query method and device
CN107085613A (en) Enter the filter method and device of library file
CN110019067A (en) A kind of log analysis method and system
CN113238926B (en) Database script detection method and device, electronic equipment and storage medium
CN107066391A (en) The processing method and system of test case
CN111737349A (en) Data consistency checking method and device
CN113342675B (en) Mapping method and device of tested module, and testing method and system
CN115576834A (en) Software test multiplexing method, system, terminal and medium for supporting fault recovery
CN114546749A (en) Chip random test case regression method, device, equipment and readable medium
CN112527757B (en) Rapid retrieval method based on large-scale chip test result
CN108536599B (en) BIOS default configuration verification method, system, device and computer readable storage medium
CN113987010B (en) Method and device for realizing insight of multi-dimensional data set

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