Test file verification method and system, computer readable storage medium and electronic equipment

By constructing a rule-based data dictionary with a key-value structure, test files are automatically identified and processed, solving the problems of low efficiency and error-proneness in manual comparison during engineering testing. This enables multi-format compatible specification data comparison, improving comparison efficiency and accuracy.

CN121659931APending Publication Date: 2026-03-13DREAM INNOVATION TECH (SUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-22
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In the current field of engineering testing, the comparison between specifications and test data mainly relies on manual operation, which has problems such as low efficiency, easy error, inability to handle encrypted Excel and non-standard text files, difficulty in tracing results, and insufficient file format compatibility.

Method used

A rule data dictionary with a key-value structure is constructed to automatically identify and preprocess test file types. By comparing keywords and data tuples, matching keyword information is queried in the rule data dictionary to achieve automated, multi-format compatible specification data comparison.

Benefits of technology

It significantly improves comparison efficiency and accuracy, supports automatic processing of encrypted and text files, overcomes the problems of poor format compatibility, error-proneness and low efficiency in traditional manual operation, and can more effectively and accurately locate problems and trace quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121659931A_ABST
    Figure CN121659931A_ABST
Patent Text Reader

Abstract

The invention provides a test file verification method and system, a computer readable storage medium and electronic equipment, and the method comprises the steps: constructing a rule data dictionary with a key value structure based on a loaded specification file, the rule data dictionary comprising keyword information and data tuple information corresponding to the keyword information; the method comprises the steps that a test file is received, the file type of the test file is automatically recognized, the test file is preprocessed according to the file type, and the preprocessed test file comprises a comparison keyword and a comparison data tuple corresponding to the comparison keyword; on the basis of a rule data dictionary, verifying the preprocessed test file to output a verification result; the verification of the preprocessed test file comprises the steps of extracting a comparison keyword and a comparison data tuple from the test file, and searching matched keyword information from a rule data dictionary based on the comparison keyword so as to verify the comparison data tuple. According to the invention, the comparison efficiency and accuracy are obviously improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and more specifically, to a test document verification method, system, computer-readable storage medium, and electronic device. Background Technology

[0002] Currently, in the field of engineering testing, the comparison between specifications and test data mainly relies on manual operation, which suffers from problems such as low efficiency, high error rate, inability to handle encrypted Excel files and non-standard text files, and difficulty in tracing results. Furthermore, there are also issues such as insufficient file format compatibility and low efficiency of manual comparison.

[0003] Therefore, it is necessary to provide an improved test file verification method, system, computer-readable storage medium, and electronic device to solve one of the aforementioned technical problems. Summary of the Invention

[0004] The purpose of this application is to provide a test document verification method, system, computer-readable storage medium, and electronic device, which can solve at least one of the technical problems mentioned above, namely, the low efficiency, error-proneness, inability to handle encrypted Excel and non-standard text files, poor accuracy, insufficient file format compatibility, and low efficiency of manual comparison caused by the excessive reliance on manual operation for comparing specifications and test data in the current engineering testing field. The specific solution is as follows:

[0005] According to a specific embodiment of this application, this application provides a test file verification method, comprising: constructing a rule data dictionary with a key-value structure based on a loaded specification file, the rule data dictionary including keyword information and data tuple information corresponding to the keyword information; receiving a test file, automatically identifying the file type of the test file, and preprocessing the test file according to the file type, the preprocessed test file including comparison keywords and comparison data tuples corresponding to the comparison keywords; verifying the preprocessed test file based on the rule data dictionary to output a verification result; wherein, the verification of the preprocessed test file includes extracting the comparison keywords and the comparison data tuples from the test file, and searching for matching keyword information from the rule data dictionary based on the comparison keywords to verify the comparison data tuples.

[0006] According to a specific embodiment of this application, this application also provides a test file verification system, which executes the test file verification method described in this application, including: a dictionary construction module, which constructs a rule data dictionary with a key-value structure based on a loaded specification file, the rule data dictionary including keyword information and data tuple information corresponding to the keyword information; a receiving and processing module, which receives a test file, automatically identifies the file type of the test file, and preprocesses the test file according to the file type, the preprocessed test file including comparison keywords and comparison data tuples corresponding to the comparison keywords; and a comparison processing module, which verifies the preprocessed test file based on the rule data dictionary to output a verification result; wherein, the verification of the preprocessed test file includes extracting the comparison keywords and the comparison data tuples from the test file, and searching for matching keyword information from the rule data dictionary based on the comparison keywords to verify the comparison data tuples.

[0007] According to specific embodiments of this application, this application also provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the test file verification method as described in any of the preceding claims.

[0008] According to specific embodiments of this application, this application also provides an electronic device, including: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the test file verification method as described in any of the preceding claims.

[0009] Compared with the prior art, the above-described solutions of this application have at least the following beneficial effects:

[0010] This application constructs a rule-based data dictionary with a key-value structure for verifying test files. It automatically identifies the file type of received test files and processes them accordingly to obtain uniformly formatted table files, achieving automated, multi-format compatible specification data comparison. By extracting comparison keywords and comparison data tuples from the test files, and querying matching keyword information from the rule-based data dictionary based on the comparison keywords to verify the comparison data tuples, and using key-value queries for data verification, the efficiency and accuracy of comparison can be significantly improved. This application supports automatic processing of encrypted and text files, overcoming the problems of poor format compatibility, error-proneness, and low efficiency in traditional manual operations. Attached Figure Description

[0011] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:

[0012] Figure 1 This is a flowchart illustrating the steps of one embodiment of the test document verification method of this application;

[0013] Figure 2 This is a flowchart illustrating one embodiment of the test document verification method of this application;

[0014] Figure 3 This is a schematic diagram of a visual interface for loading a test project in an application example of the test file verification method of this application;

[0015] Figure 4 This is an example table of the rule data dictionary constructed based on the test items in the specification file in the test file verification method of this application;

[0016] Figure 5 This is a schematic diagram of a visual interface for selecting the output verification result in the test document verification method of this application;

[0017] Figure 6 This is a structural framework diagram of an embodiment of the test document verification system of this application;

[0018] Figure 7 A schematic diagram of a visual interface of an application example of the test document verification system of this application;

[0019] Figure 8 This is a schematic diagram of the electronic device structure shown in an embodiment of this application. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms “a,” “said,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms, and “multiple” generally includes at least two unless the context clearly indicates otherwise.

[0022] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0023] It should be understood that although the terms first, second, third, etc., may be used in the embodiments of this application, these descriptions should not be limited to these terms. These terms are only used to distinguish the descriptions. For example, first may also be referred to as second without departing from the scope of the embodiments of this application, and similarly, second may also be referred to as first.

[0024] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that an article or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or device. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the article or device that includes said element.

[0025] In view of the above problems, this application provides a test file verification method and system. Based on the loaded specification file, this method constructs a rule data dictionary with a key-value structure, automatically identifies the file type of the received test file and performs preprocessing, effectively achieving automated, multi-format compatible specification data comparison. By extracting comparison keywords and comparison data tuples from the test file, and querying matching keyword information from the rule data dictionary based on the comparison keywords to verify the comparison data tuples, and using key-value queries for data verification, the comparison efficiency and accuracy can be significantly improved. This application can support automatic processing of encrypted files and text files, overcoming the problems of poor format compatibility, error-proneness, and low efficiency in traditional manual operations. Through diversified output results, more effective and accurate problem localization and quality traceability can be achieved.

[0026] It should be noted that the test file verification method of this application has a wide range of applications, and is particularly suitable for table files, text files, or files without extensions that can be opened as text files.

[0027] The following is combined with Figures 1 to 5 The optional embodiments of this application are described in detail below.

[0028] Figure 1 This is a flowchart illustrating the steps of an embodiment of the test document verification method of this application. Figure 2 This is a flowchart illustrating one implementation of the test document verification method of this application.

[0029] like Figure 1 As shown, in step S101, a rule data dictionary with a key-value structure is constructed based on the loaded specification file. The rule data dictionary includes keyword information and data tuple information corresponding to the keyword information.

[0030] Specifically, the specification documents are in tabular format, such as an Excel spreadsheet. Each specification document contains multiple test items, with each test item corresponding to a worksheet. Each worksheet defines all test steps for the corresponding test item and its pass / fail criterion range (e.g., upper and lower limits). For example, a user selects a test item from the loaded specification document, and the selected test item is loaded. The test items are in tabular format.

[0031] In a specific application example, the openpyxl library is used to open the project specification file in read-only mode (e.g., ...). Figure 3 The file “Specification file: D: / Documents / R2532 Series-Engineering Specification.xlsx” shows the information. This will retrieve all test items, i.e., all worksheet names, from the engineering specification file.

[0032] exist Figure 3 The visual interface shows that the test items include cover verification, gyroscope calibration, overall airtightness, and TOF calibration. Users can select the target test item from multiple test items (such as...). Figure 3 As shown, select the "Overall Air Tightness" test item. After selecting this test item, click Load to load the test item selected in the specification file.

[0033] Specifically, a rule-based data dictionary is constructed based on the loaded "Overall Airtightness" test item. For example, for the "Overall Airtightness" test item, the system scans each cell in a predefined first row (e.g., the fifth row of the current worksheet is the first row), traverses each cell, and dynamically locates key data columns using specific keywords. These specific keywords include text or characters related to keyword information and data tuple information, such as step name, lower limit, min, upper limit, and max.

[0034] It should be noted that in this example, the predefined first line is within the range of the first five lines, such as the fifth line, but it is not limited to this; it can also be the second line, the third line, and so on. The above is only an optional example and should not be construed as a limitation of this application.

[0035] In one optional implementation, the data key columns include three columns: a first data key column, a second data key column, and a third data key column. For example, the three types of data key columns are located in predefined specified columns, such as the second, fourth, and fifth columns (see details...). Figure 4 The number of the data key columns is the same as the number of the specific keywords. For example... Figure 4 As shown, the first key column contains keyword information. The first row contains the step name, and subsequent rows contain the specific step names corresponding to the target test item, such as Step A, Step B, etc. The second key column contains the lower limit values ​​of the data tuples. The first row contains the lower limit value, and subsequent rows contain the lower limit value corresponding to the specific step. The third key column contains the upper limit values ​​of the data tuples. The first row contains the upper limit value, and subsequent rows contain the upper limit value corresponding to the corresponding step.

[0036] It should be noted that, in this embodiment, the data tuple information is a set of tuple data containing an upper limit value and a lower limit value, but it is not limited to this. In other embodiments, the data tuple information may also include multiple sets of tuple data, each set containing two data points: an upper limit value and a lower limit value, or the data tuple information may only include one upper limit value or one lower limit value. Furthermore, there are no particular restrictions on the position and number of data key columns, and they will vary depending on user definition or selection and the test project. The above are only illustrative examples and should not be construed as limitations on this application.

[0037] Specifically, the content of the test item is parsed, and keyword information and corresponding data tuple information are extracted line by line from the starting row of the data. The keyword information is placed in the first key column, the lower limit value of the data tuple information is placed in the second key column, and the upper limit value of the data tuple information is placed in the third key column to construct a temporary table file with a key-value structure. The keyword information includes the step name, and the data tuple information includes the upper limit value and the lower limit value.

[0038] For example, starting from the first row of data, each row is read sequentially to extract the step name (i.e., keyword information), lower limit value, and upper limit value (i.e., data tuple information). The extracted step name is used as the key, and the tuple data containing the lower and upper limits is used as the value. A temporary table file with a key-value structure, i.e., a rule data dictionary, is constructed in memory for use in verifying the test file. The rule data dictionary is, for example,... Figure 4 The Python dictionary shown.

[0039] Optionally, when extracting keyword information such as step names, standardization processing such as removing leading and trailing spaces and converting to lowercase is also performed to further improve text error tolerance, thereby improving the accuracy of the extracted keyword information.

[0040] It should be noted that the number of key columns in this example is three, but it is not limited to this. In other examples, the number of columns can be adapted according to the number of valid data in the test project. The above is only an optional example and should not be construed as a limitation of this application.

[0041] Next, in step S102, a test file is received, the file type of the test file is automatically identified, and the test file is preprocessed according to the file type. The preprocessed test file includes comparison keywords and comparison data tuples corresponding to the comparison keywords.

[0042] Specifically, the system receives test files and automatically identifies their file type based on their file extension (e.g., .xlsx, .txt, etc.) and content. The test files include encrypted spreadsheet files, unencrypted spreadsheet files, and text files; see details below. Figure 2 .

[0043] When the test file has no extension, it is opened in .txt format and preprocessed as a text file.

[0044] The test file is preprocessed according to its file type. The preprocessing includes converting the test file into a temporary table file and determining whether decryption is required.

[0045] In a first specific embodiment, when the test file is of text type, the preprocessing is to convert the test file into a temporary table file.

[0046] Specifically, converting the test file into a temporary table file includes: reading the contents of the test file (i.e., cell data) line by line, extracting valid data (including comparison keywords and comparison data tuples), splitting fields with a tab delimiter (TAB), and storing the extracted comparison keywords and comparison data tuples into a temporary table file according to predefined column mapping rules, as detailed in Table 1 below. The comparison keywords include step names, and the comparison data tuples include upper and lower limits.

[0047] In this example, as shown in Table 1 below, the comparison keywords include the entire column of data corresponding to the comparison keywords, specifically including the step name in the first row, and the specific steps such as step A and step B in subsequent rows starting from the first row. The comparison data tuple includes two columns of data corresponding to the upper and lower limits, specifically including the upper and lower limits in the first row, and the specific values ​​in subsequent rows starting from the first row.

[0048] Table 1

[0049] Step Name ... Upper limit lower limit value Step A ... 1 0.50 Step B ... 2.00 1.00 Step C ... 5.00 4.50

[0050] Table 1 is an example table showing a temporary table file formed after the test file has been preprocessed.

[0051] The predefined column mapping rule includes placing the extracted comparison keywords and comparison data tuples in a specified key column, with the columns separated by tabs. In this example, as shown in Table 1, the comparison keyword "step name" is placed in the second column, the upper limit value in the comparison data tuple is placed in the fourth column, and the lower limit value in the comparison data tuple is placed in the fifth column, thus forming the comparison keywords and comparison data tuples to be compared.

[0052] In a second specific embodiment, when the test file is of table type, the preprocessing is to determine whether to perform decryption processing.

[0053] For example, the msoffcrypto-tool library can be used to detect whether a test file is encrypted in order to determine whether decryption should be performed.

[0054] When decryption is initiated, it is performed, and the decrypted test file is converted into a temporary table file. The decryption process includes displaying a dialog box to the client requesting a password, performing decryption in memory, and writing the cell data from the decrypted test file to a temporary table file (e.g., an .xlsx file). This temporary file is used only for the current comparison task and is automatically deleted after the task is completed, thus ensuring data security.

[0055] For example, the comparison keywords, the upper limit and lower limit values ​​of the comparison data tuples in the decrypted test file are placed in the first column, the fourth column and the third column to form the comparison keywords and the comparison data tuples to be compared (i.e., verification data), and stored in a temporary table file, as shown in Table 2 below.

[0056] Table 2

[0057] Step Name Other data lower limit upper limit Step A ... 0.40 1.20 Step B ... 1.00 2.00

[0058] Table 2 is an example of a temporary table file generated from the decrypted test file.

[0059] When it is determined that no decryption processing is required, the test file is directly used as the file to be verified, and the comparison keywords and comparison data tuples in the test file are used as verification data.

[0060] Optionally, when extracting comparison keywords and comparison data tuples, the extracted comparison keywords and comparison data tuples may be cleaned by at least one of the following: removing spaces, processing null values, unifying simplified and traditional Chinese characters, unifying capitalization, and unifying the number of decimal places.

[0061] It should be noted that the above is only an optional example and should not be construed as a limitation of this application.

[0062] Next, in step S103, the preprocessed test file is verified based on the rule data dictionary to output the verification result; wherein, the verification of the preprocessed test file includes extracting the comparison keywords and the comparison data tuple from the test file, and searching for matching keyword information from the rule data dictionary based on the comparison keywords to verify the comparison data tuple.

[0063] The preprocessed test files are all table files.

[0064] Before verifying the preprocessed test file (i.e., the table file) based on the rule data dictionary, the comparison keywords and the comparison data tuples are extracted from the test file (specifically, the temporary table file formed by the test file, such as Table 2 above).

[0065] Specifically, the system receives a rule data dictionary and a preprocessed test file (e.g., a temporary table file formed after preprocessing the test file, such as Table 2 above), and performs the following row-by-row comparison loop:

[0066] Step S201: Read the table data in the test file (specifically, the temporary table file formed after preprocessing) line by line.

[0067] For example, the table data in the first row is read within a predefined range (e.g., the first three rows), the comparison keywords (i.e., step names) are read in the second column, the upper limit value of the comparison data tuple is read in the fourth column, and the lower limit value of the comparison data tuple is read in the fifth column.

[0068] It should be noted that the predefined range can also be the first two lines, the first four lines, the first five lines, etc. The above are only optional examples and should not be construed as a limitation of this application.

[0069] Step S202: Clean the read comparison keywords (step name) and the comparison data tuples (lower limit value, upper limit value) corresponding to the comparison keywords, and extract the comparison keywords and the comparison data tuples corresponding to the comparison keywords.

[0070] Specifically, the comparison keywords include a column of data whose first row is the step name, and the comparison data tuple includes two columns of data corresponding to the upper and lower limits, respectively. The data cleaning includes removing spaces and processing null values.

[0071] Step S203: Based on the extracted comparison keywords, find matching keyword information from the rule data dictionary to verify the comparison data tuple.

[0072] In one specific implementation, the extracted comparison keywords are used as keys to search in the rule data dictionary. When matching keyword information is found in the rule data dictionary, the comparison data tuple (i.e., upper limit value and lower limit value) corresponding to the keyword information is obtained from the rule data dictionary for verification of the comparison data tuple, i.e., comparing the comparison data tuple with the data tuple information.

[0073] For example, the extracted comparison keyword is step A in Table 1 above. When the keyword information "step A" that matches "step A" is found in the rule data dictionary, the lower limit value "0.50" and the upper limit value "1.00" corresponding to "step A" are obtained from the rule data dictionary. Then, the comparison data tuple (specifically the lower limit value "0.50" and the upper limit value "1" in Table 1 above) is compared with the data tuple information (specifically... Figure 4 The data tuples are compared with the lower limit value "0.50" and the upper limit value "1.00" corresponding to "Step A". This involves string matching and numerical equivalence matching between the compared data tuples and the data tuple information.

[0074] It should be noted that the comparison of the data tuples and the data tuple information also includes text pairings, etc. The above is merely an optional example and should not be construed as a limitation of this application.

[0075] When there is a difference between the comparison data tuple and the data tuple information, the location information, expected value, actual value and comparison result are stored in the difference result set.

[0076] The difference between the comparison data tuple and the data tuple information includes: the upper limit value of the comparison data tuple and the data tuple information are different, the lower limit value is different, or both the upper and lower limits are different.

[0077] For example, comparison Figure 4The lower limit value "0.50" and upper limit value "1.00" in the data tuple corresponding to step A in Table 1 are compared with the lower limit value "0.50" and upper limit value "1" in Table 1. The comparison result shows that the lower limit values ​​are equal and the upper limit values ​​are equal. Although the upper limit values ​​"1.00" and "1" have different strings, their numerical values ​​are equal, so they are determined to be equal. Specifically, the position information (row information, column information) of step A, the upper and lower limit values ​​in the data tuple information of the rule data dictionary are used as expected values, the upper and lower limit values ​​in the comparison data tuple in the test file are used as actual values, and the comparison result shows a difference, which is stored in the difference result set.

[0078] By simultaneously performing string matching and numerical equivalence matching on the comparison data tuples, it is possible to accurately determine the upper or lower limits of values ​​that have the same numerical value but different strings, thereby obtaining more accurate comparison results.

[0079] In another specific implementation, the extracted comparison keywords are used as keys to search in the rule data dictionary. When no matching keyword information is found in the rule data dictionary, the difference item is recorded and stored in the difference result set.

[0080] For example, using the extracted comparison keyword "step Y" as the key, when no keyword information matching "step Y" is found in the rule data dictionary, the record will be marked as "no corresponding step Y found in the rule data dictionary" and stored in the difference result set.

[0081] The preprocessed test file is validated to output validation results. The validation results include a set of differences.

[0082] Based on the system configuration and the difference result set, output at least one of the following verification result files: text report file, text tag file, and data extraction file.

[0083] Specifically, the text report file includes the time, filename, and a plain text summary of all differences. The text tag file includes the original file to be compared (the unprocessed test file), the row numbers recorded in the difference result set, and all cells in the difference rows with highlighted backgrounds. The data extraction file includes the comparison keywords and comparison data tuples from the test file.

[0084] For example, when validating the preprocessed test file, in situations such as Figure 5 The visualized interface allows users to select one or more verification result files using checkboxes (e.g., "Generate Annotation File", "Generate Extraction File", "Generate Comparison Report"). Then, based on the user-selected verification result files, the corresponding verification result file is generated and output (i.e., the corresponding...). Figure 5 (The "Comparison Report" in the document).

[0085] By diversifying the output verification results and including a set of difference results that record various differences, it is possible to more effectively and accurately locate problems and trace quality.

[0086] By querying matching keyword information from the rule data dictionary based on comparison keywords to verify the comparison data tuples, and performing data verification through key-value queries, the comparison efficiency and accuracy can be significantly improved.

[0087] It should be noted that the above examples are provided as optional illustrations and should not be construed as limiting this application.

[0088] Compared with existing technologies, this application constructs a rule data dictionary with a key-value structure for verifying test files. It automatically identifies the file type of received test files and processes them accordingly to obtain uniformly formatted table files, achieving automated, multi-format compatible specification data comparison. By extracting comparison keywords and comparison data tuples from the test files, and querying matching keyword information from the rule data dictionary based on the comparison keywords to verify the comparison data tuples, and using key-value queries for data verification, the comparison efficiency and accuracy can be significantly improved. This application supports automatic processing of encrypted and text files, overcoming the problems of poor format compatibility, error-proneness, and low efficiency in traditional manual operations.

[0089] Furthermore, by simultaneously performing string matching and numerical equivalence matching on the comparison data tuples and data tuple information, it is possible to accurately determine the upper or lower limits of values ​​that have the same numerical value but different strings, thereby obtaining more accurate comparison results.

[0090] Furthermore, by diversifying the output verification results and including a set of difference results that records various differences, it is possible to more effectively and accurately locate problems and trace quality.

[0091] This application also provides system embodiments that follow the above embodiments, for implementing the method steps described in the above embodiments. The interpretation of the same names is the same as that in the above embodiments, and they have the same technical effects as those in the above embodiments, so they will not be repeated here.

[0092] like Figure 6 As shown, this application provides a test file verification system 500, which executes the test file verification method described in this application. The test file verification system 500 includes a dictionary construction module 510, a receiving and processing module 520, and a comparison and processing module 530.

[0093] Specifically, the dictionary construction module 510 constructs a rule data dictionary with a key-value structure based on the loaded specification file. The rule data dictionary includes keyword information and data tuple information corresponding to the keyword information. The receiving and processing module 520 receives a test file, automatically identifies the file type of the test file, and preprocesses the test file according to the file type. The preprocessed test file includes comparison keywords and comparison data tuples corresponding to the comparison keywords. The comparison processing module 530 verifies the preprocessed test file based on the rule data dictionary to output a verification result. The verification of the preprocessed test file includes extracting the comparison keywords and comparison data tuples from the test file, and searching for matching keyword information from the rule data dictionary based on the comparison keywords to verify the comparison data tuples.

[0094] The test file verification system of this application is used to automatically compare the data in the test file with the data in the rule data dictionary, and output at least one of the following verification result files: text report file, text tag file, and data extraction file.

[0095] The test files are table files (or text files with the extension .xlsx).

[0096] Furthermore, the test document verification system includes a visual page for users to perform various operations such as comparison and selection.

[0097] In a specific application example, the comparison tool integrates the test file verification system of this application.

[0098] For example, double-click the comparison tool to launch it.

[0099] exist Figure 7 In the visual interface shown, users can use the "Browse" button to select specification files from the specification documents. For example, they can choose the save path for the comparison report. The default save path is usually the directory where the comparison tool program is located / comparison report. To change the save path, click "Browse" to select a new save location.

[0100] For example, by clicking "Load Data," you can select the target test item from the specification file (i.e., select the Sheet). When the target test item loads successfully, a message will appear indicating successful loading and the amount of valid data loaded. Additionally, you can select the file to be compared (i.e., the test file). There are also checkboxes to specify the type of output verification result file.

[0101] For example, when the specification file fails to load, verify that the specification file is a tabular file and includes the specified key data columns. When the test file is an encrypted tabular file, verify that the test file has completed the decryption process (e.g., whether the correct password was entered). When the test file is a text file, verify that the conversion process to a tabular file did not encounter an error (e.g., whether columns were not separated by tabs). When the validation result of the test file is abnormal, check that the test items in the test file are consistent with the data in the rule data dictionary. If they are inconsistent, reselect the corresponding test items. When saving the validation structure fails, change the save path.

[0102] Based on the loaded specification file, a rule data dictionary with a key-value structure is constructed, including: selecting a target test item from the loaded specification file and loading the target test item, wherein the specification file and the target test item are of table type.

[0103] Iterate through each cell in the predefined first row of the target test project and dynamically locate the key data columns using specific keywords.

[0104] Extract keyword information and corresponding data tuple information from each row of the starting row of the data. Place the keyword information in the first key column, place the lower limit value in the data tuple information in the second key column, and place the upper limit value in the data tuple information in the third key column to construct a temporary table file with a key-value structure for use in verifying test files.

[0105] Next, when the test file verification system receives the test file selected by the user, it automatically identifies the file type of the test file and preprocesses the test file according to the file type.

[0106] When the test file is of text type, the preprocessing involves converting the test file into a temporary table file.

[0107] Specifically, this involves reading the contents of the test file line by line, extracting valid data, splitting fields with tab delimiters, and storing the valid data into a temporary table file according to predefined column mapping rules; the valid data includes comparison keywords and comparison data tuples corresponding to the comparison keywords.

[0108] According to an optional implementation, extracting the comparison keywords and the comparison data tuple from the test file includes: reading cell data in the preprocessed test file line by line, and cleaning the cell data to form the comparison keywords and the comparison data tuple to be compared.

[0109] Cleaning the cell data includes at least one of the following: removing spaces, processing empty values, unifying simplified and traditional Chinese fonts, unifying capitalization, and unifying the number of decimal places.

[0110] When the test file is a table, the preprocessing involves determining whether to perform decryption. If decryption is performed, the decryption process is executed, and the decrypted test file is converted into a temporary table file. If decryption is not performed, the test file is directly used as the file to be verified.

[0111] According to an optional implementation, the step of searching for matching keyword information from the rule data dictionary based on the comparison keywords is used to verify the comparison data tuple.

[0112] When a keyword matching the extracted comparison keyword is found in the rule data dictionary, the comparison data tuple is compared with the data tuple information; when there is a difference between the comparison data tuple and the data tuple information, the location information, expected value, actual value and comparison result are stored in the difference result set.

[0113] According to optional implementations, comparing the comparison data tuple with the data tuple information includes: line-by-line string comparison, numerical equivalence comparison, or text comparison.

[0114] According to an optional implementation, the comparison data tuple and the data tuple information include an upper limit value and a lower limit value. The difference between the comparison data tuple and the data tuple information includes: the upper limit value of the comparison data tuple and the data tuple information are different, the lower limit value is different, or both the upper and lower limits are different.

[0115] When no matching keyword information is found in the rule data dictionary, the location information, matching keyword, and search result are stored in the difference result set.

[0116] Based on the system configuration and the difference result set, output at least one of the following verification result files: a text report file containing: time, file name, and plain text summary of all differences; a text tag file containing: the original file to be compared, the row numbers recorded in the difference result set, and all cells in the difference row with a highlighted background; and a data extraction file containing: the comparison keywords and comparison data tuples in the test file.

[0117] It should be noted that the test file verification system of this application supports multiple systems, such as Windows 7 / 10 / 11.

[0118] like Figure 8As shown, this embodiment provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the method steps described in the above embodiment.

[0119] This application provides a non-volatile computer storage medium storing computer-executable instructions that can perform the steps described in the above embodiments.

[0120] The following is for reference. Figure 8 The diagram illustrates a structural schematic of an electronic device suitable for implementing the embodiments of this application. The terminal devices in the embodiments of this application may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0121] like Figure 8 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. The RAM 403 also stores various programs and data required for the operation of the electronic device. The processing unit 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0122] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.

[0123] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 409, or installed from a storage device 408, or installed from a ROM 402. When the computer program is executed by the processing device 401, it performs the functions defined in the methods of the embodiments of this application.

[0124] It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0125] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0126] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0127] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0128] The units described in the embodiments of this application can be implemented in software or hardware. The names of the units are not, in some cases, limiting the scope of the unit itself.

Claims

1. A method for verifying test files, characterized in that, include: Based on the loaded specification file, a rule data dictionary with a key-value structure is constructed. The rule data dictionary includes keyword information and data tuple information corresponding to the keyword information. The test file is received, the file type of the test file is automatically identified, and the test file is preprocessed according to the file type. The preprocessed test file includes comparison keywords and comparison data tuples corresponding to the comparison keywords. Based on the rule data dictionary, the preprocessed test file is validated to output a validation result; wherein, the validation of the preprocessed test file includes extracting the comparison keywords and the comparison data tuple from the test file, and searching for matching keyword information from the rule data dictionary based on the comparison keywords to validate the comparison data tuple.

2. The test file verification method according to claim 1, characterized in that, The step of extracting the comparison keywords and the comparison data tuples from the test file includes: The cell data in the preprocessed test file is read line by line, and the cell data is cleaned to form the comparison keywords and comparison data tuples to be compared.

3. The test file verification method according to claim 2, characterized in that, Cleaning the cell data includes at least one of the following: removing spaces, processing empty values, unifying simplified and traditional Chinese fonts, unifying capitalization, and unifying the number of decimal places.

4. The test file verification method according to claim 2, characterized in that, The step of searching for matching keyword information from the rule data dictionary based on the comparison keywords to verify the comparison data tuple includes: When the keyword information that matches the extracted comparison keyword is found in the rule data dictionary, the comparison data tuple is compared with the data tuple information. When there is a difference between the comparison data tuple and the data tuple information, the location information, expected value, actual value and comparison result are stored in the difference result set.

5. The test file verification method according to claim 4, characterized in that, The comparison of the comparison data tuple with the data tuple information includes: line-by-line string comparison, numerical equivalence comparison, or text comparison.

6. The test file verification method according to claim 4, characterized in that, The comparison data tuple and the data tuple information include an upper limit value and a lower limit value. The difference between the comparison data tuple and the data tuple information includes: the upper limit value of the comparison data tuple and the data tuple information are different, the lower limit value is different, or both the upper and lower limits are different.

7. The test file verification method according to claim 4, characterized in that, When no keyword information matching the extracted comparison keyword is found in the rule data dictionary, the location information, comparison keyword, and search result are stored in the difference result set.

8. The test file verification method according to claim 1, characterized in that, The rule data dictionary with a key-value structure is constructed based on the loaded specification file, including: Select the target test item from the loaded specification file and load the target test item. The specification file and the target test item are of table type. Iterate through each cell in the predefined first row of the target test project and dynamically locate the key data columns using specific keywords; Extract keyword information and corresponding data tuple information from each row of the starting row of data. Place the keyword information in the first key column, place the lower limit value in the data tuple information in the second key column, and place the upper limit value in the data tuple information in the third key column to construct a temporary table file with a key-value structure.

9. The test file verification method according to claim 1, characterized in that, The automatic identification of the file type of the test file and the preprocessing of the test file according to the file type include: When the test file is of text type, the preprocessing involves converting the test file into a temporary table file, wherein the preprocessing includes: The contents of the test file are read line by line, the valid data is extracted, the fields are separated by tab delimiters, and the valid data is stored in a temporary table file according to predefined column mapping rules; the valid data includes comparison keywords and comparison data tuples corresponding to the comparison keywords.

10. The test file verification method according to claim 1, characterized in that, The automatic identification of the file type of the test file and the preprocessing of the test file according to the file type include: When the test file is of table type, the preprocessing involves determining whether to perform decryption. When it is determined that decryption processing is required, the decryption process is executed, and the decrypted test file is converted into a temporary table file; If it is determined that no decryption process will be performed, then the test file will be used directly as the file to be verified.

11. The test file verification method according to claim 7, characterized in that, The output verification result includes: Based on the system configuration and the aforementioned difference result set, at least one of the following verification result files will be output: A text report file containing: time, filename, and a plain text summary of all differences; The text tag file contains: the original file to be compared, the row numbers of the records in the difference result set, and all cells in the difference row with a highlighted background; The extracted data file contains: the comparison keywords and comparison data tuples from the test file.

12. A test document verification system, characterized in that, The test document verification method according to any one of claims 1 to 11 includes: The dictionary construction module constructs a rule data dictionary with a key-value structure based on the loaded specification file. The rule data dictionary includes keyword information and data tuple information corresponding to the keyword information. The receiving and processing module is used to receive test files, automatically identify the file type of the test files, and preprocess the test files according to the file type. The preprocessed test files include comparison keywords and comparison data tuples corresponding to the comparison keywords. The comparison processing module is used to verify the preprocessed test file based on the rule data dictionary to output the verification result; wherein, the verification of the preprocessed test file includes extracting the comparison keywords and the comparison data tuple from the test file, and searching for matching keyword information from the rule data dictionary based on the comparison keywords to verify the comparison data tuple.

13. A computer-readable storage medium having a computer program stored thereon, the program, when executed by a processor, implementing the test document verification method according to any one of claims 1 to 11.

14. An electronic device comprising: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the test file verification method as described in claims 1 to 11.