Method and system for analyzing data test diversity based on data coverage metrics

By using a data coverage-based approach to acquire and analyze metadata of structured data, and generate test points and weights, the problem of the inability to quantify the diversity of data testing in existing technologies is solved, achieving comprehensive coverage and accurate evaluation of data testing.

CN115391229BActive Publication Date: 2025-11-04SICHUAN XW BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211147615.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-19
Publication Date
2025-11-04
Estimated Expiration
2042-09-19

AI Technical Summary

Technical Problem

Existing coverage metrics often use code coverage, which cannot characterize the diversity and completeness of data tests, nor can they quantitatively analyze the completeness of data tests.

Method used

By using a data coverage-based approach, we obtain metadata from structured data, parse field metadata, generate field checkpoints, calculate the number and weight of checkpoints, perform data testing, and generate a data coverage test report.

Benefits of technology

It enables quantitative evaluation of the diversity of data testing, improves the completeness and accuracy of testing, identifies deficiencies in data coverage, and enhances the efficiency of test result analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115391229B_ABST
    Figure CN115391229B_ABST
Patent Text Reader

Abstract

The application discloses an analysis method and system for data coverage rate measurement data test diversity, comprising: obtaining metadata of structured data, analyzing field metadata, obtaining field name and value range of the field metadata; generating field detection points according to the value range and preset detection point rules, and calculating the number of field detection points; counting the number of fields in the field metadata, and calculating the detection weight of each field by using a field detection weight distribution method; calculating the weight of each field detection point; executing data test to obtain test results; according to the test results, performing detection point statistics on each column of the test results to obtain the number of covered detection points under each field; calculating the coverage rate of each field and the table-level coverage rate of the result data to obtain a data coverage rate test report of the data test. The application is based on the result data, reversely counts the test data diversity coverage rate, and is more effective and accurate than direct code coverage rate analysis.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of software development and software testing, in particular to an analysis method and system for measuring data test diversity based on data coverage. BACKGROUND

[0002] Coverage is a means to measure test integrity, and the conventional existing coverage measurement method often uses code coverage, that is, the test integrity is evaluated by testing the covered code. The principle of code coverage statistics is that after test execution, the number of covered lines accounts for the proportion of the total number of code lines, but the data processing code is generally pure SQL statements, and the code does not involve process branching or exception judgment, which is equivalent to all code logic being in the main trunk, so after test execution, the code can be covered by 100%, that is, the code coverage is basically 100%, but this only represents that the program has run these codes, and cannot represent how many kinds of data are applied to the test. Therefore, the existing code coverage only represents process coverage, and cannot represent the data diversity used to cover the code. SUMMARY

[0003] The technical problem to be solved by the present application is that the existing coverage measurement method often uses code coverage, which only represents process coverage and cannot represent the data diversity used to cover the code, that is, after data test execution, the scene of the quantitative analysis of data test integrity cannot be quantitatively analyzed. The measurement based on data test integrity depends on data diversity, and the purpose of the present application is to provide an analysis method and system for measuring data test diversity based on data coverage. The present application is based on data coverage, that is, the data executed during testing covers the entire data space, and the higher the data coverage rate, the more diverse the data covered by the test. Since data can represent real business scenarios, the present application uses data coverage to measure data test diversity, thereby analyzing test integrity.

[0004] The present application is realized by the following technical scheme:

[0005] In a first aspect, the present application provides an analysis method for measuring data test diversity based on data coverage, which comprises:

[0006] Step 1: obtaining metadata of structured data;

[0007] Step 2: parsing field metadata from the metadata to obtain the field name of the field metadata and the value range of the field metadata;

[0008] Step 3: generating field detection points according to the value range of the field metadata and the preset detection point rules, and calculating the number of field detection points;

[0009] Step 4, according to the field metadata, count the number of fields in the field metadata, and calculate the detection weight of each field by using the field detection weight distribution method;

[0010] Step 5, according to the number of field detection points and the detection weight of each field, calculate the weight of each field detection point;

[0011] Step 6, perform data testing to obtain test results;

[0012] Step 7, according to the test results, obtain the result data; count the detection points of each column of the result data to obtain the number of covered detection points under each field; according to the number of covered detection points under each field and the weight of each field detection point obtained in step 5, calculate the coverage rate of each field and the table-level coverage rate of the result data; and according to the coverage rate of each field and the table-level coverage rate, obtain the data coverage rate test report of the data testing.

[0013] Wherein, the metadata is data describing data, such as a book, the content in the book is the data of the book itself, and the data describing the book, such as the author of the book, the publisher, the category, etc. represents the metadata of the book. In the general IT industry database field, it represents data describing data. According to the granularity, it can be divided into table-level metadata (used to describe the data of the table, such as table name), field metadata (describing the data of the field, such as field name, length, whether null, etc.).

[0014] Further, step 1 specifically includes the following steps:

[0015] Determine the storage location of the structured data;

[0016] Connect according to the storage location of the structured data to obtain the metadata of the structured data.

[0017] Further, step 2 specifically includes the following steps:

[0018] Parse the field metadata from the metadata to obtain the field name of the field metadata and the field type of the field metadata;

[0019] Further split the field type of the field metadata into the category of the field metadata and the value domain of the field metadata;

[0020] Wherein, the category of the field metadata includes integer, string type, enumeration type and floating point number, etc.

[0021] The value domain of the field metadata refers to the numerical value range preset by the category of the field metadata.

[0022] Further, the setting step of the preset detection point rule in step 3 is:

[0023] Collect and obtain all field types, which are field types in a relational database table, including integer type (tinyint, int, bigint), string type (varchar), enumeration type (enum) and floating point number (decimal) and the like;

[0024] For the field type, set the detection point rules for each type of field; the detection rule for the string type is to traverse the boundary, the super limit and the middle value of the length for N times randomly; the detection rule for the integer type is to traverse the boundary, the super limit and the middle value for N times randomly; the detection rule for the enumeration type is to traverse all values and the super limit;

[0025] Further, the step 3 calculates the number of field detection points, specifically:

[0026] According to the detection point rules for each type of field, the number of detection points for each type of field is calculated by using the detection point number calculation formula;

[0027] The detection point number calculation formula is:

[0028] The field detection point calculation formula for the string type is: the number of boundaries + the number of super limits + the number of random numbers N; the field detection point calculation formula for the integer type is: the number of boundaries + the number of super limits + the number of random numbers N; the field detection point calculation formula for the enumeration type is: the number of enumerations + the number of super limits.

[0029] Further, the step 4 specifically includes the following steps:

[0030] According to the field metadata, the number of fields in the field metadata is counted by using the count command;

[0031] The detection weight of each field is calculated by using the field detection weight allocation method; the field detection weight allocation method adopts the equal distribution method or the character type weight method.

[0032] Further, the step 6 specifically includes the following steps:

[0033] Analyze the measured content and output the test case;

[0034] Prepare for testing, which includes program running environment and data preparation and the like;

[0035] Run the measured program and check the test results, and check according to the data quality index, which usually includes uniqueness, accuracy, authenticity, security, primary key non-empty and the like. If the quality check objective is not met, submit the defect tracking until the target data after the measured program is run is checked for quality.

[0036] Further, in step 7, according to the number of detection points covered under each field and the weight of each field detection point obtained in step 5, the number of detection points covered under each field and the weight of each field detection point obtained in step 5 are correspondingly multiplied to obtain the coverage rate of each field.

[0037] The coverage rates of each field obtained by calculation are added to obtain the total coverage rate of all fields, and the total coverage rate of all fields is taken as the table-level coverage rate of the result data.

[0038] Further, in step 7, according to the coverage rate of each field and the table-level coverage rate, a data coverage rate test report of the data test is obtained, which specifically includes:

[0039] The content of the data coverage rate test report is set; the content of the data coverage rate test report includes the table name, the table-level coverage rate, the weight that each field should cover, the actual coverage rate and the un-covered description;

[0040] According to the coverage rate of each field and the table-level coverage rate, the data coverage rate test report is backfilled.

[0041] In a second aspect, the present application further provides an analysis system for measuring the diversity of data test based on data coverage rate, which supports the analysis method for measuring the diversity of data test based on data coverage rate; the system comprises:

[0042] A field detection point weight calculation module, which comprises an acquisition unit, a field metadata analysis unit, a field detection point number calculation unit, a field detection weight calculation unit and a field detection point weight calculation unit;

[0043] The acquisition unit is used to acquire the metadata of the structured data.

[0044] The field metadata analysis unit is used to analyze the field metadata from the metadata to acquire the field name of the field metadata and the value range of the field metadata.

[0045] The field detection point number calculation unit is used to generate the field detection point according to the value range of the field metadata and the preset detection point rule, and calculate the number of field detection points.

[0046] The field detection weight calculation unit is used to count the number of fields in the field metadata according to the field metadata, and calculate the detection weight of each field by using the field detection weight distribution method.

[0047] The field detection point weight calculation unit is used to calculate the weight of each field detection point according to the number of field detection points and the detection weight of each field.

[0048] The data test module is used to execute the data test to obtain the test result.

[0049] The data coverage test report calculation unit is configured to obtain result data according to the test result, detect points of each column of the result data to obtain the number of covered detect points under each field, calculate the coverage rate of each field and the table-level coverage rate of the result data according to the number of covered detect points under each field and the weight of each field detect point obtained by the field detect point weight calculation module, and obtain the data coverage test report of the data test according to the coverage rate of each field and the table-level coverage rate.

[0050] The output unit is configured to output the data coverage test report.

[0051] Compared with the prior art, the present application has the following advantages and beneficial effects:

[0052] The present application is based on a data coverage measurement data test diversity analysis method and system. The present application is based on data coverage, that is, the proportion of the entire data space covered by the executed data during the test. The higher the data coverage rate, the more diverse the data covered by the test. Since data can represent real business scenarios, the present application uses data coverage to measure data test diversity, thereby analyzing test integrity. The present application is more effective than directly using code coverage analysis because data coverage is based on result data and reversely calculates the test data diversity coverage rate. Compared with code coverage that only covers code and does not guarantee result coverage, the present application is more accurate. BRIEF DESCRIPTION OF DRAWINGS

[0053] The accompanying drawings, which are included to provide a further understanding of the embodiments of the present application and constitute a part of the application, illustrate embodiments of the present application and are used to explain the principle of the present application, but do not limit the present application. In the drawings:

[0054] Figure 1 The present application is based on a data coverage measurement data test diversity analysis method and system. The present application is based on data coverage, that is, the proportion of the entire data space covered by the executed data during the test. The higher the data coverage rate, the more diverse the data covered by the test. Since data can represent real business scenarios, the present application uses data coverage to measure data test diversity, thereby analyzing test integrity. The present application is more effective than directly using code coverage analysis because data coverage is based on result data and reversely calculates the test data diversity coverage rate. Compared with code coverage that only covers code and does not guarantee result coverage, the present application is more accurate.

[0055] Figure 2 The present application is based on a data coverage measurement data test diversity analysis method and system. The present application is based on data coverage, that is, the proportion of the entire data space covered by the executed data during the test. The higher the data coverage rate, the more diverse the data covered by the test. Since data can represent real business scenarios, the present application uses data coverage to measure data test diversity, thereby analyzing test integrity. The present application is more effective than directly using code coverage analysis because data coverage is based on result data and reversely calculates the test data diversity coverage rate. Compared with code coverage that only covers code and does not guarantee result coverage, the present application is more accurate.

[0056] Figure 3 The present application is based on a data coverage measurement data test diversity analysis method and system. The present application is based on data coverage, that is, the proportion of the entire data space covered by the executed data during the test. The higher the data coverage rate, the more diverse the data covered by the test. Since data can represent real business scenarios, the present application uses data coverage to measure data test diversity, thereby analyzing test integrity. The present application is more effective than directly using code coverage analysis because data coverage is based on result data and reversely calculates the test data diversity coverage rate. Compared with code coverage that only covers code and does not guarantee result coverage, the present application is more accurate. DETAILED DESCRIPTION

[0057] To make the purpose, technical scheme and advantages of the present application clearer, the present application is further described in detail below with reference to the embodiments and drawings. The illustrative embodiments of the present application and their descriptions are used to explain the present application, but do not limit the present application.

[0058] Embodiment 1

[0059] In order to solve the scene problem that after data test execution, the existing coverage measurement method (commonly using code coverage) only represents process coverage and cannot represent data test diversity for covering code, and cannot quantitatively analyze data test integrity, the application designs an analysis method for measuring data test diversity based on data coverage. The application is based on data coverage, that is, the proportion of data covered during test to the entire data space. The higher the data coverage, the more diverse the data covered by the test. Since data can represent real business scenarios, the application uses data coverage to measure data test diversity, thereby analyzing test integrity.

[0060] As shown in Figure 1 The application is based on an analysis method for measuring data test diversity based on data coverage, and the method comprises the following steps:

[0061] Step 1: obtaining metadata of structured data; wherein the metadata is data describing data, such as a book, the content in the book is data of the book itself, and data describing the book, such as the author, the publisher and the category of the book, represents the metadata of the book. In the general field of IT industry database, it represents data describing data. According to the granularity, it can be divided into table-level metadata (used for describing data of the table, such as the table name), field metadata (describing data of the field, such as the field name, the length, whether null or not, etc.).

[0062] Step 1 specifically comprises the following steps:

[0063] Step 1.1: determining the storage location of structured data, such as the connection information of the table in the database and the file storage path in the server;

[0064] Step 1.2: connecting according to the storage location of the structured data to obtain the metadata of the structured data, such as the structure data of the table, which can be obtained by connecting the database and using the desc xxx library.xxx table in the sql language, such as Figure 2 exhibition.

[0065] Step 2: parsing the field metadata from the metadata to obtain the field name of the field metadata and the value range of the field metadata; Step 2 specifically comprises the following steps:

[0066] Step 2.1: parsing the field metadata from the metadata to obtain the field name of the field metadata and the field type of the field metadata, which can be obtained by Figure 2 The result obtained is the field name, and the Type is the field type.

[0067] Step 2.2: further splitting the field type of the field metadata into a category of the field metadata and a value domain of the field metadata; wherein the category of the field metadata comprises an integer type, a string type, an enumeration type, and a floating point number, etc.; and the value domain of the field metadata refers to a numerical value range preset for the category of the field metadata.

[0068] For example, if the type is varchar(10), the type is varchar, which is a variable-length string type, and the length of the string is 10; if the type is tinyint, the type is an integer, and the numerical value range is -128 to 127; if the type is enum, the type is enumeration, and the enumeration values are defined ranges, such as ‘01’ and ‘02’ in Figure 2

[0069] Step 3: generating field detection points according to the value domain of the field metadata and preset detection point rules, and calculating the number of field detection points.

[0070] Specifically, the setting step of the preset detection point rules is as follows:

[0071] Step A: sorting and obtaining all field types, the field types being field types in a relational database table, including integer types (tinyint, int, bigint), string types (varchar), enumeration types (enum), and floating point numbers (decimal), etc.; each database type name may have slight differences, but is basically one of the above types. Since the floating point number is similar to the integer type, the following examples only describe the integer type, and the floating point number is not described.

[0072] Step B: setting detection point rules for each type of field; the detection rules for the string type are traversing the boundary, out-of-range (where the out-of-range of the string refers to the length of the string being out-of-range, for example, a string with a length of 10, and the out-of-range includes any string with a length of 11, such as ‘aabbccddeef’), and a random N times (N is configurable) of the middle value of the length; the detection rules for the integer type are traversing the boundary, out-of-range, and a random N times (N is configurable) of the middle value; the detection rules for the enumeration type are traversing all values and out-of-range (excluding any value defined by the enumeration, which usually includes Null, a blank character “”, and any other value not in the defined range);

[0073] Specifically, the number of field detection points for each type of field is calculated, specifically: according to the detection point rules for each type of field, the number of detection points for each type of field is calculated using a detection point number calculation formula.

[0074] The detection point number calculation formula is as follows:

[0075] ​The field detection point calculation formula of the string type is: boundary number (2) + out-of-bound number (1) + random number (N) = 3+N; the field detection point calculation formula of the integer type is: boundary number (2) + out-of-bound number (2) + random number (N) = 4+N; and the field detection point calculation formula of the enumeration type is: enumeration number (M) + out-of-bound number 3 = 3+M.

[0076] Specifically, step 3 specifically includes the following steps:

[0077] Step 3.1: According to the value range of the field metadata obtained in step 2, and combined with the detection point number calculation formula, the detection points of each field can be obtained: the detection points of cust_no are strings with lengths of 0 and 10, strings with lengths out of bounds of 11, and random values in the middle of 0-10, randomly N times; the detection points of cust_type are 01, 02, Null, blank characters, and any other values not in the definition; and the detection points of cust_age are -128, 127, -129, 128, and random values in the middle of -128-127, randomly N times.

[0078] Step 3.2: According to the value range of the field metadata obtained in step 2, and combined with the detection point number calculation formula, the number of detection points of each field can be obtained: the number of detection points of cust_no is 3+N, the number of detection points of cust_type is 3+M, where M=2, so it is 5, and the number of detection points of cust_age is 4+N.

[0079] Step 4, according to the field metadata, the number of fields in the field metadata is counted, and the field detection weight allocation method is used to calculate the detection weight of each field; step 4 specifically includes the following steps:

[0080] Step 4.1: According to the field metadata, the number of fields in the field metadata is counted by the count command;

[0081] Step 4.2: The field detection weight allocation method is used to calculate the detection weight of each field; the field detection weight allocation method adopts an equal division system (100% / total number of fields) or a field type weight system (the weight value of each type is defined according to the field type).

[0082] If the total number of fields is N, the detection weight value of each field is 100% / N in the equal division system calculation method; and the field type weight method is that the weight of the enumeration type is 50%, the weight of the string type is 30%, and the weight of the integer type is 20%. Then the number of fields of each type is counted, and the weight shared by the same type is divided by the total number of fields of this type, for example, if there are 2 enumeration type fields, the weight of each enumeration field accounts for 50% / 2=25%.

[0083] Step 5: Calculate the weight of each field detection point based on the number of field detection points and the detection weight of each field;

[0084] The calculation formula is: detection weight of each field / number of detection points. Continuing with the equal-weighted example in section 4.2 above, the weight of each detection point in cust_type = (100% / 3) / 5.

[0085] Step 6: Perform data testing and obtain test results; Step 6 specifically includes the following steps:

[0086] Step 6.1: Analyze the content under test and output test cases;

[0087] Step 6.2: Prepare for testing, including the program runtime environment and data preparation;

[0088] Step 6.3: Run the program under test and check the test results. Check the data quality indicators, which typically include uniqueness, accuracy, authenticity, security, and primary key non-nullability. If the quality check objectives are not met, submit a defect tracking report until the target data passes the quality check after the program under test has run.

[0089] Step 7: Based on the test results, obtain the result data; perform test point statistics on each column of the result data to obtain the number of test points covered under each field; assume that the final result data contains the following 3 data entries:

[0090] cust_no cust_type cust_age 1000000000 01 10 100 02 128 1346 NULL 0

[0091] Based on the detection points for each field, and given that cust_no has a length of 10, the first row of data occupies one boundary checkpoint. The second and third rows have lengths of 3 and 4 respectively, falling within the middle range, thus occupying two random intermediate values. Therefore, cust_no has a total of 3 coverage detection points. Among these, the string with a length of 0 for the out-of-bounds checkpoint and another boundary checkpoint is not covered. The calculation method for other fields is similar and will not be elaborated further.

[0092] Based on the number of detection points covered under each field and the weight of each field detection point obtained in step 5, the coverage rate of each field is calculated by multiplying the number of detection points covered under each field and the weight of each field detection point obtained in step 5.

[0093] The calculated coverage rates for each field are summed to obtain the total field coverage rate, which is then used as the table-level coverage rate of the resulting data.

[0094] Based on the coverage of each field and the table-level coverage, a data coverage test report is generated, which includes:

[0095] Setting the content of the data coverage test report; the content of the data coverage test report includes table name, table level coverage, weight that each field should cover, actual coverage rate and un-covered explanation;

[0096] According to the coverage rate of each field and the table level coverage, the data coverage test report is backfilled.

[0097] The present application measures data test diversity based on data coverage, that is, the ratio of covered data (numerator) and total data (denominator) is analyzed. The present application has the following advantages:

[0098] 1. After the conventional quality inspection index is met, the data coverage measurement index is added, which can effectively evaluate the proportion of the current test range in the actual data possibility. The un-covered part in the data coverage report can assist the tester, so as to actively supplement the test data to improve the test integrity.

[0099] 2. In the data coverage, the boundary coverage part is not involved due to insufficient actual data diversity, and the mandatory coverage can effectively test the data usage boundary in the code, so as to achieve data boundary testing and improve the program robustness.

[0100] 3. The super-boundary part in the data coverage may not be reflected in the result, and active super-boundary testing can be used to test whether the field type selection is reasonable, so as to improve the accuracy of metadata definition.

[0101] 4. The data coverage calculation method has been given, and the whole process can be realized by program code, so as to automatically generate the coverage report after the test is completed, and improve the efficiency of the tester in evaluating and analyzing the test result.

[0102] 5. The present application is based on the data coverage to measure the data test diversity analysis method, which is more effective than directly using code coverage analysis. The reason is that the data coverage is based on the result data, and the test data diversity coverage rate is statistically analyzed in reverse. Compared with the code coverage which only covers the code and does not guarantee the result coverage, the method is more accurate.

[0103] Embodiment 2

[0104] The difference between this embodiment and embodiment 1 is that this embodiment takes the test of a customer information table (customer_info) data as an example, and the specific information is as shown in Table 1:

[0105] Table 1

[0106]

[0107] If the data of the last table can cover the entire detection range, it is marked as 100%.

[0108] The calculation process is as follows by using the analysis method of the application:

[0109] 1. Count all field numbers (obtainable by a table structure statement), such as the 3 fields in Table 3 above.

[0110] 2. Assign a weight to each field, such as in an equal division system, each field accounts for 100% / total field number = 100% / 3 = 33%, indicating that each field accounts for a weight of 33%.

[0111] 3. For each field, the weight of the field is assigned according to the boundary coverage (number of boundary values) + ladder coverage number + out-of-range number, and the proportion of each value in each field is finally obtained. For example, the customer type field has 2 boundary values, 0 ladder coverage numbers, and 2 out-of-range numbers, so each value in the customer type field accounts for 33% / (2+0+2) = 8.25%, i.e., the weight of each value is 8.25%.

[0112] 4. When the test execution ends, the result data is classified and checked, and if it is detected that the customer type field only has 01 and AA two values, then the coverage rate of this field is only 8.25%*2 = 16.5%.

[0113] 5. Finally, the coverage rates of all fields are added up to obtain the data coverage rate of the entire table.

[0114] 6. According to the coverage rate of each field and the table-level coverage rate, the data coverage rate test report can be backfilled.

[0115] Embodiment 3

[0116] As shown in Figure 3 The difference between this embodiment and Embodiment 1 is that this embodiment further provides an analysis system for measuring data test diversity based on data coverage rate, which supports the analysis method for measuring data test diversity based on data coverage rate described in Embodiment 1; the system comprises:

[0117] a field detection point weight calculation module, which comprises an acquisition unit, a field metadata analysis unit, a field detection point number calculation unit, a field detection weight calculation unit, and a field detection point weight calculation unit;

[0118] The acquisition unit is configured to acquire metadata of the structured data.

[0119] The field metadata analysis unit is configured to analyze field metadata from the metadata to obtain a field name of the field metadata and a value range of the field metadata.

[0120] The field detection point number calculation unit is configured to generate field detection points according to the value range of the field metadata and a preset detection point rule, and calculate the number of the field detection points.

[0121] a field detection weight calculating unit, configured to count the number of fields in the field metadata according to the field metadata, and calculate the detection weight of each field by using a field detection weight distribution method;

[0122] a field detection point weight calculating unit, configured to calculate the weight of each field detection point according to the number of field detection points and the detection weight of each field;

[0123] a data testing module, configured to perform data testing to obtain a testing result;

[0124] a data coverage testing report calculating unit, configured to obtain result data according to the testing result, count the number of covered detection points under each field by performing detection point counting on each column of the result data, calculate the coverage rate of each field and the table-level coverage rate of the result data according to the number of covered detection points under each field and the weight of each field detection point obtained by the field detection point weight calculating module, and obtain a data coverage testing report of the data testing according to the coverage rate of each field and the table-level coverage rate;

[0125] an output unit, configured to output the data coverage testing report.

[0126] The execution process of each unit can be performed according to the analysis method and process steps of the data coverage measurement data testing diversity described in Embodiment 1, and will not be repeated here.

[0127] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.

[0128] The present application is described with reference to flowcharts and / or block diagrams according to the method, device (system), and computer program product of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions described in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1apparatuses that carry out functions specified in one or more blocks or multiple blocks.

[0129] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flow Figure 1 one or more flows and / or blocks Figure 1 the functions specified in one or more blocks.

[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions that are executed on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 one or more flows and / or blocks Figure 1 the functions specified in one or more blocks.

[0131] The above detailed description has further explained the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific implementation of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. An analysis method for measuring data test diversity based on data coverage, characterized in that, The method comprises: Step 1, obtaining metadata of structured data; Step 2, parsing field metadata from the metadata to obtain field name of the field metadata and value range of the field metadata; Step 3, generating field detection points according to the value range of the field metadata and preset detection point rules, and calculating the number of field detection points; Step 4, according to the field metadata, the number of fields in the field metadata is counted, and the detection weight of each field is calculated by using the field detection weight distribution method; Step 5, according to the number of field detection points and the detection weight of each field, the weight of each field detection point is calculated; Step 6, performing data test to obtain test results; Step 7, according to the test results, result data is obtained; the number of covered detection points under each field is obtained by detecting points of each column of the result data; the coverage rate of each field and the table level coverage rate of the result data are calculated according to the number of covered detection points under each field and the weight of each field detection point obtained in step 5; and the data coverage rate test report of data test is obtained according to the coverage rate of each field and the table level coverage rate.

2. The method of claim 1, wherein the data coverage metric data test diversity analysis is based on a data coverage metric. Step 1 specifically comprises the following steps: determining the storage location of structured data; connecting according to the storage location of structured data to obtain the metadata of structured data.

3. The method of claim 1, wherein the data coverage metric data test diversity analysis is based on a data coverage metric. Step 2 specifically comprises the following steps: parsing field metadata from the metadata to obtain field name of the field metadata and field type of the field metadata; further splitting the field type of the field metadata into category of the field metadata and value range of the field metadata; wherein the category of the field metadata comprises integer type, string type, enumeration type and floating point number; the value range of the field metadata refers to the numerical value range preset by the category of the field metadata.

4. The method of claim 1, wherein the data coverage metric data test diversity analysis is based on a data coverage metric. The setting step of the preset detection point rule in step 3 is: combining and obtaining all field types, the field types are field types in a relational database table, including integer type, string type, enumeration type and floating point number; setting the detection point rule of each type field for the field types; the detection rule of string type is traversing boundary, out of range, and middle value random N times; the detection rule of integer type is traversing boundary, out of range, and middle value random N times; the detection rule of enumeration type is traversing all values and out of range.

5. The method of claim 4, wherein the data coverage metric data test diversity analysis is based on a data coverage metric. In step 3, the number of field detection points is calculated, specifically: according to the detection point rule of each type field, the number of detection points of each field type is calculated by using a detection point number calculation formula; the detection point number calculation formula is: the field detection point calculation formula of string type is: boundary number + out of range number + random number N; the field detection point calculation formula of integer type is: boundary number + out of range number + random number N; the field detection point calculation formula of enumeration type is: enumeration number + out of range number.

6. The method of claim 1, wherein the data coverage metric data test diversity analysis is based on a data coverage metric. Step 4 specifically comprises the following steps: according to the field metadata, the number of fields in the field metadata is counted by using the count command; the detection weight of each field is calculated by using the field detection weight distribution method; the field detection weight distribution method adopts the equal distribution method or the character type weight method.

7. The method of claim 1, wherein the data coverage metric data test diversity analysis is based on a data coverage metric. Step 6 specifically comprises the following steps: Analyzing the content to be tested, and outputting test cases; Performing test preparation, which comprises program running environment and data preparation; Running the program to be tested, and checking the test results according to the data quality indicators, and if the quality check target is not met, submitting a defect tracking until the target data after the program to be tested is run passes the quality check.

8. The method of claim 1, wherein the data coverage metric data test diversity analysis is based on a data coverage metric. In step 7, the number of covered detection points under each field and the weight of each field detection point obtained in step 5 are multiplied correspondingly to calculate the coverage rate of each field. The coverage rates of each field are added up to obtain the total field coverage rate, which is the table-level coverage rate of the result data.

9. The method of claim 1, wherein the data coverage metric data test diversity analysis is based on a data coverage metric. In step 7, the data coverage rate test report of the data test is obtained according to the coverage rate of each field and the table-level coverage rate, specifically comprising: Setting the content of the data coverage rate test report; the content of the data coverage rate test report comprises table name, table-level coverage rate, weight that each field should cover, actual coverage rate and un-covered description; According to the coverage rate of each field and the table-level coverage rate, the data coverage rate test report is backfilled.

10. An analysis system for testing diversity of data based on a data coverage metric, characterized in that, The system comprises: A field detection point weight calculation module, which comprises an acquisition unit, a field metadata analysis unit, a field detection point number calculation unit, a field detection weight calculation unit and a field detection point weight calculation unit; The acquisition unit is used to acquire the metadata of the structured data; The field metadata analysis unit is used to analyze the field metadata from the metadata, and acquire the field name of the field metadata and the value range of the field metadata; The field detection point number calculation unit is used to generate field detection points according to the value range of the field metadata and the preset detection point rules, and calculate the number of field detection points; The field detection weight calculation unit is used to count the number of fields in the field metadata according to the field metadata, and calculate the detection weight of each field by using a field detection weight distribution method; The field detection point weight calculation unit is used to calculate the weight of each field detection point according to the number of field detection points and the detection weight of each field; The data test module is used to execute data test and obtain test results; The data coverage rate test report calculation unit is used to obtain result data according to the test results; count the number of covered detection points under each field; calculate the coverage rate of each field and the table-level coverage rate of the result data according to the number of covered detection points under each field and the weight of each field detection point obtained by the field detection point weight calculation module; and obtain the data coverage rate test report of the data test according to the coverage rate of each field and the table-level coverage rate; The output unit is used to output the data coverage rate test report.

Citation Information

Patent Citations

  • Service system testing method, device and system

    CN104461863A

  • Internet business change detection method and system

    CN108075918A