CN103279422A - Self-adaptive random test method based on rejecting area - Google Patents
Self-adaptive random test method based on rejecting area Download PDFInfo
- Publication number
- CN103279422A CN103279422A CN2013102388252A CN201310238825A CN103279422A CN 103279422 A CN103279422 A CN 103279422A CN 2013102388252 A CN2013102388252 A CN 2013102388252A CN 201310238825 A CN201310238825 A CN 201310238825A CN 103279422 A CN103279422 A CN 103279422A
- Authority
- CN
- China
- Prior art keywords
- program
- input
- current
- input vector
- test
- 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
Images
Landscapes
- Debugging And Monitoring (AREA)
- Test And Diagnosis Of Digital Computers (AREA)
Abstract
The invention discloses a self-adaptive random test method based on a rejecting area. The self-adaptive random test method is mainly used for reducing blindness of test case generation in random tests and weakening the problems caused by boundary effect. The method includes firstly, determining an input domain of a program; secondly, setting magnitude of a radius of the rejecting area according to distance from a point to a space center; thirdly, randomly generating a test case according to the input domain and performing a test; finally, analyzing a result of the test, if the result acquired by the test case conforms to a desired value, repeating the above process, and if not, stopping the test and modifying the program.
Description
Technical field
The present invention proposes a kind of self-adapting random method of testing of cutting apart, be used for the generation of test case, belong to the technical field of software test automation.
Background technology
Along with software systems are more and more important in the application of every field, software quality assurance becomes an important research focus.Though means such as code inspection, formalization checking are arranged now, software test remains the means that topmost software quality ensures.Software test is a kind of process that is used for promoting to identify correctness, integrality, security and the quality of software, and the software here may be certain function, module or software itself.The generation of test case is essential step in the software test, and its validity has material impact to the result of test.Random test is the test case generation technique that is widely used at present, is characterized in simple, automaticity is high and easy operating.What but wrong probability was found in random test completely only with in the input domain causes that the shared ratio of wrong input is relevant.In order to remedy the defective of appeal, improve the efficient of test, people this has been done deep research and proposed the self-adapting random test (Adaptive random testing, ART).The thought of ART is to make the test case of generation be evenly distributed in the efficient that input domain improves test as far as possible, and it has inherited the advantage of the robotization of random test, and has reduced and tested required test case quantity, has reduced the expense of test.
Summary of the invention
Technical matters: the invention provides a kind of blindness for reducing test case generation in the random test, slacken the problem that boundary effect is brought simultaneously, can more effectively generate test case, the method that the self-adapting random based on repulsive area of raising random test performance is tested.
Technical scheme: method of testing based on the self-adapting random of repulsive area of the present invention comprises the steps:
Step 1) is obtained its input domain { I according to the interface of tested function or program
kSpan and the coordinate vector of the central point C of input domain, wherein k be 1,2 ..., n}, n are the dimensions of input domain, the span (i of input domain k dimension
Kmin, i
Kmax), the value of the k dimension of the coordinate vector of central point is (i
Kmax+ i
KmiN)/2, adopt following formula to calculate the distance on summit and central point in the input domain then:
Step 2) sets up empty chained list, the data structure of catena is abstract to be Item={Point, DistToCen, Next}, the wherein input vector of Point representation program, form is Point=(p1, p2 ..., pn), DistTCen represents that Point arrives the distance at the center of the input space, and Next represents the next item down of this item in the chained list; The number Num of element is 0 in the initialization chained list, and setting the basic ratio Ratio of repulsive area in the space is 50%;
Step 3) is according to the scope (i of the k dimension of input domain
Kmin, i
Kmax), in this scope, generate a value at random, as the value of input vector k dimension, described input vector is come working procedure as the parameter of program, if the operation result of program and expection are not inconsistent, then go to step 9), otherwise go to step 4);
Step 4) is calculated input vector to the distance of central point with input vector with according to following formula
Then input vector together is saved in the head of chained list to the distance of central point and input vector, with seasonal Num=Num+1;
Step 5) is calculated the base radius of current repulsive area according to following formula:
Step 6) is according to the interface of program and the current input vector of current input domain random generating program;
Whether the current input vector of step 7) calculation procedure is included in the repulsive area that has generated test case, in this way, then goes to step 6), otherwise goes to step 8);
Step 8) if the result of program operation and expection are not inconsistent then enter step 9), otherwise is got back to step 4) with the current input vector of the program input working procedure as program;
Step 9) finishes testing process.
The idiographic flow of step 3) of the present invention is:
3a) input domain { I
kThe scope of k dimension be (i
Kmin, i
Kmax) (k=1,2 ... N), in this scope, generate a value at random, as the value of input vector k dimension;
3b) tester calculates with 3a according to the purpose of program) expected result when the middle input vector that obtains is the program input;
3c) with 3a) in the input vector that obtains come working procedure as the parameter of program, if the operation result of program and expection are not inconsistent, then go to step 9), otherwise go to step 4).
The idiographic flow of step 7) of the present invention is:
7a) first node of note chained list is node CURRENT;
7b) according to the distance of input vector and current input vector among the following formula computing node CURRENTD:
If D<(1+Current.DistToCen/Dmax) is * R, then current input vector is included in the repulsive area that generates test case, go to step 6), otherwise enter step 7c), wherein Current.DistToCen is the distance at node Current and input domain center;
7c) make node CURRENT point to next node, even CURRENT=CURRENT.Next, if there is not next node then to go to 7d), otherwise go to 7b);
7d) ending said process goes to step 9).
Beneficial effect: the present invention compared with prior art has the following advantages:
The repulsion radius that traditional method is had a few is identical, cause that the test case of generation accumulates in the border in space. become big and become big along with the distance with the center with a related repulsive area in this method, the influence that can reduce boundary effect shows through experiment, the present invention can be good at improving the validity of the test case that random test generates, and reduce the problem that boundary effect is brought, this method can effectively improve the validity of random test, thereby reduces the time of test.
Description of drawings
Fig. 1 is the process flow diagram of random test.
Fig. 2 is the process flow diagram of the inventive method.
Embodiment
The present invention is intended to improve the deficiency of existing method, improves the efficient that test case generates in the random test, is elaborated with reference to accompanying drawing below in conjunction with example.
A kind of self-adapting random method of testing concrete steps of cutting apart that the present invention proposes are as follows:
Step 1) is obtained its input domain { I according to the interface of tested function or program
kSpan and the coordinate vector of the central point C of input domain, wherein k be 1,2 ..., n}, n are the dimensions of input domain, the span (i of input domain k dimension
Kmin, i
Kmax), the value of the k dimension of the coordinate vector of central point is (i
Kmax+ i
KmiN)/2, adopt following formula to calculate the distance on summit and central point in the input domain then:
The input domain of program can obtain according to the specification of program, type and the restriction of required parameter when being used for the read-me execution, and it is set to current input domain behind the acquisition input domain.Be example with interface int add (unsigned short a, unsigned short b), input domain I={ (0,65535), (0,65535) }, Center=(32768,32768), Dmax=46340;
Step 2) sets up empty chained list, the data structure of catena is abstract to be Item={Point, DistToCen, Next}, the wherein input vector of Point representation program, form is Point=(p1, p2 ..., pn), DistTCen represents that Point arrives the distance at the center of the input space, and Next represents the next item down of this item in the chained list; The number Num of element is 0 in the initialization chained list, sets the basic ratio Ratio of repulsive area in the space, and Ratio is a constant, and setting the basic ratio Ratio of repulsive area in the space is 50%;
Num is used for the number of record chained list middle term, because chained list be sky when initial, so Num=0.Ratio is that all repulsive area is in the ratio in space.
Step 3) is according to the scope (i of the k dimension of input domain
Kmin, i
Kmax), in this scope, generate a value at random, as the value of input vector k dimension, described input vector is come working procedure as the parameter of program, if the operation result of program and expection are not inconsistent, then go to step 9), otherwise go to step 4);
Generate corresponding value according to each stochastic parameter in the interface docking port of program or function, to be worth and form input vector, with interface int add (unsigned short a, unsigned short b) be example, generate the value of shape ginseng a at first at random, generate the value of shape ginseng b then at random, the correctness of calling the add function then and testing its result.Go to step 9) if make mistakes;
Step 4) is calculated input vector to the distance of central point with input vector with according to following formula
Then input vector together is saved in the head of chained list to the distance of central point and input vector, with seasonal Num=Num+1;
Generate the variable i tem of Item type, initialization item.Point=intpu, item.DistToCen=Dc is inserted into item on the head of chained list.
Step 5) is calculated the base radius of current repulsive area according to following formula:
Step 6) is according to the interface of program and the current input vector of current input domain random generating program;
Whether the current input vector of step 7) calculation procedure is included in the repulsive area that has generated test case, in this way, then goes to step 6), otherwise goes to step 8); Detailed idiographic flow is:
7a) first node of note chained list is node CURRENT;
7b) according to the distance of input vector and current input vector among the following formula computing node CURRENTD:
If D<(1+Current.DistToCen/Dmax) is * R, then current input vector is included in the repulsive area that generates test case, go to step 6), otherwise enter step 7c), wherein Current.DistToCen is the distance at node Current and input domain center;
7c) make node CURRENT point to next node, even CURRENT=CURRENT.
Next, if there is not next node then to go to 7d), otherwise go to 7b);
7d) ending said process goes to step 9).
Step 8) if the result of program operation and expection are not inconsistent then enter step 9), otherwise is got back to step 4) with the current input vector of the program input working procedure as program;
Step 9) finishes testing process.
Embodiment:
To the present invention be described by specific embodiment below.
Verify validity of the present invention by experiment.For validity of the present invention is described, we will contrast with the result of random test and traditional self-adapting random method of testing.Therefore we will use two kinds of methods to same program, relatively both testing efficiencies.
Experimental subjects
We are example with following program:
2. evaluation criteria
Target of the present invention is to reduce the time that test case generates, and guarantees the efficient of test simultaneously.We use the quantity of finding first wrong test case that needs as the standard that detects.
3. interpretation of result
We have done 3000 groups of experiments, and the quantity of spent time and the test case that needs is as the module of testing efficiency when finding that first is wrong, and the quantity contrast that obtains the required test case of random test and this method is as follows.
Testing classification | Test case quantity |
Random test | 3988 |
This method | 3289 |
Claims (3)
1. the method based on the self-adapting random test of repulsive area is characterized in that this method comprises the steps:
Step 1) is obtained its input domain { I according to the interface of tested function or program
kSpan and the coordinate vector of the central point C of input domain, wherein k be 1,2 ..., n}, n are the dimensions of input domain, the span (i of input domain k dimension
Kmin, i
Kmax), the value of the k dimension of the coordinate vector of central point is (i
Kmax+ i
KmiN)/2, adopt following formula to calculate the distance on summit and central point in the input domain then:
Step 2) sets up empty chained list, the data structure of catena is abstract to be Item={Point, DistToCen, Next}, the wherein input vector of Point representation program, form is Point=(p1, p2 ..., pn), DistTCen represents that Point arrives the distance at the center of the input space, and Next represents the next item down of this item in the chained list; The number Num of element is 0 in the initialization chained list, and setting the basic ratio Ratio of repulsive area in the space is 50%;
Step 3) is according to the scope (i of the k dimension of input domain
Kmin, i
Kmax), in this scope, generate a value at random, as the value of input vector k dimension, described input vector is come working procedure as the parameter of program, if the operation result of program and expection are not inconsistent, then go to step 9), otherwise go to step 4);
Step 4) is calculated input vector to the distance of central point with input vector with according to following formula
Then input vector together is saved in the head of chained list to the distance of central point and input vector, with seasonal Num=Num+1;
Step 5) is calculated the base radius of current repulsive area according to following formula:
Step 6) is according to the interface of program and the current input vector of current input domain random generating program;
Whether the current input vector of step 7) calculation procedure is included in the repulsive area that has generated test case, in this way, then goes to step 6), otherwise goes to step 8);
Step 8) if the result of program operation and expection are not inconsistent then enter step 9), otherwise is got back to step 4) with the current input vector of the program input working procedure as program;
Step 9) finishes testing process.
2. according to claim 1 based on based on the method based on the test of the self-adapting random of dynamic partition, it is characterized in that the idiographic flow of described step 3) is:
3a) input domain { I
kThe scope of k dimension be (i
Kmin, i
Kmax) (k=1,2 ... N), in this scope, generate a value at random, as the value of input vector k dimension;
3b) tester calculates with 3a according to the purpose of program) expected result when the middle input vector that obtains is the program input;
3c) with 3a) in the input vector that obtains come working procedure as the parameter of program, if the operation result of program and expection are not inconsistent, then go to step 9), otherwise go to step 4).
3. according to claim 1 based on based on the method based on the test of the self-adapting random of dynamic partition, it is characterized in that the idiographic flow of described step 7) is:
7a) first node of note chained list is node CURRENT;
7b) according to the distance of input vector and current input vector among the following formula computing node CURRENTD:
If D<(1+Current.DistToCen/Dmax) is * R, then current input vector is included in the repulsive area that generates test case, go to step 6), otherwise enter step 7c), wherein Current.DistToCen is the distance at node Current and input domain center;
7c) make node CURRENT point to next node, even CURRENT=CURRENT.
Next, if there is not next node then to go to 7d), otherwise go to 7b);
7d) ending said process goes to step 9).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310238825.2A CN103279422B (en) | 2013-06-17 | 2013-06-17 | A kind of method that self-adapting random based on repulsive area is tested |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310238825.2A CN103279422B (en) | 2013-06-17 | 2013-06-17 | A kind of method that self-adapting random based on repulsive area is tested |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103279422A true CN103279422A (en) | 2013-09-04 |
CN103279422B CN103279422B (en) | 2015-09-09 |
Family
ID=49061951
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310238825.2A Expired - Fee Related CN103279422B (en) | 2013-06-17 | 2013-06-17 | A kind of method that self-adapting random based on repulsive area is tested |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103279422B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105786708A (en) * | 2016-03-21 | 2016-07-20 | 苏州大学 | Iterative division testing method and system |
CN110221957A (en) * | 2018-12-10 | 2019-09-10 | 江苏大学 | A kind of self-adapting random test method divided equally based on iteration region with positioning |
CN112306859A (en) * | 2020-07-10 | 2021-02-02 | 北京航空航天大学 | Improved software self-adaptive testing method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060253739A1 (en) * | 2005-05-03 | 2006-11-09 | Godefroid Patrice I | Method and apparatus for performing unit testing of software modules with use of directed automated random testing |
CN102508770A (en) * | 2011-10-10 | 2012-06-20 | 南京大学 | Test case suite amplification method based on self-adaption random testing of predicate |
CN102629229A (en) * | 2012-03-02 | 2012-08-08 | 南京大学 | Co-diversified random testing (CAT) method |
-
2013
- 2013-06-17 CN CN201310238825.2A patent/CN103279422B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060253739A1 (en) * | 2005-05-03 | 2006-11-09 | Godefroid Patrice I | Method and apparatus for performing unit testing of software modules with use of directed automated random testing |
CN102508770A (en) * | 2011-10-10 | 2012-06-20 | 南京大学 | Test case suite amplification method based on self-adaption random testing of predicate |
CN102629229A (en) * | 2012-03-02 | 2012-08-08 | 南京大学 | Co-diversified random testing (CAT) method |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105786708A (en) * | 2016-03-21 | 2016-07-20 | 苏州大学 | Iterative division testing method and system |
CN105786708B (en) * | 2016-03-21 | 2018-06-01 | 苏州大学 | A kind of Loop partition test method and system |
CN110221957A (en) * | 2018-12-10 | 2019-09-10 | 江苏大学 | A kind of self-adapting random test method divided equally based on iteration region with positioning |
CN110221957B (en) * | 2018-12-10 | 2023-06-09 | 江苏大学 | Adaptive random test method based on iterative region equipartition and positioning |
CN112306859A (en) * | 2020-07-10 | 2021-02-02 | 北京航空航天大学 | Improved software self-adaptive testing method |
CN112306859B (en) * | 2020-07-10 | 2022-07-08 | 北京航空航天大学 | Improved software self-adaptive testing method |
Also Published As
Publication number | Publication date |
---|---|
CN103279422B (en) | 2015-09-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110505241B (en) | Network attack plane detection method and system | |
CN104317722B (en) | A kind of unit test method and device based on Junit | |
CN103279422A (en) | Self-adaptive random test method based on rejecting area | |
Vilkomir et al. | Evaluation of t-wise approach for testing logical expressions in software | |
CN105302413A (en) | UI test method and system for control | |
Huang et al. | Poster: Is euclidean distance the best distance measurement for adaptive random testing? | |
Hirata et al. | Statistical tests for serial dependence and laminarity on recurrence plots | |
CN105045715A (en) | Programming mode and mode matching based bug clustering method | |
CN104462983A (en) | PHP source code processing method and system | |
CN103295227A (en) | Circle detection method based on gradient direction segmentation | |
CN103646031B (en) | The coordinate data control methods of DRC files | |
Zhang et al. | An Application of Adaptive Random Sequence in Test Case Prioritization. | |
US9501390B1 (en) | Enhancing automated mobile application testing | |
CN109284513B (en) | Chip layout detection method and device, computer readable storage medium and terminal | |
CN112597662A (en) | Method and system for checking correctness and mistakes of building model | |
CN102103539A (en) | Z-specification-based test case generating method | |
CN103970129A (en) | Control valve adhesion detecting method | |
CN105701004B (en) | Application testing method and device | |
CN106326106B (en) | Resource leakage detection method based on android handbooks | |
CN104050079A (en) | Real-time system testing method based on time automata | |
CN103226470A (en) | Method and device for determining weighted value of check item based on BVS (benchmark verification system) | |
Pathania et al. | Role of test case prioritization based on regression testing using clustering | |
US8924316B2 (en) | Multiclass classification of points | |
CN106291222A (en) | The method of testing of a kind of holding wire annexation and device | |
CN103902420A (en) | Method and device for performance test of electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20150909 Termination date: 20200617 |