Artificial Intelligence-Based Data Testing Methods and Related Equipment

By constructing a set of database data retrieval rules and generating a logical vector hash table, the problem of low data testing efficiency was solved, and efficient and accurate data testing was achieved.

CN114860591BActive Publication Date: 2025-10-31CHINA PING AN LIFE INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210466559.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-26
Publication Date
2025-10-31
Estimated Expiration
2042-04-26

AI Technical Summary

Technical Problem

Existing data testing methods are inefficient when dealing with large amounts of data, especially as the number of programs to be tested increases, making the data testing process cumbersome.

Method used

By constructing a set of database retrieval rules and encoding them to generate logical vectors, a hash table of retrieval results is built. The key-value pairs in the hash table are used to quickly query test results, reducing the need for direct execution of the program under test.

Benefits of technology

It improves the efficiency and accuracy of data testing, enables the parallel processing of multiple test tasks, reduces tedious individual program running steps, and improves fault tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114860591B_ABST
    Figure CN114860591B_ABST
Patent Text Reader

Abstract

This application proposes a data testing method, apparatus, electronic device, and storage medium based on artificial intelligence. The data testing method based on artificial intelligence includes: obtaining a set of program attributes from a database; using the character value of each attribute in the set of program attributes as the variable corresponding to that attribute; combining the variables corresponding to each attribute to obtain multiple variable groups and storing them as a set of data retrieval rules; encoding each variable in the set of data retrieval rules to obtain a floating-point encoded value corresponding to each variable; combining the floating-point encoded values ​​to obtain a logical vector corresponding to each variable group to construct a set of logical vectors; matching the set of data retrieval rules with the set of logical vectors to construct a hash table of data retrieval results; and using the hash table of data retrieval results to obtain the test results of the program under test. This method can uniformly obtain the test results of different programs in a data system and store the test results in an iterable data structure, thereby improving the timeliness of data testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a data testing method, apparatus, electronic device and storage medium based on artificial intelligence. Background Technology

[0002] Most data application products on the market today feature various types of data display. The amount of data that data applications need to display is usually very large, with hundreds or thousands of data dimensions. Since the displayed data is usually screened and output by the data retrieval logic in the database, testing the data retrieval logic of the data application is very important.

[0003] The current method for testing data retrieval logic is to run the corresponding program for each program under test sequentially to obtain its test results. However, as the number of programs under test increases, the data testing process becomes more cumbersome, resulting in low efficiency in data testing. Summary of the Invention

[0004] In view of the above, it is necessary to provide an artificial intelligence-based data testing method and related equipment to solve the technical problem of how to improve the efficiency of data testing. The related equipment includes an artificial intelligence-based data testing device, electronic equipment, and storage media.

[0005] This application provides a data testing method based on artificial intelligence, the method comprising:

[0006] Retrieve a set of program attributes from the database, the set of program attributes including output attributes, table attributes, business attributes, and time attributes;

[0007] The value character of each attribute in the program attribute set is used as the variable corresponding to that attribute.

[0008] The variables corresponding to each attribute are combined to obtain multiple variable groups, and the variable groups are arranged row by row and stored as a set of data retrieval rules.

[0009] Encode each variable in the set of data retrieval rules to obtain the floating-point code value corresponding to each variable;

[0010] The floating-point code values ​​are combined according to the variable arrangement order of each variable group in the set of data retrieval rules to obtain the logical vector corresponding to each variable group, and the logical vectors are arranged row by row to construct a logical vector set;

[0011] The set of data retrieval rules is matched with the set of logical vectors to construct a hash table of data retrieval results;

[0012] The test results of the program to be tested are obtained using the hash table of the data retrieval results.

[0013] The aforementioned AI-based data testing method obtains a set of data retrieval rules by constructing a database, encodes the set of rules to obtain a logical vector corresponding to each rule, runs the data retrieval rule corresponding to each logical vector, and constructs a hash table of data retrieval results. The key-value pairs in this hash table encompass all test results of all programs in the database, and the data retrieval results can be quickly retrieved by calculating the similarity between the key (logical vector) in the hash table and the program under test. Compared with the current method of running each program under test to obtain test results, the method described in this solution is more efficient.

[0014] In some embodiments, the step of using the value character of each attribute in the program attribute set as the variable corresponding to that attribute includes:

[0015] The output variable is defined based on the value character of the output attribute;

[0016] Enumerate the possible values ​​of the table attributes and define concatenation variables based on the possible values ​​of the table attributes;

[0017] Use the names of all fields in the database as the value characters for the business attributes, and define business variables based on the value characters of the business attributes;

[0018] The value character of the time attribute is determined based on the type of the time attribute, and the time variable is defined according to the value character of the time attribute.

[0019] In this way, by analyzing the function and meaning of each attribute in the program, the corresponding variables and value characters for each attribute are defined, which enables the program to be formatted, facilitates the subsequent construction of a set of data retrieval rules, and thus improves the efficiency of data testing.

[0020] In some embodiments, encoding each variable in the set of data retrieval rules to obtain the floating-point encoded value corresponding to each variable includes:

[0021] Each column in the set of number selection rules is labeled sequentially according to the natural numbers, and the natural number corresponding to each column is used as the column code value for all variables in that column;

[0022] Count the number of values ​​for each column variable in the set of data retrieval rules, and match each integer from 1 to the number of values ​​to each value character in the column variable to obtain the row code value of all variables in each column;

[0023] The column code value and the row code value are combined to obtain the floating-point code value corresponding to each variable in the data retrieval rule set. The units digit of the floating-point code value is the column code value, and the decimal place of the floating-point code value is the row code value.

[0024] In this way, by encoding the row and column of each variable, the column code value and row code value corresponding to each variable are obtained, and the column code value and row code value are combined into a floating-point code value, thereby ensuring the uniqueness of the code value corresponding to each variable. This facilitates the subsequent construction of a hash table of data retrieval results. Furthermore, using floating-point code values ​​to represent each variable can effectively reduce the units to improve the calculation speed, thereby improving the efficiency of data testing.

[0025] In some embodiments, matching the set of data retrieval rules with the set of logical vectors to construct a test result hash table includes:

[0026] Match the set of data retrieval rules and the set of logical vectors, and use all the matched data retrieval rules as a program sequence;

[0027] Run the program sequence to obtain the data retrieval results;

[0028] The data retrieval results are matched with the logical vector set, and all the matched key-value pairs are used as a hash table of the data retrieval results.

[0029] In this way, multiple data retrieval rules are obtained by matching the one-to-one correspondence between variable groups and logical vectors. Then, a program is generated based on the data retrieval rules and the data retrieval results are obtained. The data retrieval results are matched one-to-one with the logical vectors and combined to obtain a data retrieval result hash table. The key-value pairs in the data retrieval result hash table are unique, which can ensure that the data test results can be queried efficiently and accurately in the future, thereby improving the efficiency of data testing.

[0030] In some embodiments, the matching of the set of data retrieval rules and the set of logical vectors, and the determination of all matched data retrieval rules as a program sequence, includes:

[0031] Match each logical vector in the set of logical vectors with the set of data retrieval rules, and use the matched data retrieval rules as the target keywords;

[0032] The target keywords are combined to construct a program sequence.

[0033] In this way, a program sequence is generated through the one-to-one correspondence between logical vectors and data retrieval rules, which can ensure the uniqueness of key-value pairs in the hash table of subsequent data retrieval results, thereby improving the efficiency of data testing.

[0034] In some embodiments, obtaining the test results of the program under test using the data retrieval result hash table includes:

[0035] Encode multiple program attributes of the program under test to obtain the encoded value corresponding to each program attribute of the program under test and combine them into a logic vector to be tested;

[0036] Calculate the similarity between the vector to be tested and each logical vector in the set of logical vectors, and take the logical vector corresponding to the maximum value of the similarity as the target logical vector;

[0037] The test results of the program to be tested are obtained by comparing the target logic vector with the test result hash table.

[0038] In this way, a similarity set is obtained by calculating the similarity between the test vector corresponding to the program under test and each vector in the logical vector set. The target logical vector is found based on the maximum value in the similarity set to obtain the test result. The test result can be obtained by simply calculating the similarity without running the program under test. This allows multiple test tasks to be processed in parallel, thus improving test efficiency.

[0039] In some embodiments, after comparing the target logic vector with the test result hash table to obtain the test result of the program under test, the method further includes:

[0040] The ratio of the maximum value in the similarity score to a preset first threshold is calculated as the confidence level of the result.

[0041] If the confidence level of the result is greater than a preset second threshold, the test result is pushed to the developers;

[0042] If the confidence level of the result is not greater than a preset second threshold, the developers are notified to conduct multiple tests.

[0043] Thus, the confidence level of the test result can be calculated based on the maximum value of the similarity. The confidence level is used to characterize the degree to which the test result can be trusted, which can ensure and improve the accuracy of the test result. Comparing the confidence level with the second threshold for post-processing decision-making can improve the fault tolerance of data testing.

[0044] This application embodiment also provides a data testing device based on artificial intelligence, the device comprising:

[0045] The acquisition unit is used to acquire a set of program attributes from the database, the set of program attributes including output attributes, table attributes, business attributes and time attributes;

[0046] The statistical unit is used to take the value character of each attribute in the program attribute set as the variable corresponding to that attribute.

[0047] The combination unit is used to combine the variables corresponding to each attribute to obtain multiple variable groups, and then store the variable groups in a row as a set of data retrieval rules.

[0048] The encoding unit is used to encode each variable in the set of data retrieval rules to obtain the floating-point encoded value corresponding to each variable;

[0049] The arrangement unit is used to combine the floating-point code values ​​according to the variable arrangement order of each variable group in the set of data retrieval rules to obtain the logical vector corresponding to each variable group, and arrange the logical vectors row by row to construct a logical vector set;

[0050] A matching unit is used to match the set of data retrieval rules with the set of logical vectors to construct a hash table of data retrieval results;

[0051] The comparison unit is used to obtain the test results of the program to be tested using the hash table of the data retrieval results.

[0052] This application embodiment also provides an electronic device, the device comprising:

[0053] Memory, which stores computer-readable instructions; and

[0054] The processor executes computer-readable instructions stored in the memory to implement the artificial intelligence-based data testing method.

[0055] This application also provides a computer-readable storage medium storing computer-readable instructions, which are executed by a processor in an electronic device to implement the artificial intelligence-based data testing method. Attached Figure Description

[0056] Figure 1 This is a flowchart of a preferred embodiment of an artificial intelligence-based data testing method involved in this application.

[0057] Figure 2 This is a flowchart of a preferred embodiment of the method for obtaining test results of a program under test using the hash table of the data retrieval results involved in this application.

[0058] Figure 3 This is a functional block diagram of a preferred embodiment of the artificial intelligence-based data testing device involved in this application.

[0059] Figure 4 This is a schematic diagram of the structure of an electronic device according to a preferred embodiment of the artificial intelligence-based data testing method involved in this application.

[0060] Figure 5 This is a schematic diagram of the set of data retrieval rules involved in the embodiments of this application.

[0061] Figure 6 This is a schematic diagram of the set of logical vectors involved in the embodiments of this application.

[0062] Figure 7 This is a schematic diagram of the hash table for data retrieval results involved in the embodiments of this application. Detailed Implementation

[0063] To better understand the purpose, features, and advantages of this application, a detailed description of the application is provided below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of this application can be combined with each other. Numerous specific details are set forth in the following description to provide a thorough understanding of this application; the described embodiments are only a part of the embodiments of this application, and not all of them.

[0064] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

[0065] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0066] This application provides an artificial intelligence-based data testing method that can be applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0067] The electronic device can be any electronic product that can interact with the user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), game console, interactive network television (IPTV), smart wearable device, etc.

[0068] The electronic device may also include network devices and / or user devices. The network devices include, but are not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.

[0069] The networks in which the electronic devices are located include, but are not limited to, the Internet, wide area networks, metropolitan area networks, local area networks, and virtual private networks (VPNs).

[0070] like Figure 1 The diagram shown is a flowchart of a preferred embodiment of the data testing method based on artificial intelligence according to this application. The order of the steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements.

[0071] S10, retrieve the program attribute set from the database, the program attribute set including output attributes, table attributes, business attributes and time attributes.

[0072] In this optional embodiment, the database is a collection of data designed, stored and managed according to a data structure, and the preset database may be a MySQL database.

[0073] In this optional embodiment, the program in the database can be analyzed to obtain the program's attribute set, and the attribute set can be used as the program attribute set.

[0074] In this optional embodiment, the database program can be a preset SQL script, which can be in the form of "select 'data' from 'table' where 'condition' and 'time'", where data represents the name of the data output after running the SQL script, table represents the data table called by the SQL script, condition represents the screening condition that the output data should meet, and time represents the time condition that the output data should meet. The function of the preset SQL script is to filter out data that meets the screening condition and time condition from the table.

[0075] For example, when the preset SQL script is in the form of "select price from table_seal where item = 1 and to_days(date) = to_days(now())", the output data of the SQL statement is defined as "price"; the name of the data table called by the SQL statement is "table_seal"; the screening condition of the SQL statement is "item = 1", which means that the item field value of the output data is 1; the time condition of the SQL statement is "to_days(date) = to_days(now())", which means that the time attribute of the output data is the current date.

[0076] In this optional embodiment, the information represented by the data can be defined as an output attribute, the information represented by the table can be named a table attribute, the information represented by the condition can be named a business attribute, and the information represented by the time can be named a time attribute.

[0077] In this optional embodiment, the output attributes, table attributes, business attributes, and time attributes can be used as the set of program attributes.

[0078] In this way, by analyzing the function and meaning of each key piece of information in the program, the corresponding attribute is defined for each key piece of information. The method can formulate SQL statements, which facilitates the subsequent statistical analysis of the variables of each attribute, thereby improving the efficiency of data testing.

[0079] S11, each attribute in the program attribute set is used as a variable corresponding to that attribute, based on the value character of that attribute.

[0080] In this optional embodiment, the step of using the value character of each attribute in the program attribute set as the variable corresponding to that attribute includes:

[0081] S111, Define output variables based on the value characters of the output attributes;

[0082] S112, enumerate the value characters of the table attribute, and define concatenation variables based on the value characters of the table attribute;

[0083] S113, use the names of all fields in the database as the value characters of the business attribute, and define business variables based on the value characters of the business attribute;

[0084] S114, determine the value character of the time attribute based on the type of the time attribute, and define a time variable according to the value character of the time attribute.

[0085] In this optional embodiment, the value characters of the output attribute can be specified based on the output attribute. Since the function of the output attribute is to define the name of the program output data, and the result obtained by running the program does not depend on the output attribute, the value characters of the output attribute can be any character. The output variable 'a' can be defined based on the value characters of the output attribute, and the value of the output variable 'a' can be any character.

[0086] In this optional embodiment, the possible values ​​of the table attributes can be enumerated based on the concatenation methods of the tables in the database. The concatenation methods of the tables in the database include single table, outer join, inner join, full join, left join, and right join. Therefore, the possible values ​​of the table attributes include "single table", "outer join", "inner join", "full join", "left join", and "right join". Furthermore, a concatenation variable can be set based on the possible values ​​of the table attributes. This concatenation variable can be denoted as b, and b represents six possible values, including "single table", "outer join", "inner join", "full join", "left join", and "right join".

[0087] In this optional embodiment, the names of all fields in all tables of the database can be counted as the value characters for the business attribute. The meaning of each field is the name of each column in the data table. For example, the number of all fields can be denoted as n, therefore the number of value characters for the business attribute can also be n. The value characters of the business attribute can be used as business variables, then the business variable c has n possible values, and its value range includes the names of all fields in all tables.

[0088] In this optional embodiment, the time attribute can be categorized to set its value characters. The time attribute of the program can include point-in-time information and time period information. For example, when the value of the time attribute is “to_days(date)=to_days(now())”, the time attribute is a point-in-time; when the value of the time attribute is “datebetween'date1'and'date2'”, the time attribute is a time period. The value characters of the time attribute can be defined based on its type. The value characters of the time attribute include “=” and “between”, which correspond to the point-in-time type and the time period type of the time attribute, respectively. Further, the time variable d can be defined based on the type of the time attribute. The time variable d has two values, including “=” and “between”, which correspond to the “point-in-time” category and the “time period” category of the time attribute, respectively.

[0089] In this way, by analyzing the function and meaning of each attribute in the program, the corresponding variables and value characters for each attribute are defined, which enables the program to be formatted, facilitates the subsequent construction of a set of data retrieval rules, and thus improves the efficiency of data testing.

[0090] S12, combine the variables corresponding to each attribute to obtain multiple variable groups, and store the variable groups in a row as a set of data retrieval rules.

[0091] In this optional embodiment, the values ​​of variables a, b, c, and d can be combined to generate multiple variable groups. The combination method is to perform cross-combination based on the value of each variable to obtain m variable groups, where each variable group can be used as a data point, and m is the product of the number of values ​​of each variable.

[0092] In this optional embodiment, since the value of the output variable does not affect the running result of the program, the value of the output variable can be any character. Therefore, the value of the output variable can be defined as "any", and the number of values ​​of the output variable can be defined as 1.

[0093] For example, m = 1 × 6 × n × 2 = 12n, and each piece of data includes four attributes, thus obtaining a dataset with 12n rows and 4 columns, denoted as Data.

[0094] In this optional embodiment, the Data can be used as the set of data retrieval rules. Figure 5 This is a schematic diagram of the set of data retrieval rules.

[0095] In this way, multiple variable groups are obtained by cross-combining the values ​​of the variables, and a set of data retrieval rules is obtained by uniformly storing multiple variable groups. This set of data retrieval rules encompasses the key information of the program in the database, which can provide data support for the subsequent construction of a hash table of data retrieval results, thereby improving the efficiency of data testing.

[0096] S13, Encode each variable in the set of data retrieval rules to obtain the floating-point code value corresponding to each variable.

[0097] In this optional embodiment, encoding each variable in the set of data retrieval rules to obtain the floating-point encoded value corresponding to each variable includes:

[0098] S131, each column in the set of number selection rules is marked sequentially according to the natural number, and the natural number corresponding to each column is used as the column code value of all variables in that column;

[0099] S132, count the number of values ​​of each column variable in the set of data retrieval rules, match each integer between the integer 1 and the number of values ​​to each value character in the column variable, and obtain the row code value of all variables in each column;

[0100] S133, combine the column code value and the row code value to obtain the floating-point code value corresponding to each variable in the data retrieval rule set, wherein the units digit of the floating-point code value is the column code value, and the decimal place of the floating-point code value is the row code value.

[0101] In this optional embodiment, each column in the set of data retrieval rules can be sequentially labeled according to natural numbers. For example, the column containing the output variable a can be labeled as 1, the column containing the concatenated variable b as 2, the column containing the business variable c as 3, and the column containing the time variable d as 4. Then, the column code value for all values ​​of the output variable a is 1, the column code value for all values ​​of the concatenated variable b is 2, the column code value for all values ​​of the business variable c is 3, and the column code value for all values ​​of the time variable d is 4.

[0102] In this optional embodiment, the number of values ​​for each variable in the set of data retrieval rules can be counted. For example, in this scheme, the number of values ​​for output variable a is 1, the number of values ​​for concatenated variable b is 6, the number of values ​​for business variable c is n, and the number of values ​​for time variable d is 2. The row code value for all values ​​in the output variable a is 1; the row code value for all values ​​in the concatenated variable b includes integers between 1 and 6. For example, when the concatenated variable is "single table", the row code value can be 1; when the concatenated variable is "outer join", the row code value can be 2; when the concatenated variable is "inner join", the row code value can be 3; when the concatenated variable is "full join", the row code value can be 4; when the concatenated variable is "left join", the row code value can be 5; when the concatenated variable is "right join", the row code value can be 6; the row code value for all values ​​in the business variable c includes integers between 1 and n; and the row code value for all values ​​in the time variable d includes 1 and 2.

[0103] In this optional embodiment, the column code value and the row code value can be combined to obtain the floating-point code value of all variables in the data retrieval rule dataset. The combination method is to use the column code value as the units digit of the floating-point code value and the row code value as the decimal place of the floating-point code value. For example, when the concatenated variable is a "single table", the code value of the concatenated variable is 2.1; when the business variable is "field 1", the code value of the business variable can be 3.1; when the time variable is a "point in time", the code value of the time variable can be 4.1.

[0104] In this way, by encoding the row and column of each variable, the column code value and row code value corresponding to each variable are obtained, and the column code value and row code value are combined into a floating-point code value, thereby ensuring the uniqueness of the code value corresponding to each variable. This facilitates the subsequent construction of a hash table of data retrieval results. Furthermore, using floating-point code values ​​to represent each variable can effectively reduce the units to improve the calculation speed, thereby improving the efficiency of data testing.

[0105] S14, combine the floating-point code values ​​according to the variable arrangement order of each variable group in the data retrieval rule set to obtain the logical vector corresponding to each variable group, and arrange the logical vectors row by row to construct a logical vector set.

[0106] In this optional embodiment, the variable arrangement order of each variable group in the data retrieval rule set is "output variable", "concatenation variable", "business variable" and "time variable". The floating-point code values ​​can be combined according to the variable arrangement order to obtain the logical vector corresponding to each variable group.

[0107] For example, when the variable group takes the values ​​"any", "single table", "field 1", and "time point", the corresponding logical vector for the variable group is [1, 2.1, 3.1, 4.1].

[0108] In this optional embodiment, the logical vectors corresponding to each variable group can be arranged row by row and stored to construct a logical vector set, such as... Figure 6 The diagram shown is a schematic of the logical vector set.

[0109] In this way, by combining the floating-point encoded values, the logical vector corresponding to each variable group is obtained, and the logical vectors are arranged and stored row by row to obtain a logical vector set. This can convert the variable values ​​in character form into numerical values, and the converted numerical values ​​are unique, thereby improving the accuracy of subsequent data testing.

[0110] S15, Match the set of data retrieval rules with the set of logical vectors to construct a hash table of data retrieval results.

[0111] In this optional embodiment, matching the set of data retrieval rules with the set of logical vectors to construct a hash table of data retrieval results includes:

[0112] S151, match the set of data retrieval rules and the set of logical vectors, and take all the matched data retrieval rules as a program sequence;

[0113] S152, Run the program sequence to obtain the data acquisition result;

[0114] S153, match the data retrieval result with the logical vector set, and use all the matched key-value pairs as a hash table of the data retrieval result.

[0115] In this optional embodiment, the matching of the data retrieval rule set and the logical vector set, and the use of all matched data retrieval rules as a program sequence, includes:

[0116] Match each logical vector in the set of logical vectors with the set of data retrieval rules, and use the matched data retrieval rules as the target keywords;

[0117] The target keywords are combined to construct a program sequence.

[0118] In this optional embodiment, each logical vector in the logical vector set has a one-to-one correspondence with the data retrieval rule in each row of the data retrieval rule set. The logical vector set can be traversed sequentially to obtain each logical vector, and the data retrieval rule corresponding to each logical vector can be found in the data retrieval rule set as the target keyword.

[0119] For example, when the logical vector traversed is [1,2.4,3.3,4.1], the target keywords are "any", "fully connected", "field 3", and "time point".

[0120] In this optional embodiment, the target keywords can be combined to form a program sequence. For example, when the target keywords are "any", "full join", "field 3", and "time point", the obtained program is "select any from table_1 UNION table_2 where field 3 = 'value' and date = time point", which means filtering out data from the union of the data tables represented by table_1 and table_2 where the value of field 3 is 'value' and the time attribute is time point.

[0121] In this optional embodiment, the program consisting of each program sequence can be run to obtain the running result of the program. If the running result does not report an error, the result is 1; if the running result reports an error, the result is 0.

[0122] For example, when the program "select any from table_1 UNION table_2 where field3 = 'value' and date = time point" is run, if the program does not report an error, the result will be 1; if the program reports an error, the result will be 0.

[0123] In this optional embodiment, the data retrieval result can be used as the "value" and its corresponding logical vector as the "key" to form multiple key-value pairs. Further, the key-value pairs can be arranged row by row to obtain a hash table of the data retrieval result, such as... Figure 7 The diagram shown is a schematic of the hash table of the data retrieval results.

[0124] In this way, multiple data retrieval rules are obtained by matching the one-to-one correspondence between variable groups and logical vectors. Then, a program is generated based on the data retrieval rules and the data retrieval results are obtained. The data retrieval results are matched one-to-one with the logical vectors and combined to obtain a data retrieval result hash table. The key-value pairs in the data retrieval result hash table are unique, which can ensure that the data test results can be queried efficiently and accurately in the future, thereby improving the efficiency of data testing.

[0125] S16, use the hash table of the data retrieval results to obtain the test results of the program to be tested.

[0126] like Figure 2 As shown, obtaining the test results of the program under test using the hash table of the data retrieval results includes:

[0127] S161, Encode multiple program attributes of the program to be tested to obtain the encoded value corresponding to each program attribute of the program to be tested and combine them into a logic vector to be tested;

[0128] S162, calculate the similarity between the logic vector to be tested and each logic vector in the set of logic vectors, and take the logic vector corresponding to the maximum value of the similarity as the target logic vector of the logic vector to be tested;

[0129] S163, compare the target logic vector with the test result hash table to obtain the test result of the program to be tested.

[0130] In this optional embodiment, the preset program to be tested can be an SQL script to be tested, which can be in the form of "selectdata test fromtable test wherecondition test andtime test ", where data test The table represents the output attributes of the program under test. testThe table attribute representing the program under test, condition test Represents the business attributes of the program under test, time test This represents the time attribute of the program under test. The variables corresponding to the four attributes of the program under test can be encoded using the encoding method described in step S13 to obtain the floating-point encoded value corresponding to each attribute in the program under test. These floating-point encoded values ​​are then combined sequentially to obtain the logic vector to be tested, denoted as Vec. test .

[0131] In this optional embodiment, the similarity between the logic vector to be tested and each logic vector in the set of logic vectors can be calculated using a cosine similarity algorithm. The specific calculation method is as follows:

[0132]

[0133] Among them, S j The cosine similarity between the test logic vector corresponding to the program under test and the j-th logic vector in the set of logic vectors is used to characterize the similarity between the program under test and a certain logic vector in the set of logic vectors; A represents the test logic vector Vec corresponding to the program under test. test B represents a logical vector in the set of logical vectors; i represents the index of the dimension of the logical vector and i∈[1,4]; j represents the index of the code vector in the set of logical vectors and j∈[1,12]; z represents the dimension of the logical vector, and z=4 in this scheme.

[0134] For example, when A = [1, 2.1, 3.1, 4.1] and B j When S = [1, 2.1, 3.2, 4.1], the S j The calculation method is as follows:

[0135]

[0136] Then when A = [1, 2.1, 3.1, 4.1] and B j When the value is [1, 2.1, 3.2, 4.1], the similarity between the test logic vector of the test program represented by A and the j-th logic vector in the set of logic vectors represented by B is 0.9.

[0137] In this optional embodiment, the Vec can be calculated based on the cosine similarity algorithm. test The similarity to each key (logical vector) in the hash table of the data retrieval results is calculated to obtain a similarity set S, which contains 12n values. The largest similarity in S is selected and the logical vector corresponding to that similarity is used as the target logical vector of the logical vector to be tested.

[0138] In this optional embodiment, the value (data retrieval result) corresponding to the data retrieval result in the hash table of the data retrieval result is used as the test result of the program to be tested and recorded as Test. result The test results include 0 and 1. If the test result is 0, it means that the program under test has failed the test. If the test result is 1, it means that the program under test has passed the test.

[0139] In this optional embodiment, the ratio of the maximum value of the similarity to a preset first threshold can be calculated as the result confidence level. In this scheme, the maximum value of the similarity is denoted as S. max For example, the preset first threshold can be 1, when the S max When the confidence level is 0.9, the confidence level of the result is calculated as follows:

[0140]

[0141] Wherein, Con represents the confidence level of the result, which characterizes the degree to which the test result can be believed; S max This represents the maximum value among the similarities.

[0142] In this optional embodiment, the second threshold can be 0.8. If the confidence level of the result is greater than the second threshold, it means that the test result can be trusted to a high degree, so the test result can be pushed to the developers. If the confidence level of the result is not greater than the second threshold, it means that the test result can be trusted to a low degree, so the developers can be notified to conduct multiple tests to avoid large errors in the test results.

[0143] In this optional embodiment, the Test can be... result As the test result stated.

[0144] Thus, the confidence level of the test result can be calculated based on the maximum value of the similarity. The confidence level is used to characterize the degree to which the test result can be trusted, which can ensure and improve the accuracy of the test result. Comparing the confidence level with the second threshold for post-processing decision-making can improve the fault tolerance of data testing.

[0145] The aforementioned AI-based data testing method obtains a set of data retrieval rules by analyzing all programs in the database, encodes the set of rules to obtain a logical vector corresponding to each rule, runs the data retrieval rule corresponding to each logical vector, and constructs a hash table of data retrieval results. The key-value pairs in this hash table encompass all test results of all programs in the database, and the data retrieval results can be quickly retrieved by calculating the similarity between the key (logical vector) in the hash table and the program under test. Compared to the current method of running each program under test to obtain test results, the method described in this solution is more efficient.

[0146] like Figure 3 The diagram shown is a functional block diagram of a preferred embodiment of the artificial intelligence-based data testing device provided in this application. The artificial intelligence-based data testing device 11 includes an acquisition unit 110, a statistics unit 111, a combination unit 112, an encoding unit 113, an arrangement unit 114, a matching unit 115, and a comparison unit 116. The module / unit referred to in this application refers to a series of computer program segments that can be executed by the processor 13 and perform a fixed function, and are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0147] In an optional embodiment, the acquisition unit 110 is used to acquire a set of program attributes from a database, the set of program attributes including output attributes, table attributes, business attributes and time attributes.

[0148] In this optional embodiment, the database is a collection of data designed, stored and managed according to a data structure, and the preset database may be a MySQL database.

[0149] In this optional embodiment, the programs in the database can be analyzed to obtain a set of program attributes, and the set of attributes can be used as a set of program attributes.

[0150] In this optional embodiment, the database program can be a preset SQL script, which can be in the form of "select 'data' from 'table' where 'condition' and 'time'", where data represents the name of the data output after running the SQL script, table represents the data table called by the SQL script, condition represents the screening condition that the output data should meet, and time represents the time condition that the output data should meet. The function of the preset SQL script is to filter out data that meets the screening condition and time condition from the table.

[0151] For example, when the preset SQL script is in the form of "select price from table_seal where item = 1 and to_days(date) = to_days(now())", the output data of the SQL statement is defined as "price"; the name of the data table called by the SQL statement is "table_seal"; the screening condition of the SQL statement is "item = 1", which means that the item field value of the output data is 1; the time condition of the SQL statement is "to_days(date) = to_days(now())", which means that the time attribute of the output data is the current date.

[0152] In this optional embodiment, the information represented by the data can be defined as an output attribute, the information represented by the table can be named a table attribute, the information represented by the condition can be named a business attribute, and the information represented by the time can be named a time attribute.

[0153] In this optional embodiment, the output attributes, table attributes, business attributes, and time attributes can be used as the set of program attributes.

[0154] In an optional embodiment, the statistics unit 111 is used to use the value character of each attribute in the program attribute set as the variable corresponding to that attribute.

[0155] In this optional embodiment, the variable corresponding to each attribute is determined based on the value character of each attribute in the program attribute set:

[0156] The output variable is defined based on the value character of the output attribute;

[0157] Enumerate the possible values ​​of the table attributes and define concatenation variables based on the possible values ​​of the table attributes;

[0158] Use the names of all fields in the database as the value characters for the business attributes, and define business variables based on the value characters of the business attributes;

[0159] The value character of the time attribute is determined based on the type of the time attribute, and the time variable is defined according to the value character of the time attribute.

[0160] In this optional embodiment, the value characters of the output attribute can be specified based on the output attribute. Since the function of the output attribute is to define the name of the program output data, and the result obtained by running the program does not depend on the output attribute, the value characters of the output attribute can be any character. The output variable 'a' can be defined based on the value characters of the output attribute, and the value of the output variable 'a' can be any character.

[0161] In this optional embodiment, the possible values ​​of the table attributes can be enumerated based on the concatenation methods of the tables in the database. The concatenation methods of the tables in the database include single table, outer join, inner join, full join, left join, and right join. Therefore, the possible values ​​of the table attributes include "single table", "outer join", "inner join", "full join", "left join", and "right join". Furthermore, a concatenation variable can be set based on the possible values ​​of the table attributes. This concatenation variable can be denoted as b, and b represents six possible values, including "single table", "outer join", "inner join", "full join", "left join", and "right join".

[0162] In this optional embodiment, the names of all fields in all tables of the database can be counted as the value characters for the business attribute. The meaning of each field is the name of each column in the data table. For example, the number of all fields can be denoted as n, therefore the number of value characters for the business attribute can also be n. The value characters of the business attribute can be used as business variables, then the business variable c has n possible values, and its value range includes the names of all fields in all tables.

[0163] In this optional embodiment, the time attribute can be categorized to set its value characters. The time attribute of the program can include point-in-time information and time period information. For example, when the value of the time attribute is “to_days(date)=to_days(now())”, the time attribute is a point-in-time; when the value of the time attribute is “datebetween'date1'and'date2'”, the time attribute is a time period. The value characters of the time attribute can be defined based on its type. The value characters of the time attribute include “=” and “between”, which correspond to the point-in-time type and the time period type of the time attribute, respectively. Further, the time variable d can be defined based on the type of the time attribute. The time variable d has two values, including “=” and “between”, which correspond to the “point-in-time” category and the “time period” category of the time attribute, respectively.

[0164] In an optional embodiment, the combination unit 112 is used to combine the variables corresponding to each attribute to obtain multiple variable groups, and then store the variable groups in a row as a set of data retrieval rules.

[0165] In this optional embodiment, the values ​​of variables a, b, c, and d can be combined to generate multiple variable groups. The combination method is to perform cross-combination based on the value of each variable to obtain m variable groups, where each variable group can be used as a data point, and m is the product of the number of values ​​of each variable.

[0166] In this optional embodiment, since the value of the output variable does not affect the running result of the program, the value of the output variable can be any character. Therefore, the value of the output variable can be defined as "any", and the number of values ​​of the output variable can be defined as 1.

[0167] For example, m = 1 × 6 × n × 2 = 12n, and each piece of data includes four attributes, thus obtaining a dataset with 12n rows and 4 columns, denoted as Data.

[0168] In this optional embodiment, the Data can be used as the set of data retrieval rules. Figure 5 This is a schematic diagram of the set of data retrieval rules.

[0169] In an optional embodiment, the encoding unit 113 is used to encode each variable in the set of data retrieval rules to obtain the floating-point encoded value corresponding to each variable.

[0170] In this optional embodiment, encoding each variable in the set of data retrieval rules to obtain the floating-point encoded value corresponding to each variable includes:

[0171] Each column in the set of number selection rules is labeled sequentially according to the natural numbers, and the natural number corresponding to each column is used as the column code value for all variables in that column;

[0172] Count the number of values ​​for each column variable in the set of data retrieval rules, and match each integer from 1 to the number of values ​​to each value character in the column variable to obtain the row code value of all variables in each column;

[0173] The column code value and the row code value are combined to obtain the floating-point code value corresponding to each variable in the data retrieval rule set. The units digit of the floating-point code value is the column code value, and the decimal place of the floating-point code value is the row code value.

[0174] In this optional embodiment, each column in the set of data retrieval rules can be sequentially labeled according to natural numbers. For example, the column containing the output variable a can be labeled as 1, the column containing the concatenated variable b as 2, the column containing the business variable c as 3, and the column containing the time variable d as 4. Then, the column code value for all values ​​of the output variable a is 1, the column code value for all values ​​of the concatenated variable b is 2, the column code value for all values ​​of the business variable c is 3, and the column code value for all values ​​of the time variable d is 4.

[0175] In this optional embodiment, the number of values ​​for each variable in the set of data retrieval rules can be counted. For example, in this scheme, the number of values ​​for output variable a is 1, the number of values ​​for concatenated variable b is 6, the number of values ​​for business variable c is n, and the number of values ​​for time variable d is 2. The row code value for all values ​​in the output variable a is 1; the row code value for all values ​​in the concatenated variable b includes integers between 1 and 6. For example, when the concatenated variable is "single table", the row code value can be 1; when the concatenated variable is "outer join", the row code value can be 2; when the concatenated variable is "inner join", the row code value can be 3; when the concatenated variable is "full join", the row code value can be 4; when the concatenated variable is "left join", the row code value can be 5; when the concatenated variable is "right join", the row code value can be 6; the row code value for all values ​​in the business variable c includes integers between 1 and n; and the row code value for all values ​​in the time variable d includes 1 and 2.

[0176] In this optional embodiment, the column code value and the row code value can be combined to obtain the floating-point code value of all variables in the data retrieval rule dataset. The combination method is to use the column code value as the units digit of the floating-point code value and the row code value as the decimal place of the floating-point code value. For example, when the concatenated variable is a "single table", the code value of the concatenated variable is 2.1; when the business variable is "field 1", the code value of the business variable can be 3.1; when the time variable is a "point in time", the code value of the time variable can be 4.1.

[0177] In an optional embodiment, the arrangement unit 114 is used to combine the floating-point code values ​​according to the variable arrangement order of each variable group in the data retrieval rule set to obtain the logical vector corresponding to each variable group, and arrange the logical vectors row by row to construct a logical vector set.

[0178] In this optional embodiment, the variable arrangement order of each variable group in the data retrieval rule set is "output variable", "concatenation variable", "business variable" and "time variable". The floating-point code values ​​can be combined according to the variable arrangement order to obtain the logical vector corresponding to each variable group.

[0179] For example, when the variable group takes the values ​​"any", "single table", "field 1", and "time point", the corresponding logical vector for the variable group is [1, 2.1, 3.1, 4.1].

[0180] In this optional embodiment, the logical vectors corresponding to each variable group can be arranged row by row and stored to construct a logical vector set, such as... Figure 6 The diagram shown is a schematic of the logical vector set.

[0181] In an optional embodiment, the matching unit 115 is used to match the set of data retrieval rules with the set of logical vectors to construct a hash table of data retrieval results.

[0182] In this optional embodiment, matching the set of data retrieval rules with the set of logical vectors to construct a hash table of data retrieval results includes:

[0183] Match the set of data retrieval rules and the set of logical vectors, and use all the matched data retrieval rules as a program sequence;

[0184] Run the program sequence to obtain the data retrieval results;

[0185] The data retrieval results are matched with the logical vector set, and all the matched key-value pairs are used as a hash table of the data retrieval results.

[0186] In this optional embodiment, the matching of the data retrieval rule set and the logical vector set, and the use of all matched data retrieval rules as a program sequence, includes:

[0187] Match each logical vector in the set of logical vectors with the set of data retrieval rules, and use the matched data retrieval rules as the target keywords;

[0188] The target keywords are combined to construct a program sequence.

[0189] In this optional embodiment, each logical vector in the logical vector set has a one-to-one correspondence with the data retrieval rule in each row of the data retrieval rule set. The logical vector set can be traversed sequentially to obtain each logical vector, and the data retrieval rule corresponding to each logical vector can be found in the data retrieval rule set as the target keyword.

[0190] For example, when the logical vector traversed is [1,2.4,3.3,4.1], the target keywords are "any", "fully connected", "field 3", and "time point".

[0191] In this optional embodiment, the target keywords can be combined to form a program sequence. For example, when the target keywords are "any", "full join", "field 3", and "time point", the obtained program is "select any from table_1 UNION table_2 where field 3 = 'value' and date = time point", which means filtering out data from the union of the data tables represented by table_1 and table_2 where the value of field 3 is 'value' and the time attribute is time point.

[0192] In this optional embodiment, the program consisting of each program sequence can be run to obtain the running result of the program. If the running result does not report an error, the result is 1; if the running result reports an error, the result is 0.

[0193] For example, when the program "select any from table_1 UNION table_2 where field3 = 'value' and date = time point" is run, if the program does not report an error, the result will be 1; if the program reports an error, the result will be 0.

[0194] In this optional embodiment, the data retrieval result can be used as the "value" and its corresponding logical vector as the "key" to form multiple key-value pairs. Further, the key-value pairs can be arranged row by row to obtain a hash table of the data retrieval result, such as... Figure 7 The diagram shown is a schematic of the hash table of the data retrieval results.

[0195] In an optional embodiment, the comparison unit 116 is used to obtain the test results of the program to be tested using the data retrieval result hash table.

[0196] In this optional embodiment, obtaining the test results of the program under test using the data retrieval result hash table includes:

[0197] Encode multiple program attributes of the program under test to obtain the encoded value corresponding to each program attribute of the program under test and combine them into a logic vector to be tested;

[0198] Calculate the similarity between the vector to be tested and each logical vector in the set of logical vectors, and take the logical vector corresponding to the maximum value of the similarity as the target logical vector;

[0199] The test results of the program to be tested are obtained by comparing the target logic vector with the test result hash table.

[0200] In this optional embodiment, the preset program to be tested can be an SQL script to be tested, which can be in the form of "selectdata test fromtable test wherecondition test andtime test ", where data test The table represents the output attributes of the program under test. test The table attribute representing the program under test, condition test Represents the business attributes of the program under test, time test This represents the time attribute of the program under test. The variables corresponding to the four attributes of the program under test can be encoded using the encoding method described in step S13 to obtain the floating-point encoded value corresponding to each attribute in the program under test. These floating-point encoded values ​​are then combined sequentially to obtain the logic vector to be tested, denoted as Vec. test .

[0201] In this optional embodiment, the similarity between the logic vector to be tested and each logic vector in the set of logic vectors can be calculated using a cosine similarity algorithm. The specific calculation method is as follows:

[0202]

[0203] Among them, S j The cosine similarity between the test logic vector corresponding to the program under test and the j-th logic vector in the set of logic vectors is used to characterize the similarity between the program under test and a certain logic vector in the set of logic vectors; A represents the test logic vector Vec corresponding to the program under test. test B represents a logical vector in the set of logical vectors; i represents the index of the dimension of the logical vector and i∈[1,4]; j represents the index of the code vector in the set of logical vectors and j∈[1,12]; z represents the dimension of the logical vector, and z=4 in this scheme.

[0204] For example, when A = [1, 2.1, 3.1, 4.1] and B j When S = [1, 2.1, 3.2, 4.1], the S j The calculation method is as follows:

[0205]

[0206] Then when A = [1, 2.1, 3.1, 4.1] and B jWhen the value is [1, 2.1, 3.2, 4.1], the similarity between the test logic vector of the test program represented by A and the j-th logic vector in the set of logic vectors represented by B is 0.9.

[0207] In this optional embodiment, the Vec can be calculated based on the cosine similarity algorithm. test The similarity to each key (logical vector) in the hash table of the data retrieval results is calculated to obtain a similarity set S, which contains 12n values. The largest similarity in S is selected and the logical vector corresponding to that similarity is used as the target logical vector of the logical vector to be tested.

[0208] In this optional embodiment, the value (data retrieval result) corresponding to the data retrieval result in the hash table of the data retrieval result is used as the test result of the program to be tested and recorded as Test. result The test results include 0 and 1. If the test result is 0, it means that the program under test has failed the test. If the test result is 1, it means that the program under test has passed the test.

[0209] In this optional embodiment, the ratio of the maximum value of the similarity to a preset first threshold can be calculated as the result confidence level. In this scheme, the maximum value of the similarity is denoted as S. max For example, the preset first threshold can be 1, when the S max When the confidence level is 0.9, the confidence level of the result is calculated as follows:

[0210]

[0211] Wherein, Con represents the confidence level of the result, which characterizes the degree to which the test result can be believed; S max This represents the maximum value among the similarities.

[0212] In this optional embodiment, the second threshold can be 0.8. If the confidence level of the result is greater than the second threshold, it means that the test result can be trusted to a high degree, so the test result can be pushed to the developers. If the confidence level of the result is not greater than the second threshold, it means that the test result can be trusted to a low degree, so the developers can be notified to conduct multiple tests to avoid large errors in the test results.

[0213] In this optional embodiment, the Test can be... result As the test result stated.

[0214] like Figure 4The diagram shown is a structural schematic of an electronic device provided in an embodiment of this application. The electronic device 1 includes a memory 12 and a processor 13. The memory 12 stores computer-readable instructions, and the processor 13 executes the computer-readable instructions stored in the memory to implement the artificial intelligence-based data testing method of any of the above embodiments.

[0215] In an alternative embodiment, the electronic device 1 further includes a bus and a computer program stored in memory 12 and executable on processor 13, such as an artificial intelligence-based data program sequence.

[0216] Figure 4 Only the electronic device 1 with components 12-13 is shown; those skilled in the art will understand that... Figure 4 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0217] Combination Figure 1 The memory 12 in electronic device 1 stores multiple computer-readable instructions to implement an artificial intelligence-based data testing method, and the processor 13 can execute multiple instructions to achieve:

[0218] Retrieve a set of program attributes from the database, the set of program attributes including output attributes, table attributes, business attributes, and time attributes;

[0219] The value character of each attribute in the program attribute set is used as the variable corresponding to that attribute.

[0220] The variables corresponding to each attribute are combined to obtain multiple variable groups, and the variable groups are arranged row by row and stored as a set of data retrieval rules.

[0221] Encode each variable in the set of data retrieval rules to obtain the floating-point code value corresponding to each variable;

[0222] The floating-point code values ​​are combined according to the variable arrangement order of each variable group in the set of data retrieval rules to obtain the logical vector corresponding to each variable group, and the logical vectors are arranged row by row to construct a logical vector set;

[0223] The set of data retrieval rules is matched with the set of logical vectors to construct a hash table of data retrieval results;

[0224] The test results of the program to be tested are obtained using the hash table of the data retrieval results.

[0225] Specifically, the processor 13's implementation method for the above instructions can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.

[0226] Those skilled in the art will understand that the schematic diagram is merely an example of electronic device 1 and does not constitute a limitation on electronic device 1. Electronic device 1 can be either a bus topology or a star topology. Electronic device 1 may also include more or fewer other hardware or software than shown in the diagram, or different component arrangements. For example, electronic device 1 may also include input / output devices, network access devices, etc.

[0227] It should be noted that electronic device 1 is only an example. Other existing or future electronic products that are suitable for this application should also be included within the scope of protection of this application and are incorporated herein by reference.

[0228] The memory 12 includes at least one type of readable storage medium, which can be non-volatile or volatile. The readable storage medium includes flash memory, portable hard drives, multimedia cards, card-type memory (e.g., SD or DX memory), magnetic storage, magnetic disks, optical disks, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a portable hard drive of the electronic device 1. In other embodiments, the memory 12 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, SmartMediaCard (SMC), SecureDigital (SD) card, or FlashCard equipped on the electronic device 1. Furthermore, the memory 12 can include both internal and external storage units of the electronic device 1. The memory 12 can be used not only to store application software and various types of data installed on the electronic device 1, such as code for data program sequences based on artificial intelligence, but also to temporarily store data that has been output or will be output.

[0229] In some embodiments, the processor 13 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 13 is the control unit of the electronic device 1, connecting various components of the electronic device 1 through various interfaces and lines. It executes programs or modules stored in the memory 12 (e.g., executing artificial intelligence-based data program sequences) and calls data stored in the memory 12 to perform various functions and process data in the electronic device 1.

[0230] Processor 13 executes the operating system of electronic device 1 and various installed applications. Processor 13 executes these applications to implement the steps in the various embodiments of the artificial intelligence-based data testing methods described above, for example... Figures 1 to 2 The steps are shown.

[0231] For example, the computer program may be divided into one or more modules / units, which are stored in memory 12 and executed by processor 13 to complete this application. The one or more modules / units may be a series of computer-readable instruction segments capable of performing specific functions, which describe the execution process of the computer program in electronic device 1. For example, the computer program may be divided into an acquisition unit 110, a statistics unit 111, a combination unit 112, an encoding unit 113, a permutation unit 114, a matching unit 115, and a comparison unit 116.

[0232] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, computer equipment, or network device, etc.) or processor to execute portions of the artificial intelligence-based data testing methods described in the various embodiments of this application.

[0233] If the modules / units integrated in electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware devices. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.

[0234] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, and other memory.

[0235] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.

[0236] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0237] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, in... Figure 4 The symbol is represented by only one arrow, but this does not indicate that there is only one bus or one type of bus. The bus is configured to enable communication between the memory 12 and at least one processor 13, etc.

[0238] Although not shown, electronic device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 13 via a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power sources, a recharging device, a power fault detection circuit, a power converter or inverter, a power status indicator, or any other components. Electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.

[0239] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the electronic device 1 and other electronic devices.

[0240] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.

[0241] This application also provides a computer-readable storage medium (not shown), which stores computer-readable instructions that are executed by a processor in an electronic device to implement the artificial intelligence-based data testing method described in any of the above embodiments.

[0242] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.

[0243] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0244] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0245] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0246] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in the specification may also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.

[0247] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of this application without departing from the spirit and scope of the technical solutions of this application.

Claims

1. A data testing method based on artificial intelligence, characterized in that, The method includes: Retrieve a set of program attributes from the database, the set of program attributes including output attributes, table attributes, business attributes, and time attributes; The value character of each attribute in the program attribute set is used as the variable corresponding to that attribute. The variables corresponding to each attribute are combined to obtain multiple variable groups, and the variable groups are arranged row by row and stored as a set of data retrieval rules. Encode each variable in the set of data retrieval rules to obtain the floating-point code value corresponding to each variable; The floating-point code values ​​are combined according to the variable arrangement order of each variable group in the set of data retrieval rules to obtain the logical vector corresponding to each variable group, and the logical vectors are arranged row by row to construct a logical vector set; The process of matching the set of data retrieval rules with the set of logical vectors to construct a hash table of data retrieval results includes: matching the set of data retrieval rules and the set of logical vectors, and using all matched data retrieval rules as a program sequence; running the program sequence to obtain data retrieval results; and matching the data retrieval results with the set of logical vectors, using all matched key-value pairs as a hash table of data retrieval results. Obtaining the test results of the program under test using the hash table of data retrieval results includes: encoding multiple program attributes of the program under test to obtain the encoded value corresponding to each program attribute of the program under test and combining them into a logic vector to be tested; calculating the similarity between the logic vector to be tested and each logic vector in the set of logic vectors, and taking the logic vector corresponding to the maximum value of the similarity as the target logic vector of the logic vector to be tested; comparing the target logic vector with the hash table of test results to obtain the test results of the program under test.

2. The data testing method based on artificial intelligence as described in claim 1, characterized in that, The step of using the value character of each attribute in the program attribute set as the variable corresponding to that attribute includes: The output variable is defined based on the value character of the output attribute; Enumerate the possible values ​​of the table attributes and define concatenation variables based on the possible values ​​of the table attributes; Use the names of all fields in the database as the value characters for the business attributes, and define business variables based on the value characters of the business attributes; The value character of the time attribute is determined based on the type of the time attribute, and the time variable is defined according to the value character of the time attribute.

3. The data testing method based on artificial intelligence as described in claim 1, characterized in that, The process of encoding each variable in the set of data retrieval rules to obtain the corresponding floating-point encoded value includes: Each column in the set of number selection rules is labeled sequentially according to the natural numbers, and the natural number corresponding to each column is used as the column code value for all variables in that column; Count the number of values ​​for each column variable in the set of data retrieval rules, and match each integer from 1 to the number of values ​​to each value character in the column variable to obtain the row code value of all variables in each column; The column code value and the row code value are combined to obtain the floating-point code value corresponding to each variable in the data retrieval rule set. The units digit of the floating-point code value is the column code value, and the decimal place of the floating-point code value is the row code value.

4. The data testing method based on artificial intelligence as described in claim 1, characterized in that, The process of matching the set of data retrieval rules and the set of logical vectors, and treating all matched data retrieval rules as a program sequence, includes: Match each logical vector in the set of logical vectors with the set of data retrieval rules, and use the matched data retrieval rules as the target keywords; The target keywords are combined to construct a program sequence.

5. The data testing method based on artificial intelligence as described in claim 1, characterized in that, After comparing the target logic vector with the test result hash table to obtain the test result of the program to be tested, the method further includes: The ratio of the maximum value in the similarity score to a preset first threshold is calculated as the confidence level of the result. If the confidence level of the result is greater than a preset second threshold, the test result is pushed to the developers; If the confidence level of the result is not greater than a preset second threshold, the developers are notified to conduct multiple tests.

6. A data testing device based on artificial intelligence, characterized in that, The device includes: The acquisition unit is used to acquire a set of program attributes from the database, the set of program attributes including output attributes, table attributes, business attributes and time attributes; The statistical unit is used to take the value character of each attribute in the program attribute set as the variable corresponding to that attribute. The combination unit is used to combine the variables corresponding to each attribute to obtain multiple variable groups, and then store the variable groups in a row as a set of data retrieval rules. The encoding unit is used to encode each variable in the set of data retrieval rules to obtain the floating-point encoded value corresponding to each variable; The arrangement unit is used to combine the floating-point code values ​​according to the variable arrangement order of each variable group in the set of data retrieval rules to obtain the logical vector corresponding to each variable group, and arrange the logical vectors row by row to construct a logical vector set; A matching unit is used to match the set of data retrieval rules with the set of logical vectors to construct a hash table of data retrieval results, including: matching the set of data retrieval rules and the set of logical vectors, and taking all matched data retrieval rules as a program sequence; running the program sequence to obtain data retrieval results; and matching the data retrieval results with the set of logical vectors, and taking all matched key-value pairs as a hash table of data retrieval results. The comparison unit is used to obtain the test results of the program under test using the data retrieval result hash table, including: encoding multiple program attributes of the program under test to obtain the encoded value corresponding to each program attribute of the program under test and combining them into a logic vector to be tested; calculating the similarity between the logic vector to be tested and each logic vector in the logic vector set, and taking the logic vector corresponding to the maximum value of the similarity as the target logic vector of the logic vector to be tested; comparing the target logic vector with the test result hash table to obtain the test results of the program under test.

7. An electronic device, characterized in that, The electronic device includes: Memory, which stores computer-readable instructions; and The processor executes computer-readable instructions stored in the memory to implement the artificial intelligence-based data testing method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which are executed by a processor in an electronic device to implement the artificial intelligence-based data testing method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • System and method for generating test case data

    CN103473325A

  • SQL detection method and system based on neural network model and Hash matching

    CN112966268A