CN114090457A - Method, device, processing equipment and medium for testing database storage process - Google Patents

Method, device, processing equipment and medium for testing database storage process Download PDF

Info

Publication number
CN114090457A
CN114090457A CN202111441944.9A CN202111441944A CN114090457A CN 114090457 A CN114090457 A CN 114090457A CN 202111441944 A CN202111441944 A CN 202111441944A CN 114090457 A CN114090457 A CN 114090457A
Authority
CN
China
Prior art keywords
target
storage process
sentence
target storage
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111441944.9A
Other languages
Chinese (zh)
Inventor
吴国锋
黄智勇
李茜
赵大平
孙嘉明
刘宁
周卫民
张异
丁高海
徐安琪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Winning Health Technology Group Co Ltd
Original Assignee
Winning Health Technology Group 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 Winning Health Technology Group Co Ltd filed Critical Winning Health Technology Group Co Ltd
Priority to CN202111441944.9A priority Critical patent/CN114090457A/en
Publication of CN114090457A publication Critical patent/CN114090457A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • 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
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, a device, processing equipment and a medium for testing a database storage process, and relates to the technical field of software testing. The test method of the database storage process comprises the following steps: acquiring a target sentence segment containing the entry identifier in the target storage process according to the query instruction of the target storage process aiming at the target database; determining an input parameter value of a target storage process according to the target sentence segments; and obtaining a test case of the target storage process according to the parameter values, wherein the test case is used for testing the target storage process. The target sentence period containing the entry mark in the target storage process is obtained according to the query instruction, the entry value is determined based on the target sentence period more comprehensively and accurately, and the test case of the target storage process generated according to the entry value is more accurate.

Description

Method, device, processing equipment and medium for testing database storage process
Technical Field
The invention relates to the technical field of software testing, in particular to a method, a device, processing equipment and a medium for testing a database storage process.
Background
The storage process of the database is a set of SQL (standard computer language for accessing and processing the database) statements for completing specific functions in the database system, the storage process is often used in the application software system to complete the processing and calculation of the business data, the storage process is an important component of the application software system, and the testing of the storage process becomes the necessary work of the software testing.
In the related technology, a regular expression is written by a tester, a parameter is extracted from the content of a storage process by adopting the regular expression, a wide value set is generated according to the data type of the parameter, a test case is determined according to the value set, and the test case is adopted for testing.
However, in the related art, the regular expression is adopted to extract the input parameters, and the situations of missing and inaccurate acquisition of the input parameters are easy to occur, so that the problems of inaccurate test cases and inaccurate test are caused.
Disclosure of Invention
The invention aims to provide a test method, a test device, a test processing device and a test processing medium for a database storage process, aiming at the defects in the prior art, so as to solve the problems that in the related art, the regular expression is adopted to extract the input parameters, the input parameters are easy to be obtained, missing and inaccurate, and thus the test cases are inaccurate.
In order to achieve the above purpose, the embodiment of the present invention adopts the following technical solutions:
in a first aspect, an embodiment of the present invention provides a method for testing a database storage process, where the method includes:
acquiring a target sentence segment containing an entry identifier in a target storage process according to a query instruction of the target storage process aiming at a target database;
determining an entry parameter value of the target storage process according to the target sentence period;
and obtaining a test case of the target storage process according to the parameter values, wherein the test case is used for testing the target storage process.
Optionally, the obtaining, according to the query instruction of the target storage process for the target database, the target sentence segment of the target storage process, which includes the entry identifier, includes:
obtaining a parameter entering identification set of the target storage process according to the parameter entering query instruction aiming at the target storage process;
obtaining sentence segments of the target storage process according to the sentence query instruction aiming at the target storage process;
and determining the target sentence period according to the reference mark set and the sentence period.
Optionally, the obtaining a sentence segment of the target storage process according to the sentence query instruction for the target storage process includes:
obtaining a statement set of the target storage process according to the statement query instruction;
and analyzing the sentence set by adopting a preset interface to obtain the sentence segments.
Optionally, the target sentence fragment includes at least one of the following types of sentence fragments: the storage process defines sentence segments, judges sentence segments, inquires sentence segments, updates sentence segments and deletes sentence segments.
Optionally, if the target sentence segment includes the storage process definition sentence segment;
determining the entry value of the target storage process according to the target sentence period comprises the following steps:
analyzing the storage process definition sentence segments to obtain default values of the input parameters; the parameter values include: default values for the entries.
Optionally, if the target sentence segment includes the judgment sentence segment;
determining the entry value of the target storage process according to the target sentence period comprises the following steps:
determining the value of the expression of the input parameter according to the judged sentence segment; the parameter values include: the value of the expression in which the reference is located.
Optionally, if the target sentence segment includes: at least one of the query sentence fragment, the update sentence fragment and the deletion sentence fragment;
determining the entry value of the target storage process according to the target sentence period comprises the following steps:
determining the field names and the table names corresponding to the entries from the conditional clauses of the target sentence segments;
and determining the parameter value according to the field name and the table name corresponding to the parameter.
Optionally, the determining the parameter value according to the field name and the table name corresponding to the parameter includes:
according to a parameter value query instruction aiming at the target database, a field name corresponding to the parameter and a name of the table, determining a field value corresponding to the field name in the table; the parameter values include: and the field value corresponding to the field name in the table.
Optionally, the obtaining a test case of the target storage process according to the parameter values includes:
carrying out duplicate removal treatment on the input parameter value to obtain a duplicate-removed input parameter value;
obtaining a permutation and combination of the input parameter values according to the input parameter values after the duplication removal by adopting a preset orthogonal algorithm;
and combining each permutation to serve as one test case.
In a second aspect, an embodiment of the present invention further provides a device for testing a database storage process, where the device includes:
the first acquisition module is used for acquiring a target sentence segment containing the entry identifier in a target storage process according to a query instruction of the target storage process aiming at a target database;
the determining module is used for determining the entry parameter value of the target storage process according to the target sentence period;
and the second obtaining module is used for obtaining a test case of the target storage process according to the parameter values, and the test case is used for testing the target storage process.
Optionally, the first obtaining module is further configured to obtain a parameter entering identifier set of the target storage process according to a parameter entering query instruction for the target storage process; obtaining sentence segments of the target storage process according to the sentence query instruction aiming at the target storage process; and determining the target sentence period according to the reference mark set and the sentence period.
Optionally, the first obtaining module is further configured to obtain a statement set of the target storage process according to the statement query instruction; and analyzing the sentence set by adopting a preset interface to obtain the sentence segments.
Optionally, the target sentence fragment includes at least one of the following types of sentence fragments: the storage process defines sentence segments, judges sentence segments, inquires sentence segments, updates sentence segments and deletes sentence segments.
Optionally, if the target sentence segment includes the storage process definition sentence segment;
the determining module is further configured to analyze the storage process definition sentence segments to obtain default values of the input parameters; the parameter values include: default values for the entries.
Optionally, if the target sentence segment includes the judgment sentence segment;
the determining module is further configured to determine a value of an expression in which the input parameter is located according to the judged sentence segment; the parameter values include: the value of the expression in which the reference is located.
Optionally, if the target sentence segment includes: at least one of the query sentence fragment, the update sentence fragment and the deletion sentence fragment;
the determining module is further configured to determine, from the conditional clauses of the target sentence segment, a field name and a table name corresponding to the entry parameter; and determining the parameter value according to the field name and the table name corresponding to the parameter.
Optionally, the determining module is further configured to determine, according to an entry value query instruction for the target database, a field name corresponding to the entry, and a name of the table, a field value corresponding to the field name in the table; the parameter values include: and the field value corresponding to the field name in the table.
Optionally, the second obtaining module is further configured to perform deduplication processing on the input parameter value to obtain a deduplicated input parameter value; obtaining a permutation and combination of the input parameter values according to the input parameter values after the duplication removal by adopting a preset orthogonal algorithm; and combining each permutation to serve as one test case.
In a third aspect, an embodiment of the present invention further provides a processing device, including: a memory and a processor, wherein the memory stores a computer program executable by the processor, and the processor implements the method for testing the database storage process according to any one of the first aspect.
In a fourth aspect, an embodiment of the present invention further provides a storage medium, where the storage medium stores a computer program, and when the computer program is read and executed, the method for testing a database storage process according to any one of the first aspect is implemented.
The invention has the beneficial effects that: the embodiment of the invention provides a method, a device, processing equipment and a medium for testing a database storage process, wherein the method comprises the following steps: acquiring a target sentence segment containing the entry identifier in the target storage process according to the query instruction of the target storage process aiming at the target database; determining an input parameter value of a target storage process according to the target sentence segments; and obtaining a test case of the target storage process according to the parameter values, wherein the test case is used for testing the target storage process. The target sentence period containing the entry mark in the target storage process is obtained according to the query instruction, the entry value is determined based on the target sentence period more comprehensively and accurately, and the test case of the target storage process generated according to the entry value is more accurate.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of a method for testing a database storage process according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for testing a database storage process according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a method for testing a database storage process according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a method for testing a database storage process according to an embodiment of the present invention;
fig. 5 is a schematic flowchart of a method for testing a database storage process according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a testing apparatus for a database storage process according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present application, it should be noted that if the terms "upper", "lower", etc. are used for indicating the orientation or positional relationship based on the orientation or positional relationship shown in the drawings or the orientation or positional relationship which is usually arranged when the product of the application is used, the description is only for convenience of describing the application and simplifying the description, but the indication or suggestion that the referred device or element must have a specific orientation, be constructed in a specific orientation and operation, and thus, cannot be understood as the limitation of the application.
Furthermore, the terms "first," "second," and the like in the description and in the claims, as well as in the drawings, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations 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, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the features of the embodiments of the present application may be combined with each other without conflict.
The application software system usually uses a storage process to complete the processing and calculation of the service data, the storage process is an important component of the application software system, and the testing of the storage process becomes the necessary work of software testing. In the related technology, a regular expression is written by a tester, a parameter is extracted from the content of a storage process by adopting the regular expression, a wide value set is generated according to the data type of the parameter, a test case is determined according to the value set, and the test case is adopted for testing.
The method aims at the problems that in the related technology, the regular expression is adopted to extract the input parameters, the conditions of missing and inaccurate acquisition of the input parameters are easy to occur, and therefore the test cases are inaccurate and the test is inaccurate. The embodiment of the application provides a method for testing a database storage process, wherein a target sentence segment containing an entry mark in the target storage process is obtained according to a query instruction, the entry mark is more comprehensive and more accurate, an entry value is determined based on the target sentence segment, and a test case of the target storage process generated according to the entry mark is more accurate.
It should be noted that the processing device may be a terminal, a server, or another device with a processing function, which is not specifically limited in this embodiment of the present application. If the processing device is a terminal, the processing device may be any one of the following devices: desktop computers, notebook computers, smart phones, tablet computers, and the like.
The following explains a method for testing a database storage process provided in an embodiment of the present application, with a processing device as an execution subject.
Fig. 1 is a schematic flowchart of a method for testing a database storage process according to an embodiment of the present invention, as shown in fig. 1, the method includes:
s101, acquiring a target sentence segment containing the entry mark in the target storage process according to the query instruction of the target storage process aiming at the target database.
The query instruction may include: the target stores identification information for the process.
Optionally, the identification information of the target storage process may be a name of the target storage process, and certainly, may also be other information that can identify the target storage process, which is not specifically limited in this embodiment of the application.
In some embodiments, when a target stored procedure of a target database needs to be tested, the processing device may execute a query instruction for the target stored procedure of the target database to obtain target sentence segments, where each target sentence segment obtained by the query may include: and entering a reference mark. Optionally, the reference identifier may be a reference name.
It should be noted that the target statement segment may be a set of SQL (standard computer language for accessing and processing databases) statements.
And S102, determining the parameter value of the target storage process according to the target sentence segment.
The number of the target sentence segments can be multiple.
In some embodiments, for each target sentence segment, the processing device determines a sentence segment type of the target sentence segment, parses the target sentence segment according to a parsing manner corresponding to the sentence segment type, and determines an entry parameter corresponding to each target sentence segment.
It should be noted that the reference values of the target storage procedure include: and the entry values correspond to a plurality of target sentence periods.
And S103, obtaining a test case of the target storage process according to the parameter values.
The test case is used for testing the target storage process.
In the embodiment of the application, the processing device may generate at least one test case of the target storage process according to the parameter values. Then, the processing device may test the target storage process by using the test case of the target storage process.
Of course, the processing device may also send the test case of the target storage process to other devices, and the other devices may receive the test case of the target storage process and test the target storage process by using the test case of the target storage process.
It should be noted that the processing device and the other device may be in communication connection, the communication connection may be a wired communication connection or a wireless communication connection, and the other device may be a testing device.
In summary, an embodiment of the present invention provides a method for testing a database storage process, where the method includes: acquiring a target sentence segment containing the entry identifier in the target storage process according to the query instruction of the target storage process aiming at the target database; determining an input parameter value of a target storage process according to the target sentence segments; and obtaining a test case of the target storage process according to the parameter values, wherein the test case is used for testing the target storage process. The target sentence period containing the entry mark in the target storage process is obtained according to the query instruction, the entry value is determined based on the target sentence period more comprehensively and accurately, and the test case of the target storage process generated according to the entry value is more accurate.
Optionally, fig. 2 is a schematic flowchart of a method for testing a database storage process according to an embodiment of the present invention, and as shown in fig. 2, acquiring a target sentence segment containing a parameter entry identifier in a target storage process according to a query instruction for the target storage process of a target database may include:
s201, obtaining a parameter entering identification set of the target storage process according to a parameter entering query instruction aiming at the target storage process.
The participating query instruction may include: the target stores identification information for the process.
In some embodiments, the processing device may connect to the target database, execute the join query instruction of the target storage process for the target database to obtain a plurality of join identifiers, and use the plurality of join identifiers as a join identifier set of the target storage process.
Optionally, the reference query instruction is as follows:
“select a.id ProcId,b.name ParamName,d.name ParamType,c.name ParamTypeName,COLUMNPROPERTY(b.id,b.name,'PRECISION')ParamLength,
isnull(COLUMNPROPERTY(b.id,b.name,'Scale'),0)ParamScale,
(case b. isonuclable where 1then 'is' else 'not' end) IsNullable, (case b. isonuclable where 1then 'refers' else 'into' end) IsOutParam
from sysobjects a with(nolock)
join syscolumns b with(nolock)on b.id=a.id
join systypes c with(nolock)on c.xusertype=b.xusertype
join syslypes d with (unlock) on, xusertype b, xtype where a, type P and a, name target storage procedure name'.
S202, obtaining sentence segments of the target storage process according to the sentence query instruction aiming at the target storage process.
The statement query instruction may include: the target stores identification information for the process.
In some embodiments, the processing device executes a statement query instruction for executing the target stored procedure against the target database, resulting in a statement segment for the target stored procedure.
It should be noted that the processing device may first execute S201 and then execute S202; s202 may be executed first, and S201 may be executed; the execution sequence of S201 and S202 is not specifically limited in this embodiment of the application.
And S203, determining a target sentence segment according to the reference mark set and the sentence segment.
In this embodiment of the present application, the processing device may retrieve each sentence segment according to a plurality of entry identifiers in the entry identifier set, and determine whether each sentence segment includes at least one entry identifier of the plurality of entry identifiers; if yes, determining the sentence segment as the target sentence segment.
Optionally, fig. 3 is a schematic flow chart of a method for testing a database storage process according to an embodiment of the present invention, as shown in fig. 3, a process of obtaining a sentence fragment of a target storage process according to a statement query instruction for the target storage process in S202 may include:
s301, obtaining a statement set of the target storage process according to the statement query instruction.
And the processing equipment executes the statement query instruction to obtain the statement segment of the target storage process. The statement set of the target storage process can comprise: a plurality of statements.
Optionally, the statement query instruction is as follows:
"SELECT text FROM components WHERE name is" target storage process name ".
And S302, analyzing the statement set by adopting a preset interface to obtain statement segments.
Herein, a statement segment may also be referred to as an SQL statement segment.
It should be noted that, the processing device may sequentially analyze each statement in the statement set by using a preset interface, or may concurrently analyze each statement in the statement set by using the preset interface, which is not specifically limited in the embodiment of the present application.
Optionally, the preset interface may be an interface in a preset library, for example, the preset library may be a script dom library, and the preset interface may be a Parse interface.
Optionally, the target sentence fragment includes at least one of the following types of sentence fragments: the storage process defines sentence segments, judges sentence segments, inquires sentence segments, updates sentence segments and deletes sentence segments.
In the embodiment of the present application, the storage procedure definition sentence fragment may be expressed as: "CreateProcedureStatement"; a sentence fragment can be expressed as: "IfStatement"; the query statement segment may be expressed as: "SelectStatement", the update statement segment may be denoted as "UpdateStatement", and the delete statement segment may be denoted as "DeleteStatement".
Optionally, the target statement segment includes a stored procedure definition statement segment.
The step of determining the parameter value of the target storage process according to the target sentence fragment in S102 may include: and analyzing the definition sentence segments in the storage process to obtain default values of the input parameters.
Wherein, the parameter value may include: and entering default values of the parameters.
In some embodiments, the processing device may parse the stored procedure definition period "createprocedurestate" to obtain a default value of the target parameter in the stored procedure definition period.
In addition, the stored procedure definition sentence fragment may include: and entering identification information of the reference.
In summary, the statement segment defined in the storage procedure is analyzed to obtain a default value of the entry parameter, so that the entry parameter may include: default values for entering parameters; omission of default values for entries is avoided; the test case is generated more comprehensively and accurately based on the input parameter values.
Optionally, if the target sentence segment includes the judgment sentence segment.
The step of determining the parameter value of the target storage process according to the target sentence fragment in S102 may include: and determining the value of the expression of the input parameter according to the judged sentence segment.
Wherein, the parameter value may include: and taking into account the value of the expression.
In some embodiments, the processing device may determine the value of the expression in which the target argument is located in the judgment statement segment for the judgment statement segment "IfStatement", i.e., the IF statement segment. The VALUE of the expression where the target argument is located may be a VALUE of the expression where the target argument is located.
In addition, the sentence judgment section may include: and entering identification information of the reference.
In summary, according to the statement segment, the value of the expression where the argument is located is determined, so that the argument value may include: entering the value of the expression where the parameter is located; avoiding omission of the value of the expression where the parameter is located; the test case is generated more comprehensively and accurately based on the input parameter values.
Optionally, if the target sentence fragment includes: at least one of query sentence fragment, update sentence fragment, and delete sentence fragment.
The query sentence fragment, the updated sentence fragment and the deleted sentence fragment may all include the identification information of the reference.
Fig. 4 is a schematic flow chart of a method for testing a database storage process according to an embodiment of the present invention, and as shown in fig. 4, the process of determining an entry parameter of a target storage process according to a target statement segment in S102 may include:
s401, determining the field names and the table names corresponding to the entries from the conditional clauses of the target sentence segments.
In some embodiments, the processing device may retrieve the corresponding field names and table names of the query statement segment "SelectStatement", the update statement segment "UpdateStatement", and the delete statement segment "DeleteStatement" from the conditional clauses of the query statement segment "SelectStatement", the update statement segment "UpdateStatement", and the delete statement segment "DeleteStatement".
S402, determining the parameter value according to the field name and the table name corresponding to the parameter.
It should be noted that the processing device may perform query in the target database according to the field name and the table name corresponding to the entry parameter, so as to obtain the entry parameter value.
Optionally, the step of determining the parameter value according to the field name and the table name corresponding to the parameter in S402 may include: and determining a field value corresponding to the field name in the affiliated table according to the reference value query instruction aiming at the target database, the field name corresponding to the reference and the affiliated table name.
Wherein, the parameter value may include: and the field value corresponding to the field name in the table.
In a possible implementation manner, the processing device may execute a reference value query instruction in the target database according to the field name corresponding to the reference and the name of the table to which the reference corresponds, determine the table to which the name of the table belongs, and obtain the field value corresponding to the field name in the table to which the reference corresponds.
Optionally, the number of field values corresponding to the field names in the table to which the processing device belongs may be multiple, and the processing device may aggregate the field values corresponding to the field names in the table to which the processing device belongs, and use a preset number of values in the aggregated field values as the entry parameters.
It should be noted that the preset number may be set according to actual requirements, for example, the preset number may be 10.
In summary, according to the statement segment, the value of the expression where the argument is located is determined, so that the argument value may include: entering the value of the expression where the parameter is located; avoiding omission of the value of the expression where the parameter is located; the test case is generated more comprehensively and accurately based on the input parameter values.
Optionally, fig. 5 is a schematic flowchart of a method for testing a database storage process according to an embodiment of the present invention, and as shown in fig. 5, the process of obtaining a test case of a target storage process according to a reference value in S103 may include:
s501, carrying out duplicate removal processing on the input parameter value to obtain the input parameter value after duplicate removal.
In some embodiments, the processing device may perform a deletion process on a duplicate entry value of the plurality of entry values to obtain a deleted entry value, and may use the deleted entry value as a deduplicated entry value.
And S502, obtaining a permutation and combination of the input parameter values according to the input parameter values after the duplication removal by adopting a preset orthogonal algorithm.
In this embodiment of the present application, the processing device may generate an optimal permutation and combination of the input parameters according to the input parameters after the deduplication by using a preset function of a preset orthogonal algorithm in a preset python library. The number of the optimal permutation and combination may be at least one.
In addition, the preset python library may be an allpair library (a python library for testing the combination generator), and the preset function may be: allpair function.
S503, arranging and combining each item to serve as a test case.
It should be noted that the number of permutation and combination may be at least one, and correspondingly, the number of test cases may also be at least one.
In summary, an embodiment of the present invention provides a method for testing a database storage process, where the method includes: acquiring a target sentence segment containing the entry identifier in the target storage process according to the query instruction of the target storage process aiming at the target database; determining an input parameter value of a target storage process according to the target sentence segments; and obtaining a test case of the target storage process according to the parameter values, wherein the test case is used for testing the target storage process. The target sentence period containing the entry mark in the target storage process is obtained according to the query instruction, the entry value is determined based on the target sentence period more comprehensively and accurately, and the test case of the target storage process generated according to the entry value is more accurate.
Compared with the method for generating the input parameter according to the regular expression in the related art, the test method for the database storage process provided by the embodiment of the invention has the advantages that the generated test case is not missed, the generated test case is more suitable for actual service, and the condition of missed test caused by a large number of invalid cases is avoided.
In addition, the method also has a test case which determines that the value of the input parameter is more accurate and more practical and effective, tests the target storage process based on the test case, has higher test coverage rate and more comprehensive test, and realizes a more accurate and efficient storage process test method.
The following describes a testing apparatus, a processing device, a storage medium, and the like for performing a database storage procedure of the testing method for the database storage procedure provided in the present application, and for specific implementation procedures and technical effects, reference is made to the relevant contents of the testing method for the database storage procedure, and details are not described below.
Fig. 6 is a schematic structural diagram of a testing apparatus for a database storage process according to an embodiment of the present invention, and as shown in fig. 6, the apparatus may include:
a first obtaining module 601, configured to obtain, according to a query instruction for a target storage process of a target database, a target sentence segment containing an entry identifier in the target storage process;
a determining module 602, configured to determine an entry parameter value of the target storage process according to the target sentence period;
a second obtaining module 603, configured to obtain a test case of the target storage process according to the parameter value, where the test case is used to test the target storage process.
Optionally, the first obtaining module 601 is further configured to obtain a parameter entering identifier set of the target storage process according to a parameter entering query instruction for the target storage process; obtaining sentence segments of the target storage process according to the sentence query instruction aiming at the target storage process; and determining the target sentence period according to the reference mark set and the sentence period.
Optionally, the first obtaining module 601 is further configured to obtain a statement set of the target storage process according to the statement query instruction; and analyzing the sentence set by adopting a preset interface to obtain the sentence segments.
Optionally, the target sentence fragment includes at least one of the following types of sentence fragments: the storage process defines sentence segments, judges sentence segments, inquires sentence segments, updates sentence segments and deletes sentence segments.
Optionally, if the target sentence segment includes the storage process definition sentence segment;
the determining module 602 is further configured to analyze the storage process definition sentence fragment to obtain a default value of the parameter; the parameter values include: default values for the entries.
Optionally, if the target sentence segment includes the judgment sentence segment;
the determining module 602 is further configured to determine a value of an expression in which the entry parameter is located according to the judged sentence segment; the parameter values include: the value of the expression in which the reference is located.
Optionally, if the target sentence segment includes: at least one of the query sentence fragment, the update sentence fragment and the deletion sentence fragment;
the determining module 602 is further configured to determine, from the conditional clause of the target sentence segment, a field name and a table name corresponding to the entry parameter; and determining the parameter value according to the field name and the table name corresponding to the parameter.
Optionally, the determining module 602 is further configured to determine, according to an entry value query instruction for the target database, a field name corresponding to the entry and a name of the table, a field value corresponding to the field name in the table; the parameter values include: and the field value corresponding to the field name in the table.
Optionally, the second obtaining module 603 is further configured to perform deduplication processing on the input parameter value to obtain a deduplicated input parameter value; obtaining a permutation and combination of the input parameter values according to the input parameter values after the duplication removal by adopting a preset orthogonal algorithm; and combining each permutation to serve as one test case.
The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs), among others. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 7 is a schematic structural diagram of a processing apparatus according to an embodiment of the present invention, and as shown in fig. 7, the apparatus includes: a processor 701, a memory 702. The memory 702 is used for storing programs, and the processor 701 calls the programs stored in the memory 702 to execute the above method embodiments. The specific implementation and technical effects are similar, and are not described herein again.
Optionally, the invention also provides a program product, for example a computer-readable storage medium, comprising a program which, when being executed by a processor, is adapted to carry out the above-mentioned method embodiments.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods 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 (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method for testing a database storage process, the method comprising:
acquiring a target sentence segment containing an entry identifier in a target storage process according to a query instruction of the target storage process aiming at a target database;
determining an entry parameter value of the target storage process according to the target sentence period;
and obtaining a test case of the target storage process according to the parameter values, wherein the test case is used for testing the target storage process.
2. The method of claim 1, wherein the obtaining the target sentence segment of the target stored procedure containing the reference identifier according to the query instruction of the target stored procedure for the target database comprises:
obtaining a parameter entering identification set of the target storage process according to the parameter entering query instruction aiming at the target storage process;
obtaining sentence segments of the target storage process according to the sentence query instruction aiming at the target storage process;
and determining the target sentence period according to the reference mark set and the sentence period.
3. The method of claim 2, wherein obtaining the sentence fragments of the target stored procedure according to the sentence query instruction for the target stored procedure comprises:
obtaining a statement set of the target storage process according to the statement query instruction;
and analyzing the sentence set by adopting a preset interface to obtain the sentence segments.
4. The method of claim 1, wherein said target sentence fragment comprises at least one of the following types of sentence fragments: the storage process defines sentence segments, judges sentence segments, inquires sentence segments, updates sentence segments and deletes sentence segments.
5. The method of claim 4, wherein if said target sentence fragment comprises said stored procedure definition sentence fragment;
determining the entry value of the target storage process according to the target sentence period comprises the following steps:
analyzing the storage process definition sentence segments to obtain default values of the input parameters; the parameter values include: default values for the entries.
6. The method of claim 4, wherein if said target sentence fragment comprises said decision sentence fragment;
determining the entry value of the target storage process according to the target sentence period comprises the following steps:
determining the value of the expression of the input parameter according to the judged sentence segment; the parameter values include: the value of the expression in which the reference is located.
7. The method of claim 4, wherein if the target sentence fragment comprises: at least one of the query sentence fragment, the update sentence fragment and the deletion sentence fragment;
determining the entry value of the target storage process according to the target sentence period comprises the following steps:
determining the field names and the table names corresponding to the entries from the conditional clauses of the target sentence segments;
and determining the parameter value according to the field name and the table name corresponding to the parameter.
8. The method according to claim 7, wherein the determining the value of the entry parameter according to the field name and the table name corresponding to the entry parameter comprises:
according to a parameter value query instruction aiming at the target database, a field name corresponding to the parameter and a name of the table, determining a field value corresponding to the field name in the table; the parameter values include: and the field value corresponding to the field name in the table.
9. The method according to any one of claims 1 to 8, wherein obtaining the test case of the target storage procedure according to the parameter values comprises:
carrying out duplicate removal treatment on the input parameter value to obtain a duplicate-removed input parameter value;
obtaining a permutation and combination of the input parameter values according to the input parameter values after the duplication removal by adopting a preset orthogonal algorithm;
and combining each permutation to serve as one test case.
10. An apparatus for testing a stored procedure in a database, the apparatus comprising:
the first acquisition module is used for acquiring a target sentence segment containing the entry identifier in a target storage process according to a query instruction of the target storage process aiming at a target database;
the determining module is used for determining the entry parameter value of the target storage process according to the target sentence period;
and the second acquisition module is used for acquiring the test case of the target storage process according to the parameter values.
11. A processing device, comprising: a memory storing a computer program executable by the processor, and a processor implementing a method of testing a database storage process according to any one of claims 1 to 9 when executing the computer program.
12. A storage medium having stored thereon a computer program which, when read and executed, implements a method of testing a database storage process according to any one of claims 1 to 9.
CN202111441944.9A 2021-11-30 2021-11-30 Method, device, processing equipment and medium for testing database storage process Pending CN114090457A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111441944.9A CN114090457A (en) 2021-11-30 2021-11-30 Method, device, processing equipment and medium for testing database storage process

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111441944.9A CN114090457A (en) 2021-11-30 2021-11-30 Method, device, processing equipment and medium for testing database storage process

Publications (1)

Publication Number Publication Date
CN114090457A true CN114090457A (en) 2022-02-25

Family

ID=80305835

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111441944.9A Pending CN114090457A (en) 2021-11-30 2021-11-30 Method, device, processing equipment and medium for testing database storage process

Country Status (1)

Country Link
CN (1) CN114090457A (en)

Similar Documents

Publication Publication Date Title
US9405662B2 (en) Process for displaying test coverage data during code reviews
CN102073640B (en) Method, system and server for testing structured query language (SQL) statements
CN110851209B (en) Data processing method and device, electronic equipment and storage medium
KR20190060725A (en) SQL review methods, devices, servers, and storage media
US10248626B1 (en) Method and system for document similarity analysis based on common denominator similarity
CN104462606B (en) A kind of method that diagnostic process measure is determined based on daily record data
US11042529B2 (en) System of migration and validation
CN109376142B (en) Data migration method and terminal equipment
WO2014167647A1 (en) Data management device, date management method, and permanent storage medium
CN110389941B (en) Database checking method, device, equipment and storage medium
CN109445768B (en) Database script generation method and device, computer equipment and storage medium
CN109710571B (en) File analysis method, device and storage medium
CN110737689A (en) Data standard conformance detection method, device, system and storage medium
CN110874364B (en) Query statement processing method, device, equipment and storage medium
CN111324510A (en) Log processing method and device and electronic equipment
CN109460363B (en) Automatic testing method and device, electronic equipment and computer readable medium
CN114020813A (en) Data comparison method, device and equipment based on Hash algorithm and storage medium
CN113010208A (en) Version information generation method, version information generation device, version information generation equipment and storage medium
CN108694172B (en) Information output method and device
CN109977104B (en) Data management method and device
CN107341105A (en) Information processing method, terminal and server
CN114090457A (en) Method, device, processing equipment and medium for testing database storage process
CN113138974B (en) Method and device for detecting database compliance
CN115033592A (en) SQL statement processing method, device, equipment and storage medium based on database
CN114090673A (en) Data processing method, equipment and storage medium for multiple data sources

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