CN110232023A - A kind of software defect positioning method based on convolutional neural networks, device and medium - Google Patents

A kind of software defect positioning method based on convolutional neural networks, device and medium Download PDF

Info

Publication number
CN110232023A
CN110232023A CN201910429282.XA CN201910429282A CN110232023A CN 110232023 A CN110232023 A CN 110232023A CN 201910429282 A CN201910429282 A CN 201910429282A CN 110232023 A CN110232023 A CN 110232023A
Authority
CN
China
Prior art keywords
sentence
convolutional neural
test
neural networks
coverage information
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
Application number
CN201910429282.XA
Other languages
Chinese (zh)
Other versions
CN110232023B (en
Inventor
宋元章
李洪雨
陈媛
王俊杰
王安邦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changchun Institute of Optics Fine Mechanics and Physics of CAS
Original Assignee
Changchun Institute of Optics Fine Mechanics and Physics of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Changchun Institute of Optics Fine Mechanics and Physics of CAS filed Critical Changchun Institute of Optics Fine Mechanics and Physics of CAS
Priority to CN201910429282.XA priority Critical patent/CN110232023B/en
Publication of CN110232023A publication Critical patent/CN110232023A/en
Application granted granted Critical
Publication of CN110232023B publication Critical patent/CN110232023B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a kind of software defect positioning method based on convolutional neural networks, device and computer readable storage mediums, it calls preset test case to treat test program to be tested, generates the one-dimensional sentence coverage information of test case and the implementing result of test case;According to the transformation rule of setting, two-dimentional sentence coverage information is converted by the one-dimensional sentence coverage information of test case;Initial convolutional neural networks are trained using two-dimentional sentence coverage information and its corresponding implementing result as sample data, obtain the convolutional neural networks for meeting preset requirement;The incidence relation between the one-dimensional sentence coverage information of test case and implementing result is sufficiently excavated by convolutional neural networks, effectively improve the accuracy that convolutional neural networks position software defect, test program is treated according to convolutional neural networks to be handled, to obtain the suspicious angle value of each sentence in program to be tested, so that the suspicious angle value predicted is more accurate.

Description

A kind of software defect positioning method based on convolutional neural networks, device and medium
Technical field
The present invention relates to software testing technology fields, fixed more particularly to a kind of software defect based on convolutional neural networks Position method, apparatus and computer readable storage medium.
Background technique
Software defect positioning is intended to detect and search the error code for causing software failure.Traditional manual setting breakpoint Adjustment method, not only breakpoint location selection is difficult, and time overhead is huge.Therefore, realize that the automation of defect location becomes The target that software academia and industry are pursued jointly.In recent years, researcher attempts to propose a system from different angles The method for arranging assisted automated defect location, including based on slice method, based on the method for program invariants, model testing side Method and the method based on program frequency spectrum etc..
For the method based on slice, the method based on program invariants and Model Checking, it is based on frequency spectrum Defect positioning method (spectrum-based fault localization, abbreviation SFL) due to have without the concern for journey Sequence internal structure itself and the small feature of executive overhead become a kind of more effective important method.SFL method is main The program spectrum information executed by comparative analysis tested program in successful execution and failure, the corresponding suspicious degree of construction calculate public Formula is come a possibility that estimating program entity (such as sentence, predicate) error.It is influenced by the limitation of suspicious degree calculation formula, software The accuracy of defect location is unable to reach very high.
It is those skilled in the art's urgent problem to be solved as it can be seen that how to promote the accuracy of software defect positioning.
Summary of the invention
The purpose of the embodiment of the present invention is that provide a kind of software defect positioning method based on convolutional neural networks, device and Computer readable storage medium can promote the accuracy of software defect positioning.
In order to solve the above technical problems, the embodiment of the present invention provides a kind of software defect positioning based on convolutional neural networks Method, comprising:
The embodiment of the invention also provides a kind of software defect positioning methods based on convolutional neural networks, comprising:
It calls preset test case to treat test program to be tested, generates the one-dimensional sentence covering of test case The implementing result of information and test case;
According to the transformation rule of setting, two-dimentional sentence is converted by the one-dimensional sentence coverage information of the test case and is covered Information;
Using the two-dimentional sentence coverage information and its corresponding implementing result as sample data to initial convolution nerve net Network is trained, and obtains the convolutional neural networks for meeting preset requirement;
The program to be tested is handled according to the convolutional neural networks, it is each in the program to be tested to obtain The suspicious angle value of sentence.
Optionally, the transformation rule according to setting converts the one-dimensional sentence coverage information of the test case to Two-dimentional sentence coverage information includes:
When the one-dimensional sentence coverage information of the test case is dense data, according to the one-dimensional of function and test case The one-dimensional sentence coverage information of the test case is converted two-dimentional sentence covering letter by the corresponding relationship of sentence coverage information Breath;
When the one-dimensional sentence coverage information of the test case is sparse data, by the one-dimensional sentence of the test case Coverage information is randomly provided in two-dimensional table, to obtain two-dimentional sentence coverage information.
Optionally, it is described using the two-dimentional sentence coverage information and its corresponding implementing result as sample data to initial Convolutional neural networks are trained, and the convolutional neural networks for obtaining meeting preset requirement include:
The sample data is divided into training sample set and test sample collection;
The initial convolutional neural networks are trained using the training sample set, obtain trained convolutional Neural Network;
Target detection sample is inputted into the convolutional neural networks, obtains output result;The target detection sample is institute It states test sample and concentrates any one test sample without test;
Whether within a preset range to judge the deviation of the implementing result of the output result and the test sample;
The initial convolutional neural networks are trained if it is not, then returning to the utilization training sample set, are obtained The step of trained convolutional neural networks;
A test sample not after tested is chosen as target detection sample if so, concentrating from the test sample, And described the step of target detection sample is inputted into the convolutional neural networks, obtains output result is returned, until the test All test samples in sample set are completed to test, then using the convolutional neural networks as the convolution mind for meeting preset requirement Through network.
Optionally, described to treat test program according to the convolutional neural networks and handled, it is described to be tested to obtain The suspicious angle value of each sentence of program includes:
Construct virtual test use-case corresponding with sentence each in the program to be tested;
According to the transformation rule, two-dimentional sentence is converted by the one-dimensional sentence coverage information of the virtual test use-case and is covered Lid information;
The two-dimentional sentence coverage information is inputted into the convolutional neural networks, to obtain each sentence of program to be tested Suspicious angle value.
The software defect positioning device based on convolutional neural networks that the embodiment of the invention also provides a kind of, including generate single Member, conversion unit, training unit and assessment unit;
The generation unit is tested for calling preset test case to treat test program, generates test The one-dimensional sentence coverage information of use-case and the implementing result of test case;
The conversion unit, for the transformation rule according to setting, by the one-dimensional sentence coverage information of the test case It is converted into two-dimentional sentence coverage information;
The training unit, for using the two-dimentional sentence coverage information and its corresponding implementing result as sample data Initial convolutional neural networks are trained, the convolutional neural networks for meeting preset requirement are obtained;
The assessment unit, for handling according to the convolutional neural networks the program to be tested, to obtain The suspicious angle value of each sentence in the program to be tested.
Optionally, the conversion unit includes dense transforming subunit and sparse transforming subunit;
The dense transforming subunit, for when the one-dimensional sentence coverage information of the test case be dense data when, According to the corresponding relationship of function and the one-dimensional sentence coverage information of test case, the one-dimensional sentence of the test case is covered into letter Breath is converted into two-dimentional sentence coverage information;
The sparse transforming subunit, for when the one-dimensional sentence coverage information of the test case be sparse data when, The one-dimensional sentence coverage information of the test case is randomly provided in two-dimensional table, to obtain two-dimentional sentence coverage information.
Optionally, the training unit include divide subelement, training subelement, test subelement, judgment sub-unit and Choose subelement;
The division subelement, for the sample data to be divided into training sample set and test sample collection;
The trained subelement, for being trained using the training sample set to the initial convolutional neural networks, Obtain trained convolutional neural networks;
The test subelement obtains output result for target detection sample to be inputted the convolutional neural networks;Institute Stating target detection sample is that the test sample concentrates any one test sample without test;
The judgment sub-unit, for judge it is described output result and the implementing result of the test sample deviation be It is no within a preset range;If it is not, then returning to the trained subelement;If so, triggering the selection subelement;
The selection subelement chooses a test sample not after tested as mesh for concentrating from the test sample Test sample is marked, and returns to the test subelement, until all test samples that the test sample is concentrated are completed to test, Then using the convolutional neural networks as the convolutional neural networks for meeting preset requirement.
Optionally, the assessment unit includes building subelement, transforming subunit and output subelement;
The building subelement, for constructing virtual test use-case corresponding with sentence each in the program to be tested;
The transforming subunit, for according to the transformation rule, the one-dimensional sentence of the virtual test use-case to be covered Information is converted into two-dimentional sentence coverage information;
The output subelement, for the two-dimentional sentence coverage information to be inputted the convolutional neural networks, to obtain The suspicious angle value of each sentence of program to be tested.
The software defect positioning device based on convolutional neural networks that the embodiment of the invention also provides a kind of, comprising:
Memory, for storing computer program;
Processor, for executing the computer program to realize as the above-mentioned software defect based on convolutional neural networks is fixed The step of position method.
The embodiment of the invention also provides a kind of computer readable storage medium, deposited on the computer readable storage medium Computer program is contained, realizes that the above-mentioned software based on convolutional neural networks such as lacks when the computer program is executed by processor The step of falling into localization method.
It calls preset test case to treat test program it can be seen from above-mentioned technical proposal to be tested, it is raw At the one-dimensional sentence coverage information of test case and the implementing result of test case;For the data lattice with convolutional neural networks Formula is adapted, and is needed the transformation rule according to setting, is converted two-dimentional sentence for the one-dimensional sentence coverage information of test case and cover Lid information;Initial convolutional neural networks are carried out using two-dimentional sentence coverage information and its corresponding implementing result as sample data Training, obtains the convolutional neural networks for meeting preset requirement;The one-dimensional language of test case is sufficiently excavated by convolutional neural networks Incidence relation between sentence coverage information and implementing result, effectively improves the standard that convolutional neural networks position software defect True property, when needing to treat test program and analyzing its software defect, then can be treated according to convolutional neural networks test program into Row processing, to obtain the suspicious angle value of each sentence in program to be tested.Test case is effectively excavated based on convolutional neural networks One-dimensional sentence coverage information and implementing result between incidence relation so that the suspicious angle value predicted is more accurate.
Detailed description of the invention
In order to illustrate the embodiments of the present invention more clearly, attached drawing needed in the embodiment will be done simply below It introduces, it should be apparent that, drawings in the following description are only some embodiments of the invention, for ordinary skill people For member, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of process of the software defect positioning method based on convolutional neural networks provided in an embodiment of the present invention Figure;
Fig. 2 is that a kind of structure of the software defect positioning device based on convolutional neural networks provided in an embodiment of the present invention is shown It is intended to;
Fig. 3 is that a kind of structure of the software defect positioning device based on convolutional neural networks provided in an embodiment of the present invention is shown It is intended to.
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, rather than whole embodiments.Based on this Embodiment in invention, those of ordinary skill in the art are without making creative work, obtained every other Embodiment belongs to the scope of the present invention.
In order to enable those skilled in the art to better understand the solution of the present invention, with reference to the accompanying drawings and detailed description The present invention is described in further detail.
Software defect positioning main purpose is to detect and search the error code for causing software failure.In conventional method, Other related fields calculation formula are often quoted, and carry out the suspicious degree calculating public affairs that lot of experiments carrys out design defect positioning Formula;Either start with from tested program itself, by excavating the certain law information that contains of program itself, such as event includes Information content, execution track mode etc. construct new spectral method.Based on the premise, researcher executes using test case The implementing result of the sentence coverage information of generation and test case constructs suspicious degree calculation formula Tarantula, to assist Software defect positioning.The 4 class factors are defined in Tarantula formula executes the sentence generated covering letter to describe test case Relationship between breath and implementing result: a11Indicate the number that certain sentence covers in failure testing; a10Indicate certain language The number that sentence covers in successfully test;a00Indicate certain sentence uncovered number arrived in successfully test;a01It indicates Certain sentence uncovered number arrived in failure testing.
The reason in part for traditional shortcoming localization method difference on effect, can sum up are as follows: how utilize a11、a10、 a00、a01This 4 The information that a weight factor contains carrys out the suspicious degree of computing statement.It executes the sentence coverage information generated according to test case and holds It is potential associated it is assumed that considering more accurate to the weight of this 4 factors, then the defect location of corresponding method between row result Effect is also better.
It is determining suspicious that test case, which executes existing potential association between the sentence coverage information generated and implementing result, The basis of degree.Obviously, fully excavate with using it is this it is potential be associated with the defect illustration information contained, help to promote suspicious degree The effectiveness of calculation formula defect location.Therefore, a kind of software defect based on convolutional neural networks provided in an embodiment of the present invention Localization method, device and computer readable storage medium execute generation using convolutional neural networks sufficiently to excavate test case Sentence coverage information and implementing result between potential relationship, by test case execute generate sentence coverage information and test The implementing result of use-case is trained convolutional neural networks respectively as the characteristic of sample, flag data, effectively mentions The accuracy of convolutional neural networks test result is risen.
Next, a kind of software defect positioning based on convolutional neural networks provided by the embodiment of the present invention is discussed in detail Method.Fig. 1 is a kind of flow chart of the software defect positioning method based on convolutional neural networks provided in an embodiment of the present invention, should Method includes:
S101: calling preset test case to treat test program and tested, and generates the one-dimensional language of test case The implementing result of sentence coverage information and test case.
It is run in program to be tested using test case, when test case traverses some sentence in program to be tested When, then it represents that test case covers the sentence, in embodiments of the present invention, can cover letter with the one-dimensional sentence of test case Breath indicates that test case treats the coverage condition of test program.
For ease of description, P={ s can be used1,s2,…,szIndicate program to be tested.Wherein, si(1≤i≤z) table Show that i-th of sentence, z indicate to constitute the number of the sentence of the program to be tested.
Program to be tested is generally made of multiple functions, and each function includes multiple sentences.It indicates to survey with functional form Example P={ f on probation1,f2,…,fm}.Wherein, fi(1≤i≤m) indicates that i-th of function, m indicate of the function of configuration program Number.
fi={ Ei1,Ei2,…,EinRepresentative function fiThe set of middle sentence.Wherein, Eij(1≤i≤m, 1≤j≤n) table Show function fiJ-th strip sentence, n representative function fiSentence sum.
T={ t1,t2,…,tlIndicate test case set.Wherein, ti(1≤i≤l) indicates i-th of test case.
Ps(ti)={ e1,e2,…,ej,…,ezIndicate test case ti(1≤i≤l) executes the test case generated One-dimensional sentence coverage information.Wherein, ej(1≤j≤z) indicates tiWhether sentence s is coveredjIf tiCover sentence sj, then ejValue is 1, otherwise ejValue is 0.
Rs(ti) indicate test case tiThe implementing result of (1≤i≤l), if tiIt runs succeeded, then Rs (ti) it is 0, if tiIt holds Row fails, then Rs (ti) it is 1.
By taking a program to be tested as an example, corresponding sentence coverage information and test case implementing result are as shown in table 1:
Table 1
The corresponding relationship of representative function and sentence as shown in table 2:
Table 2
S102: according to the transformation rule of setting, two-dimentional sentence is converted by the one-dimensional sentence coverage information of test case and is covered Lid information.
In embodiments of the present invention, test case is excavated using convolutional neural networks executes the sentence coverage information generated Potential relationship between implementing result.In view of convolutional neural networks are for handling high dimensional data, therefore, it is necessary to will The one-dimensional sentence coverage information of obtained test case is converted into two-dimentional sentence coverage information.
In embodiments of the present invention, two different transform modes can be used, the one-dimensional sentence of test case is covered Information is converted into two-dimentional sentence coverage information.
Specifically, can be used when the one-dimensional sentence coverage information of test case is dense data according to function and test The corresponding relationship of the one-dimensional sentence coverage information of example converts two-dimentional sentence for the one-dimensional sentence coverage information of test case and covers Information;When the one-dimensional sentence coverage information of test case be sparse data when, by the one-dimensional sentence coverage information of test case with Machine is set in two-dimensional table, to obtain two-dimentional sentence coverage information.
It, can also be according to the one-dimensional of function and test case for sparse data it should be noted that in practical applications The one-dimensional sentence coverage information of test case is converted two-dimentional sentence coverage information by the corresponding relationship of sentence coverage information;It is right In dense data, the one-dimensional sentence coverage information of test case can also be randomly provided in two-dimensional table, to obtain two dimension Sentence coverage information.In embodiments of the present invention, for specifically using which kind of transform mode without limitation.
Assuming that the columns of the 2-D data after converting is Dh, line number into Dl.When the one-dimensional sentence coverage information of test case When more dense, according to the corresponding relationship of function and sentence in table 2, Dh can be enabled to be equal to the number m of function, Dl, which is equal to, " to be had The sentence item number of the function of most sentence item numbers ", the data of each column indicate the coverage information of the sentence of certain function.It will be in table 1 The one-dimensional sentence coverage information of test case is converted to the initial format of two-dimentional sentence coverage information as shown in following table 3a:
E11 E21 E31
E12 E22 Filling
E13 Filling Filling
Table 3a
As Dh × Dl ≠ z, need to carry out data filling to Dh × Dl-z space.Wherein, z is indicated in sample data The number of sentence.
The data of filling can meet the minimum value that random normal is distributed, is uniformly distributed, directly filling effective range.It does not lose Generality can set 0 for data to be filled, correspondingly, the form after being filled to table 3a is as shown in the table:
For the format shown in the table 3a, test case t1It is corresponding two dimension sentence coverage information as shown in following table 3b, Corresponding implementing result is 1:
1 1 0
1 0 0
0 0 0
Table 3b
Test case t2For corresponding two dimension sentence coverage information as shown in following table 3c, corresponding implementing result is 0:
0 1 1
1 0 0
1 0 0
Table 3c
Test case t3For corresponding two dimension sentence coverage information as shown in following table 3d, corresponding implementing result is 1:
0 1 0
0 1 0
0 0 0
Table 3d
When the one-dimensional sentence coverage information of test case is more sparse, one-dimensional sentence can be covered into data and fallen at random In z grid of Dh × Dl grid,Wherein
The one-dimensional sentence coverage information of test case in table 1 is converted to a kind of initial lattice of two-dimentional sentence coverage information Formula is as shown in following table 4a:
E22 E21 E13
E12 E11 E31
Table 4a
It should be noted that the form of table 4a is only a kind of possible form because being to be randomly provided.
For the format shown in the table 4a, test case t1It is corresponding two dimension sentence coverage information as shown in following table 4b, Corresponding implementing result is 1:
0 1 0
1 1 0
Table 4b
Test case t2For corresponding two dimension sentence coverage information as shown in following table 4c, corresponding implementing result is 0:
0 1 1
1 0 1
Table 4c
Test case t3For corresponding two dimension sentence coverage information as shown in following table 4d, corresponding implementing result is 1:
1 1 0
0 0 0
Table 4d
S103: using two-dimentional sentence coverage information and its corresponding implementing result as sample data to initial convolution nerve net Network is trained, and obtains the convolutional neural networks for meeting preset requirement.
Two-dimentional sentence coverage information is the sentence coverage information form of the identifiable test case of convolutional neural networks.
In embodiments of the present invention, sample data is divided into training sample set and test sample collection;Utilize training sample Collection is trained initial convolutional neural networks, obtains trained convolutional neural networks.
Wherein, convolutional neural networks are mainly by input layer, convolutional layer, pond (Pooling) layer, full articulamentum and output layer This few class layer is constituted.By the way that these stackings are added up, so that it may construct a complete convolutional neural networks.
In embodiments of the present invention, the topological structure of the convolutional neural networks of building is as follows:
(1) input layer Input
The number of plies of input layer is 1 layer, inputs the 2-D data for Dh × Dl.
(2) convolutional layer
It include the number of plies of determining convolutional layer when constructing convolutional layer;Determine convolution kernel number, the convolution kernel ruler of each convolutional layer Very little, convolution kernel sliding step-length;Determine whether that biasing (Nobias) is added;Determine whether using wide convolution algorithm (convolution algorithm It is preceding that benefit 0 is carried out to edge);Before activation primitive activation, it is determined whether L2 regularization is added and punishes convolution nuclear parameter itself Penalize (L2 regular parameter).
(3) pond layer
It include the number of plies of determining pond layer when constructing pond layer;Determine that pond window size, the pond window of each pond layer are sliding The form (mean value pond, maximum value pond etc.) of dynamic step-length, pondization operation.
(4) full articulamentum
It include the number of plies of determining full articulamentum when constructing full articulamentum;Determine the Dropout parameter of each articulamentum.
(5) output layer
The number of plies of output layer is one layer, number of nodes 1.Output layer uses logical function or normalization exponential function (softmax function) output category label.
In embodiments of the present invention, the activation primitive of each layer can be using amendment linear unit (Rectified Linear Unit, ReLU) function.Learning algorithm can use back-propagation algorithm (Back Propagation Algorithm, BPA).
It, can be by target by taking test sample concentrates any one test sample, that is, target detection sample without test as an example Test sample inputs convolutional neural networks, obtains output result.The deviation of the implementing result of judgement output result and test sample Within a preset range whether value;If it is not, then Returning utilization training sample set is trained initial convolutional neural networks, instructed The step of convolutional neural networks perfected;A test sample conduct not after tested is chosen if so, concentrating from test sample Target detection sample, and the step of returning and target detection sample is inputted into convolutional neural networks, obtaining output result, until test All test samples in sample set are completed to test, then using convolutional neural networks as the convolutional Neural net for meeting preset requirement Network.
For example, the corresponding two-dimentional sentence coverage information of test sample is input to the output knot obtained after convolutional neural networks Fruit be Y ', the corresponding test case implementing result of the test sample be Y, work as satisfaction | Y '-Y |≤τ, then it is assumed that output result with The deviation of the implementing result of test sample is within a preset range.Otherwise it is assumed that the implementing result of output result and test sample Deviation not within a preset range.
S104: test program is treated according to convolutional neural networks and is handled, to obtain each sentence in program to be tested Suspicious angle value.
After training convolutional neural networks, test program can be treated according to the convolutional neural networks and carries out defect Positioning.What is inputted when training in view of convolutional neural networks is the form of the two-dimentional sentence coverage information of test case, correspondingly, When treating test program progress defect location, needs to construct virtual test corresponding with sentence each in program to be tested and use Example;According to transformation rule, two-dimentional sentence coverage information is converted by the one-dimensional sentence coverage information of virtual test use-case;It will be two-dimentional Sentence coverage information inputs convolutional neural networks, to obtain the suspicious angle value of each sentence of program to be tested.
When constructing virtual test use-case, it can be directed to its corresponding virtual test use-case of each sentence builder, When one virtual test use-case is run in program to be tested, a corresponding sentence in program to be tested can be only called.
For including 6 sentences in program to be tested, it is followed successively by s1To s6
Sentence s1Corresponding virtual test use-case ts1One-dimensional sentence coverage information be Ps ' (ts1)={ 1,0,0,0,0, 0}。
Sentence s2Corresponding virtual test use-case ts2One-dimensional sentence coverage information be Ps ' (ts2)={ 0,1,0,0,0, 0}。
Sentence s3Corresponding virtual test use-case ts3One-dimensional sentence coverage information be Ps ' (ts3)={ 0,0,1,0,0, 0}。
Sentence s4Corresponding virtual test use-case ts4One-dimensional sentence coverage information be Ps ' (ts4)={ 0,0,0,1,0, 0}。
Sentence s5Corresponding virtual test use-case ts5One-dimensional sentence coverage information be Ps ' (ts5)={ 0,0,0,0,1, 0}。
Sentence s6Corresponding virtual test use-case ts6One-dimensional sentence coverage information be Ps ' (ts6)={ 0,0,0,0,0, 1}。
(1) use dense processing mode, i.e., according to the corresponding relationship of function and the one-dimensional sentence coverage information of test case, The format for converting two-dimentional sentence coverage information for the one-dimensional sentence coverage information of test case is as follows:
Sentence s1Virtual test use-case ts1The input data of corresponding convolutional neural networks:
1 0 0
0 0 0
0 0 0
Sentence s2Virtual test use-case ts2The input data of corresponding convolutional neural networks:
0 0 0
1 0 0
0 0 0
Sentence s3Virtual test use-case ts3The input data of corresponding convolutional neural networks:
0 0 0
0 0 0
1 0 0
Sentence s4Virtual test use-case ts4The input data of corresponding convolutional neural networks:
0 1 0
0 0 0
0 0 0
Sentence s5Virtual test use-case ts5The input data of corresponding convolutional neural networks:
0 0 0
0 1 0
0 0 0
Sentence s6Virtual test use-case ts6The input data of corresponding convolutional neural networks:
0 0 1
0 0 0
0 0 0
(2) sparse processing mode is used, i.e., the one-dimensional sentence coverage information of test case is randomly provided in two-dimensional table In, it is as follows with the format for obtaining two-dimentional sentence coverage information:
Sentence s1Virtual test use-case ts1The input data of corresponding convolutional neural networks:
0 0 0
0 1 0
Sentence s2Virtual test use-case ts2The input data of corresponding convolutional neural networks:
0 0 0
1 0 0
Sentence s3Virtual test use-case ts3The input data of corresponding convolutional neural networks:
0 0 1
0 0 0
Sentence s4Virtual test use-case ts4The input data of corresponding convolutional neural networks:
0 1 0
0 0 0
Sentence s5Virtual test use-case ts5The input data of corresponding convolutional neural networks:
1 0 0
0 0 0
Sentence s6Virtual test use-case ts6The input data of corresponding convolutional neural networks:
0 0 0
0 0 1
When determining the suspicious angle value of each sentence in program to be tested, can be determined according to the suspicious angle value of each sentence Which sentence is problem sentence out, to realize the positioning of defect.
It calls preset test case to treat test program it can be seen from above-mentioned technical proposal to be tested, it is raw At the one-dimensional sentence coverage information of test case and the implementing result of test case;According to the transformation rule of setting, will test The one-dimensional sentence coverage information of use-case is converted into two-dimentional sentence coverage information;By two-dimentional sentence coverage information and its corresponding execution As a result initial convolutional neural networks are trained as sample data, obtain the convolutional neural networks for meeting preset requirement;It is logical It crosses convolutional neural networks and sufficiently excavates incidence relation between the one-dimensional sentence coverage information of test case and implementing result, effectively The accuracy for improving convolutional neural networks and software defect being positioned, analyze its software defect when needing to treat test program When, then test program can be treated according to convolutional neural networks and be handled, to obtain the suspicious of each sentence in program to be tested Angle value.Being associated between the one-dimensional sentence coverage information of test case and implementing result is effectively excavated based on convolutional neural networks Relationship, so that the suspicious angle value predicted is more accurate.
The value range of the suspicious angle value of each sentence of convolutional neural networks output is 0 to 1.In embodiments of the present invention, It can also be by each sentence of program to be tested according to suspicious angle value after the suspicious angle value of each sentence in obtaining program to be tested The sequence of descending arranges, and generates software defect positioning reporting table.To be comprising 6 sentences in the program to be tested introduced in S104 Example, corresponding software defect positioning reporting table are as follows:
Suspicious angle value Sentence si
0.93 s1
0.91 s2
0.91 s3
0.76 s4
0.53 s5
0.18 s6
Software defect positioning reporting table
Suspicious angle value by treating each sentence in test program carries out descending arrangement, obtains software defect positioning reporting Table can get information about the defect situation of each sentence in program to be tested in order to related personnel, to realize to defect sentence Quick localization process.
Fig. 2 is that a kind of structure of the software defect positioning device based on convolutional neural networks provided in an embodiment of the present invention is shown It is intended to, including generation unit 21, conversion unit 22, training unit 23 and assessment unit 24;
Generation unit 21 is tested for calling preset test case to treat test program, is generated test and is used The one-dimensional sentence coverage information of example and the implementing result of test case;
Conversion unit 22 converts the one-dimensional sentence coverage information of test case to for the transformation rule according to setting Two-dimentional sentence coverage information;
Training unit 23 is used for using two-dimentional sentence coverage information and its corresponding implementing result as sample data to initial Convolutional neural networks are trained, and obtain the convolutional neural networks for meeting preset requirement;
Assessment unit 24 is handled for treating test program according to convolutional neural networks, to obtain program to be tested In each sentence suspicious angle value.
Optionally, conversion unit includes dense transforming subunit and sparse transforming subunit;
Dense transforming subunit, for when the one-dimensional sentence coverage information of test case be dense data when, according to function With the corresponding relationship of the one-dimensional sentence coverage information of test case, two dimension is converted by the one-dimensional sentence coverage information of test case Sentence coverage information;
Sparse transforming subunit, for when the one-dimensional sentence coverage information of test case is sparse data, test to be used The one-dimensional sentence coverage information of example is randomly provided in two-dimensional table, to obtain two-dimentional sentence coverage information.
Optionally, training unit includes dividing subelement, training subelement, test subelement, judgment sub-unit and selection Subelement;
Subelement is divided, for sample data to be divided into training sample set and test sample collection;
Training subelement is obtained trained for being trained using training sample set to initial convolutional neural networks Convolutional neural networks;
Subelement is tested, for target detection sample to be inputted convolutional neural networks, obtains output result;Target detection sample This is that test sample concentrates any one test sample without test;
Judgment sub-unit, for judge to export result and test sample implementing result deviation whether in preset range It is interior;If it is not, then returning to trained subelement;If so, subelement is chosen in triggering;
Subelement is chosen, chooses a test sample not after tested as target detection sample for concentrating from test sample This, and test subelement is returned, until all test samples that test sample is concentrated are completed to test, then by convolutional neural networks As the convolutional neural networks for meeting preset requirement.
Optionally, assessment unit includes building subelement, transforming subunit and output subelement;
Subelement is constructed, for constructing virtual test use-case corresponding with sentence each in program to be tested;
Transforming subunit, for converting two for the one-dimensional sentence coverage information of virtual test use-case according to transformation rule Tie up sentence coverage information;
Subelement is exported, it is each to obtain program to be tested for two-dimentional sentence coverage information to be inputted convolutional neural networks The suspicious angle value of sentence.
The explanation of feature may refer to the related description of embodiment corresponding to Fig. 1 in embodiment corresponding to Fig. 2, here no longer It repeats one by one.
It calls preset test case to treat test program it can be seen from above-mentioned technical proposal to be tested, it is raw At the one-dimensional sentence coverage information of test case and the implementing result of test case;For the data lattice with convolutional neural networks Formula is adapted, and is needed the transformation rule according to setting, is converted two-dimentional sentence for the one-dimensional sentence coverage information of test case and cover Lid information;Initial convolutional neural networks are carried out using two-dimentional sentence coverage information and its corresponding implementing result as sample data Training, obtains the convolutional neural networks for meeting preset requirement;The one-dimensional language of test case is sufficiently excavated by convolutional neural networks Incidence relation between sentence coverage information and implementing result, effectively improves the standard that convolutional neural networks position software defect True property, when needing to treat test program and analyzing its software defect, then can be treated according to convolutional neural networks test program into Row processing, to obtain the suspicious angle value of each sentence in program to be tested.Test case is effectively excavated based on convolutional neural networks One-dimensional sentence coverage information and implementing result between incidence relation so that the suspicious angle value predicted is more accurate.
Fig. 3 is a kind of knot of the software defect positioning device 30 based on convolutional neural networks provided in an embodiment of the present invention Structure schematic diagram, comprising:
Memory 31, for storing computer program;
Processor 32, for executing computer program to realize the software defect positioning as above-mentioned based on convolutional neural networks The step of method.
The embodiment of the invention also provides a kind of computer readable storage medium, it is stored on computer readable storage medium Computer program realizes such as the above-mentioned software defect positioning side based on convolutional neural networks when computer program is executed by processor The step of method.
It is provided for the embodiments of the invention a kind of software defect positioning method based on convolutional neural networks, device above It is described in detail with computer readable storage medium.Each embodiment is described in a progressive manner in specification, each What embodiment stressed is the difference from other embodiments, and the same or similar parts in each embodiment refer to each other ?.For the device disclosed in the embodiment, since it is corresponded to the methods disclosed in the examples, so the comparison of description is simple Single, reference may be made to the description of the method.It should be pointed out that for those skilled in the art, Without departing from the principles of the invention, can be with several improvements and modifications are made to the present invention, these improvement and modification are also fallen Enter in the protection scope of the claims in the present invention.
Professional further appreciates that, unit described in conjunction with the examples disclosed in the embodiments of the present disclosure And algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These Function is implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Profession Technical staff can use different methods to achieve the described function each specific application, but this realization is not answered Think beyond the scope of this invention.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can directly be held with hardware, processor The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology In any other form of storage medium well known in field.

Claims (10)

1. a kind of software defect positioning method based on convolutional neural networks characterized by comprising
It calls preset test case to treat test program to be tested, generates the one-dimensional sentence coverage information of test case And the implementing result of test case;
According to the transformation rule of setting, two-dimentional sentence covering letter is converted by the one-dimensional sentence coverage information of the test case Breath;
Using the two-dimentional sentence coverage information and its corresponding implementing result as sample data to initial convolutional neural networks into Row training, obtains the convolutional neural networks for meeting preset requirement;
The program to be tested is handled according to the convolutional neural networks, to obtain each sentence in the program to be tested Suspicious angle value.
2. the method according to claim 1, wherein the transformation rule according to setting, the test is used The one-dimensional sentence coverage information of example is converted into two-dimentional sentence coverage information and includes:
When the one-dimensional sentence coverage information of the test case is dense data, according to the one-dimensional sentence of function and test case The one-dimensional sentence coverage information of the test case is converted two-dimentional sentence coverage information by the corresponding relationship of coverage information;
When the one-dimensional sentence coverage information of the test case is sparse data, the one-dimensional sentence of the test case is covered Information is randomly provided in two-dimensional table, to obtain two-dimentional sentence coverage information.
3. the method according to claim 1, wherein described by the two-dimentional sentence coverage information and its corresponding Implementing result is trained initial convolutional neural networks as sample data, obtains the convolutional neural networks for meeting preset requirement Include:
The sample data is divided into training sample set and test sample collection;
The initial convolutional neural networks are trained using the training sample set, obtain trained convolutional Neural net Network;
Target detection sample is inputted into the convolutional neural networks, obtains output result;The target detection sample is the survey Any one test sample of sample this concentration not after tested;
Whether within a preset range to judge the deviation of the implementing result of the output result and the test sample;
The initial convolutional neural networks are trained if it is not, then returning to the utilization training sample set, are trained The step of convolutional neural networks got well;
A test sample not after tested is chosen as target detection sample if so, concentrating from the test sample, and is returned Described the step of target detection sample is inputted into the convolutional neural networks, obtains output result is returned, until the test sample All test samples concentrated are completed to test, then using the convolutional neural networks as the convolutional Neural net for meeting preset requirement Network.
4. method according to claim 1 to 3, which is characterized in that described according to the convolutional neural networks pair Program to be tested is handled, and includes: to obtain the suspicious angle value of each sentence of program to be tested
Construct virtual test use-case corresponding with sentence each in the program to be tested;
According to the transformation rule, two-dimentional sentence covering letter is converted by the one-dimensional sentence coverage information of the virtual test use-case Breath;
The two-dimentional sentence coverage information is inputted into the convolutional neural networks, it can with obtain each sentence of program to be tested Doubt angle value.
5. a kind of software defect positioning device based on convolutional neural networks, which is characterized in that single including generation unit, conversion Member, training unit and assessment unit;
The generation unit is tested for calling preset test case to treat test program, generates test case One-dimensional sentence coverage information and test case implementing result;
The conversion unit converts the one-dimensional sentence coverage information of the test case for the transformation rule according to setting For two-dimentional sentence coverage information;
The training unit is used for using the two-dimentional sentence coverage information and its corresponding implementing result as sample data to first Beginning convolutional neural networks are trained, and obtain the convolutional neural networks for meeting preset requirement;
The assessment unit, it is described to obtain for handling according to the convolutional neural networks the program to be tested The suspicious angle value of each sentence in program to be tested.
6. device according to claim 5, which is characterized in that the conversion unit includes dense transforming subunit and sparse Transforming subunit;
The dense transforming subunit, for when the one-dimensional sentence coverage information of the test case be dense data when, according to The corresponding relationship of function and the one-dimensional sentence coverage information of test case turns the one-dimensional sentence coverage information of the test case Turn to two-dimentional sentence coverage information;
The sparse transforming subunit, for when the one-dimensional sentence coverage information of the test case be sparse data when, by institute The one-dimensional sentence coverage information for stating test case is randomly provided in two-dimensional table, to obtain two-dimentional sentence coverage information.
7. device according to claim 5, which is characterized in that the training unit includes dividing subelement, training son list Member, test subelement, judgment sub-unit and selection subelement;
The division subelement, for the sample data to be divided into training sample set and test sample collection;
The trained subelement is obtained for being trained using the training sample set to the initial convolutional neural networks Trained convolutional neural networks;
The test subelement obtains output result for target detection sample to be inputted the convolutional neural networks;The mesh Marking test sample is that the test sample concentrates any one test sample without test;
The judgment sub-unit, for judge it is described output result and the test sample implementing result deviation whether In preset range;If it is not, then returning to the trained subelement;If so, triggering the selection subelement;
The selection subelement chooses a test sample not after tested as target survey for concentrating from the test sample Sample sheet, and the test subelement is returned, until all test samples that the test sample is concentrated are completed to test, then will The convolutional neural networks are as the convolutional neural networks for meeting preset requirement.
8. according to device described in claim 5-7 any one, which is characterized in that the assessment unit includes that building is single Member, transforming subunit and output subelement;
The building subelement, for constructing virtual test use-case corresponding with sentence each in the program to be tested;
The transforming subunit is used for according to the transformation rule, by the one-dimensional sentence coverage information of the virtual test use-case It is converted into two-dimentional sentence coverage information;
The output subelement, it is described to obtain for the two-dimentional sentence coverage information to be inputted the convolutional neural networks The suspicious angle value of each sentence of program to be tested.
9. a kind of software defect positioning device based on convolutional neural networks characterized by comprising
Memory, for storing computer program;
Processor, for executing the computer program to realize as described in Claims 1-4 any one based on convolutional Neural The step of software defect positioning method of network.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium Program is realized when the computer program is executed by processor and is based on convolutional neural networks as described in any one of Claims 1-4 Software defect positioning method the step of.
CN201910429282.XA 2019-05-22 2019-05-22 Software defect positioning method, device and medium based on convolutional neural network Expired - Fee Related CN110232023B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910429282.XA CN110232023B (en) 2019-05-22 2019-05-22 Software defect positioning method, device and medium based on convolutional neural network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910429282.XA CN110232023B (en) 2019-05-22 2019-05-22 Software defect positioning method, device and medium based on convolutional neural network

Publications (2)

Publication Number Publication Date
CN110232023A true CN110232023A (en) 2019-09-13
CN110232023B CN110232023B (en) 2021-07-06

Family

ID=67860968

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910429282.XA Expired - Fee Related CN110232023B (en) 2019-05-22 2019-05-22 Software defect positioning method, device and medium based on convolutional neural network

Country Status (1)

Country Link
CN (1) CN110232023B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893256A (en) * 2016-03-30 2016-08-24 西北工业大学 Software failure positioning method based on machine learning algorithm
CN107330519A (en) * 2017-06-26 2017-11-07 西北工业大学 Fault Locating Method based on deep neural network
CN108806698A (en) * 2018-03-15 2018-11-13 中山大学 A kind of camouflage audio recognition method based on convolutional neural networks
US20180349256A1 (en) * 2017-06-01 2018-12-06 Royal Bank Of Canada System and method for test generation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893256A (en) * 2016-03-30 2016-08-24 西北工业大学 Software failure positioning method based on machine learning algorithm
US20180349256A1 (en) * 2017-06-01 2018-12-06 Royal Bank Of Canada System and method for test generation
CN107330519A (en) * 2017-06-26 2017-11-07 西北工业大学 Fault Locating Method based on deep neural network
CN108806698A (en) * 2018-03-15 2018-11-13 中山大学 A kind of camouflage audio recognition method based on convolutional neural networks

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈翔等: ""基于程序频谱的动态缺陷定位方法研究"", 《软件学报》 *

Also Published As

Publication number Publication date
CN110232023B (en) 2021-07-06

Similar Documents

Publication Publication Date Title
Cheng et al. Dissolved gas analysis principle-based intelligent approaches to fault diagnosis and decision making for large oil-immersed power transformers: A survey
Butts Social network analysis with sna
WO2020224433A1 (en) Target object attribute prediction method based on machine learning and related device
WO2020010350A1 (en) System and method associated with generating an interactive visualization of structural causal models used in analytics of data associated with static or temporal phenomena
CN109840205A (en) Applied program testing method, device, readable storage medium storing program for executing and terminal device
CN108491228A (en) A kind of binary vulnerability Code Clones detection method and system
CN112463976A (en) Knowledge graph construction method taking crowd sensing task as center
Cao et al. FTCLNet: Convolutional LSTM with Fourier transform for vulnerability detection
CN117743601B (en) Natural resource knowledge graph completion method, device, equipment and medium
CN108287974A (en) Coupling evaluation method towards land use change survey Cellular Automata Simulation precision
Sun et al. Intelligent oil well identification modelling based on deep learning and neural network
CN117408167A (en) Debris flow disaster vulnerability prediction method based on deep neural network
CN110232023A (en) A kind of software defect positioning method based on convolutional neural networks, device and medium
CN116861358A (en) BP neural network and multi-source data fusion-based computing thinking evaluation method
Dang et al. Multi-task optimization-based test data generation for mutation testing via relevance of mutant branch and input variable
CN111965733B (en) Method for evaluating correlation between forecasting factor and solar flare occurrence
Wang et al. The application of artificial neural networks to predict wind spectra for rectangular cross-section buildings
Liu et al. LogE-Net: Logic evolution network for temporal knowledge graph forecasting
Kumar et al. Predictive analysis of novel coronavirus using machine learning model-a graph mining approach
CN112732549A (en) Test program classification method based on cluster analysis
CN110780660A (en) Tobacco production industry control system fault diagnosis method based on production state
Sun et al. The use of neural network in defense audit nonlinear dynamic processing under the background of big data
CN111291376A (en) Web vulnerability verification method based on crowdsourcing and machine learning
CN113064962B (en) Environment complaint reporting event similarity analysis method
Ismail et al. Change Vulnerability Forecasting for Southeast Asia using Deep Learning Algorithm

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20210706

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