A database function testing system and method
By using simulated annealing algorithm and deep learning to generate test case scripts, and combining hash value and cosine similarity to judge test results, this method solves the problems of low automation and inaccurate test results in traditional manual testing and existing intelligent testing methods, and achieves efficient, reliable and comprehensive automated testing of database functions.
Patent Information
- Application Number
- CN202410469915.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-18
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-04-18
AI Technical Summary
Traditional manual testing of database functions requires a large amount of work and is difficult to cover all test cases. Furthermore, existing intelligent testing methods cannot achieve automatic functional testing of newly added data tables, resulting in low automation and testing efficiency, unclear test result interpretation, and difficulty in ensuring reliability and accuracy.
By employing simulated annealing algorithm combined with deep learning, the test steps with the highest matching degree to the data to be tested from historical successful test cases are automatically obtained, test case scripts are generated, and the test results are judged by calculating hash value and cosine similarity. The test number threshold is combined to determine whether to switch to manual testing.
It enables automated functional testing of databases with newly added data tables, improving testing efficiency and accuracy, ensuring the reliability and comprehensiveness of testing, and allowing for flexible adjustment of testing strategies.
Smart Images

Figure CN118394635B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of database testing, and more specifically, to a database function testing system and method. Background Art
[0002] As Internet applications become increasingly complex, databases are important components for data storage and access in various applications, and their reliability and correctness are particularly important. However, traditional manual testing of databases requires a lot of work for each function point, and it is difficult to cover all test cases. In addition, as requirements change, database structures and functions are constantly evolving, making retesting even more difficult.
[0003] Of course, there are also intelligent testing methods. For example, the patent with authorization announcement number CN110147319B discloses a database testing method, device and computer equipment; including: obtaining a test case script created for the database to be tested; obtaining a configuration instruction input by a tester for the database to be tested, and injecting test parameters into the test case script according to the configuration instruction; testing the database to be tested through the test case script injected with the test parameters, and obtaining the query data returned by the database to be tested during the test process; generating the test result of the database to be tested according to the query data; this invention solves the problem that database testing in the prior art relies on manual implementation;
[0004] However, the above technology does not specifically describe the method of generating the test case script, and it is impossible to know whether it is automatically created by the computer device; at the same time, it relies on the tester to input the test parameters. As the database function and structure are constantly changing, it is impossible to perform automatic functional testing on the database with newly added data tables, and the degree of automation and test efficiency are low; in addition, the judgment basis for the test results is unclear, and the test results cannot be accurately judged, making it difficult to ensure the reliability and accuracy of the test;
[0005] In view of this, the present invention proposes a database function testing system and method to solve the above problems. Summary of the invention
[0006] In order to overcome the above defects of the prior art and to achieve the above objectives, the present invention provides the following technical solutions: a database function testing method, comprising:
[0007] Generate test case scripts for the database to be tested;
[0008] Perform functional testing on the database to be tested according to the test case script;
[0009] After the test is completed, obtain the test results;
[0010] Based on the test results, determine whether to generate a test stop instruction.
[0011] Furthermore, the test case script includes a test environment, test parameters and test steps; the test environment is a simulated operating environment when a functional test is performed on the database to be tested; and the test steps are steps for performing a functional test on the database to be tested.
[0012] Furthermore, the test parameters include the name of the table to be tested, the test table structure, the target data and the test stop condition; the test number threshold is preset, and the test stop condition is the test number threshold;
[0013] The name of the table to be tested is the name of the table to be tested in the database to be tested, and the table to be tested is a data table newly added to the database to be tested; the structure of the table to be tested includes a second field name and a second data type; the second field name is the name corresponding to each field in the table to be tested; the second data type is the data type corresponding to each field in the table to be tested; the target data is the data in the table to be tested, and each data in the target data is composed of multiple fields; the test stop condition is the condition for stopping the functional test of the database to be tested;
[0014] The test environment generation method includes:
[0015] Obtaining environmental parameters, the environmental parameters including database type, database version, test table name, test table structure, and character set settings, the test table structure including a first field name and a first data type; generating a test environment according to the environmental parameters;
[0016] The test table name is the name of the data table in the database to be tested; the test table structure is the structure of the data table in the database to be tested; the character set is set to the character encoding format used by the database to be tested;
[0017] The first field name is the name of each field in the data table; the first data type is the data type corresponding to each field in the data table.
[0018] Furthermore, the method for obtaining the test step includes:
[0019] Step a: Collect a collection of historical test steps; the collection of historical test steps includes database function test steps that have been successfully executed in the past;
[0020] Step b: The name of the table to be tested, the structure of the table to be tested, the database type, the database version and the string type are used as the data to be tested; digital labels are set for the test steps in the historical test step collection in sequence, and the range of the digital labels is [1, n], where n is an integer greater than 1; the digital labels correspond to the test steps one by one; the digital labels corresponding to the test steps are marked as test labels, and the range of the test labels is [1, n];
[0021] Step c: Preset initialization temperature T max , minimum temperature T min , cooling coefficient δ and maximum number of iterations And let the current temperature T = T max ;
[0022] Step d: Randomly set a feasible solution χ, which is the test label. The range of feasible solution χ is [1,n];
[0023] Step e: determine the fitness function;
[0024] The expression of fitness function is: f = FG;
[0025] In the formula, f is the fitness, FG is the coverage;
[0026] Step f: Calculate the fitness f corresponding to the feasible solution χ; take the feasible solution χ as the current point, perform random perturbations in the neighborhood of the current point, obtain a new feasible solution χ′, and calculate the fitness f′ corresponding to the new feasible solution χ′;
[0027] Step g: Calculate the fitness difference f″, the expression of the fitness difference f″ is f″=f′-f;
[0028] If the fitness difference f″>0, let χ=χ′, that is, assign the value of the new feasible solution χ′ to the feasible solution χ; if the fitness difference f″≤0, calculate the probability p′, and let χ=χ′ according to the probability p′; the expression of probability p′ is: In the formula, e is a natural constant;
[0029] Step h: Repeat steps f to g until the number of loops reaches the maximum number of iterations. When , the loop ends and enters step i;
[0030] Step i: Set the current temperature T = T × δ, that is, cool down the current temperature in step c, and assign the value after cooling to the current temperature; set the maximum number of iterations The value of the maximum number of iterations after the reduction is assigned to the maximum number of iterations;
[0031] Step j: Repeat steps f to i until the current temperature T < T min When , the loop ends, the test label corresponding to the feasible solution χ is obtained, and the corresponding test steps are obtained according to the test label.
[0032] Furthermore, the method for obtaining the coverage includes:
[0033] The test label and the data to be tested corresponding to the feasible solution χ are used as analysis data; the analysis data is input into the trained coverage prediction model to predict the corresponding coverage; the coverage is the coverage degree when the test steps are used to perform functional testing on the test data;
[0034] The training process of the coverage prediction model includes:
[0035] Pre-collecting the coverages corresponding to M groups of analysis data, and converting the analysis data and the corresponding coverages into a corresponding set of feature vectors;
[0036] Each group of feature vectors is used as the input of the coverage prediction model, and the coverage prediction model takes a group of coverage corresponding to each group of analysis data as output, and takes the actual coverage corresponding to each group of analysis data as the prediction target, and the actual coverage is the pre-collected coverage corresponding to the analysis data; minimizing the sum of prediction errors of all analysis data is used as the training goal; the coverage prediction model is trained until the sum of prediction errors converges and the training is stopped; the coverage prediction model is a deep neural network model.
[0037] Furthermore, a test environment is configured for the database to be tested, and a functional test is performed on the database to be tested based on the test parameters and according to the test steps.
[0038] Furthermore, the test result is query data, and the query data is data obtained after performing a query function test on the database to be tested, and each data in the query data is composed of multiple fields.
[0039] Furthermore, the method for determining whether to generate a test stop instruction includes:
[0040] Count the number of fields in the query data and target data respectively; obtain the corresponding number of tests after the test is completed;
[0041] Compare the number of fields in the query data with the number of fields in the target data;
[0042] If the number of fields of the query data is inconsistent with the number of fields of the target data, and the number of tests is less than the test number threshold, a first test instruction is generated, but a test stop instruction is not generated, and the functional test of the database to be tested is performed again;
[0043] If the number of fields in the query data is inconsistent with the number of fields in the target data, and the number of tests is equal to the test number threshold, a test stop instruction is generated, and a function abnormality instruction is generated at the same time;
[0044] If the number of fields in the query data is the same as the number of fields in the target data, the hash values corresponding to each field in the query data and the target data are calculated respectively, and the hash values correspond to the fields one by one; the hash value corresponding to each field in the query data is marked as the query hash value, and the hash value corresponding to each field in the target data is marked as the target hash value;
[0045] The fields in the query data correspond one-to-one with the fields in the target data, and the hash values in the query hash value correspond one-to-one with the hash values in the target hash value;
[0046] Match the m hash values in the query hash value with the m′ hash values in the corresponding target hash value, and use a hash value in the query hash value and a hash value in the corresponding target hash value as a group of analysis sets to obtain m″ groups of analysis sets, where m=m′=m″;
[0047] Compare both hash values in the m″ group analysis set;
[0048] If two hash values in the analysis set are equal, an equal instruction is generated;
[0049] If two hash values in the analysis set are not equal, no equal instruction is generated;
[0050] If the number of equal instructions generated is m″′, m″′=m″; then use the trained word vector conversion model to convert the fields in the query data and the target data into corresponding word vectors in turn; replace the hash values in the m″ groups of analysis sets with the word vectors of the corresponding fields; calculate the cosine similarity corresponding to each group of analysis sets, and the cosine similarity range is [R1, R2], R2>R1;
[0051] If the cosine similarities corresponding to the m″ analysis sets are all R2, a test stop instruction is generated;
[0052] If there is an analysis set whose corresponding cosine similarity is not R2, and the number of tests is less than the test number threshold, a second test instruction is generated, but a test stop instruction is not generated, and the functional test is performed again on the database to be tested;
[0053] If there is an analysis set whose corresponding cosine similarity is not R2, and the number of tests is equal to the test number threshold, a test stop instruction is generated;
[0054] If the number of generated equal instructions is less than m″′, and the number of tests is less than the test number threshold, a second test instruction is generated, but a test stop instruction is not generated, and the functional test is performed again on the database to be tested;
[0055] If the number of generated equal instructions is less than m″′, and the number of tests is equal to the test number threshold, a test stop instruction is generated, and a function abnormality instruction is generated at the same time;
[0056] Furthermore, the hash value is calculated using a hash algorithm, multiple hash algorithms are obtained and a hash algorithm set is constructed;
[0057] When obtaining the test steps, the fitness f corresponding to each feasible solution χ is sorted to generate a sorting table;
[0058] When the functional test is performed again on the database to be tested, if the first test instruction is generated, the feasible solution χ corresponding to the test steps used when the functional test is performed on the current database to be tested is marked as the current feasible solution; the fitness that is next to the fitness corresponding to the current feasible solution is obtained, and marked as the re-fitness; the test steps corresponding to the feasible solution corresponding to the re-fitness are used as the test steps used when the functional test is performed again on the database to be tested; if the second test instruction is generated, the hash algorithm used when the functional test is performed on the current database to be tested is marked as a used hash algorithm, and when the functional test is performed again on the database to be tested, a hash algorithm that is not marked as a used hash algorithm is randomly selected from the hash algorithm set, and the hash values of the query data and the target data are calculated.
[0059] A database function testing system, implementing the database function testing method, comprises:
[0060] The script generation module is used to generate the test case script for the database to be tested;
[0061] Functional testing module, used to perform functional testing on the database to be tested according to the test case script;
[0062] The result acquisition module is used to obtain the test results after the test is completed;
[0063] The end judgment module is used to judge whether to generate a test stop instruction according to the test result.
[0064] The technical effects and advantages of a database function testing system and method of the present invention are as follows:
[0065] By combining the simulated annealing algorithm with deep learning, the test steps with the highest degree of match with the data to be tested in historical test success cases are automatically obtained, avoiding the subjectivity and shortcomings of manually setting test steps; then the test case script is generated in combination with the test environment and test parameters to perform functional testing on the database to be tested. Functional testing can be performed according to specific test requirements, and automatic functional testing of the database with newly added data tables can be achieved to speed up test execution and improve test efficiency; the test results are obtained by calculating the hash value and cosine similarity to determine whether the query is accurate, and then the test number threshold is integrated to determine whether to switch to manual testing. The test results can be accurately judged, the reliability and accuracy of the test can be improved, and the test strategy can be flexibly adjusted to ensure the comprehensiveness and effectiveness of the test. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 A schematic diagram of a database function test system according to Embodiment 1 of the present invention;
[0067] Figure 2 This is a flow chart of a database function testing method according to Embodiment 2 of the present invention;
[0068] Figure 3 This is a schematic diagram of an electronic device according to Embodiment 3 of the present invention;
[0069] Figure 4 This is a schematic diagram of a storage medium according to Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0070] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0071] Embodiment 1:
[0072] See also Figure 1 As shown, a database function test system described in this embodiment includes a script generation module, a function test module, a result acquisition module and an end judgment module; each module is connected by wired and / or wireless means to achieve data transmission between modules;
[0073] The script generation module is used to generate the test case script for the database to be tested;
[0074] The test case script includes the test environment, test parameters and test steps;
[0075] The test environment is the operating environment simulated when the function test is performed on the database to be tested; the test steps are the steps for performing the function test on the database to be tested;
[0076] The test parameters include the name of the table to be tested, the test table structure, the target data, and the test stop condition; the test number threshold is preset, and the test stop condition is the test number threshold;
[0077] The name of the table to be tested is the name of the table to be tested in the database to be tested, and the table to be tested is a data table newly added to the database to be tested; the structure of the table to be tested includes a second field name and a second data type; the second field name is the name corresponding to each field in the table to be tested; the second data type is the data type corresponding to each field in the table to be tested; the target data is the data in the table to be tested, and each data in the target data is composed of multiple fields; the test stop condition is the condition for stopping the functional test of the database to be tested;
[0078] The name and structure of the table to be tested are obtained from the database to be tested; the target data is obtained from the table to be tested; the threshold of the number of tests is pre-set by a technician in this field according to the scale of the database to be tested;
[0079] The test environment generation method includes:
[0080] Obtaining environmental parameters, including database type (such as MySQL, SQL Server), database version (such as MySQL5.7, SQL Server 2017), test table name, test table structure, and character set settings, where the test table structure includes a first field name and a first data type; generating a test environment according to the environmental parameters;
[0081] Environmental parameters are obtained from the database to be tested; different database types and database version numbers correspond to different functions; the test table name is the name of the data table in the database to be tested, which is used to locate the test object; the test table structure is the structure of the data table in the database to be tested, which is used to describe the information of the data table; the character set is set to the character encoding format used by the database to be tested (such as UTF8, GB2312);
[0082] The first field name is the name of each field in the data table; the first data type is the data type corresponding to each field in the data table (such as string type is varchar, integer type is int);
[0083] The methods for obtaining test steps include:
[0084] Step a: Collect a collection of historical test steps;
[0085] The historical test step collection is obtained by a person skilled in the art from an automated test report or log in a database. The historical test step collection includes database function test steps that have been successfully executed in the past. The test steps at least include writing a query statement, executing a query statement, etc.
[0086] Step b: The name of the table to be tested, the structure of the table to be tested, the database type, the database version and the string type are used as the data to be tested; digital labels are set for the test steps in the historical test step collection in sequence, and the range of the digital labels is [1, n], where n is an integer greater than 1; the digital labels correspond to the test steps one by one; the digital labels corresponding to the test steps are marked as test labels, and the range of the test labels is [1, n];
[0087] Step c: Preset initialization temperature T max , minimum temperature T min , cooling coefficient δ and maximum number of iterations And let the current temperature T = T max ;
[0088] Step d: Randomly set a feasible solution χ, which is the test label. The range of feasible solution χ is [1,n];
[0089] Step e: determine the fitness function;
[0090] The expression of fitness function is: f = FG;
[0091] In the formula, f is the fitness, FG is the coverage;
[0092] Methods for obtaining coverage include:
[0093] The test labels and test data corresponding to the feasible solution χ are used as analysis data; the analysis data is input into the trained coverage prediction model to predict the corresponding coverage; the coverage is the coverage degree when the test steps are used to perform functional tests on the test data; the greater the coverage, the greater the fitness corresponding to the test steps, indicating that the selected test steps are more compatible with the test data;
[0094] The specific training process of the coverage prediction model includes:
[0095] Pre-collecting the coverages corresponding to M groups of analysis data, and converting the analysis data and the corresponding coverages into a corresponding set of feature vectors;
[0096] Each set of feature vectors is used as the input of the coverage prediction model. The coverage prediction model uses a set of coverage corresponding to each set of analysis data as output, and uses the actual coverage corresponding to each set of analysis data as the prediction target. The actual coverage is the coverage corresponding to the analysis data collected in advance. The training target is to minimize the sum of the prediction errors of all analysis data. The calculation formula of the prediction error is Z K =(α K -μ K ) 2 , where Z K is the prediction error, K is the group number of the eigenvector corresponding to the analysis data, α K is the coverage rate corresponding to the Kth group of analysis data, μ K is the actual coverage rate corresponding to the Kth group of analysis data; the coverage rate prediction model is trained until the sum of the prediction errors reaches convergence and the training is stopped;
[0097] The above coverage prediction model is specifically a deep neural network model;
[0098] It should be noted that the coverage rate corresponding to the analysis data is obtained by a technician in this field who collects M groups of analysis data during the functional testing process of the historical database, and uses a code coverage tool (such as JaCoCo, Cobertura) under the condition of the M groups of analysis data to track the code execution path, monitor the execution of the code, and generate a coverage report; the coverage rate obtained according to the coverage report is the coverage rate corresponding to the analysis data;
[0099] Step f: Calculate the fitness f corresponding to the feasible solution χ; take the feasible solution χ as the current point, perform random perturbations in the neighborhood of the current point, obtain a new feasible solution χ′, and calculate the fitness f′ corresponding to the new feasible solution χ′;
[0100] Step g: Calculate the fitness difference f″, the expression of the fitness difference f″ is f″=f′-f;
[0101] If the fitness difference f″>0, let χ=χ′, that is, assign the value of the new feasible solution χ′ to the feasible solution χ; if the fitness difference f″≤0, calculate the probability p′, and let χ=χ′ according to the probability p′; the expression of probability p′ is: In the formula, e is a natural constant;
[0102] Step h: Repeat steps f to g until the number of loops reaches the maximum number of iterations. When , the loop ends and enters step i;
[0103] Step i: Set the current temperature T = T × δ, that is, cool down the current temperature in step c, and assign the value after cooling to the current temperature; set the maximum number of iterations That is, assign the value of the maximum number of iterations after the reduction to the maximum number of iterations; if the maximum number of iterations after the reduction is not an integer, the maximum number of iterations after the reduction is rounded up so that the maximum number of iterations after the reduction is an integer;
[0104] Step j: Repeat steps f to i until the current temperature T < T min When , the loop ends, the test label corresponding to the feasible solution χ is obtained, and the corresponding test steps are obtained according to the test label;
[0105] It should be noted that the initialization temperature T max , minimum temperature T min , cooling coefficient δ and maximum number of iterations As preset parameters, the preset parameters are collected by a technician in this field during the function test of the historical database, and multiple groups of different data to be tested are collected. For the same data to be tested, multiple groups of different preset parameters are pre-set in sequence, and the test labels are obtained by the simulated annealing algorithm in sequence. The corresponding fitness is calculated according to the multiple test labels, and the test label corresponding to the maximum fitness is obtained and marked as the maximum label; the preset parameters corresponding to the maximum label are used as the preset parameters corresponding to the group of data to be tested, and the preset parameters corresponding to multiple groups of data to be tested are obtained by analogy, and the mean values of multiple preset parameters (i.e., the initialization temperature mean, the minimum temperature mean, the cooling coefficient mean, and the maximum number of iterations mean) are used as the initialization temperature T preset in step a. max , minimum temperature T min , cooling coefficient δ and maximum number of iterations
[0106] Functional testing module, used to perform functional testing on the database to be tested according to the test case script;
[0107] Configure the test environment for the database to be tested, and perform functional testing on the database to be tested based on the test parameters and test steps;
[0108] The result acquisition module is used to obtain the test results after the test is completed;
[0109] The test result is query data, which is the data obtained after the query function test of the database to be tested. Each data in the query data consists of multiple fields.
[0110] It should be noted that each data in the database is represented and stored by multiple fields, so each data in the query data and target data is also composed of multiple fields;
[0111] The end judgment module is used to judge whether to generate a test stop instruction according to the test result;
[0112] The method for determining whether to generate a test stop instruction includes:
[0113] Count the number of fields in the query data and target data respectively; obtain the corresponding number of tests after the test is completed;
[0114] It should be noted that the test number is the number of functional tests that the database to be tested has undergone between two test stop instructions, that is, after the last test stop instruction is generated, each time the database to be tested completes a functional test, the corresponding test number increases, and when the test stop instruction is generated again, the test number is reset to zero;
[0115] Compare the number of fields in the query data with the number of fields in the target data;
[0116] If the number of fields in the query data is inconsistent with the number of fields in the target data, and the number of tests is less than the test number threshold, a first test instruction is generated, but a test stop instruction is not generated, and the function test of the database to be tested is performed again, indicating that the data in the query data is inconsistent with the data in the target data, and the query function of the database to be tested is abnormal, and needs to be tested again;
[0117] If the number of fields in the query data is inconsistent with the number of fields in the target data, and the number of tests is equal to the test number threshold, a test stop instruction is generated, and a function abnormality instruction is generated at the same time, indicating that multiple function tests have been performed on the database to be tested, and the number of function tests has reached the test number threshold, but the result of each function test is abnormal, and there is no need to perform function tests on the database to be tested, and technical personnel in the field need to perform manual tests;
[0118] When the number of tests reaches the test number threshold, the function test of the database to be tested will be stopped, so the number of tests will not be greater than the test number threshold;
[0119] If the number of fields in the query data is the same as the number of fields in the target data, the hash values corresponding to each field in the query data and the target data are calculated respectively, and the hash values correspond to the fields one by one; the hash value corresponding to each field in the query data is marked as the query hash value, and the hash value corresponding to each field in the target data is marked as the target hash value;
[0120] Since the query data is the data obtained after the query function test is performed on the database to be tested, the data in the query data should correspond to the data in the target data, that is, the fields in the query data correspond one-to-one with the fields in the target data, and the hash values in the query hash value correspond one-to-one with the hash values in the target hash value;
[0121] Match the m hash values in the query hash value with the m′ hash values in the corresponding target hash value, and use a hash value in the query hash value and a hash value in the corresponding target hash value as a group of analysis sets to obtain m″ groups of analysis sets, where m=m′=m″;
[0122] Compare both hash values in the m″ group analysis set;
[0123] If two hash values in the analysis set are equal, an equal instruction is generated, indicating that the fields corresponding to the two hash values in the analysis set are equal;
[0124] If the two hash values in the analysis set are not equal, no equal instruction is generated, which means that the fields corresponding to the two hash values in the analysis set are not equal, and the data corresponding to the fields are also not equal;
[0125] If the number of equal instructions generated is m″′, m″′=m″; then the trained word vector conversion model is used to convert the fields in the query data and the target data into corresponding word vectors in turn; the hash values in the m″ analysis sets are replaced with the word vectors of the corresponding fields; the cosine similarity corresponding to each analysis set is calculated, and the cosine similarity range is [R1, R2], R2>R1; the cosine similarity algorithm is a prior art and will not be described in detail here; in this embodiment, R1=0, R2=1 is preferred;
[0126] The training process of the word vector conversion model includes:
[0127] Collect multiple sets of target data in advance; use the WordPiece algorithm to build a word list containing vocabulary in the target data domain; the target data domain vocabulary is a vocabulary collection of professional vocabulary and terminology related to the target data; convert the target data into an ID sequence through the word list, and add position encoding as inputs; the inputs are deep Transformer encoded through the BERT encoder to obtain latent sentence representation, which is the word vector; randomly select some word masks and predict the corresponding original words as the unsupervised pre-training task target; use cross entropy to calculate the loss function, and back propagate to optimize and modify the parameters of the word vector conversion model to complete the training of the word vector conversion model; the word vector conversion model is the BERT semantic model;
[0128] It should be noted that the training process of the word vector conversion model is only a conceptual training process. The BERT semantic model is an existing technology, and the specific training process of the word vector conversion model will not be described in detail here.
[0129] If the cosine similarities corresponding to the m″ analysis sets are all R2, a test stop instruction is generated, indicating that the query data is consistent with the target data, so the query function of the database to be tested is normal, and there is no need to test again, and the test stops;
[0130] If there is an analysis set whose corresponding cosine similarity is not R2, and the number of tests is less than the test number threshold, a second test instruction is generated, but a test stop instruction is not generated, and the functional test is performed again on the database to be tested, indicating that although the query hash value is consistent with the target hash value, the reason for the consistency is that a hash collision occurs, that is, the hash values corresponding to different fields are the same, so it is necessary to test again;
[0131] If there is an analysis set whose corresponding cosine similarity is not R2, and the number of tests is equal to the test number threshold, a test stop instruction is generated; this indicates that the database to be tested has been subjected to multiple functional tests, and the number of functional tests has reached the test number threshold, but the result of each functional test is abnormal, and no further functional tests are required for the database to be tested, and a technician in this field needs to perform manual tests;
[0132] If the number of generated equal instructions is less than m″′, and the number of tests is less than the test number threshold, a second test instruction is generated, but a test stop instruction is not generated, and the function test of the database to be tested is performed again, indicating that the hash value in the query hash value is different from the hash value in the corresponding target hash value, that is, the data in the query data is inconsistent with the data in the target data, and the query function of the database to be tested is abnormal, and needs to be tested again;
[0133] If the number of generated equal instructions is less than m″′, and the number of tests is equal to the test number threshold, a test stop instruction is generated, and a function abnormality instruction is generated at the same time;
[0134] Since the number of analysis sets is m″ groups, the generated equal instruction data will not be greater than m″, that is, it will not be greater than m″′;
[0135] The calculation of the above hash value adopts a hash algorithm, and multiple hash algorithms are obtained and a hash algorithm set is constructed; hash algorithms such as MD5, SHA-1, SHA-256, etc., due to different design principles and operation methods, will lead to differences in operation functions corresponding to the same or different hash algorithms. At the same time, the hash algorithm is an existing technology, so it will not be described in detail here;
[0136] When the test steps are obtained, the fitness f corresponding to each feasible solution χ is sorted to generate a sorting table; when the functional test is re-performed on the database to be tested, if the first test instruction is generated, the feasible solution χ corresponding to the test step used when the functional test is performed on the current database to be tested is marked as the current feasible solution; the fitness ranked after the fitness corresponding to the current feasible solution is obtained, and marked as the re-fitness; the test steps corresponding to the feasible solution corresponding to the re-fitness are used as the test steps used when the functional test is re-performed on the database to be tested; if the second test instruction is generated, the hash algorithm used when the functional test is performed on the current database to be tested is marked as a used hash algorithm, and when the functional test is re-performed on the database to be tested, a hash algorithm that is not marked as a used hash algorithm is randomly selected from the hash algorithm set to calculate the hash values of the query data and the target data;
[0137] It should be noted that if the first test instruction is generated, it means that the data in the query data is inconsistent with the data in the target data. If the test steps originally used for functional testing of the database to be tested are still used, the query data obtained is still inconsistent with the target data, so the test steps need to be changed; if the second test instruction is generated, it means that there is a hash value in the query hash value that is inconsistent with the hash value in the corresponding target hash value, then it is necessary to change the hash algorithm, calculate the query hash value and the target hash value again, and determine whether they are consistent;
[0138] This embodiment combines deep learning with a simulated annealing algorithm to automatically obtain the test steps with the highest matching degree with the data to be tested in historical test success cases, avoiding the subjectivity and shortcomings of manually setting test steps; then generates a test case script in combination with the test environment and test parameters to perform functional testing on the database to be tested. It can perform functional testing according to specific test requirements and realize automatic functional testing of the database with newly added data tables to speed up the test execution and improve the test efficiency; the test results are obtained by calculating the hash value and cosine similarity to determine whether the query is accurate, and then the test number threshold is integrated to determine whether to switch to manual testing. It can accurately judge the test results, improve the reliability and accuracy of the test, and flexibly adjust the test strategy to ensure the comprehensiveness and effectiveness of the test.
[0139] Embodiment 2:
[0140] See also Figure 2 As shown, the part not described in detail in this embodiment is described in Example 1, and a database function testing method is provided, the method comprising:
[0141] Generate test case scripts for the database to be tested;
[0142] Perform functional testing on the database to be tested according to the test case script;
[0143] After the test is completed, obtain the test results;
[0144] Based on the test results, determine whether to generate a test stop instruction.
[0145] Furthermore, the test case script includes a test environment, test parameters and test steps; the test environment is a simulated operating environment when a functional test is performed on the database to be tested; and the test steps are steps for performing a functional test on the database to be tested.
[0146] Furthermore, the test parameters include the name of the table to be tested, the test table structure, the target data and the test stop condition; the test number threshold is preset, and the test stop condition is the test number threshold;
[0147] The name of the table to be tested is the name of the table to be tested in the database to be tested, and the table to be tested is a data table newly added to the database to be tested; the structure of the table to be tested includes a second field name and a second data type; the second field name is the name corresponding to each field in the table to be tested; the second data type is the data type corresponding to each field in the table to be tested; the target data is the data in the table to be tested, and each data in the target data is composed of multiple fields; the test stop condition is the condition for stopping the functional test of the database to be tested;
[0148] The test environment generation method includes:
[0149] Obtaining environmental parameters, the environmental parameters including database type, database version, test table name, test table structure, and character set settings, the test table structure including a first field name and a first data type; generating a test environment according to the environmental parameters;
[0150] The test table name is the name of the data table in the database to be tested; the test table structure is the structure of the data table in the database to be tested; the character set is set to the character encoding format used by the database to be tested;
[0151] The first field name is the name of each field in the data table; the first data type is the data type corresponding to each field in the data table.
[0152] Furthermore, the method for obtaining the test step includes:
[0153] Step a: Collect a collection of historical test steps; the collection of historical test steps includes database function test steps that have been successfully executed in the past;
[0154] Step b: The name of the table to be tested, the structure of the table to be tested, the database type, the database version and the string type are used as the data to be tested; digital labels are set for the test steps in the historical test step collection in sequence, and the range of the digital labels is [1, n], where n is an integer greater than 1; the digital labels correspond to the test steps one by one; the digital labels corresponding to the test steps are marked as test labels, and the range of the test labels is [1, n];
[0155] Step c: Preset initialization temperature T max , minimum temperature T min , cooling coefficient δ and maximum number of iterations And let the current temperature T = T max ;
[0156] Step d: Randomly set a feasible solution χ, which is the test label. The range of feasible solution χ is [1,n];
[0157] Step e: determine the fitness function;
[0158] The expression of fitness function is: f = FG;
[0159] In the formula, f is the fitness, FG is the coverage;
[0160] Step f: Calculate the fitness f corresponding to the feasible solution χ; take the feasible solution χ as the current point, perform random perturbations in the neighborhood of the current point, obtain a new feasible solution χ′, and calculate the fitness f′ corresponding to the new feasible solution χ′;
[0161] Step g: Calculate the fitness difference f″, the expression of the fitness difference f″ is f″=f′-f;
[0162] If the fitness difference f″>0, let χ=χ′, that is, assign the value of the new feasible solution χ′ to the feasible solution χ; if the fitness difference f″≤0, calculate the probability p′, and let χ=χ′ according to the probability p′; the expression of probability p′ is: In the formula, e is a natural constant;
[0163] Step h: Repeat steps f to g until the number of loops reaches the maximum number of iterations. When , the loop ends and enters step i;
[0164] Step i: Set the current temperature T = T × δ, that is, cool down the current temperature in step c, and assign the value after cooling to the current temperature; set the maximum number of iterations The value of the maximum number of iterations after the reduction is assigned to the maximum number of iterations;
[0165] Step j: Repeat steps f to i until the current temperature T < T minWhen , the loop ends, the test label corresponding to the feasible solution χ is obtained, and the corresponding test steps are obtained according to the test label.
[0166] Furthermore, the method for obtaining the coverage includes:
[0167] The test label and the data to be tested corresponding to the feasible solution χ are used as analysis data; the analysis data is input into the trained coverage prediction model to predict the corresponding coverage; the coverage is the coverage degree when the test steps are used to perform functional testing on the test data;
[0168] The training process of the coverage prediction model includes:
[0169] Pre-collecting the coverages corresponding to M groups of analysis data, and converting the analysis data and the corresponding coverages into a corresponding set of feature vectors;
[0170] Each group of feature vectors is used as the input of the coverage prediction model, and the coverage prediction model takes a group of coverage corresponding to each group of analysis data as output, and takes the actual coverage corresponding to each group of analysis data as the prediction target, and the actual coverage is the pre-collected coverage corresponding to the analysis data; minimizing the sum of prediction errors of all analysis data is used as the training goal; the coverage prediction model is trained until the sum of prediction errors converges and the training is stopped; the coverage prediction model is a deep neural network model.
[0171] Furthermore, a test environment is configured for the database to be tested, and a functional test is performed on the database to be tested based on the test parameters and according to the test steps.
[0172] Furthermore, the test result is query data, and the query data is data obtained after performing a query function test on the database to be tested, and each data in the query data is composed of multiple fields.
[0173] Furthermore, the method for determining whether to generate a test stop instruction includes:
[0174] Count the number of fields in the query data and target data respectively; obtain the corresponding number of tests after the test is completed;
[0175] Compare the number of fields in the query data with the number of fields in the target data;
[0176] If the number of fields of the query data is inconsistent with the number of fields of the target data, and the number of tests is less than the test number threshold, a first test instruction is generated, but a test stop instruction is not generated, and the functional test of the database to be tested is performed again;
[0177] If the number of fields in the query data is inconsistent with the number of fields in the target data, and the number of tests is equal to the test number threshold, a test stop instruction is generated, and a function abnormality instruction is generated at the same time;
[0178] If the number of fields in the query data is the same as the number of fields in the target data, the hash values corresponding to each field in the query data and the target data are calculated respectively, and the hash values correspond to the fields one by one; the hash value corresponding to each field in the query data is marked as the query hash value, and the hash value corresponding to each field in the target data is marked as the target hash value;
[0179] The fields in the query data correspond one-to-one with the fields in the target data, and the hash values in the query hash value correspond one-to-one with the hash values in the target hash value;
[0180] Match the m hash values in the query hash value with the m′ hash values in the corresponding target hash value, and use a hash value in the query hash value and a hash value in the corresponding target hash value as a group of analysis sets to obtain m″ groups of analysis sets, where m=m′=m″;
[0181] Compare both hash values in the m″ group analysis set;
[0182] If two hash values in the analysis set are equal, an equal instruction is generated;
[0183] If two hash values in the analysis set are not equal, no equal instruction is generated;
[0184] If the number of equal instructions generated is m″′, m″′=m″; then use the trained word vector conversion model to convert the fields in the query data and the target data into corresponding word vectors in turn; replace the hash values in the m″ groups of analysis sets with the word vectors of the corresponding fields; calculate the cosine similarity corresponding to each group of analysis sets, and the cosine similarity range is [R1, R2], R2>R1;
[0185] If the cosine similarities corresponding to the m″ analysis sets are all R2, a test stop instruction is generated;
[0186] If there is an analysis set whose corresponding cosine similarity is not R2, and the number of tests is less than the test number threshold, a second test instruction is generated, but a test stop instruction is not generated, and the functional test is performed again on the database to be tested;
[0187] If there is an analysis set whose corresponding cosine similarity is not R2, and the number of tests is equal to the test number threshold, a test stop instruction is generated;
[0188] If the number of generated equal instructions is less than m″′, and the number of tests is less than the test number threshold, a second test instruction is generated, but a test stop instruction is not generated, and the functional test is performed again on the database to be tested;
[0189] If the number of generated equal instructions is less than m″′, and the number of tests is equal to the test number threshold, a test stop instruction is generated, and a function abnormality instruction is generated at the same time;
[0190] Furthermore, the hash value is calculated using a hash algorithm, multiple hash algorithms are obtained and a hash algorithm set is constructed;
[0191] When obtaining the test steps, the fitness f corresponding to each feasible solution χ is sorted to generate a sorting table; when re-performing a functional test on the database to be tested, if the first test instruction is generated, the feasible solution χ corresponding to the test steps used when the current database to be tested is performed functionally is marked as the current feasible solution; the fitness ranked after the fitness corresponding to the current feasible solution is obtained, and marked as the re-fitness; the test steps corresponding to the feasible solution corresponding to the re-fitness are used as the test steps used when re-performing a functional test on the database to be tested; if the second test instruction is generated, the hash algorithm used when the current database to be tested is performed functionally is marked as a used hash algorithm, and when re-performing a functional test on the database to be tested, a hash algorithm that is not marked as a used hash algorithm is randomly selected from the hash algorithm set, and the hash values of the query data and the target data are calculated.
[0192] Embodiment 3:
[0193] See also Figure 3 As shown, according to another aspect of the present application, an electronic device 500 is also provided. The electronic device 500 may include one or more processors and one or more memories. The memories store computer readable codes, and when the computer readable codes are run by one or more processors, a database function test method as described above may be executed.
[0194] The method or system according to the embodiment of the present application can also be used by Figure 3 The electronic device architecture shown in FIG. Figure 3 As shown, the electronic device 500 may include a bus 501, one or more CPUs 502, ROM 503, RAM 504, a communication port 505 connected to a network, an input / output 506, a hard disk 507, etc. The storage device in the electronic device 500, such as ROM 503 or hard disk 507, may store a database function test method provided by the present application. Further, the electronic device 500 may also include a user interface 508. Of course, Figure 3 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different devices. Figure 3 One or more components of an electronic device are shown.
[0195] Embodiment 4:
[0196] See also Figure 4 As shown, a computer-readable storage medium 600 according to an embodiment of the present application is shown. Computer-readable instructions are stored on the computer-readable storage medium 600. When the computer-readable instructions are executed by the processor, a database function test method according to an embodiment of the present application described with reference to the above figures can be executed. The storage medium 600 includes, but is not limited to, for example, volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc.
[0197] In addition, according to the embodiments of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the present application provides a non-transitory machine-readable storage medium, which stores machine-readable instructions, and the machine-readable instructions can be executed by a processor to execute instructions corresponding to the method steps provided by the present application, for example: a database function testing method. When the computer program is executed by a central processing unit (CPU), the above functions defined in the method of the present application are executed.
[0198] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center through a wired network or a wireless network. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.
[0199] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0200] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0201] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only one, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0202] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0203] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0204] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0205] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A database function testing method, characterized in that: include: Generate test case scripts for the database to be tested; The test case script includes a test environment, test parameters and test steps; The test parameters include the name of the table to be tested, the test table structure, the target data and the test stop condition; The method for generating the test environment includes: Obtaining environmental parameters, the environmental parameters including database type, database version, test table name, test table structure, and character set settings, the test table structure including a first field name and a first data type; generating a test environment according to the environmental parameters; The method for obtaining the test step includes: Step a: Collect a collection of historical test steps; the collection of historical test steps includes database function test steps that have been successfully executed in the past; Step b: The name of the table to be tested, the structure of the table to be tested, the database type, the database version and the string type are used as the data to be tested; digital labels are set for the test steps in the historical test step collection in sequence, and the range of the digital labels is [1, n], where n is an integer greater than 1; the digital labels correspond to the test steps one by one; the digital labels corresponding to the test steps are marked as test labels, and the range of the test labels is [1, n]; Step c: Preset initialization temperature T max , minimum temperature T min , cooling coefficient δ and maximum number of iterations And let the current temperature T = T max ; Step d: Randomly set a feasible solution χ, which is the test label. The range of feasible solution χ is [1,n]; Step e: determine the fitness function; The expression of fitness function is: f = FG; In the formula, f is the fitness, FG is the coverage; The method for obtaining the coverage rate includes: The test label and the data to be tested corresponding to the feasible solution χ are used as analysis data; the analysis data is input into the trained coverage prediction model to predict the corresponding coverage; the coverage is the coverage degree when the test steps are used to perform functional testing on the test data; The training process of the coverage prediction model includes: Pre-collecting the coverages corresponding to M groups of analysis data, and converting the analysis data and the corresponding coverages into a corresponding set of feature vectors; Each group of feature vectors is used as the input of the coverage prediction model. The coverage prediction model uses a group of coverage corresponding to each group of analysis data as output, and uses the actual coverage corresponding to each group of analysis data as the prediction target, where the actual coverage is the coverage corresponding to the analysis data collected in advance; minimizing the sum of prediction errors of all analysis data is used as the training target; the coverage prediction model is trained until the sum of prediction errors reaches convergence and the training is stopped; the coverage prediction model is a deep neural network model; Step f: Calculate the fitness f corresponding to the feasible solution χ; take the feasible solution χ as the current point, perform random perturbations in the neighborhood of the current point, obtain a new feasible solution χ′, and calculate the fitness f′ corresponding to the new feasible solution χ′; Step g: Calculate the fitness difference f″, the expression of the fitness difference f″ is f″=f′-f; If the fitness difference f″>0, let χ=χ′, that is, assign the value of the new feasible solution χ′ to the feasible solution χ; if the fitness difference f″≤0, calculate the probability p′, and let χ=χ′ according to the probability p′; the expression of probability p′ is: In the formula, e is a natural constant; Step h: Repeat steps f to g until the number of loops reaches the maximum number of iterations. When , the loop ends and enters step i; Step i: Set the current temperature T = T × δ, that is, cool down the current temperature in step c, and assign the value after cooling to the current temperature; set the maximum number of iterations The value of the maximum number of iterations after the reduction is assigned to the maximum number of iterations; Step j: Repeat steps f to i until the current temperature T < T min When , the loop ends, the test label corresponding to the feasible solution χ is obtained, and the corresponding test steps are obtained according to the test label; Perform functional testing on the database to be tested according to the test case script; After the test is completed, obtain the test results; According to the test results, determine whether to generate a test stop instruction; The method for determining whether to generate a test stop instruction includes: Count the number of fields in the query data and target data respectively; obtain the corresponding number of tests after the test is completed; Compare the number of fields in the query data with the number of fields in the target data; If the number of fields of the query data is inconsistent with the number of fields of the target data, and the number of tests is less than the test number threshold, a first test instruction is generated, but a test stop instruction is not generated, and the functional test of the database to be tested is performed again; If the number of fields in the query data is inconsistent with the number of fields in the target data, and the number of tests is equal to the test number threshold, a test stop instruction is generated, and a function abnormality instruction is generated at the same time; If the number of fields in the query data is the same as the number of fields in the target data, the hash values corresponding to each field in the query data and the target data are calculated respectively, and the hash values correspond to the fields one by one; the hash value corresponding to each field in the query data is marked as the query hash value, and the hash value corresponding to each field in the target data is marked as the target hash value; The fields in the query data correspond one-to-one with the fields in the target data, and the hash values in the query hash value correspond one-to-one with the hash values in the target hash value; Match the m hash values in the query hash value with the m′ hash values in the corresponding target hash value, and use a hash value in the query hash value and a hash value in the corresponding target hash value as a group of analysis sets to obtain m″ groups of analysis sets, where m=m′=m″; Compare both hash values in the m″ group analysis set; If two hash values in the analysis set are equal, an equal instruction is generated; If two hash values in the analysis set are not equal, no equal instruction is generated; If the number of equal instructions generated is m″′, m″′=m″; then use the trained word vector conversion model to convert the fields in the query data and the target data into corresponding word vectors in turn; replace the hash values in the m″ groups of analysis sets with the word vectors of the corresponding fields; calculate the cosine similarity corresponding to each group of analysis sets, and the cosine similarity range is [R1, R2], R2>R1; If the cosine similarities corresponding to the m″ analysis sets are all R2, a test stop instruction is generated; If there is an analysis set whose corresponding cosine similarity is not R2, and the number of tests is less than the test number threshold, a second test instruction is generated, but a test stop instruction is not generated, and the functional test is performed again on the database to be tested; If there is an analysis set whose corresponding cosine similarity is not R2, and the number of tests is equal to the test number threshold, a test stop instruction is generated; If the number of generated equal instructions is less than m″′, and the number of tests is less than the test number threshold, a second test instruction is generated, but a test stop instruction is not generated, and the functional test is performed again on the database to be tested; If the number of generated equal instructions is less than m″′, and the number of tests is equal to the test number threshold, a test stop instruction is generated, and a function abnormality instruction is generated at the same time.
2. A database function testing method according to claim 1, characterized in that: The test environment is a simulated operating environment when a functional test is performed on a database to be tested; and the test steps are steps for performing a functional test on the database to be tested.
3. A database function testing method according to claim 2, characterized in that: A test number threshold is preset, and the test stop condition is the test number threshold; The name of the table to be tested is the name of the table to be tested in the database to be tested, and the table to be tested is a data table newly added to the database to be tested; the structure of the table to be tested includes the second field name and the second data type; The second field name is the name corresponding to each field in the table to be tested; the second data type is the data type corresponding to each field in the table to be tested; The target data is the data in the table to be tested, and each data in the target data is composed of multiple fields; the test stop condition is the condition for stopping the functional test of the database to be tested; The test table name is the name of the data table in the database to be tested; the test table structure is the structure of the data table in the database to be tested; the character set is set to the character encoding format used by the database to be tested; The first field name is the name of each field in the data table; the first data type is the data type corresponding to each field in the data table.
4. A database function testing method according to claim 3, characterized in that: Configure the test environment for the database to be tested, and perform functional testing on the database to be tested based on the test parameters and test steps.
5. A database function testing method according to claim 4, characterized in that: The test result is query data. The query data is data obtained after performing a query function test on the database to be tested. Each data in the query data is composed of multiple fields.
6. A database function testing method according to claim 5, characterized in that: The hash value is calculated by using a hash algorithm, obtaining multiple hash algorithms and constructing a hash algorithm set; When obtaining the test steps, the fitness f corresponding to each feasible solution χ is sorted to generate a sorting table; When the functional test is performed again on the database to be tested, if the first test instruction is generated, the feasible solution x corresponding to the test step used when the functional test is currently performed on the database to be tested is marked as the current feasible solution; Obtain the fitness that is next to the fitness corresponding to the current feasible solution, and mark it as the re-fitness; use the test steps corresponding to the feasible solution corresponding to the re-fitness as the test steps used when re-performing functional testing on the database to be tested; if a second test instruction is generated, mark the hash algorithm used in the functional testing of the current database to be tested as a used hash algorithm, and when re-performing functional testing on the database to be tested, randomly select a hash algorithm that is not marked as a used hash algorithm from the hash algorithm set, and calculate the hash values of the query data and the target data.
7. A database function testing system, implementing a database function testing method according to any one of claims 1 to 6, characterized in that: include: The script generation module is used to generate the test case script for the database to be tested; Functional testing module, used to perform functional testing on the database to be tested according to the test case script; The result acquisition module is used to obtain the test results after the test is completed; The end judgment module is used to judge whether to generate a test stop instruction according to the test result.
