CN105868214B - Automatic test comparison device and method - Google Patents

Automatic test comparison device and method Download PDF

Info

Publication number
CN105868214B
CN105868214B CN201510032317.8A CN201510032317A CN105868214B CN 105868214 B CN105868214 B CN 105868214B CN 201510032317 A CN201510032317 A CN 201510032317A CN 105868214 B CN105868214 B CN 105868214B
Authority
CN
China
Prior art keywords
domain names
file
data structure
index
comparison
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201510032317.8A
Other languages
Chinese (zh)
Other versions
CN105868214A (en
Inventor
陈在正
陈思帆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SYSCOM GROUP
Original Assignee
SYSCOM GROUP
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SYSCOM GROUP filed Critical SYSCOM GROUP
Priority to CN201510032317.8A priority Critical patent/CN105868214B/en
Publication of CN105868214A publication Critical patent/CN105868214A/en
Application granted granted Critical
Publication of CN105868214B publication Critical patent/CN105868214B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses an automatic test comparison method, which is used for comparing a first file with a second file, and improving the speed of comparing the two files by using a structure used by a similar database, can also freely select comparison contents, and solves the problems that the comparison of a large amount of data cannot be quickly completed and simple results expected by an automation process cannot be realized for a long time in the test automation process. The invention also discloses an automatic test comparison device, which is a device designed by further utilizing the automatic test comparison method so as to achieve the effects of quick comparison and free selection of comparison contents.

Description

Automatic test comparison device and method
Technical Field
The present invention relates to the field of automated testing, and more particularly, to a comparison apparatus and method for testing an automation program and using a B + tree data structure to increase the speed when processing a large amount of data, thereby greatly reducing the time cost.
Background
When a manufacturer manufactures or changes a system or a file for an automation program, it is usually necessary to perform a test comparison before the system or the file is actually put into use to test whether the system or the file is changed or manufactured to meet the requirements of the manufacturer, and if any part of the system or the file is found to be inconsistent with the requirements of the manufacturer in the comparison process, the system or the file is displayed to allow a tester to know and modify the system or the file.
The comparison tools in the market at present are mainly presented in a UI mode, mainly compare rows with rows, have powerful functions, can distinguish different places by colors or other modes, but cannot exclude specific positions so as not to compare the specific positions. For example, the result of the Beyond match comparison is shown in fig. 1, which is a window diagram of the Beyond match comparison software, the left and right data in the window are the first file 2 and the second file 3 that have been compared, the position marked with bold characters is known as a time field, but the time varies with the position, so the former and latter treatment should be different, but the comparison sequence cannot be excluded from the field position before the comparison, and the redundant comparison treatment and the influence on the interpretation cannot be increased. In the case of Line mode, such as fc, etc., the comparison is performed in a whole Line, and if there are a plurality of fields in the contents of two files compared with each other, the comparison is performed using the comparison tool, if the sequence of the fields is different, the comparison process is regarded as different, even if the contents of the fields are the same, which is inconvenient, and the output result of the comparison tool in the market is UI or file-based, and the display of all information is not a simple result expected by the automation process. Moreover, when comparing a large amount of data, the performance problem may occur, when the amount of data is large and the content is very different, the time consumed is often more than one hour or even the comparison software cannot respond, which is unacceptable in the test automation process because the comparison is often performed after each step is completed in the test automation process, if each comparison needs to take more than half an hour or even one hour, the speed that the automation originally should have is lost, and all comparison tools in the market at present cannot solve the performance problem when comparing a large amount of data for a long time.
Accordingly, the present invention is directed to an improved apparatus and method for automatic testing and comparing, which can solve the above-mentioned problems of the prior art by means of the accumulated experience of the industry for many years.
Disclosure of Invention
In view of the above, an objective of the present invention is to provide an automatic testing and comparing apparatus and method, by which a user can achieve the effects of fast comparison and freely selecting comparison contents, and can greatly shorten the comparison time and improve the comparison accuracy.
To achieve the above object, the present invention provides an automatic test comparison method for comparing a first file with a second file, comprising the steps of: firstly, setting an index tag, wherein the index tag comprises at least one index name; reading the first file and the second file, and respectively putting the first file and the second file into a B + Tree data structure according to the index name of the index tag; extracting external node data of the first file and the second file in the B + Tree data structure to form a first data structure and a second data structure, wherein the first data structure comprises a plurality of first fields, the first fields comprise a plurality of first domain names and a plurality of first field contents corresponding to the first domain names, the second data structure comprises a plurality of second fields, and the second fields comprise a plurality of second domain names and a plurality of second field contents corresponding to the second domain names; confirming whether the first domain names and the second domain names in the first data structure and the second data structure respectively comprise the index names in the index labels or not, forming a confirmation result, comparing whether each of the first field contents and each of the second field contents corresponding to the first domain names and the second domain names which are the same one by one when the first domain names and the second domain names comprise at least one same index name, and displaying the confirmation result and the comparison result to make a user know after forming a comparison result.
When the index name is set, if the set index name is multiple, each index name in the index tag is different. When the confirmation result and the comparison result are displayed, the confirmation result only displays the index names which are not contained in the first domain names and the second domain names, the comparison result only displays the difference between the contents of the first fields and the contents of the second fields, and the confirmation result and the comparison result are combined into a completion file which is displayed to be known by a user.
Furthermore, the present invention provides an automated testing and comparing apparatus, comprising: an input unit, which is used for setting an index tag, wherein the index tag comprises at least one index name; a sorting unit, for putting a first file and a second file into the B + Tree data structure according to the index name of the index tag, and then taking out external node data of the first file and the second file put into the B + Tree data structure to form a first data structure and a second data structure, wherein the first data structure comprises a plurality of first fields, the plurality of first fields comprise a plurality of first domain names and a plurality of first field contents corresponding to the plurality of first domain names, the second data structure comprises a plurality of second fields, the plurality of second fields comprise a plurality of second domain names and a plurality of second field contents corresponding to the plurality of second domain names; a comparison unit electrically connected to the input unit and the sorting unit to receive the index tag, the first data structure and the second data structure and determine whether a plurality of first domain names and second domain names in the first data structure and the second data structure include the index name in the index tag to form a determination result; when the first domain names and the second domain names contain at least one same index name, comparing whether the content of each of the first fields and the content of each of the second fields corresponding to the same first domain names and second domain names are the same one by one to form a comparison result; and an output unit for displaying the confirmation result and the comparison result compared by the comparison unit. The invention also comprises a display electrically connected with the output unit so as to display the confirmation result and the comparison result received by the output unit on the display.
When the input unit sets the index name, if the set index names are multiple, each index name set in the index tag is different. When the output unit displays the confirmation result and the comparison result, the confirmation result only displays the index names which are not contained in the first domain names and the second domain names, the comparison result only displays the difference between the first field contents and the second field contents, the output unit combines the confirmation result and the comparison result into a finished file, and the finished file is displayed through the output unit to be known by a user.
Drawings
FIG. 1 is a diagram of a software window in the prior art;
FIG. 2 is a first flowchart of the preferred embodiment of the present invention;
FIG. 3 is a second flowchart of the preferred embodiment of the present invention;
FIG. 4 is a block diagram of the preferred embodiment of the present invention.
Description of reference numerals: 1-automatic testing and comparing device; 11-an input unit; 12-a sorting unit; 13-an alignment unit; 14-an output unit; 15-a display; S001-S009-; S101-S110; 2-a first file; 3-second file.
Detailed Description
In order to make the present invention clear, the following description is only given with reference to the accompanying drawings, and for the sake of easy understanding, the same elements in the following embodiments are indicated by the same reference numerals.
Fig. 2 is a first flowchart of the preferred embodiment of the present invention. As shown in fig. 2, the automated testing and comparing method provided by the present invention is used for comparing a first file with a second file, and comprises the following steps: first, an index tag is set, wherein the index tag includes at least one index name (step S001), wherein when the index name is multiple, each index name in the index tag is different, and in order to avoid duplication, for example, in comparing personal data, the index name of "address" does not appear in the set index tag more than twice.
Reading the first file and the second file, respectively putting the first file and the second file into a B + Tree data structure according to the index name of the index tag (step S002), and then taking out the external node data of the first file and the second file in the B + Tree data structure to form a first data structure and a second data structure (step S003). The first data structure includes a plurality of first fields, the plurality of first fields include a plurality of first domain names and a plurality of first field contents corresponding to the plurality of first domain names, the second data structure includes a plurality of second fields, and the plurality of second fields include a plurality of second domain names and a plurality of second field contents corresponding to the plurality of second domain names.
It is determined whether the first domain names and the second domain names in the first data structure and the second data structure respectively include the index name in the index tag (step S004). If the index name not included in the first domain names or the second domain names is found, a confirmation result is formed (step S005). When the first domain names and the second domain names include at least one identical index name, each of the first field contents and each of the second field contents corresponding to the identical first domain names and second domain names are compared one by one to determine whether the identical first field contents and the identical second field contents are identical (step S006). If the first field contents and the second field contents are found to have differences, only the differences are displayed to form a comparison result (step S007), but if the first field contents and the second field contents are identical, words such as "no difference" are displayed (step S008), so that the user can know that the first file and the second file are not different in the required comparison content range. Then, the confirmation result and the comparison result are displayed to be known by the user (step S009).
The method of the invention utilizes the structure used by the similar database to improve the speed of comparing the two files, and the index label set at the beginning and the B + Tree data structure used later are the key points of the utilization mode. In a system without an index, all data retrieval is typically accomplished by scanning the data table. In the operation of scanning the data table, all the data needs to be read and compared with the data to be queried, which results in an incredible amount of I/O, especially when scanning a huge data table, it may take a lot of time and consume considerable system resources. But if the index is used, the number of I/O operations can be specifically reduced, and the data access speed can be improved. According to the invention, by using the B + Tree data structure, because all leaf nodes of the B + Tree data structure contain information of all keywords and pointers for pointing to records containing the keywords, and the leaf nodes are linked in the sequence of small keywords and large keywords, because non-terminal nodes do not point to nodes of file contents finally but are indexes of the keywords in the leaf nodes, any keyword needs to be searched along a path from a root node to the leaf nodes, and the path lengths of all keyword queries are the same, so that the query efficiency of each data of the B + Tree data structure is very stable. Therefore, the problem of efficiency of comparing a large amount of data existing for a long time can be solved by using the method. For example, a test file is copied into 2 identical target files, each having 1307901 data therein, each having a size of 224 MB. If the two files are compared by the method of the present invention, the time consumed for comparison is 1 minute 53 seconds, but if the comparison software in the general market, such as Araxis Merge or Win Merge, is used, it will take much time. If Araxis Merge is used, the software reads in one file at a time, which takes 5 min 37 seconds to read the first file, and 11 min 14 seconds to read the second file and compare them at the same time, which is 16 min 51 seconds in total. If Win Merge is used, the software compares the two files with each other and ends the comparison if a program error occurs. This situation occurs only by comparing two files that are identical, and if the files with more differences and more data amount are compared, the difference of time consumption is larger, so the present invention can improve the efficiency problem of comparing a large amount of data. Moreover, the confirmation result only displays the index names which are not contained in the first domain names and the second domain names, and the comparison result only displays the differences of the contents of the first fields and the second fields, so that the simple result expected by the automation process can be better met, a user or a tester can be better made to know which difference is needed, and whether the difference needs to be modified or not can be quickly confirmed.
Because the index mode used by the index tag in the invention is a composite index, the specific field content to be compared can be freely specified, and because the setting of the index tag only aims at the field content and does not aim at the field sequence for comparison, the field content is not compared with the field sequence in the prior art, and the field content is still judged to be different results after comparison as long as the content is the same but the sequence is different. And because the compound index can retrieve fewer data columns from the data structure, the data columns are more clearly checked and the efficiency is higher.
Fig. 3 is a second flowchart of the preferred embodiment of the present invention. As shown in fig. 3, which is another implementation manner of the preferred embodiment, steps S101 to S108 are the same as those mentioned in the first flowchart, and are not repeated herein. The difference between the second flowchart and the first flowchart is that in the second flowchart, after the confirmation result and the comparison result are formed, the confirmation result and the comparison result are merged into a completion file (step S109), and the completion file is displayed (step S110). The arrangement has all the advantages of the first flow chart, and can combine the two results into a form of an integrated report, so that a user or a tester can know all the results by only looking at one report, and the time consumed by manual confirmation can be saved.
Furthermore, the inventor further creates an automatic test comparison device according to the automatic test comparison method, so that the automatic test comparison method can be implemented reliably. FIG. 4 is a block diagram of a preferred embodiment of the present invention. As shown in fig. 4, the automated testing and comparing apparatus 1 provided by the present invention comprises: an input unit 11, a sequencing unit 12, a comparison unit 13, an output unit 14 and a display 15. The input unit 1 is used for setting an index tag, and the index tag comprises at least one index name. The sorting unit 12 puts a first file and a second file into the B + Tree data structure according to the index name of the index tag, and then takes out external node data of the first file and the second file put into the B + Tree data structure to form a first data structure and a second data structure, wherein the first data structure includes a plurality of first fields including a plurality of first domain names and a plurality of first field contents corresponding to the plurality of first domain names, and the second data structure includes a plurality of second fields including a plurality of second domain names and a plurality of second field contents corresponding to the plurality of second domain names. The comparing unit 13 is electrically connected to the input unit 11 and the sorting unit 12 to receive the index tag, the first data structure and the second data structure, and determine whether the first domain names and the second domain names in the first data structure and the second data structure include the index name in the index tag, so as to form a determination result; and when the first domain names and the second domain names contain at least one same index name, comparing whether the content of each of the first fields and the content of each of the second fields corresponding to the same first domain names and second domain names are the same one by one to form a comparison result. The output unit 14 is electrically connected to the comparing unit 13, and displays the confirmation result and the comparison result compared by the comparing unit 13 on the display 15.
When the input unit 11 sets the index name, if there are a plurality of index names, each index name set in the index tag is different. When the output unit 14 displays the confirmation result and the comparison result, the confirmation result only displays the index names not included in the first domain names and the second domain names, the comparison result only displays the difference between the contents of the first fields and the contents of the second fields, and the output unit 14 combines the confirmation result and the comparison result into a finished file and displays the finished file through the output unit to let the user know the finished file.
The automatic test comparison device can read two files at a time and compare the files by the method, so that a user or a tester does not need to use the existing comparison tool which cannot compare a large amount of data on the market at present, the speed is increased when a large amount of data is processed in the test automation process, the time cost consumed is greatly reduced, and the comparison device of contents to be compared can be randomly specified.
It is therefore intended that all such alterations and modifications as fall within the true spirit and scope of the invention, and all such equivalent and modifications as would be obvious to one skilled in the art are deemed to be within the scope and spirit of the invention.

Claims (9)

1. An automatic test comparison method for comparing a first file with a second file, comprising the steps of:
setting an index tag, wherein the index tag comprises at least one index name;
reading the first file and the second file, and respectively putting the first file and the second file into a B + Tree data structure according to the index name of the index tag, wherein all leaf nodes in the B + Tree data structure contain information of all keywords and pointers pointing to records containing the keywords, the leaf nodes are linked according to the sequence of the sizes of the keywords from small to large, and non-terminal nodes are not nodes pointing to the content of the file finally but are only indexes of the keywords in the leaf nodes;
extracting external node data of the first file and the second file in a B + Tree data structure to form a first data structure and a second data structure, wherein the first data structure comprises a plurality of first fields, the first fields comprise a plurality of first domain names and a plurality of first field contents corresponding to the first domain names, the second data structure comprises a plurality of second fields, and the second fields comprise a plurality of second domain names and a plurality of second field contents corresponding to the second domain names;
confirming whether the first domain names and the second domain names in the first data structure and the second data structure respectively contain the index names in the index labels or not, and forming a confirmation result;
when the first domain names and the second domain names contain at least one same index name, comparing whether each of the first field contents and each of the second field contents corresponding to the same first domain names and second domain names are the same one by one to form a comparison result; and
and displaying the confirmation result and the comparison result.
2. The method of claim 1, wherein each index name in the index tag is different when there are multiple index names.
3. The method according to claim 1, wherein when displaying the confirmation result and the comparison result, the confirmation result only displays the index names not included in the first domain names and the second domain names, and the comparison result only displays the differences between the first field contents and the second field contents.
4. The automated testing and comparing method of claim 1, wherein when displaying the confirmation result and the comparison result, the confirmation result and the comparison result are combined into a completion file, and the completion file is displayed.
5. An automated test alignment device, comprising:
an input unit, which is used for setting an index tag, wherein the index tag comprises at least one index name;
a sorting unit for putting a first file and a second file into the B + Tree data structure according to the index name of the index tag, and then taking out the external node data of the first file and the second file put into the B + Tree data structure to form a first data structure and a second data structure, wherein the first data structure comprises a plurality of first fields including a plurality of first domain names and a plurality of first field contents corresponding to the plurality of first domain names, the second data structure comprises a plurality of second fields including a plurality of second domain names and a plurality of second field contents corresponding to the plurality of second domain names, all leaf nodes in the B + Tree data structure include information of all keywords and pointers containing the keyword records, and the leaf nodes are linked according to the order of the keywords from small to large, the non-end node is not a node which finally points to the content of the file, but is only an index of a keyword in a leaf node;
a comparison unit electrically connected to the input unit and the sorting unit to receive the index tag, the first data structure and the second data structure and determine whether the first domain names and the second domain names in the first data structure and the second data structure include the index name in the index tag to form a determination result; when the first domain names and the second domain names contain at least one same index name, comparing whether each of the first field contents and each of the second field contents corresponding to the same first domain names and second domain names are the same one by one to form a comparison result; and
an output unit for displaying the confirmation result and the comparison result compared by the comparison unit.
6. The automated test alignment device of claim 5, further comprising a display electrically connected to the output unit.
7. The automated test alignment apparatus of claim 5, wherein each index name in the index tag is different when there are multiple index names.
8. The apparatus according to claim 5, wherein when the output unit displays the confirmation result and the comparison result, the confirmation result only displays the index names not included in the first domain names and the second domain names, and the comparison result only displays the differences between the first field contents and the second field contents.
9. The automatic testing and comparing device of claim 5, wherein the output unit combines the confirmation result and the comparison result into a completed file and displays the completed file when the output unit displays the confirmation result and the comparison result.
CN201510032317.8A 2015-01-22 2015-01-22 Automatic test comparison device and method Expired - Fee Related CN105868214B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510032317.8A CN105868214B (en) 2015-01-22 2015-01-22 Automatic test comparison device and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510032317.8A CN105868214B (en) 2015-01-22 2015-01-22 Automatic test comparison device and method

Publications (2)

Publication Number Publication Date
CN105868214A CN105868214A (en) 2016-08-17
CN105868214B true CN105868214B (en) 2020-03-10

Family

ID=56623405

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510032317.8A Expired - Fee Related CN105868214B (en) 2015-01-22 2015-01-22 Automatic test comparison device and method

Country Status (1)

Country Link
CN (1) CN105868214B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7437664B2 (en) * 2002-06-18 2008-10-14 Microsoft Corporation Comparing hierarchically-structured documents
CN102681975A (en) * 2012-05-10 2012-09-19 江苏省电力公司电力科学研究院 PQDIF (Power Quality Data Interchange Format) file tree structure comparative method based on linked list
CN103136230A (en) * 2011-11-25 2013-06-05 阿里巴巴集团控股有限公司 Comparing method and device of tree-type structure file
CN103500169A (en) * 2013-09-02 2014-01-08 用友软件股份有限公司 File comparison device and file comparison method
CN103578048A (en) * 2013-11-13 2014-02-12 国家电网公司 Method for checking and comparing configuration related information of intelligent substation SCL documents

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7437664B2 (en) * 2002-06-18 2008-10-14 Microsoft Corporation Comparing hierarchically-structured documents
CN103136230A (en) * 2011-11-25 2013-06-05 阿里巴巴集团控股有限公司 Comparing method and device of tree-type structure file
CN102681975A (en) * 2012-05-10 2012-09-19 江苏省电力公司电力科学研究院 PQDIF (Power Quality Data Interchange Format) file tree structure comparative method based on linked list
CN103500169A (en) * 2013-09-02 2014-01-08 用友软件股份有限公司 File comparison device and file comparison method
CN103578048A (en) * 2013-11-13 2014-02-12 国家电网公司 Method for checking and comparing configuration related information of intelligent substation SCL documents

Also Published As

Publication number Publication date
CN105868214A (en) 2016-08-17

Similar Documents

Publication Publication Date Title
CN110321344B (en) Information query method and device for associated data, computer equipment and storage medium
US10268758B2 (en) Method and system of acquiring semantic information, keyword expansion and keyword search thereof
US9870382B2 (en) Data encoding and corresponding data structure
US9870421B2 (en) Method for accurately searching for comprehensive information
CN110033206A (en) Bill of materials automatic Check method and device
US9619455B2 (en) Table format multi-dimensional data translation method and device
CN115236260B (en) Chromatographic data storage method and device, electronic equipment and storage medium
CN106355375B (en) A kind of automatic materiel affirmation method
CN110515896B (en) Model resource management method, model file manufacturing method, device and system
CN108388640B (en) Data conversion method and device and data processing system
CN104765665A (en) Method and device for testing hard disks
CN104778135A (en) Device compatible method and system
CN112364024A (en) Control method and device for batch automatic comparison of table data
CA3148489A1 (en) Method of and device for assessing data query time consumption, computer equipment and storage medium
CN105868214B (en) Automatic test comparison device and method
CN111061733B (en) Data processing method, device, electronic equipment and computer readable storage medium
CN111858581A (en) Page query method and device, storage medium and electronic equipment
CN111177119A (en) Database-based full-data comparison method, device, equipment and storage medium
CN103365778A (en) Control test method and device
US8302045B2 (en) Electronic device and method for inspecting electrical rules of circuit boards
CN111143356B (en) Report retrieval method and device
CN115510289A (en) Data cube configuration method and device, electronic equipment and storage medium
TW201627881A (en) Automation test comparison device and method
CN106294433B (en) Equipment information processing method and device
CN114090673A (en) Data processing method, equipment and storage medium for multiple data sources

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200310

Termination date: 20220122

CF01 Termination of patent right due to non-payment of annual fee