CN109254924A - A kind of software fault positioning method, device, equipment and readable storage medium storing program for executing - Google Patents
A kind of software fault positioning method, device, equipment and readable storage medium storing program for executing Download PDFInfo
- Publication number
- CN109254924A CN109254924A CN201811144869.8A CN201811144869A CN109254924A CN 109254924 A CN109254924 A CN 109254924A CN 201811144869 A CN201811144869 A CN 201811144869A CN 109254924 A CN109254924 A CN 109254924A
- Authority
- CN
- China
- Prior art keywords
- test case
- sentence
- failure
- covering
- program
- 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.)
- Granted
Links
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/362—Software debugging
- G06F11/3644—Software debugging by instrumenting at runtime
-
- 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
Abstract
The invention discloses a kind of software fault positioning methods, this method is during positioning the failure sentence in program to be tested, the Suspected Degree of the correct test case of each of test case set has been calculated first, and has calculated according to the Suspected Degree of all correct test cases the number of the correct test case of contingency in test case set;And according to the correct test case number of contingency, adjust separately the corresponding covering of every sentence and the successfully number of the number of test case and the test case of covering and failure, the failure sentence in program to be tested is positioned using Ochiai method again later, to reduce the difference of the failure doubtful value and true value of sentence, the accuracy for improving the breakdown judge of every sentence in program to be tested, also improves software fault location efficiency and the working efficiency of technical staff.Correspondingly, a kind of software fault positioning device, equipment and readable storage medium storing program for executing disclosed by the invention, similarly have above-mentioned technique effect.
Description
Technical field
The present invention relates to software testing technology field, more specifically to a kind of software fault positioning method, device,
Equipment and readable storage medium storing program for executing.
Background technique
Software test is tested according to testing scheme and process the function and performance of product using testing tool
Process.For tracking and positioning software fault, need program to be tested inputting a large amount of test case, for the execution knot of output
Fruit is analyzed and processed, and optimizes program to be tested, so that it is guaranteed that the product of exploitation is suitble to demand.
In the prior art, for the test case in the test case set of test program include correct test case and
Error checking use-case, and there are the correct test cases of contingency in correct test case.Existing research shows that contingency is correctly surveyed
Example on probation is generally existing in test case set, or even can account for 90% of test case or more.
The correct test case of contingency refers to the use-case with following features: its execution covers the failure language of program
Sentence, but the output of program is correct.According to PIE (Propagation Infection Execution) model: if
Test case triggers software failure, then must satisfy 3 conditions:
(1) test case goes to failure sentence;
(2) execution of failure sentence causes subsequent program internal state to malfunction;
(3) output that the internal state of mistake passes through propagation effect to program.
Accidental correctness test case only meets condition (1) and/or condition (2), is unsatisfactory for condition (3).Through analysis it is found that
The correct test case of contingency do not result in program error output the reason of have following two: test case covers failure sentence,
But mistake is not activated;Test case covers failure sentence, and mistake is activated, but because following situations causes
Mistake is embodied as the output to program: error result is by chance in the section that test case can successfully pass;Error result quilt
Subsequent sentence is rinsed or is covered.
At present during positioning fault of software, not in view of the correct test case of contingency is to the shadow of positioning result
It is loud, therefore the doubtful value of failure of the sentence of existing software fault positioning method determination is smaller compared with true value, to influence
The accuracy rate and efficiency of fault location.And existing software fault positioning method only considers the test case to run succeeded and execution
The test case of failure is different for the information content of fault location, and considers same test case to the fault location of different sentences
Effective information difference.
Therefore, how to weaken the negative influence that the correct test case of contingency positions software fault, be art technology
Personnel's problem to be solved.
Summary of the invention
The purpose of the present invention is to provide a kind of software fault positioning method, device, equipment and readable storage medium storing program for executing, to cut
The negative influence that the weak correct test case of contingency positions software fault.
To achieve the above object, the embodiment of the invention provides following technical solutions:
A kind of software fault positioning method, comprising:
Program and test case set to be tested is obtained, and to be measured with each testing case in test case set
Program is tried, the corresponding sentence spectrum of each test case and implementing result are obtained;
According to the sentence of acquisition spectrum and implementing result, determine respectively the corresponding covering of every sentence in program to be tested and
Successful test case, covering and failure test case, do not cover and successfully test case and do not cover and failure survey
Example on probation;
Determine the Suspected Degree of the correct test case of each of test case set, and according to all correct test cases
Suspected Degree calculates the number of the correct test case of contingency in test case set;
According to the number of the correct test case of contingency, the corresponding covering of every sentence and successfully test use are adjusted separately
The number of the test case of the number and covering and failure of example, and do not cover and successfully test use based on every sentence is corresponding
Example, do not cover and failure test case, it is adjusted covering and successfully test case and it is adjusted covering and failure
Test case positions the failure sentence in program to be tested using Ochiai method.
Wherein it is determined that the Suspected Degree of each correct test case of test case set, comprising:
For each correct test case, following step is respectively adopted and determines Suspected Degree:
The sentence spectrum and test case of the correct test case of target in test case set are calculated using Jaccard coefficient
The similarity of the sentence spectrum of each error checking use-case in set, obtains similarity set;
Determine the maximum similarity in similarity set, and using maximum similarity as the doubtful of the correct test case of target
Degree.
Wherein, the contingency in test case set is calculated according to the Suspected Degree of all correct test cases and correctly tests use
The number of example, comprising:
Using the sum of the Suspected Degree of all correct test cases as the number of the correct test case of contingency.
Wherein, according to the number of the correct test case of contingency, the corresponding covering of every sentence and successfully is adjusted separately
The number of the test case of the number and covering and failure of test case, comprising:
By the corresponding covering of every sentence and successfully the number of test case reduces survey that is N number of, and will covering and fail
The number of example on probation increases N number of, the number of the N expression correct test case of contingency.
Wherein, the failure sentence in program to be tested is positioned using Ochiai method, comprising:
The doubtful value of failure that every sentence is calculated using Ochiai method;
According to the doubtful value of failure size by program to be tested all sentence descendings or ascending order arrange, formed failure language
Sentence sequence, and according to failure statement sequence positioning failure sentence.
Wherein, further includes:
When the doubtful value of the failure of a plurality of sentence is identical, the doubtful value weight of the failure of every sentence is determined;
The doubtful value of failure for correcting every sentence using the doubtful value weight of the failure of every sentence, obtains multiple amendment failures
Doubtful value;
There is a plurality of sentence of the doubtful value of same fault according to the big minispread of the amendment doubtful value of failure.
Wherein it is determined that test case set is each before the Suspected Degree of correct test case, further includes:
The corresponding correction factor of every sentence is calculated, and every using the corresponding amendment of the corresponding correction factor of every execution sentence
A sentence spectrum.
A kind of software fault positioning device, comprising:
Module is obtained, for obtaining program and test case set to be tested, and with each survey in test case set
Example on probation tests program to be tested, obtains the corresponding sentence spectrum of each test case and implementing result;
Determining module, for determining every language in program to be tested respectively according to the sentence of acquisition spectrum and implementing result
The corresponding covering of sentence and successful test case, covering and the test case of failure do not cover and successful test case and not
The test case of covering and failure;
Computing module, for determining the Suspected Degree of the correct test case of each of test case set, and according to all
The Suspected Degree of correct test case calculates the number of the correct test case of contingency in test case set;
Locating module adjusts separately the corresponding covering of every sentence for the number according to the correct test case of contingency
And the successful number of the number of test case and the test case of covering and failure, and do not cover based on every sentence is corresponding
And successfully after test case, the test case for not covering and failing, covering adjusted and successful test case and adjustment
Covering and failure test case, the failure sentence in program to be tested is positioned using Ochiai method.
A kind of software fault positioning device, comprising:
Memory, for storing computer program;
Processor, the step of software fault positioning method of above-mentioned any one is realized when for executing computer program.
A kind of readable storage medium storing program for executing is stored with computer program on readable storage medium storing program for executing, and computer program is held by processor
The step of software fault positioning method of above-mentioned any one is realized when row.
By above scheme it is found that a kind of software fault positioning method provided in an embodiment of the present invention, comprising: obtain to be measured
It tries program and test case set, and with each testing case program to be tested in test case set, obtains each
The corresponding sentence spectrum of test case and implementing result;According to the sentence of acquisition spectrum and implementing result, program to be tested is determined respectively
In every sentence it is corresponding covering and successful test case, covering and failure test case, do not cover and successfully survey
Example on probation and the test case for not covering and failing;Determine the Suspected Degree of the correct test case of each of test case set,
And the number of the correct test case of contingency in test case set is calculated according to the Suspected Degree of all correct test cases;Root
According to the number of the correct test case of contingency, adjust separately the corresponding covering of every sentence and the successfully number of test case and
Covering and failure test case number, and based on every sentence it is corresponding do not cover and successfully test case, do not cover
And the test case of the test case of failure, covering adjusted and successful test case and covering adjusted and failure,
The failure sentence in program to be tested is positioned using Ochiai method.
It is used as it can be seen that the method during positioning the failure sentence in program to be tested, has calculated test first
The Suspected Degree of the correct test case of each of example set, and test has been calculated according to the Suspected Degree of all correct test cases
The number of the correct test case of contingency in use-case set;And it according to the correct test case number of contingency, adjusts separately
The corresponding covering of every sentence and the successfully number of the number of test case and the test case of covering and failure, are adopted again later
The failure sentence in program to be tested is positioned with Ochiai method, thus the difference of the failure for reducing sentence doubtful value and true value
It is different, improve the accuracy of the breakdown judge of every sentence in program to be tested, also improve software fault location efficiency and
The working efficiency of technical staff.
Correspondingly, a kind of software fault positioning device, equipment and readable storage medium storing program for executing provided in an embodiment of the present invention, also together
Sample has above-mentioned technique effect.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is a kind of software fault positioning method flow chart disclosed by the embodiments of the present invention;
Fig. 2 is another software fault positioning method flow chart disclosed by the embodiments of the present invention;
Fig. 3 is a kind of software fault positioning device schematic diagram disclosed by the embodiments of the present invention;
Fig. 4 is a kind of software fault positioning device schematic diagram disclosed by the embodiments of the present invention;
Fig. 5 is a kind of test case set schematic diagram disclosed by the embodiments of the present invention;
Fig. 6 is a kind of software fault positioning method flow chart disclosed by the embodiments of the present invention;
Fig. 7 is a kind of sentence spectrum amendment flow chart disclosed by the embodiments of the present invention;
Fig. 8 is a kind of flow chart of the determining correct test case number of contingency disclosed by the embodiments of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a kind of software fault positioning method, device, equipment and readable storage medium storing program for executing, to weaken
The negative influence that the correct test case of contingency positions software fault.
Referring to Fig. 1, a kind of software fault positioning method provided in an embodiment of the present invention, comprising:
S101, program and test case set to be tested are obtained, and is surveyed with each test case in test case set
Program to be tested is tried, the corresponding sentence spectrum of each test case and implementing result are obtained;
It should be noted that test case set is made of correct test case and error checking use-case, wherein correct survey
It include the correct test case of contingency in example on probation.Journey to be tested is executed one by one with each test case in test case set
Sequence, and record each test case with preset overlay marks value and treat whether every sentence in test program covers, and
Corresponding implementing result.
Wherein, correct test case is the test case that runs succeeded, comprising: covering and successfully test case and is not covered
Lid and successful test case;Error checking use-case is the test case for executing failure, comprising: the test case of covering and failure
The test case for not covering and failing.
Such as: include tri- sentences of A, B, C in program to be tested, includes that tri- tests of a, b, c are used in test case set
Example;The mark value for indicating covering current statement with 1, use 0 indicate the mark value for not covering current statement;Test case a, b, c are held
The implementing result of capable program to be measured is respectively as follows: successfully, unsuccessfully, successfully;So test case a, b, c corresponding sentence spectrum and
Implementing result is as follows:
The corresponding sentence spectrum of test case a is { 1,1,0 }, indicates that test case a covers the sentence A in program to be tested
And B, sentence C is not covered;Entire test case a treats the implementing result of ranging sequence are as follows: success;
The corresponding sentence spectrum of test case b is { 1,0,0 }, indicates that test case b covers the sentence in program to be tested
A does not cover sentence B and C;Entire test case b treats the implementing result of ranging sequence are as follows: failure;
The corresponding sentence spectrum of test case c is { 0,1,1 }, indicates that test case c covers the sentence B in program to be tested
And C, sentence A is not covered;Entire test case c treats the implementing result of ranging sequence are as follows: success.
To sum up, after executing program to be tested with test case a, b, c, obtained test case with it is each in program to be tested
The relationship of sentence can refer to following table:
S102, according to the sentence of acquisition spectrum and implementing result, determine that every sentence in program to be tested is corresponding respectively
Covering and successful test case, covering and the test case of failure do not cover and successfully test case and do not cover and lose
The test case lost;
In conjunction with examples detailed above, the corresponding covering of sentence A, B, C and successful test case in program to be tested are covered
Lid and failure test case, do not cover and successfully test case and do not cover and failure test case it is as follows:
The corresponding covering of sentence A and successful test case are as follows: the test case of test case a, covering and failure are as follows: survey
Example b on probation, does not cover and successful test case are as follows: test case c, without not covering and the test case of failure;
The corresponding covering of sentence B and successful test case are as follows: test case a and test case c, no covering and failure
Test case, nothing does not cover and successful test case, the test case for not covering and failing are as follows: test case b;
The corresponding covering of sentence C and successful test case are as follows: the test case of test case c, no covering and failure, not
Covering and successful test case are as follows: test case a, the test case for not covering and failing are as follows: test case b.
The Suspected Degree of S103, the correct test case that each of determines test case set, and according to all correct tests
The Suspected Degree of use-case calculates the number of the correct test case of contingency in test case set;
In the present embodiment, for each correct test case, each of itself and test case set mistake is calculated and is surveyed
Maximum similarity, is determined as the Suspected Degree of correct test case by the similarity of example on probation.Since test case set is in the presence of more
A correct test case, and each correct test case is corresponding with a maximum similarity, i.e. Suspected Degree, by all correct surveys
Number of the sum of the Suspected Degree of example on probation as the correct test case of contingency in test case set.
S104, according to the correct test case number of contingency, adjust separately the corresponding covering of every sentence and successfully survey
The number of the test case of the number and covering and failure of example on probation;
S105, based on every sentence it is corresponding do not cover and successfully test case, do not cover and failure test case,
The test case of covering adjusted and successfully test case and covering adjusted and failure, is positioned using Ochiai method
Failure sentence in program to be tested.
Specifically, according to the correct test case number of contingency, the corresponding covering of every sentence and successfully is adjusted separately
The number of the test case of the number and covering and failure of test case, positions program to be tested using Ochiai method again later
In failure sentence, so as to weaken the negative influence that the correct test case of contingency positions software fault.
As it can be seen that present embodiments providing a kind of software fault positioning method, the method is in positioning program to be tested
During failure sentence, the Suspected Degree of the correct test case of each of test case set has been calculated first, and according to
The Suspected Degree of all correct test cases has calculated the number of the correct test case of contingency in test case set;And
According to the correct test case number of contingency, adjust separately the corresponding covering of every sentence and the successfully number of test case and
The number of the test case of covering and failure positions the failure sentence in program to be tested using Ochiai method again later, from
And the difference for the failure doubtful value and true value for reducing sentence, improve the breakdown judge of every sentence in program to be tested
Accuracy, also improve software fault location efficiency and the working efficiency of technical staff.
The embodiment of the invention discloses another software fault positioning methods, relative to a upper embodiment, the present embodiment pair
Technical solution has made further instruction and optimization.
Referring to fig. 2, another software fault positioning method provided in an embodiment of the present invention, comprising:
S201, program and test case set to be tested are obtained, and is surveyed with each test case in test case set
Program to be tested is tried, the corresponding sentence spectrum of each test case and implementing result are obtained;
S202, according to the sentence of acquisition spectrum and implementing result, determine that every sentence in program to be tested is corresponding respectively
Covering and successful test case, covering and the test case of failure do not cover and successfully test case and do not cover and lose
The test case lost;
S203, the corresponding correction factor of every sentence is calculated, and corresponding using the corresponding correction factor of every execution sentence
Correct each sentence spectrum;
In the present embodiment, in order to more precisely distinguish contingency test case, each correct test case is being determined
Suspected Degree before, correct each sentence spectrum first.Specifically: the corresponding correction factor of every sentence is calculated, and utilizes calculating
Obtained correction factor corrects the overlay marks value in each sentence spectrum, to obtain revised sentence spectrum.
For every sentence, correction factor is calculated using following step;Object statement in program to be tested is corresponding
The ratio of the number of the number and failure testing use-case of the test case of covering and failure, is determined as the corresponding amendment of object statement
Coefficient;Wherein, failure testing use-case includes: the test case of the test case and covering and failure that do not cover and fail.
Such as: for test case tiThe sentence E of coveringj, according to the following equation to Ps (ti) be modified, generate amendment
Sentence composes Ps+(ti)=(c1, c2..., cj..., cm)。
As correction factor.
Wherein, tiIndicate some test case, test case t before correctingiCorresponding sentence spectrum are as follows: Ps (ti)={ e1,
e2..., ej..., em, ejThe value of (1≤j≤m) is 0,1, indicates test case tiWhether sentence E is coveredj, EjIndicate a certain item
Sentence, ejIndicate the overlay marks value of every sentence, cjIndicate revised overlay marks value.
nfIndicate the number of failure testing use-case, ncf(ej) indicate covering sentence EjFailure testing use-case number, nuf
(ej) indicate not covering sentence EjFailure testing use-case number.
S204, the Suspected Degree for determining the correct test case of each of test case set is composed according to revised sentence,
And the number of the correct test case of contingency in test case set is calculated according to the Suspected Degree of all correct test cases;
S205, according to the correct test case number of contingency, adjust separately the corresponding covering of every sentence and successfully survey
The number of the test case of the number and covering and failure of example on probation;
S206, based on every sentence it is corresponding do not cover and successfully test case, do not cover and failure test case,
The test case of covering adjusted and successfully test case and covering adjusted and failure, is positioned using Ochiai method
Failure sentence in program to be tested.
As it can be seen that present embodiments providing another software fault positioning method, the method is in positioning program to be tested
Failure sentence during, first to sentence spectrum be corrected, and according to revised sentence spectrum calculated test use
The Suspected Degree of the correct test case of each of example set, and test has been calculated according to the Suspected Degree of all correct test cases
The number of the correct test case of contingency in use-case set;And it according to the correct test case number of contingency, adjusts separately
The corresponding covering of every sentence and the successfully number of the number of test case and the test case of covering and failure, are adopted again later
The failure sentence in program to be tested is positioned with Ochiai method, thus the difference of the failure for reducing sentence doubtful value and true value
It is different, improve the accuracy of the breakdown judge of every sentence in program to be tested, also improve software fault location efficiency and
The working efficiency of technical staff.
Based on above-mentioned any embodiment, it should be noted that determine test case set each correct test case doubt
Like degree, comprising:
For each correct test case, following step is respectively adopted and determines Suspected Degree:
The sentence spectrum and test case of the correct test case of target in test case set are calculated using Jaccard coefficient
The similarity of the sentence spectrum of each error checking use-case in set, obtains similarity set;
Determine the maximum similarity in similarity set, and using maximum similarity as the doubtful of the correct test case of target
Degree.
Specifically, calculating Pc with generalized J accard coefficient+(ti) and Pc+(tj) similarity, as test case tiWith tj
Similarity degree measurement, i.e. similarity Sim (ti, tj) value, calculating formula of similarity are as follows:
Wherein, Pc+(ti) indicate the corresponding amendment sentence spectrum of correct test case, Pc+(tj) indicate error checking use-case pair
The amendment sentence spectrum answered.
Based on above-mentioned any embodiment, it should be noted that calculated and tested according to the Suspected Degree of all correct test cases
The number of the correct test case of contingency in use-case set, comprising:
Using the sum of the Suspected Degree of all correct test cases as the number of the correct test case of contingency.
For correct test case ti(1≤i≤n), tiFor the Suspected Degree Scc (t of the correct test case of contingencyi) it is ti
With the maximum value of the similarity of all error checking use-cases, Suspected Degree Scc (ti) calculation formula are as follows:
Based on above-mentioned any embodiment, it should be noted that according to the number of the correct test case of contingency, adjust separately
The corresponding covering of every sentence and the successfully number of the number of test case and the test case of covering and failure, comprising:
By the corresponding covering of every sentence and successfully the number of test case reduces survey that is N number of, and will covering and fail
The number of example on probation increases N number of, the number of the N expression correct test case of contingency.
Based on above-mentioned any embodiment, it should be noted that position the failure in program to be tested using Ochiai method
Sentence, comprising:
The doubtful value of failure that every sentence is calculated using Ochiai method;
According to the doubtful value of failure size by program to be tested all sentence descendings or ascending order arrange, formed failure language
Sentence sequence, and according to failure statement sequence positioning failure sentence.
It should be noted that in order to make technical staff determine the failure sentence in program to be tested as early as possible, in practical application
When, all sentences are subjected to descending arrangement generally according to the size of the doubtful value of failure.
Based on above-mentioned any embodiment, it should be noted that further include:
When the doubtful value of the failure of a plurality of sentence is identical, the doubtful value weight of the failure of every sentence is determined;
The doubtful value of failure for correcting every sentence using the doubtful value weight of the failure of every sentence, obtains multiple amendment failures
Doubtful value;
There is a plurality of sentence of the doubtful value of same fault according to the big minispread of the amendment doubtful value of failure.
It should be noted that not changing the doubtful value of failure using the doubtful value weight amendment doubtful value of failure of failure
Size, but in order to which the fault degree for identifying a plurality of sentence with the doubtful value of same fault based on the amendment doubtful value of failure is big
It is small.
A kind of software fault positioning device provided in an embodiment of the present invention is introduced below, one kind described below is soft
Part fault locator can be cross-referenced with a kind of above-described software fault positioning method.
Referring to Fig. 3, a kind of software fault positioning device provided in an embodiment of the present invention, comprising:
Module 301 is obtained, for obtaining program and test case set to be tested, and with each of test case set
Testing case program to be tested obtains the corresponding sentence spectrum of each test case and implementing result;
Determining module 302, for determining every in program to be tested respectively according to the sentence of acquisition spectrum and implementing result
Sentence it is corresponding covering and successful test case, covering and failure test case, do not cover and successfully test case and
The test case for not covering and failing;
Computing module 303, for determining the Suspected Degree of the correct test case of each of test case set, and according to institute
There is the Suspected Degree of correct test case to calculate the number of the correct test case of contingency in test case set;
Locating module 304 adjusts separately that every sentence is corresponding to be covered for the number according to the correct test case of contingency
Lid and the successfully number of the number of test case and the test case of covering and failure, and do not cover based on every sentence is corresponding
Lid and successfully test case, the test case for not covering and failing, covering adjusted and successfully test case and adjustment
The test case of covering and failure afterwards, the failure sentence in program to be tested is positioned using Ochiai method.
Wherein, computing module includes:
Computing unit is calculated in test case set for being directed to each correct test case using Jaccard coefficient
The similarity of the sentence spectrum of the sentence spectrum and each error checking use-case in test case set of the correct test case of target, obtains
To similarity set;
Determination unit, for determining the maximum similarity in similarity set, and it is correct using maximum similarity as target
The Suspected Degree of test case.
Wherein, computing module is specifically used for:
Using the sum of the Suspected Degree of all correct test cases as the number of the correct test case of contingency.
Wherein, locating module is specifically used for:
By the corresponding covering of every sentence and successfully the number of test case reduces survey that is N number of, and will covering and fail
The number of example on probation increases N number of, the number of the N expression correct test case of contingency.
Wherein, locating module includes:
The doubtful value computing unit of failure, for calculating the doubtful value of failure of every sentence using Ochiai method;
Positioning unit, for the size according to the doubtful value of failure by program to be tested all sentence descendings or ascending order arrange
Column form failure statement sequence, and according to failure statement sequence positioning failure sentence.
Wherein, further includes:
Weight calculation module, for determining that the failure of every sentence is doubtful when the doubtful value of the failure of a plurality of sentence is identical
It is worth weight;
The doubtful value correction module of failure corrects the failure of every sentence for the doubtful value weight of failure using every sentence
Doubtful value obtains the doubtful value of multiple amendment failures;
Module is arranged, for having a plurality of language of the doubtful value of same fault according to the big minispread of the amendment doubtful value of failure
Sentence.
Wherein, further includes:
Correction module for calculating the corresponding correction factor of every sentence, and utilizes the corresponding amendment of every execution sentence
Coefficient is corresponding to correct each sentence spectrum.
As it can be seen that present embodiments providing a kind of software fault positioning device, comprising: receiving module, first judgment module with
And monitoring modular.Share out the work and help one another between modules, Each performs its own functions, thus the doubtful value of the failure for reducing sentence and true value
Difference improves the accuracy of the breakdown judge of every sentence in program to be tested, also improves software fault location efficiency
With the working efficiency of technical staff.
A kind of software fault positioning device provided in an embodiment of the present invention is introduced below, one kind described below is soft
Part FLU Fault Location Unit can be cross-referenced with a kind of above-described software fault positioning method and device.
Referring to fig. 4, a kind of software fault positioning device provided in an embodiment of the present invention, comprising:
Memory 401, for storing computer program;
Processor 402 realizes that software fault described in above-mentioned any embodiment is fixed when for executing the computer program
The step of position method.
A kind of readable storage medium storing program for executing provided in an embodiment of the present invention is introduced below, one kind described below is readable to deposit
Storage media can be cross-referenced with a kind of above-described software fault positioning method, device and equipment.
A kind of readable storage medium storing program for executing is stored with computer program, the computer program quilt on the readable storage medium storing program for executing
The step of software fault positioning method as described in above-mentioned any embodiment is realized when processor executes.
The third software fault positioning method provided in an embodiment of the present invention is introduced below, software described below
Fault Locating Method can be cross-referenced with above description any embodiment.
Fig. 5 is referred to, Fig. 5 is test case set schematic diagram provided in this embodiment;Fig. 6 is referred to, Fig. 6 is this implementation
The software fault positioning method flow chart that example provides.
1, correlated variables defines:
Program to be tested P={ E1, E2..., EmIndicate.Wherein, Ei(1≤i≤m) indicates i-th of program entity, i.e.,
Statement entity, m indicate the number of the program entity of configuration program.T={ t1, t2..., tn}: indicate the set of test case.Its
In, ti(1≤i≤n) indicates i-th of test case.
Test case ti(1≤i≤n) executes the sentence spectrum Ps (t generatedi)={ e1, e2..., ej..., emIndicate.Its
In, ej(1≤j≤m) indicates tiWhether sentence E is coveredjIf tiCover sentence Ej, then ejValue is 1, otherwise ejValue is 0.
Pc(ti) indicate test case tiThe set of the sentence of (1≤i≤n) covering, Pc (ti) calculation formula are as follows:
TpIndicate successfully test use cases, that is, the set of the test case to run succeeded.
npIndicate the number of successfully test case, i.e. np=| Tp|。
TfIt indicates failure testing set of uses case, that is, executes the set of the test case of failure.
nfIndicate the number of failure testing use-case, i.e. nf=| Tf|。nuf(s): indicating that the failure testing for not covering sentence s is used
The number of example.
ncp(s) number of the successful test case of covering sentence s, n are indicatedcpIt (s) is the natural number in section [0, n].It is false
If s=Ek, then ncp(s) calculation formula are as follows:
ncf(s) number of the failure testing use-case of covering sentence s, n are indicatedcfIt (s) is the natural number in section [0, n].It is false
If s=Ek, then ncf(s) calculation formula are as follows:
nup(s) number for not covering the successful test case of sentence s, n are indicatedupIt (s) is the natural number in section [0, n].
Assuming that s=Ek, then nup(s) calculation formula are as follows:
nuf(s) number for not covering the failure testing use-case of sentence s, n are indicatedufIt (s) is the natural number in section [0, n].
Assuming that s=Ek, then nuf(s) calculation formula are as follows:
Ps+(ti)=(c1, c2..., cj..., cm): it indicates to be directed to test case tiThe sentence of (1≤i≤n) composes Ps (ti)=
{e1, e2..., ej..., emThe amendment sentence spectrum that generates after processing.
Pc+(ti) indicate test case t in amendment sentence spectrumiThe set of the sentence of (1≤i≤n) covering, i.e. Pc+(ti)
Calculation formula are as follows:
Sim(ti, tj) indicate test case ti(1≤i≤n) and tjThe similarity of (1≤j≤n).
Scc(ti) indicate successfully test case ti(1≤i≤n) is the Suspected Degree of the correct test case of contingency.Contingency
The relationship for surveying use-case and other use-cases is detailed in Fig. 1.
nci(s) the " a of the correct test case of contingency of the covering sentence s identified according to the method for the invention is indicated
Number ", nciIt (s) is the real number in section [0, n].
Susp (s) indicates that the suspicious degree of sentence s, the i.e. doubtful value of failure, reflection sentence s are the suspicious degree of failure sentence,
Value range is [0,1].
2, the specific implementation step of software fault positioning method provided in this embodiment are as follows:
A, it is composed for Program Generating sentence to be tested:
For test case ti, with Ps (ti)={ e1, e2..., ej..., emIndicate test case tiCorresponding sentence spectrum,
eiThe value of (1≤j≤m) is 0,1, indicates test case tiWhether sentence E is coveredj.For each test in test use cases T
Use-case generates its corresponding sentence spectrum.
B, processing is carried out to sentence spectrum and generates amendment sentence spectrum:
In order to precisely identify the correct test case of contingency, for test case tiThe sentence E of coveringj, according to the following equation
To Ps (ti) it is modified generation Ps+(ti)=(c1, c2..., cj..., cm), sentence spectrum makeover process refers to Fig. 7.
For each test case in test use cases T, its corresponding amendment sentence spectrum is generated.
C, the Suspected Degree that successfully test case is contingency success test case is measured.
By the characteristic of contingency success test case it is found that can not accurately determine whether certain success test case is contingency
Success test case, the method for the invention is on the basis of correcting sentence spectrum, for each success test case (i.e. institute above
The correct test case stated), itself and each failure testing use-case (i.e. previously described mistake are measured using generalized J accard coefficient
Accidentally test case) similarity, taking the maximum value of similarity as the success test case is contingency successfully test case
Suspected Degree.
Pc is calculated with generalized J accard coefficient+(ti) and Pc+(tj) similarity, as test case tiWith tjIt is similar
The measurement of degree, i.e. similarity Sim (ti, tj) value, calculating formula of similarity are as follows:
For success test case ti(1≤i≤n), tiFor the Suspected Degree Scc (t of contingency success test casei) it is ti
With the maximum value of the similarity of all failure testing use-cases, Suspected Degree Scc (ti) calculation formula are as follows:
D, software fault positioning is carried out for amendment sentence spectrum using Ochiai software fault positioning method.
1) it is directed to sentence s, utilizes the formula of the suspicious degree of Ochiai method computing statement are as follows:
2) calculating process of above-mentioned Suspected Degree is combined, the calculating process of the correct test case number of contingency refers to Fig. 8.
Wherein, the number n of the correct test case of contingencyci(s) it indicates, its calculation formula is:
3) the correct test case of contingency is rejected from the test case of success and covering, and as failure and covered
The test case of lid is handled, it may be assumed that by nci(s) from ncp(s) it rejects, and by nci(s) it is added to ncf(s) in, then utilizing
The formula of the suspicious degree of Ochiai method computing statement is corrected are as follows:
4) by the suspicious angle value of all sentences according to revised Ochiai+(s) after the completion of calculating, by sentence according to suspicious
Angle value size is ranked up, and obtains software fault positioning reporting.
Wherein, sentence identical for suspicious angle value determines the doubtful value weight of the failure of every sentence;Utilize every sentence
The doubtful value weight of the failure doubtful value of failure (i.e. suspicious degree) of correcting every sentence, obtain the doubtful value of multiple amendment failures;It presses
There is a plurality of sentence of the doubtful value of same fault according to the big minispread of the amendment doubtful value of failure.
Wherein, the calculation formula of weight are as follows:Using the weight being calculated and the product of suspicious degree as amendment event
Hinder doubtful value.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with other
The difference of embodiment, the same or similar parts in each embodiment may refer to each other.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention.
Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention
It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one
The widest scope of cause.
Claims (10)
1. a kind of software fault positioning method characterized by comprising
Program and test case set to be tested is obtained, and described in each testing case in the test case set
Program to be tested obtains the corresponding sentence spectrum of each test case and implementing result;
According to the sentence of acquisition spectrum and implementing result, determine respectively the corresponding covering of every sentence in the program to be tested and
Successful test case, covering and failure test case, do not cover and successfully test case and do not cover and failure survey
Example on probation;
Determine the Suspected Degree of the correct test case of each of the test case set, and according to all correct test cases
Suspected Degree calculates the number of the correct test case of contingency in the test case set;
According to the number of the correct test case of the contingency, the corresponding covering of every sentence and successfully test use are adjusted separately
The number of the test case of the number and covering and failure of example, and do not cover and successfully test use based on every sentence is corresponding
Example, do not cover and failure test case, it is adjusted covering and successfully test case and it is adjusted covering and failure
Test case positions the failure sentence in the program to be tested using Ochiai method.
2. software fault positioning method according to claim 1, which is characterized in that the determination test case set
The Suspected Degree of each correct test case, comprising:
For each correct test case, following step is respectively adopted and determines Suspected Degree:
The sentence spectrum and the test of the correct test case of target in the test case set are calculated using Jaccard coefficient
The similarity of the sentence spectrum of each error checking use-case in use-case set, obtains similarity set;
It determines the maximum similarity in the similarity set, and correctly tests use for the maximum similarity as the target
The Suspected Degree of example.
3. software fault positioning method according to claim 2, which is characterized in that described according to all correct test cases
Suspected Degree calculate the number of the correct test case of contingency in the test case set, comprising:
Using the sum of the Suspected Degree of all correct test cases as the number of the correct test case of the contingency.
4. software fault positioning method according to claim 3, which is characterized in that described correctly to be surveyed according to the contingency
The number of example on probation adjusts separately the corresponding covering of every sentence and the successfully survey of the number of test case and covering and failure
The number of example on probation, comprising:
By every sentence it is corresponding covering and successfully test case number reduce it is N number of, and will covering and failure test use
The number increase of example is N number of, and N indicates the number of the correct test case of the contingency.
5. software fault positioning method according to claim 4, which is characterized in that described to position institute using Ochiai method
State the failure sentence in program to be tested, comprising:
The doubtful value of failure that every sentence is calculated using Ochiai method;
According to the doubtful value of failure size by the program to be tested all sentence descendings or ascending order arrange, formed failure language
Sentence sequence, and the failure sentence is positioned according to the failure statement sequence.
6. software fault positioning method according to claim 1, which is characterized in that further include:
When the doubtful value of the failure of a plurality of sentence is identical, the doubtful value weight of the failure of every sentence is determined;
It is doubtful to obtain multiple amendment failures for the doubtful value of failure for correcting every sentence using the doubtful value weight of the failure of every sentence
Value;
There is a plurality of sentence of the doubtful value of same fault according to the big minispread of the amendment doubtful value of failure.
7. software fault positioning method described in -6 any one according to claim 1, which is characterized in that the determination survey
Example set on probation is each before the Suspected Degree of correct test case, further includes:
The corresponding correction factor of every sentence is calculated, and corrects each language using the corresponding correction factor of every execution sentence is corresponding
Sentence spectrum.
8. a kind of software fault positioning device characterized by comprising
Module is obtained, for obtaining program and test case set to be tested, and with each survey in the test case set
Example on probation tests the program to be tested, obtains the corresponding sentence spectrum of each test case and implementing result;
Determining module, for determining every language in the program to be tested respectively according to the sentence of acquisition spectrum and implementing result
The corresponding covering of sentence and successful test case, covering and the test case of failure do not cover and successful test case and not
The test case of covering and failure;
Computing module, for determining the Suspected Degree of the correct test case of each of the test case set, and according to all
The Suspected Degree of correct test case calculates the number of the correct test case of contingency in the test case set;
Locating module adjusts separately the corresponding covering of every sentence for the number according to the correct test case of the contingency
And the successful number of the number of test case and the test case of covering and failure, and do not cover based on every sentence is corresponding
And successfully after test case, the test case for not covering and failing, covering adjusted and successful test case and adjustment
Covering and failure test case, the failure sentence in the program to be tested is positioned using Ochiai method.
9. a kind of software fault positioning device characterized by comprising
Memory, for storing computer program;
Processor realizes that the software fault as described in claim 1-7 any one is fixed when for executing the computer program
The step of position method.
10. a kind of readable storage medium storing program for executing, which is characterized in that be stored with computer program, the meter on the readable storage medium storing program for executing
The step of software fault positioning method as described in claim 1-7 any one is realized when calculation machine program is executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811144869.8A CN109254924B (en) | 2018-09-28 | 2018-09-28 | Software fault positioning method, device, equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811144869.8A CN109254924B (en) | 2018-09-28 | 2018-09-28 | Software fault positioning method, device, equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109254924A true CN109254924A (en) | 2019-01-22 |
CN109254924B CN109254924B (en) | 2022-02-08 |
Family
ID=65048461
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811144869.8A Active CN109254924B (en) | 2018-09-28 | 2018-09-28 | Software fault positioning method, device, equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109254924B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110209573A (en) * | 2019-05-08 | 2019-09-06 | 三峡大学 | A method of enhancing software fault locating effect |
CN110362484A (en) * | 2019-07-03 | 2019-10-22 | 北京航空航天大学 | Localization method, device, electronic equipment and the storage medium of software multiple faults |
CN110688310A (en) * | 2019-09-20 | 2020-01-14 | 中国人民解放军63921部队 | Software test case distance calculation method based on attraction |
CN115185814A (en) * | 2022-06-13 | 2022-10-14 | 中南大学 | Multi-defect positioning method, system and equipment based on two-dimensional program frequency spectrum |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102193864A (en) * | 2011-05-13 | 2011-09-21 | 南京大学 | Test case set optimization method of coverage-based error positioning technology |
CN102915271A (en) * | 2012-10-31 | 2013-02-06 | 北京邮电大学 | Method for optimizing unit regression test case set based on control flow diagram |
CN106909502A (en) * | 2017-01-13 | 2017-06-30 | 河南工业大学 | Accidental correctness test case recognition methods and software error localization method |
CN107992426A (en) * | 2017-12-26 | 2018-05-04 | 河南工业大学 | A kind of software error localization method excavated based on Frequent tree mining and processing unit |
CN108415848A (en) * | 2018-05-14 | 2018-08-17 | 河南工业大学 | A kind of software error localization method and device |
-
2018
- 2018-09-28 CN CN201811144869.8A patent/CN109254924B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102193864A (en) * | 2011-05-13 | 2011-09-21 | 南京大学 | Test case set optimization method of coverage-based error positioning technology |
CN102915271A (en) * | 2012-10-31 | 2013-02-06 | 北京邮电大学 | Method for optimizing unit regression test case set based on control flow diagram |
CN106909502A (en) * | 2017-01-13 | 2017-06-30 | 河南工业大学 | Accidental correctness test case recognition methods and software error localization method |
CN107992426A (en) * | 2017-12-26 | 2018-05-04 | 河南工业大学 | A kind of software error localization method excavated based on Frequent tree mining and processing unit |
CN108415848A (en) * | 2018-05-14 | 2018-08-17 | 河南工业大学 | A kind of software error localization method and device |
Non-Patent Citations (3)
Title |
---|
李登辉: "基于偶然正确测试用例识别的错误定位方法", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
王琦等: "基于程序变异分析的软件错误定位", 《计算机工程》 * |
贺韬等: "一种基于程序变异的软件错误定位技术", 《计算机学报》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110209573A (en) * | 2019-05-08 | 2019-09-06 | 三峡大学 | A method of enhancing software fault locating effect |
CN110209573B (en) * | 2019-05-08 | 2023-06-02 | 三峡大学 | Method for enhancing software fault positioning effect |
CN110362484A (en) * | 2019-07-03 | 2019-10-22 | 北京航空航天大学 | Localization method, device, electronic equipment and the storage medium of software multiple faults |
CN110688310A (en) * | 2019-09-20 | 2020-01-14 | 中国人民解放军63921部队 | Software test case distance calculation method based on attraction |
CN115185814A (en) * | 2022-06-13 | 2022-10-14 | 中南大学 | Multi-defect positioning method, system and equipment based on two-dimensional program frequency spectrum |
Also Published As
Publication number | Publication date |
---|---|
CN109254924B (en) | 2022-02-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109254924A (en) | A kind of software fault positioning method, device, equipment and readable storage medium storing program for executing | |
CN104182335B (en) | Method for testing software and device | |
CN101866316B (en) | Software defect positioning method based on relative redundant test set reduction | |
CN103995780B (en) | A kind of program error localization method based on sentence frequency statistics | |
US20160369777A1 (en) | System and method for detecting anomaly conditions of sensor attached devices | |
US7953577B2 (en) | Method and apparatus for improved fault detection in power generation equipment | |
CN109587001A (en) | A kind of performance indicator method for detecting abnormality and device | |
AU2012272906B2 (en) | System and method for determining an optimum QC strategy for immediate release results | |
CN104794059A (en) | Defect positioning method and device based on function calling records | |
US10761961B2 (en) | Identification of software program fault locations | |
CN105630670A (en) | Code coverage rate test method and device | |
CN115168868B (en) | Business vulnerability analysis method and server applied to artificial intelligence | |
CN117436024A (en) | Fault diagnosis method and system based on drilling machine operation data analysis | |
CN101201787A (en) | System and method for debugging software program | |
CN106776283A (en) | A kind of program error localization method based on conditional probability | |
CN103019943B (en) | Software error positioning method catering to rare case of failed test cases | |
WO2022033224A1 (en) | Human reliability evaluation method and system, and computer device and storage medium | |
CN105159826B (en) | A kind of method and apparatus of wrong sentence in positioning target program | |
CN110515752A (en) | A kind of disk unit life-span prediction method and device | |
US20210318879A1 (en) | Instruction execution method, device, and electronic equipment | |
CN110457183A (en) | A kind of log processing method and device | |
CN115408927A (en) | Data processing method and device for predicting rock mass parameters | |
CN104899371B (en) | Survey of Transmission Line method and device | |
CN104950852A (en) | Data verification system and data verification method of energy management and control system of tobacco enterprise | |
CN106339288B (en) | A kind of method and device of software fault context positioning |
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 |