CN111858299B - Automatic difference analysis and verification method - Google Patents
Automatic difference analysis and verification method Download PDFInfo
- Publication number
- CN111858299B CN111858299B CN202010489931.8A CN202010489931A CN111858299B CN 111858299 B CN111858299 B CN 111858299B CN 202010489931 A CN202010489931 A CN 202010489931A CN 111858299 B CN111858299 B CN 111858299B
- Authority
- CN
- China
- Prior art keywords
- test case
- test
- group
- difference information
- sub
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses an automatic difference analysis and verification method, which comprises the steps of adopting a same difference analysis tool to run twice continuously, and establishing a change relation of test cases when the tool is run twice according to the internal attribute of the difference analysis tool, so as to obtain the expected change of an output result when the tool is run twice according to the change relation; testing the difference detection tool for whether the variation of the result output by the actual two runs is consistent with the expected variation; and finally generating a test report of the to-be-analyzed difference detection tool. When the difference detection tool is tested, the method and the device directly achieve the purposes of automatically generating part of test cases and automatically identifying whether the change of the output result is consistent with the expected change according to the internal attribute relationship, so that the accurate reference case is not required to be manually determined, the expected change relationship is only required to be manually established for two outputs, and the objectivity and the accuracy of the test of the difference detection tool are improved.
Description
Technical Field
The invention relates to the technical field of computers, in particular to an automatic difference analysis and verification method.
Background
When the network updates the configuration file (e.g., text file), it is necessary to obtain the difference information between the original configuration text and the new configuration text, i.e., determine where the original configuration file needs to be modified. At present, it is common to detect the difference between an original configuration file and a new configuration file through a difference tool; the accuracy of the discrepancy tool becomes critical in determining the relationship between the original configuration file and the new configuration file. However, in the existing detection method of the difference tool, a correct reference text is generally required, but the correct reference text is generally determined manually, and each person carries subjective judgment of the person on the correct reference value, so that the objectivity and accuracy of the detection of the difference tool are affected.
Disclosure of Invention
The invention aims to solve the technical problem of providing an automatic difference analysis and verification method aiming at the defects of the prior art.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
a method of automated differential analysis verification, the method comprising:
acquiring a test case set, wherein the test case set comprises a plurality of test case sets, each test case set comprises a first test case and a second test case, and the second test case is obtained by adjusting the first test case according to a preset mode;
For each test case group, generating a reference test case group corresponding to the test case group according to preset attributes, wherein the preset attributes are functional attributes of a difference detection tool to be analyzed;
determining a difference information set of the test case group based on a difference detection tool to be analyzed, wherein the difference information set comprises first difference information corresponding to the test case group and second difference information corresponding to a reference test case group;
and generating a test report of the difference detection tool to be analyzed according to the difference information set corresponding to each test case group.
The method for automatic difference analysis and verification, wherein the generating the test report of the difference detection tool to be analyzed according to the difference information sets corresponding to the test case groups specifically comprises the following steps:
for each test case group, determining a test result corresponding to the test case group according to a difference information set of the test case group, wherein the test result comprises test success and test failure;
selecting all test case groups failing in test, and dividing each selected test case group into two sub test case groups;
And updating the test case set according to all the sub test case groups obtained by dividing.
The method for automated differential analysis and verification, wherein the dividing each selected test case group into two sub test case groups specifically comprises:
dividing the first test case according to a dichotomy to obtain a first sub-test case and a second sub-test case;
acquiring data information corresponding to the dividing position of the first test case;
dividing the second test case based on the data information to obtain a third sub-test case and a fourth sub-test case;
and taking the first sub-test case and the third sub-test case as a group of test case groups, and taking the second sub-test case and the fourth sub-test case as a group of test case groups to obtain two groups of sub-test case groups (A group and B group). After generating (group C, group D) according to the preset attribute, the test is performed again using group a+group C and group b+group D, so that the range of the portion where the problem occurs is narrowed.
The automatic difference analysis and verification method comprises the step of randomly performing adjustment operation for the first test case for a preset number of times in the preset mode, wherein the adjustment operation is one or more of adding, changing and deleting.
The automatic difference analysis and verification method specifically includes the steps of:
acquiring a row number corresponding to the adjustment operation, wherein the row number is smaller than the total row number;
judging whether the text data corresponding to the line number is in a locking state or not;
if the line number is not in the locking state, performing adjustment operation on the text data corresponding to the line number, and locking the line number, a previous line number of the line number and a next culture line number;
and continuing to execute the step of acquiring the row number corresponding to the adjustment operation until the adjustment times corresponding to the adjustment operation reach the preset times so as to obtain a second test case corresponding to the first test case.
The automatic difference analysis and verification method, wherein the process of adjusting the first test case according to a preset mode comprises the following steps:
if the line number is in the locked state, continuing to execute the step of acquiring the line number corresponding to the adjustment operation.
The automatic difference analysis and verification method is characterized in that the preset times are smaller than the total number of lines of the first test case.
The automatic difference analysis and verification method comprises the steps of comparing differences, omitting spaces, omitting tab keys and spaces, comparing minimum units, omitting carriage returns, omitting case and case, comparing line by line, judging whether differences exist or not and accelerating searching of large documents by utilizing heuristics.
A computer readable storage medium storing one or more programs executable by one or more processors to implement steps in a method of automated differential analysis verification as described in any of the above.
A terminal device, comprising: a processor, a memory, and a communication bus; the memory has stored thereon a computer readable program executable by the processor;
the communication bus realizes connection communication between the processor and the memory;
the processor, when executing the computer readable program, performs steps in a method of automated differential analysis verification as described in any of the above.
The beneficial effects are that: compared with the prior art, the invention provides an automatic difference analysis and verification method, which comprises the steps of generating a reference test case group corresponding to each test case group according to preset attributes; determining first difference information corresponding to the test case group and second difference information corresponding to the reference test case group based on a difference detection tool to be analyzed; and determining a test report of the difference detection tool by the first difference information and the second difference information corresponding to each test case group. When the difference detection tool is tested, the corresponding second test case is directly generated according to the first test case, so that the second test case serving as the phase first test case is automatically generated, and the correct reference case is not required to be manually determined, thereby improving the objectivity and accuracy of the test of the difference detection tool.
Drawings
FIG. 1 is a flow chart of a method for automated differential analysis verification provided by the present invention.
Fig. 2 is a schematic flow chart of the method for automated differential analysis verification provided by the present invention.
Fig. 3 is a schematic structural diagram of a terminal device provided by the present invention.
Detailed Description
The invention provides an automatic difference analysis and verification method, which aims to make the purposes, technical schemes and effects of the invention clearer and more definite, and further details the invention by referring to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
It will be understood by those skilled in the art that all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs unless defined otherwise. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The present embodiment provides a method of automated differential analysis verification, which can be applied to electronic devices, which can be implemented in various forms. Such as a cell phone, tablet, palm top, personal digital assistant (Personal Digital Assistant, PDA), etc. In addition, the functions performed by the method may be performed by a processor in an electronic device that includes at least a processor and a storage medium, although the program code may be stored in a computer storage medium.
The embodiment provides an automatic difference analysis verification method, which is used for detecting a difference detection tool, wherein the difference analysis can be a difference detection tool used for detecting file differences, a difference detection tool used for detecting diagram differences, a difference detection tool used for matching data packet characteristics of a firewall, and the like.
As shown in fig. 1 and 2, the present implementation provides a method for automated differential analysis verification, which may include the steps of:
s10, acquiring a test case set.
Specifically, the test case set includes a plurality of test case groups, and each test case group includes a first test case and a second test case. The first test case may be sent by an external device, or may be obtained through a network (e.g., hundred degrees). The second test case is generated according to the corresponding first test case, and the second test case is obtained by adjusting the first test case according to a preset mode.
In one implementation manner of this embodiment, the acquiring process of the first test case may be:
a10, acquiring a word dictionary, wherein each word is used as a seed index.
Specifically, the word dictionary is a word dictionary stored in a Unix operating system or a Unix-like operating system, for example, under the existence/usr/share/direct/words or/usr/direct/words directory. Wherein each word in the word dictionary is divided by a carriage return, so that each word can be determined according to the carriage return after the word dictionary is acquired, and each word is used as a seed index.
A20, obtaining warehouse addresses of a plurality of Githubs according to the seed indexes.
Specifically, github (https:// GitHub. Com /) stores open source software projects, each of which has text files, e.g., json, XML, etc., for performing configuration network difference comparisons, and also stores pictures, e.g., jpg, png, etc., for image difference comparisons. In addition, the Github website has a provisioning API that provides a seed as a key for retrieval of repository addresses.
A30, obtaining a plurality of detection files based on the warehouse address of the gitoub.
In particular, obtaining several detection files based on the repository address of the gitub may be to synchronize the gitub repository to the terminal device locally according to the repository address of the gitub. For example, the warehouse of the gitub is synchronized to the terminal device locally by the gitclone+warehouse address command.
And A40, classifying each detection file in the local warehouse according to the extension name of the detection file to form a file database.
Specifically, the file database includes a plurality of data sets, and each data set includes a detection file with the same extension, for example, a picture with an extension jpg corresponds to one data set, a text file with an extension txt corresponds to one data set, a text file with an extension cpp corresponds to one data set, and so on. In addition, after the file database, a plurality of detection files can be selected in one data set in the file database, and each detection file in the selected plurality of detection files is used as a first test case.
Further, in an implementation manner of this embodiment, the preset manner is to randomly perform an adjustment operation for the first test case for a preset number of times, where the adjustment operation is one or more of adding, changing, and deleting operations. It will be appreciated that the second test case may be formed by randomly adding, deleting and/or changing the first test case, and that each word or text line in the first test case may perform the adjustment operation only once. Correspondingly, the process of adjusting the first test case according to the preset mode specifically includes:
h11, acquiring a row number corresponding to the adjustment operation, wherein the row number is smaller than the total row number;
h12, judging whether the text data corresponding to the line number is in a locking state or not;
h13, if the line number is not in a locking state, performing adjustment operation on the text data corresponding to the line number, and locking the line number, a previous line number of the line number and a next culture line number;
and H14, continuing to execute the step of acquiring the row number corresponding to the adjustment operation until the adjustment times corresponding to the adjustment operation reach the preset times so as to obtain a second test case corresponding to the first test case.
And H15, if the line number is in a locking state, continuing to execute the step of acquiring the line number corresponding to the adjustment operation.
Specifically, the preset number of times is smaller than the total number of lines of the first test case, where the total number of lines refers to the number of file lines included in the first test case, for example, the total number of lines is 200 lines, and then the preset number of times is smaller than 200. In a specific implementation manner of this embodiment, the preset number of times is less than one third of the total number of rows of the first test case (for reasons of having an increase, a change, a decrease, and 3 operations), for example, the total number of rows is 210, and then the preset number of times may be a number less than 70, such as 60, etc. Therefore, after the first test case is adjusted, the total line number of the first test case needs to be read, after the total line number is read, a random number is randomly generated, and the random number is used as the preset times, wherein the random number is smaller than one third of the total line number.
Further, after the preset times are determined, the first test case may be randomly added, deleted and/or changed, and the number of times of adjustment is performed to reach the predicted times, where when the first test case is adjusted, an operation performed by each adjustment may be randomly determined, that is, an operation may be randomly selected from adding, deleting and changing each time the adjustment operation is performed. Of course, in practical application, before the first test case is adjusted, each adjustment mode included in the adjustment operation and the number of times corresponding to each adjustment mode may need to be determined, where each adjustment mode is respectively added, deleted and changed, the number of times of each adjustment mode may be randomly generated, and the number of times of each adjustment mode satisfies the number of times of each adjustment and is less than one third of the total number of lines. Thus, the generating process of the preset times may be: after the total line number is obtained, generating three random numbers, judging whether the sum of the three random numbers meets a preset condition, and if so, taking the three random numbers as the increasing times, the deleting times and the changing times; if the preset condition is not met, the step of generating three random numbers is re-executed until the three random numbers meeting the preset condition are obtained. In this embodiment, the preset condition is the number of increases+the number of changes+the number of deletions < total number of rows/3.
Further, the row number corresponding to the adjustment operation is randomly generated, and the row number is smaller than the total row number. After determining the line number needing to execute the adjustment operation, searching whether the line number is locked, and if so, re-executing the line number corresponding to the adjustment operation; if the line is unlocked, the line and each of the upper and lower lines are locked and the line is adjusted. When the adjustment operation is an addition operation, a detection text with the same text type as the first test case is randomly read from the text database, and a line is added on or under the line of the line number in the detection text to add the detection text, other methods (to lock the added text and the previous and next lines) can be adopted, so that the original format of the line is maintained, and new text is added on or under the line. When the adjustment operation is a change operation, a detection text with the same text type as the first test case is randomly read from the text database, and the detection text is added at any position in the text row corresponding to the row number, and of course, other methods can be adopted, so that the original format of the row is not reserved anyway, and the format of the row is changed. And when the adjustment operation is a deletion operation, deleting the file row corresponding to the row number.
S20, for each test case group, generating a reference test case group corresponding to the test case group according to preset attributes, wherein the preset attributes are functional attributes of a difference detection tool to be analyzed.
Specifically, the preset attribute is a function attribute of a difference detection tool to be analyzed, which is a function attribute to be detected, wherein the preset attribute may be one of difference comparison, neglecting space, neglecting tab and space, minimum unit comparison, neglecting carriage return, neglecting case and case, comparing line by line, having difference, and accelerating searching of a large document by using heuristics. In addition, after the preset attribute is determined, a reference test case group corresponding to the test case group can be generated according to the preset attribute, wherein the reference test case group comprises two test cases which are respectively marked as a third test case and a fourth test case, and the third test case and the fourth test case in the reference test case group corresponding to the test case group can be different for different preset attributes.
Further, the correspondence between the preset attribute and the third test case and the fourth test case may be:
When the preset attribute is difference comparison, the third test case is the second test case, and the fourth test case is the first test case;
when the preset attribute is that the blank is ignored, the third test case is generated by randomly adding the blank to the first test case, and the fourth test case is generated by randomly adding the blank to the second test case;
when the preset attribute is that the tab key is ignored, the third test case is generated by randomly adding the tab key to the first test case, and the fourth test case is generated by randomly adding the tab key to the second test case;
when the preset attribute is to ignore the tab and the space, a third test case is generated by randomly adding the tab to the first test case, a fourth test case is generated by randomly adding the space to the second test case, the space is randomly added to the first test case to update the first test case, and the tab is randomly added to the second test case to update the second test case;
when the preset attribute is the minimum unit comparison, the third test case is the second test case, and the fourth test case is the first test case;
when the preset attribute is that the return is ignored, the third test case is generated by randomly adding the return to the first test case, and the fourth test case is generated by randomly adding the return to the second test case;
When the preset attribute is in case, the third test case is generated by randomly changing the case of the first test case, and the fourth test case is generated by randomly changing the case of the second test case;
when the preset attribute is row-by-row comparison, the third test case is the first test case, and the fourth test case is the second test case;
when the preset attribute is whether the difference exists or not, the third test case is the first test case, and the fourth test case is the second test case;
when the preset attribute is that searching of the large document is accelerated by utilizing a heuristic, the third test case is the first test case, and the fourth test case is the second test case.
S30, determining a difference information set of the test case group based on a difference detection tool to be analyzed, wherein the difference information set comprises first difference information corresponding to the test case group and second difference information corresponding to the reference test case group.
Specifically, the first test case and the second test case form a first test pair, the third test case and the fourth test case form a second test case pair, and a difference detection tool to be analyzed is adopted to test the first test pair and the second test pair respectively so as to obtain first difference information corresponding to the first test pair and second difference information corresponding to the second test pair. It can be understood that the difference detection tool operates twice, the first operation test case group in the two operations, the reference test case group corresponding to the second operation test case group in the two operations, the difference information obtained by the first operation is used as the first difference information, and the difference information obtained by the second operation is used as the second difference information.
In one embodiment, the first difference information is difference information obtained by running a first test case and a second test case by a diff instruction of difference detection to be analyzed; the second difference information is obtained by determining that the operation instruction operates the third test case and the fourth test case according to the preset attribute. Of course, it should be noted that, when the preset attribute is to ignore the space and the tab, the first difference information is obtained by determining that the running instruction runs the first test case and the second test case according to the preset attribute.
In one implementation of this embodiment, the operation rules of the first test pair and the second test pair are:
when the preset attribute is difference comparison, the corresponding operation mode of the first test pair is diff (first test case and second test case); the corresponding operation mode of the second test pair is diff (a third test case and a fourth test case);
when the preset attribute is blank neglect, the corresponding operation mode of the first test pair is diff (first test case and second test case); the corresponding operation mode of the second test pair is diff-b (a third test case and a fourth test case);
when the preset attribute is neglect of a tab key, the corresponding operation mode of the first test pair is diff (first test case and second test case); the corresponding operation mode of the second test pair is diff-e (a third test case and a fourth test case);
When the preset attribute is neglect of tab keys and blank spaces, the corresponding operation mode of the first test pair is diff-w (first test case and second test case); the corresponding operation mode of the second test pair is diff-w (a third test case and a fourth test case);
when the preset attribute is the minimum unit comparison, the corresponding operation mode of the first test pair is diff (first test case and second test case); the corresponding operation mode of the second test pair is diff-d (a third test case and a fourth test case);
when the preset attribute is neglecting the return, the corresponding operation mode of the first test pair is diff (first test case and second test case); the corresponding operation mode of the second test pair is diff-b (a third test case and a fourth test case);
when the preset attribute is case, the corresponding operation mode of the first test pair is diff (first test case and second test case); the corresponding operation mode of the second test pair is diff-i (a third test case and a fourth test case);
when the preset attribute is row-by-row comparison, the corresponding operation mode of the first test pair is diff (first test case and second test case); the corresponding operation mode of the second test pair is diff-a (a third test case and a fourth test case);
When the preset attribute is whether the difference exists or not, the corresponding operation mode of the first test pair is diff (first test case and second test case); the corresponding operation mode of the second test pair is diff-q (third test case and fourth test case);
when the preset attribute is that searching of a large document is accelerated by utilizing a heuristic, the corresponding operation mode of the first test pair is diff (first test case and second test case); the corresponding operation mode of the second test pair is diff-speed-large-files (third test case and fourth test case).
S40, generating a test report of the difference detection tool to be analyzed according to the difference information sets corresponding to the test case groups.
Specifically, after the difference information set is acquired, the first difference information and the second difference information are analyzed respectively to obtain the number of times including the number of times of addition, the number of times of change, and the number of times of deletion. The number of times of increase, the number of times of change and the number of times of deletion of the first difference information and the second difference information can be determined by means of regular expressions. In addition, after the increased test, the changing times and the deleting times corresponding to each group of test case groups are obtained, detection rules corresponding to preset attributes are obtained, each difference information set is verified according to the obtained detection rules, so that test results of each group of test case groups are determined, and a test report is formed based on the obtained test results.
In an implementation manner of this embodiment, the generating, according to the difference information sets corresponding to the test case groups, a test report of the to-be-analyzed difference detection tool specifically includes:
for each test case group, determining a test result corresponding to the test case group according to a difference information set of the test case group, wherein the test result comprises test success and test failure;
selecting all test case groups failing in test, and dividing each selected test case group into two test case groups;
updating the test case set according to all the test case sets obtained by dividing;
and continuously executing the steps of generating a third test case corresponding to the first test case and a fourth test case corresponding to the second test case according to the preset attribute for each group of test case groups until the first test case in the test case set meets the preset requirement, and generating a test report of the difference detection tool to be analyzed.
Specifically, the successful test indicates that the difference change information between the first difference information and the second difference information of the test case group satisfies the detection rule (i.e., the expected difference change information), and the failed test indicates that the difference change information between the first difference information and the second difference information of the test case group does not satisfy the detection rule (i.e., the expected difference change information). After the test case sets are detected, selecting all test case sets with test results being test failures, and taking two test case sets with test failures as reference test case sets. In addition, in the reference test case set, for each test case set in the reference test case set, dividing the test case set into two sub test case sets to update the reference test case set, and testing a difference detection tool to be analyzed by adopting the updated reference test case set until a first test case in the test case set meets a preset requirement. The file sizes of the first test case and the second test case in the test case group can be reduced by dividing the test case group, so that a user can quickly determine the error position of the difference detection software to be analyzed.
Further, the preset requirement is preset, and the dividing step of the test case can be ended according to the preset requirement so as to obtain a test report. The preset requirement is that the text size of the first test case is smaller than a preset size threshold, or the total line number of the first test case is smaller than a preset line number threshold, or the like. Of course, the preset requirement further includes that the test results of all test case groups in the test case set are test success. In addition, when the test case group with test failure exists, the test report comprises the test content for the last test in the first test case of the test case group; when there is no test case group with test failure, the test report is test success.
Further, in an implementation manner of this embodiment, the dividing each selected test case group into two sub test case groups specifically includes:
dividing the first test case according to a dichotomy to obtain a first sub-test case and a second sub-test case;
acquiring data information corresponding to the dividing position of the first test case;
dividing the second test case based on the data information to obtain a third sub-test case and a fourth sub-test case;
And taking the first sub-test case and the third sub-test case as a group of test case groups, and taking the second sub-test case and the fourth sub-test case as a group of test case groups to obtain two groups of test case groups.
Specifically, the dividing the first test case according to the dichotomy refers to dividing the first test case into two sub-test cases, which are respectively recorded as a first sub-test case and a second sub-test case. The data information corresponding to the dividing position comprises a previous text line positioned before the dividing position and adjacent to the dividing position and a subsequent text line positioned after the dividing position and adjacent to the dividing position. In addition, after the determined data information of the first test case, determining a dividing position for the second test case according to the data information, wherein the determining process of the dividing position for the second test case specifically may be: searching a previous text line in a second test, and if the previous text line is searched, taking the previous text line as the last line of the previous test case obtained by dividing, so as to finish the division of the second test case; if the previous text line is not found, searching the next text line in the second test case, and taking the next text line as the first line of the next test case obtained by dividing, thereby completing the division of the second test case. Of course, in practical application, the latter text line can also be searched; if the previous text line is found, taking the next text line as a first line of the next test case obtained by dividing, and finishing dividing the second test case; if the next text line is not found, searching the previous text line in the second test case, and taking the previous text line as the last line of the previous test case obtained by dividing, thereby completing the division of the second test case.
Further, in an implementation manner of this embodiment, the detection rule corresponding to the preset attribute may be:
when the preset attribute is difference comparison, the detection rule is as follows: the number of times of increase corresponding to the first difference information is equal to the number of times of deletion corresponding to the second difference information; the number of changes corresponding to the first difference information is equal to the number of changes corresponding to the second difference information; the deletion times corresponding to the first difference information are equal to the increase times corresponding to the second difference information; and the number of times of the first difference information corresponding to the number of times of addition, the number of times of change and the number of times of deletion and the number of times of addition, the number of times of change and the number of times of deletion are equal to the number of times of addition, the number of times of change and the number of times of deletion corresponding to the second difference information;
when the preset attribute is neglecting space, the detection rule is as follows: the number of times of increase corresponding to the first difference information is equal to the number of times of increase corresponding to the second difference information; the number of changes corresponding to the first difference information is equal to the number of changes corresponding to the second difference information; the deletion times corresponding to the first difference information are equal to the deletion times corresponding to the second difference information; and the number of times of the first difference information corresponding to the number of times of addition, the number of times of change and the number of times of deletion and the number of times of addition, the number of times of change and the number of times of deletion are equal to the number of times of addition, the number of times of change and the number of times of deletion corresponding to the second difference information;
When the preset attribute is neglecting the tab key, the detection rule is as follows: the number of times of increase corresponding to the first difference information is equal to the number of times of increase corresponding to the second difference information; the number of changes corresponding to the first difference information is equal to the number of changes corresponding to the second difference information; the deletion times corresponding to the first difference information are equal to the deletion times corresponding to the second difference information; and the number of times of the first difference information corresponding to the number of times of addition, the number of times of change and the number of times of deletion and the number of times of addition, the number of times of change and the number of times of deletion are equal to the number of times of addition, the number of times of change and the number of times of deletion corresponding to the second difference information;
when the preset attribute is neglecting tab and space, the detection rule is as follows: the number of times of increase corresponding to the first difference information is equal to the number of times of increase corresponding to the second difference information; the number of changes corresponding to the first difference information is equal to the number of changes corresponding to the second difference information; the deletion times corresponding to the first difference information are equal to the deletion times corresponding to the second difference information; and the number of times of the first difference information corresponding to the number of times of addition, the number of times of change and the number of times of deletion and the number of times of addition, the number of times of change and the number of times of deletion are equal to the number of times of addition, the number of times of change and the number of times of deletion corresponding to the second difference information;
when the preset attribute is the minimum unit comparison, the detection rule is as follows: the sum of the times of the increase times, the change times and the deletion times corresponding to the first difference information is larger than or equal to the sum of the times of the increase times, the change times and the deletion times corresponding to the second difference information;
When the preset attribute is neglecting the return, the detection rule is as follows: the number of times of increase corresponding to the first difference information is equal to the number of times of increase corresponding to the second difference information; the number of changes corresponding to the first difference information is equal to the number of changes corresponding to the second difference information; the deletion times corresponding to the first difference information are equal to the deletion times corresponding to the second difference information; and the number of times of the first difference information corresponding to the number of times of addition, the number of times of change and the number of times of deletion and the number of times of addition, the number of times of change and the number of times of deletion are equal to the number of times of addition, the number of times of change and the number of times of deletion corresponding to the second difference information;
when the preset attribute is case, the detection rule is as follows: the number of times of increase corresponding to the first difference information is equal to the number of times of increase corresponding to the second difference information; the number of changes corresponding to the first difference information is equal to the number of changes corresponding to the second difference information; the deletion times corresponding to the first difference information are equal to the deletion times corresponding to the second difference information; and the number of times of the first difference information corresponding to the number of times of addition, the number of times of change and the number of times of deletion and the number of times of addition, the number of times of change and the number of times of deletion are equal to the number of times of addition, the number of times of change and the number of times of deletion corresponding to the second difference information;
when the preset attribute is row-by-row comparison, the detection rule is as follows: the number of times of increase corresponding to the first difference information is equal to the number of times of increase corresponding to the second difference information; the number of changes corresponding to the first difference information is equal to the number of changes corresponding to the second difference information; the deletion times corresponding to the first difference information are equal to the deletion times corresponding to the second difference information; and the number of times of the first difference information corresponding to the number of times of addition, the number of times of change and the number of times of deletion and the number of times of addition, the number of times of change and the number of times of deletion are equal to the number of times of addition, the number of times of change and the number of times of deletion corresponding to the second difference information;
When the preset attribute is different, the detection rule is as follows: if the first difference information comprises addition, change or deletion, the second difference information is different between the two texts; if the first difference information does not comprise the addition, the change or the deletion, the second difference information is the same in two texts;
when the preset attribute is that searching of the large document is accelerated by utilizing a heuristic, the detection rule is as follows: the number of times of increase corresponding to the first difference information is equal to the number of times of increase corresponding to the second difference information; the number of changes corresponding to the first difference information is equal to the number of changes corresponding to the second difference information; the deletion times corresponding to the first difference information are equal to the deletion times corresponding to the second difference information; and the sum of the number of times of the first difference information corresponding to the number of times of addition, the number of times of change, and the number of times of deletion is equal to the sum of the number of times of addition, the number of times of change, and the number of times of deletion corresponding to the second difference information.
In addition, in order to further explain the method of automated differential analysis verification provided in this embodiment, a specific implementation is given below for explanation.
The method for automatic difference analysis and verification provided by the implementation manner needs to pre-establish two file temporary directories, wherein a first temporary directory in the two file temporary targets is used for storing generated test cases, and a second temporary directory in the two file temporary targets is used for storing test cases failing to test, and the method comprises the following steps of
Step 1, a first test pair and a second test pair are established according to preset attributes;
step 2, respectively operating a first test pair and a second test pair according to preset attributes to obtain first difference information and second difference information;
step 3, analyzing the first difference information and the second difference information by using a regular expression respectively to obtain the increasing times, the changing times and the deleting times corresponding to the first difference information and the increasing times, the changing times and the deleting times corresponding to the second difference information;
step 4, detecting the test case group according to the increasing times, changing times and deleting times corresponding to the first difference information and the increasing times, changing times and deleting times corresponding to the second difference information; if the test fails, jumping to the step 5, if the test is successful, jumping to the step 10;
step 5, all files of the second temporary directory are emptied
And 6, storing the first test pair and the second test pair into a second temporary directory.
Step 7, emptying all files of the first temporary target
Step 8, dividing the test cases by a dichotomy to generate 2 groups of new test cases, and storing the two groups into a temporary catalog of the generated test cases;
Step 9, dividing the file into 2 threads, respectively returning each new 4 files to step 2 in two threads, respectively, waiting for each other in step 4 by the two threads, jumping to step 10 if no error occurs in the two threads, if one thread detects the error, stopping the other thread, and jumping to step 5 by the thread which detects the error
Step 10: checking whether the file (not empty) exists in the temporary directory of the test case found to be wrong, recording the found smallest test case in the database, and if the temporary directory is empty, marking that no error is found to the test case in the database.
Step 11: this one detection cycle ends.
Based on the above-described method of automated differential analysis verification, the present embodiment provides a computer-readable storage medium storing one or more programs executable by one or more processors to implement the steps in the method of automated differential analysis verification as described in the above-described embodiments.
Based on the above method of automated differential analysis verification, the present invention also provides a terminal device, as shown in fig. 3, which includes at least one processor (processor) 20; a display screen 21; and a memory (memory) 22, which may also include a communication interface (Communications Interface) 23 and a bus 24. Wherein the processor 20, the display 21, the memory 22 and the communication interface 23 may communicate with each other via a bus 24. The display screen 21 is configured to display a user guidance interface preset in the initial setting mode. The communication interface 23 may transmit information. The processor 20 may invoke logic instructions in the memory 22 to perform the methods of the embodiments described above.
Further, the logic instructions in the memory 22 described above may be implemented in the form of software functional units and stored in a computer readable storage medium when sold or used as a stand alone product.
The memory 22, as a computer readable storage medium, may be configured to store a software program, a computer executable program, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 performs functional applications and data processing, i.e. implements the methods of the embodiments described above, by running software programs, instructions or modules stored in the memory 22.
The memory 22 may include a storage program area that may store an operating system, at least one application program required for functions, and a storage data area; the storage data area may store data created according to the use of the terminal device, etc. In addition, the memory 22 may include high-speed random access memory, and may also include nonvolatile memory. For example, a plurality of media capable of storing program codes such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or a transitory storage medium may be used.
In addition, the specific processes that the storage medium and the plurality of instruction processors in the terminal device load and execute are described in detail in the above method, and are not stated here.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (8)
1. A method of automated differential analysis verification, the method comprising:
acquiring a test case set, wherein the test case set comprises a plurality of test case sets, each test case set comprises a first test case and a second test case, and the second test case is obtained by adjusting the first test case according to a preset mode;
for each test case group, generating a reference test case group corresponding to the test case group according to preset attributes, wherein the preset attributes are functional attributes of a difference detection tool to be analyzed;
Determining a difference information set of the test case group based on a difference detection tool to be analyzed, wherein the difference information set comprises first difference information corresponding to the test case group and second difference information corresponding to a reference test case group;
generating a test report of the difference detection tool to be analyzed according to the difference information sets corresponding to the test case groups;
the generating the test report of the to-be-analyzed difference detection tool according to the difference information sets corresponding to the test case groups specifically comprises the following steps:
for each test case group, determining a test result corresponding to the test case group according to a difference information set of the test case group, wherein the test result comprises test success and test failure;
selecting all test case groups failing in test, and dividing each selected test case group into two sub test case groups;
updating the test case set according to all sub-test case groups obtained by dividing;
the dividing each selected test case group into two sub test case groups specifically includes:
dividing the first test case according to a dichotomy to obtain a first sub-test case and a second sub-test case;
Acquiring data information corresponding to the dividing position of the first test case;
dividing the second test case based on the data information to obtain a third sub-test case and a fourth sub-test case;
taking the first sub-test case and the third sub-test case as a group of test case groups, and taking the second sub-test case and the fourth sub-test case as a group of test case groups to obtain a sub-test case group A and a sub-test case group B; after generating the sub-test case group C and the sub-test case group D according to the preset attribute, testing again by using the group A+C and the group B+D so as to reduce the range of the part where the problem occurs.
2. The method of automated differential analysis verification according to claim 1, wherein the preset manner is to randomly perform a preset number of adjustment operations on the first test case, wherein the adjustment operations are one or more of adding, changing, and deleting operations.
3. The method for automated differential analysis and verification according to claim 2, wherein the process of adjusting the first test case in a preset manner specifically comprises:
acquiring a row number corresponding to the adjustment operation, wherein the row number is smaller than the total row number;
Judging whether the text data corresponding to the line number is in a locking state or not;
if the line number is not in the locking state, performing adjustment operation on the text data corresponding to the line number, and locking the line number, a previous line number of the line number and a next culture line number;
and continuing to execute the step of acquiring the row number corresponding to the adjustment operation until the adjustment times corresponding to the adjustment operation reach the preset times so as to obtain a second test case corresponding to the first test case.
4. The method of automated differential analysis verification according to claim 3, wherein the process of adjusting the first test case in a preset manner comprises:
if the line number is in the locked state, continuing to execute the step of acquiring the line number corresponding to the adjustment operation.
5. The method of automated differential analysis verification of claim 2, wherein the preset number of times is less than a total number of rows of the first test case.
6. The method of automated discrepancy analysis verification according to claim 1, wherein the preset attributes comprise one of discrepancy comparison, ignore space, ignore tab and space, minimum unit comparison, ignore carriage return, ignore case, line-by-line comparison, discrepancy, and speed up a search for a large document using heuristics.
7. A computer readable storage medium storing one or more programs executable by one or more processors to perform the steps in the automated differential analysis verification method of any of claims 1-6.
8. A terminal device, comprising: a processor, a memory, and a communication bus; the memory has stored thereon a computer readable program executable by the processor;
the communication bus realizes connection communication between the processor and the memory;
the processor, when executing the computer readable program, performs the steps in the method of automated differential analysis verification as defined in any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010489931.8A CN111858299B (en) | 2020-06-02 | 2020-06-02 | Automatic difference analysis and verification method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010489931.8A CN111858299B (en) | 2020-06-02 | 2020-06-02 | Automatic difference analysis and verification method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111858299A CN111858299A (en) | 2020-10-30 |
CN111858299B true CN111858299B (en) | 2023-06-16 |
Family
ID=72985832
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010489931.8A Active CN111858299B (en) | 2020-06-02 | 2020-06-02 | Automatic difference analysis and verification method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111858299B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006209179A (en) * | 2005-01-25 | 2006-08-10 | Fujitsu Ten Ltd | Model difference detection tool |
CN111124872A (en) * | 2018-10-31 | 2020-05-08 | 上海哔哩哔哩科技有限公司 | Branch detection method and device based on difference code analysis and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6745835B2 (en) * | 2002-08-01 | 2004-06-08 | Schlumberger Technology Corporation | Method and apparatus for pressure controlled downhole sampling |
-
2020
- 2020-06-02 CN CN202010489931.8A patent/CN111858299B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006209179A (en) * | 2005-01-25 | 2006-08-10 | Fujitsu Ten Ltd | Model difference detection tool |
CN111124872A (en) * | 2018-10-31 | 2020-05-08 | 上海哔哩哔哩科技有限公司 | Branch detection method and device based on difference code analysis and storage medium |
Non-Patent Citations (1)
Title |
---|
程序错误检测工具整合技术研究;王林刚;《中国优秀硕士学位论文全文数据库 (信息科技辑)》(第02期);I138-323 * |
Also Published As
Publication number | Publication date |
---|---|
CN111858299A (en) | 2020-10-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10489454B1 (en) | Indexing a dataset based on dataset tags and an ontology | |
CN111563051B (en) | Crawler-based data verification method and device, computer equipment and storage medium | |
CN110851308A (en) | Test method, test device, electronic equipment and storage medium | |
US11023540B2 (en) | Web page clustering method and device | |
US20180165179A1 (en) | Determining incompatibilities of automated test cases with modified user interfaces | |
US7809764B2 (en) | Method and apparatus for preserving dependancies during data transfer and replication | |
CN106407360B (en) | Data processing method and device | |
KR20190095099A (en) | Transaction system error detection method, apparatus, storage medium and computer device | |
US20230018381A1 (en) | Method for automatically identifying design changes in building information model | |
CN110837471B (en) | Test method, test device, server and storage medium | |
CN115757629A (en) | Multi-source heterogeneous data increment synchronization method and system, storage medium and electronic equipment | |
US20170329697A1 (en) | Detecting mistyped identifiers and suggesting corrections using other program identifiers | |
CN113505078B (en) | Configuration file updating method, device, equipment and storage medium | |
US10073852B2 (en) | Computer-readable storage medium, file management apparatus, and file management method | |
CN111858299B (en) | Automatic difference analysis and verification method | |
CN110532458B (en) | Method and device for determining search mode, server and storage medium | |
CN113312258A (en) | Interface testing method, device, equipment and storage medium | |
US12026141B2 (en) | Data storage system conflict management | |
CN111045948A (en) | Method, apparatus and storage medium for checking interface signal between modules | |
CN114153796A (en) | File abnormity detection method, device and system | |
CN112287027B (en) | Database synchronization method, device, equipment and storage medium | |
AU2017202199B1 (en) | Software integration testing with unstructured database | |
CN107704484B (en) | Webpage error information processing method and device, computer equipment and storage medium | |
US10095781B2 (en) | Reuse of documentation components when migrating into a content management system | |
US11720531B2 (en) | Automatic creation of database objects |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |