CN105786708A - Iterative division testing method and system - Google Patents
Iterative division testing method and system Download PDFInfo
- Publication number
- CN105786708A CN105786708A CN201610160340.XA CN201610160340A CN105786708A CN 105786708 A CN105786708 A CN 105786708A CN 201610160340 A CN201610160340 A CN 201610160340A CN 105786708 A CN105786708 A CN 105786708A
- Authority
- CN
- China
- Prior art keywords
- case
- tested
- priority
- priority set
- unenforced
- 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/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Test And Diagnosis Of Digital Computers (AREA)
Abstract
The invention provides an iterative division testing method and system. Whether all of to-be-tested cases in a to-be-tested case set have been executed is judged, if yes, an input domain D is divided according to the executed tested cases, and center points of 2<m*n> input subdomains obtained after division are taken as the to-be-tested cases to be imported into the to-be-tested case set; if no, the unexecuted to-be-tested cases in the to-be-tested case set are executed; whether the currently executed to-be-tested cases hit the failure area is judged, if yes, the number of executed tested cases is output, and if no, whether all of the to-be-tested cases in the to-be-tested case set have been executed is judged. The method combines advantages of two traditional techniques of random testing and division testing, and the problem of limitation of the two traditional techniques is solved.
Description
Technical field
The present invention relates to software testing technology field, be specifically related to a kind of Loop partition method of testing improving failure detection ability and efficiency and system.
Background technology
Software test, as an important technology in software quality assurance, receives the extensive concern of academia and industrial quarters.In the process of software test, unpractical often owing to the whole input domain of software to be carried out limit test, therefore how to select the least possible test case to carry out discovery procedure inefficacy as early as possible and become particularly important.In existing numerous measuring technologies, random test and partition testing are measuring technologies two kinds classical.
Random test have simple effectively, should be readily appreciated that and the advantage such as realization, but, owing to not utilizing other any useful information in random test process, its failure detection ability is frequently not highly desirable.Adaptive random testing is the random test technology of a kind of improvement, by realizing test case being uniformly distributed on input domain, improves the failure detection ability of random test, but this technology also correspondingly brings computing cost extra in a large number.
Partition testing is typically based on identical function or attribute carries out the division of subdomain, it would be desirable to obtaining desirable dividing mode and make each subdomain be homogeneity, namely all inputs in same subdomain are correct input or the input causing program to lose efficacy.Obtaining on the basis effectively divided, partition testing is also little for the expense selecting test case, but, the subdomain of early stage divides but to generally require and expends time overhead extra in a large number.
Visible, no matter it is random test or partition testing, all there is certain limitation.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of Loop partition method of testing and system, to solve random test and the confinement problems of two kinds of conventional arts of partition testing.
For achieving the above object, the embodiment of the present invention provides following technical scheme:
A kind of Loop partition method of testing, including:
Obtain m and tie up the input domain D of program to be measured;
Select the central point of described input domain D as use-case to be tested, described use-case to be tested is put into use-case set to be tested;
Whether the use-case to be tested judged in described use-case set to be tested is all finished, if it is, according to executed test case, described input domain D is divided, 2 after being dividedm*nIndividual sub-input domain, wherein, described n is for dividing number of times;If not, perform unenforced use-case to be tested in described use-case set to be tested, judge whether the current use-case to be tested performed hits failed areas, if, export executed test case quantity, if it does not, whether the use-case to be tested judged in described use-case set to be tested is all finished;
Select the center of every sub-input domain after dividing as use-case to be tested, described use-case to be tested is put into use-case set to be tested, whether the use-case to be tested judged in described use-case set to be tested is all finished, till exporting executed test case quantity;
Wherein, after often performing a use-case to be tested, described test case quantity increases by 1, and executed use-case to be tested is labeled as executed test case.
Preferably, in above-mentioned Loop partition method of testing, unenforced use-case to be tested in the described use-case set to be tested of described execution, including:
According to pre-set priority division rule, the use-case to be tested in described use-case set to be tested is divided;
Unenforced use-case to be tested in described use-case set to be tested is performed successively according to priority order from high to low.
Preferably, in above-mentioned Loop partition method of testing, unenforced use-case to be tested in the described use-case set to be tested of described execution, including:
According to pre-set priority division rule, use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set, the priority of wherein said first priority set is more than described second priority set, and the priority of described second priority set is more than described third priority set;
Whether the use-case to be tested judged in described first priority set is finished, if not, perform unenforced use-case to be tested in described first priority set successively, if, whether the use-case to be tested judged in described second priority set is finished, if it does not, perform unenforced use-case to be tested in described second priority set successively, if it is, the use-case unenforced to be tested performed successively in described third priority set.
Preferably, in above-mentioned Loop partition method of testing, described according to pre-set priority division rule, the use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set, including:
Occur the priority of maximum change that rule is set according to the maximum failure area causing when performing use-case to be tested currently can putting into, the use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set.
Preferably, in above-mentioned Loop partition method of testing, the use-case to be tested in described first priority set satisfies condition: the index on often one-dimensional is not 0 or maximum, and the difference of the index on often one-dimensional and the indexes in other dimensions can be divided exactly by 2;
Use-case to be tested in described third priority set satisfies condition: the index on often one-dimensional is 0 or maximum;
Use-case to be tested in described second priority set is the use-case to be tested being not belonging to described first priority set and third priority set in described use-case set to be tested.
A kind of Loop partition test system, including:
Collecting unit, ties up the input domain D of program to be measured for obtaining m;
Use-case to be tested chooses unit, for when described input domain D is unallocated, selecting the central point of described input domain D as use-case to be tested, described use-case to be tested is put into use-case set to be tested;When described input domain D divides, described use-case to be tested, as use-case to be tested, is put into use-case set to be tested by the center of every sub-input domain after selecting the last time to divide;
Judging unit, for judging whether to get the stop signal of described performance element output, if, stopping action, otherwise, it is judged that whether the use-case to be tested in described use-case set to be tested is all finished, if, signal is triggered, if it does not, trigger signal to performance element output to division unit output;
Performance element, for when after the triggering signal getting the output of described judging unit, perform unenforced use-case to be tested in described use-case set to be tested, judge whether the current use-case to be tested performed hits failed areas, if it is, export executed test case quantity, stop continuing executing with use-case to be tested, stop signal is exported, if it does not, continue executing with unenforced use-case to be tested in described use-case set to be tested to described judging unit;
Division unit, for when, after the triggering signal getting the output of described performance element, according to executed test case, described input domain D being divided, 2 after being dividedm*nIndividual sub-input domain;
Wherein, after often performing a use-case to be tested, described test case quantity increases by 1, and executed use-case to be tested is labeled as executed test case.
Preferably, in above-mentioned Loop partition test system, described performance element includes:
First test case chooses unit, for when described performance element needs to perform unenforced use-case to be tested in described use-case set to be tested, according to pre-set priority division rule, the use-case to be tested in described use-case set to be tested is divided, by in described unit set to be tested, the highest use-case to be tested of priority is as the use-case to be tested performed needed for described performance element.
Preferably, in above-mentioned Loop partition test system, described performance element includes:
Set divides module, for according to pre-set priority division rule, use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set, the priority of wherein said first priority set is more than described second priority set, and the priority of described second priority set is more than described third priority set;
Second test case chooses unit, for when described performance element needs to perform unenforced use-case to be tested in described use-case set to be tested, whether the use-case to be tested judged in described first priority set is finished, if not, using unenforced use-case to be tested in described first priority set as the use-case to be tested performed needed for described performance element, if, whether the use-case to be tested judged in described second priority set is finished, if not, using unenforced use-case to be tested in described second priority set as the use-case to be tested performed needed for described performance element, if, using use-case to be tested unenforced in described third priority set as the use-case to be tested performed needed for described performance element.
Preferably, in above-mentioned Loop partition test system, described set divide module specifically for, occur the priority of maximum change that rule is set according to the maximum failure area causing when performing use-case to be tested currently can putting into, the use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set.
Preferably, in above-mentioned Loop partition test system, described set divides module, specifically for:
Be not 0 or maximum by the index on often one-dimensional, and often one-dimensional on the use-case to be tested that can be divided exactly by 2 of the difference of index and the indexes in other dimensions import the first priority set;
By the index on often one-dimensional be 0 or the use-case to be tested of maximum import third priority set;
The use-case to be tested being not belonging to the first priority set and third priority set in described use-case set to be tested is imported described second priority set.
Based on technique scheme, the Loop partition method of testing of embodiment of the present invention offer and system, by adopting: whether the use-case to be tested judged in described use-case set to be tested is all finished, if not, perform unenforced use-case to be tested in described use-case set to be tested, judge whether the current use-case to be tested performed hits failed areas, if, export executed test case quantity, if it does not, whether the use-case to be tested judged in described use-case set to be tested is all finished;The use-case to be tested judged in described use-case set to be tested is all finished, if it is, according to executed test case, described input domain D is divided, 2 after being dividedm*nThe test mode of individual sub-input domain, does not rely on any pretreatment to input domain and divides, and computing cost is extremely low;The high uniformity distribution of test case can be realized so that it is there is good failure detection ability;The upper bound of test case quantity needed for detection was lost efficacy can be calculated.Than existing measuring technology, the present invention, from partition testing, has used for reference the equally distributed thought of adaptive random testing, combines random test and the advantage of two kinds of conventional arts of partition testing, solves random test and the corresponding limitation of partition testing.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, the accompanying drawing used required in embodiment or description of the prior art will be briefly described below, apparently, accompanying drawing in the following describes is only embodiments of the invention, for those of ordinary skill in the art, under the premise not paying creative work, it is also possible to obtain other accompanying drawing according to the accompanying drawing provided.
Fig. 1 is the schematic flow sheet of a kind of Loop partition method of testing disclosed in the embodiment of the present application;
Fig. 2 is the schematic flow sheet of a kind of Loop partition method of testing disclosed in another embodiment of the application
Fig. 3 is the schematic flow sheet of a kind of Loop partition method of testing disclosed in the another embodiment of the application;
Fig. 4 divides the schematic diagram producing 16 sub-input domains 2 times;
Fig. 5 is that the test case based on priority performs schematic diagram;
Fig. 6 is the structural representation of a kind of Loop partition test system disclosed in the embodiment of the present application.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only a part of embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under not making creative work premise, broadly fall into the scope of protection of the invention.
Based on existing related work and analysis, present invention seek to address that the equilibrium problem of failure detection ability and time overhead in software test procedure, the present invention, by partition testing, has used for reference the equally distributed thought of adaptive random testing simultaneously, it is proposed that a kind of Loop partition measuring technology.This technology is a kind of Loop partition measuring technology based on input domain spatial information, than other partition testing technology based on information such as function, path or risks, input domain spatial information needed for this technology is readily available and need not do extra pretreatment, significantly reduces partition testing expense in pretreatment.Meanwhile, the technological borrowing of the present invention equally distributed thought of adaptive random testing, it is possible to only using close on the basis of random test time overhead, it is thus achieved that even better failure detection ability close to adaptive random testing.
Concrete, referring to Fig. 1, disclosed in the embodiment of the present application, Loop partition method of testing may include that
Step S101: obtain m and tie up the input domain D of program to be measured;
Described m is the dimension of input domain, and when program to be measured has m input parameter, the input domain of this program is m-dimensional space, and suppose to be the continuous space that each dimension is equidistant, for instance as described m=2, described input domain is 2 dimension squares, as described m=3, described input domain is 3 dimension squares;
Step S102: select the central point of described input domain D as use-case to be tested, described use-case to be tested is put into use-case set to be tested;
In method disclosed in the present embodiment, the method adopting center sampling chooses use-case to be tested, namely when described input domain D divides, select the central point of described input domain D as use-case to be tested, after described input domain D divides, choose the central point of the last each subdomain dividing and obtaining as pending use-case to be tested, and these unenforced use-cases to be tested are imported in use-case set to be tested;
Step S103: whether the use-case to be tested judged in described use-case set to be tested is all finished, if it is, perform step S104, if it does not, perform step S105;
Disclosed method, when performing the use-case to be tested in described use-case set to be tested every time, first determine whether whether described use-case set to be tested exists the test case not being performed, if it is not, need to perform step S104, described input domain D is divided again, obtain the subdomain after each divides, to obtain each new use-case to be tested, if described use-case set to be tested exists unenforced use-case to be tested, perform described step S105, perform this test case;
Step S104: according to executed test case, described input domain D is divided, performs step S108;
In this step, after the use-case to be tested in described use-case set to be tested is finished, it is necessary to again described input domain D is divided, obtain new input domain, in method disclosed in the embodiment of the present application, divide every time and can obtain 2m*nIndividual sub-input domain, wherein, described n is the current number of times divided, such as, if if this time division is divide for the 1st time, described n is 1, if if this time division is divide for the 2nd time, described n is 2, and the quantity every time dividing the sub-input domain obtained is that geometry multiple increases;
Step S105: perform unenforced use-case to be tested in described use-case set to be tested, enters step S106;
In this step, if described use-case set to be tested has the use-case to be tested not carrying out testing, carry out performing test to described unenforced use-case to be tested;
Step S106: judge whether the current use-case to be tested performed hits failed areas, if it is, perform step S107, if it does not, perform step S103;
In this step, after often performing a use-case to be tested, it is necessary to the execution result of this use-case to be tested is judged, it is judged that perform whether result hits failed areas;
Step S107: export executed test case quantity;
In this step, when, after hit failed areas, the quantity of the executed test case of output is as the module of test, and executed test case quantity is more few, illustrate that the test case quantity needed for testing out failed areas is more few, testing efficiency is more high, and otherwise, testing efficiency is more low, wherein, after often performing a use-case to be tested, described test case quantity increases by 1, and executed use-case to be tested is labeled as executed test case;
After this execution use-case to be tested fails hit failed areas, continue executing with, step S103;
Step S108: select the center of every sub-input domain after dividing as use-case to be tested, described use-case to be tested is put into use-case set to be tested, performs step S103, till execution step S107 exports executed test case quantity.
Method disclosed in the above embodiments of the present application, compared with tradition partition testing technology, does not rely on any pretreatment to input domain and divides, and computing cost is extremely low;The high uniformity distribution of test case can be realized so that it is there is good failure detection ability;The upper bound of test case quantity needed for detection was lost efficacy can be calculated.Than existing measuring technology, the present invention, from partition testing, has used for reference the equally distributed thought of adaptive random testing, combines random test and the advantage of two kinds of conventional arts of partition testing, solves corresponding limitation respectively.
Experiments show that through actual emulation, adopt method disclosed in the above embodiments of the present application, when to software test, when only using close to tradition random test technology time overhead, it is possible to reach even better failure detection ability close to adaptive random testing.Meanwhile, also performance is good in higher-dimension input domain, different failure modes and true program for the present invention, has wide applicability and high efficiency.
It is understandable that, when performing the use-case to be tested in described use-case set to be tested, different implementation strategies can be selected according to user's request, such as, Loop partition measuring technology (IterativePartitionTesting can be adopted, IPT) implementation strategy in, it is possible to adopt based on the implementation strategy in the Loop partition measuring technology (IterativePartitionTestingbasedonPrioritySampling, IPT-PS) of priority;
If adopt the implementation strategy in IPT, described step S105 is specifically as follows: adopts that does not put back at random to choose mode, chooses the use-case to be tested in described use-case set to be tested one by one;
If adopt the implementation strategy in IPT-PS, referring to Fig. 2, described step S105 is specifically as follows:
Step S1051: the use-case to be tested in described use-case set to be tested is divided according to pre-set priority division rule;
In this step, user can select suitable priority division rule according to self-demand, according to this division rule, the priority of each use-case to be tested in described use-case set to be tested is divided, in performing described use-case set to be tested during unenforced use-case to be tested, the use-case unenforced to be tested that preferential execution priority is the highest;
Step S1052: perform unenforced use-case to be tested in described use-case set to be tested successively according to priority order from high to low.
Concrete, when adopting the implementation strategy in IPT-PS, except each use-case to be tested is carried out prioritization, referring to Fig. 3, described step S105 can also be specifically:
Step S1053: according to pre-set priority division rule, the use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set;
Wherein, in this step, can according to the type of the use-case to be tested in described use-case set to be tested, use-case to be tested in described use-case set to be tested is divided into multiple priority set, when performing use-case to be tested, unenforced use-case to be tested in the priority set that preferential execution priority is the highest;In the present embodiment, the priority of described first priority set is more than described second priority set, and the priority of described second priority set is more than described third priority set;
Step S1054: whether the use-case to be tested judged in described first priority set is finished, if it does not, perform step S1055, if it is, perform step S1056;
Step S1055: adopt the mode do not put back to choose successively and perform unenforced use-case to be tested in described first priority set;
Step S1056: whether the use-case to be tested judged in described second priority set is finished, if it does not, perform step S1057;If it is, perform step S1058;
Step S1057: adopt the mode do not put back to choose successively and perform unenforced use-case to be tested in described second priority set;
Step S1058: adopt the mode do not put back to choose successively and perform the use-case unenforced to be tested in described third priority set.
Concrete, different priority level initializing rules can cause that method testing efficiency disclosed in the above embodiments of the present application is different, in order to ensure testing efficiency, in said method, described step S1053 is specifically as follows: occur the priority of maximum change to arrange rule according to the maximum failure area causing when performing use-case to be tested currently can putting into, the use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set.
More specifically, the use-case to be tested in described first priority set satisfies condition: the index on often one-dimensional is not 0 or maximum, and the difference of the index on often one-dimensional and the indexes in other dimensions can be divided exactly by 2;Use-case to be tested in described third priority set satisfies condition: the index on often one-dimensional is 0 or maximum;Use-case to be tested in described second priority set is the use-case to be tested being not belonging to described first priority set and third priority set in described use-case set to be tested.
In order to facilitate user more clearly to understand the work process of method disclosed in the above embodiments of the present application, the application also adopts specific embodiment to tie up program to be measured for test object with 2, and the execution process of the method has been described in detail;
Assuming that inefficacy territory is block pattern.When adopting the implementation strategy of IPT, in Fig. 4 shown in (a)-(d), first the central point a selecting input domain A performs as test case, if a fails to hit failed areas, then according to a, input domain being divided into 4 sub-input domain B1-B4, the central point b1-b4 choosing B1-B4 respectively as use-case to be tested and performs successively.If b1-b4 all fails to hit failed areas, then according to b1-b4, input domain being divided into 16 sub regions C1-C16, the central point c1-c16 choosing C1-C16 respectively as use-case to be tested and performs successively.Now, the central point c4 of upper right side subregion C4 will hit failed areas, namely detect inefficacy, export the quantity of executed use-case to be tested.Otherwise, if c1-c16 all fails to hit failed areas, then iteration is carried out next round division, produces 64 sub regions.
For the implementation strategy of IPT-PS, also assuming that the input domain of program to be measured is 2 dimension rectangular areas, inefficacy territory is block pattern.In Fig. 5 shown in (a): early stage has been carried out 1 time and divides, and executed 5 test cases symbol " " represent, divide the central point being produced 16 sub-input domains for the 2nd time and form use-case set { c1-c16} to be tested.Spatial character according to these use-cases to be tested, 16 test cases are divided into three kinds of different priority levels, corresponding set is T1, T2, T3, when same priority, wherein any one test case will be performed at random, it is to be understood that when described input domain not being divided, because only having a use-case to be tested in described use-case set to be tested, therefore gathering two set in T1, T2, T3 is sky.
For realizing the executing rule of IPT-PS, it must be understood that how by pending test case classification, and give the priority that each use-case to be tested is different.In method disclosed in the above embodiments of the present application, the priority of use-case to be tested depends on that the maximum failure region area (being designated as S) whether the execution of this test case can cause currently can putting into produces change.As shown in Fig. 5 (a)-(d), it is assumed that the area of input domain is 1, before the test case adding 2 " * ", S=1/4, when, after the test case putting into 2 " * ", S will be changed toAfter the test case adding 10 " Δs ", S will be changed toAfter the test case adding last 4 " ο ", S remains unchanged.As can be seen here, in this example, the test case being labeled as " * " belongs to set T1, and priority is the highest;The test case being labeled as " Δ " belongs to set T2, and priority is taken second place;The test case being labeled as " ο " belongs to set T3, and priority is minimum.
Wherein, the computational methods that the implementation strategy of IPT-PS divides use-case priority to be tested are as follows: as shown in Fig. 5 (b), divide obtain 2 for often one-dimensional through n timenThe central point of individual subdomain, namely 2nIndividual pending test case indexes, and is designated as Ik=0,1,2 ... 2n-1}, wherein subscript k represents that kth is tieed up.So, in 2 dimension spaces, pending 22nIndividual test case can use (i1,i2) uniquely tagged, wherein i1∈I1,i2∈I2.Observe Fig. 5 it is found that the element in T1 need to meet following two condition simultaneously: the index on (1) is often one-dimensional is not 0 or maximum (i.e. i1≠0,2n-1 and i2≠0,2n-1);(2)|i1-i2| mod2 was 0 (mod represents remainder).Element in T3 meets: the index on often one-dimensional is 0 or maximum.T2 is then 22nIndividual use-case to be measured is not belonging to the set that the test case of T1 and T3 is constituted.
When being generalized to m-dimensional space from 2 dimension spaces, divide obtain 2 through n timemnIndividual use-case to be measured can use (i1,i2,…,im) uniquely tagged, wherein ik∈Ik.At this point it is possible to by 2mnIndividual use-case to be measured is respectively put into T1, T2, T3 according to following rule:
Element in T1 meets: the index on (1) is often one-dimensional is not 0 or maximum (i.e. ik≠0,2n, and (2)-1) | ij-ij+1| mod2 is 0, wherein j ∈ 1,2 ..., m-1}.
Element in T3 meets: the index on often one-dimensional is 0 or maximum.
T2 is 2mnIndividual use-case to be measured is not belonging to the set that the test case of T1 and T3 is constituted.
Method of testing disclosed in the above embodiments of the present application, different according to its implementation strategy, it is possible to be divided into IPT method of testing and IPT-PS method of testing, when described IPT method of testing is simulated test, its main flow is as follows:
Input: m ties up the input domain D, failed areas F of program to be measured
Output: first test case quantity F-count used when losing efficacy detected
Step 1: initialize F-count=0, divides hierachy number n=0;
Step 2: the central point a choosing input domain D performs, F-count++;
IF central point a hits failed areas;
THENRETURNF-count;
ELSEn++;
ENDIF;
Step 3 (Loop partition): territory will be currently entered according to executed test case and be divided into 2mnIndividual sub-input domain;
Step 4 (center sampling): sampling 2mnThe central point of individual sub-input domain forms set of uses case TestSet to be measured;
Step 5 (use-case execution): when TestSet is not empty, according to implementation strategy, choose test case t ∈ TestSet with not putting back to successively perform, F-count++;
IF test case t hits failed areas;
THENRETURNF-count;
ENDIF;
Step 6:n++, turns to step 3.
Wherein obtain 2 in step 4mnAfter the central point of individual subdomain forms set of uses case to be measured, step 5 (use-case execution) can adopt multiple implementation strategy, including based on equiprobable implementation strategy, such as random execution, order execution etc.;And the implementation strategy based on unequal probability, such as the execution etc. based on priority.In IPT algorithm, step 5 (use-case execution) adopts random execution.
When described IPT-PS method of testing is simulated test, its main flow is as follows:
Input: m ties up the input domain D, failed areas F of program to be measured;
Output: first test case quantity F-count used when losing efficacy detected;
Step 1: initialize F-count=0, divides hierachy number n=0;
Step 2: the central point a choosing input domain D performs, F-count++;
IF central point a hits failed areas;
THENRETURNF-count;
ELSEn++;
ENDIF;
Step 3 (Loop partition): territory will be currently entered according to executed test case and be divided into 2mnIndividual sub-input domain;
Step 4 (center sampling): sampling 2mnThe central point of individual sub-input domain forms set of uses case TestSet to be measured;
Step 5 (use-case based on priority performs): according to priority height, by 2mnIndividual use-case to be measured is respectively put into set T1, T2, T3;
Successively for set Ti (i=1,2,3);
WHILE
Random from Ti select test case tj (j=1,2 ... | Ti |) perform;
Ti=Ti { tj}, F-count++;
IF test case tj hits failed areas;
THENRETURNF-count;
ENDIF;
ENDWHILE;
Step 6:n++, turns to step 3.
The Loop partition of IPT-PS technology is identical with IPT algorithm with center sampling process, is distinctive in that in IPT-PS technology step 5 and the use-case based on priority will be adopted to perform.
The present invention illustrates the service condition of above two technology initially with emulation experiment, analyzes present invention feasibility in true application then in conjunction with true program.
Wherein, the parameter that above-mentioned emulation experiment relates to includes: dimension, crash rate, method of testing and experiment number, illustrates as follows one by one:
Dimension: when program to be measured has m input parameter, the input domain of this program is m-dimensional space, and supposes to be the continuous space that each dimension is equidistant, namely 2 dimension input domains are square, and 3 dimension input domains are square.
Crash rate: namely inefficacy input domain accounts for the ratio of whole input domain, it is clear that crash rate θ ∈ [0,1].Simultaneously it is assumed that the inefficacy input domain continuous space that to be also each dimension equidistant.
Method of testing: IPT method of testing and IPT-PS method of testing, IPT: the present invention propose Loop partition, center sampling partition testing technology.IPT-PS: the partition testing technology that Loop partition, center sampling and the use-case based on priority that the present invention proposes performs.
Experiment number: repeating certain experiment number is to be prevented effectively from the randomness impact on experimental result: one is the randomness of position, inefficacy territory, two is the randomness that method of testing selects test case.In emulation experiment, by repeating 1000 or the randomness of position, inefficacy territory can be overcome with experiment last time;Under the premise of position, given inefficacy territory, by repeating 2000 or the randomness of test cases selection can be overcome with experiment last time.
Configuring according to above-mentioned experiment parameter, emulation experiment process specifically can be summarized as:
Input domain is produced according to dimension;
Calculate according to crash rate and produce inefficacy territory, in experiment each time, randomly placing inefficacy territory;
Select test case according to method of testing one by one, then think that it detects failed areas when use-case to be tested hits in inefficacy territory, record current executed test case quantity F-count;
When completing regulation experiment number, the meansigma methods of F-count is designated as F-measure, and records the total time that experiment is spent.
The tolerance of this experiment includes measure of effectiveness and efficiency metric.In measure of effectiveness, adopt the ratio of the theoretical value (i.e. 1/ θ) of the F-measure of various technology and the F-measure of random test, be designated as F-ratio, weigh the improvement of relatively random test in failure detection ability of various technology.Obviously, F-ratio is more little, then the improvement of the relatively random test of this technology is more obvious.In efficiency metric, adopt various technology to complete the average time needed for a failure detection, be designated as Runtime and carry out the time overhead of the various technology of comparison.
Applicant to method disclosed in the above embodiments of the present application through carrying out above-mentioned emulation experiment, show: when only using close to tradition random test time overhead, the IPT-PS technology of the present invention can reach even better failure detection ability close to adaptive random testing.Compared to IPT method, IPT-PS method can effectively reduce the F-ratio of algorithm.Meanwhile, IPT-PS also has wide applicability in higher-dimension input domain, different failure modes.
The suitability of analyzing IP T-PS method additionally, the Cprogram (select program) that IPT-PS method is also applied in NumericalRecipes by applicant comes up.The input of Select program is two integers and a floating number array (unsignedlongk, unsignedlongn, floatarr []), is output as a floating number, the number that namely in n dimension group, kth is little.
Concrete execution process is as follows:
Adopt the variation of Csaw instrument stochastic generation, the initial version of program is implanted failed areas;
Variation is selected and simplifies after generating by variation: randomly selects one from the variation that all failure modes are identical and makes a variation as effectively variation, say, that each failure mode effectively made a variation is all different, and wherein, select has 8 effective variations;
For each effective variation, repeat to test and record for 30 times random test and IPT-PS method is detect the quantity of test case needed for this variation;
When completing regulation experiment number, make NRT、NIPT-PSThe respectively average of random test and test case quantity required for the present invention;
Making N-ratio is the ratio of test case quantity, i.e. N-ratio=N needed for test case quantity and random test needed for IPT-PS methodIPT-PS/NRT, when N-ratio < when 1, illustrates that IPT-PS method disclosed in the present application performance is better than traditional random test;As N-ratio > 1 time, illustrate IPT-PS method disclosed in the present application performance be inferior to random test.
Test result indicate that, in 8 effective variations of select, there is 6 (75%) variation, the N-ratio < 1 of its correspondence;Only have 2 N-ratio > 1 corresponding to variation.Visible, for select and variation version thereof, IPT-PS method disclosed in the embodiment of the present application also exists and is quickly detected the very big possible of inefficacy.
To sum up, by the checking of above-mentioned true program and variation version thereof, it is seen that said method disclosed in the embodiment of the present application is feasible in true application, and there is the possibility being quickly detected inefficacy.
It is understood that be directed to said method, disclosed herein as well is a kind of Loop partition test system, the technical characteristic between described method and system can be used for reference mutually, referring to Fig. 6, including:
Collecting unit 100, ties up the input domain D of program to be measured for obtaining m;
Use-case to be tested chooses unit 200, for when described input domain D is unallocated, selecting the central point of described input domain D as use-case to be tested, described use-case to be tested is put into use-case set to be tested;When described input domain D divides, described use-case to be tested, as use-case to be tested, is put into use-case set to be tested by the center of every sub-input domain after selecting the last time to divide;
Judging unit 300, for judging whether to get the stop signal of described performance element output, if, stopping action, otherwise, it is judged that whether the use-case to be tested in described use-case set to be tested is all finished, if, signal is triggered, if it does not, trigger signal to performance element output to division unit output;
Performance element 400, for when after the triggering signal getting the output of described judging unit, perform unenforced use-case to be tested in described use-case set to be tested, judge whether the current use-case to be tested performed hits failed areas, if it is, export executed test case quantity, stop continuing executing with use-case to be tested, stop signal is exported, if it does not, continue executing with unenforced use-case to be tested in described use-case set to be tested to described judging unit;
Division unit 500, for when, after the triggering signal getting the output of described performance element, according to executed test case, described input domain D being divided, 2 after being dividedm*nIndividual sub-input domain;
Wherein, after often performing a use-case to be tested, described test case quantity increases by 1, and executed use-case to be tested is labeled as executed test case.
Corresponding with said method, described performance element 400 may include that
First test case chooses unit, for when described performance element needs to perform unenforced use-case to be tested in described use-case set to be tested, according to pre-set priority division rule, the use-case to be tested in described use-case set to be tested is divided, by in described unit set to be tested, the highest use-case to be tested of priority is as the use-case to be tested performed needed for described performance element, or, described first test case chooses unit, for adopting that does not put back at random to choose mode, choose the use-case to be tested in described use-case set to be tested one by one.
Corresponding with said method, described performance element 400 may include that
Set divides module, for according to pre-set priority division rule, use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set, the priority of wherein said first priority set is more than described second priority set, and the priority of described second priority set is more than described third priority set;
Second test case chooses unit, for when described performance element needs to perform unenforced use-case to be tested in described use-case set to be tested, whether the use-case to be tested judged in described first priority set is finished, if not, using unenforced use-case to be tested in described first priority set as the use-case to be tested performed needed for described performance element, if, whether the use-case to be tested judged in described second priority set is finished, if not, using unenforced use-case to be tested in described second priority set as the use-case to be tested performed needed for described performance element, if, using use-case to be tested unenforced in described third priority set as the use-case to be tested performed needed for described performance element.
Corresponding with said method, described set divides module, specifically for, occur the priority of maximum change that rule is set according to the maximum failure area causing when performing use-case to be tested currently can putting into, the use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set.
Corresponding with said method, described set divides module, specifically for, be not 0 or maximum by the index on often one-dimensional, and often one-dimensional on the use-case to be tested that can be divided exactly by 2 of the difference of index and the indexes in other dimensions import the first priority set;
By the index on often one-dimensional be 0 or the use-case to be tested of maximum import third priority set;
The use-case to be tested being not belonging to the first priority set and third priority set in described use-case set to be tested is imported described second priority set.
In this specification, each embodiment adopts the mode gone forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar portion mutually referring to.For device disclosed in embodiment, owing to it corresponds to the method disclosed in Example, so what describe is fairly simple, relevant part illustrates referring to method part.
Described above to the disclosed embodiments, makes professional and technical personnel in the field be capable of or uses the present invention.The multiple amendment of these embodiments be will be apparent from for those skilled in the art, and generic principles defined herein can without departing from the spirit or scope of the present invention, realize in other embodiments.Therefore, the present invention is not intended to be limited to the embodiments shown herein, and is to fit to the widest scope consistent with principles disclosed herein and features of novelty.
Claims (10)
1. a Loop partition method of testing, it is characterised in that including:
Obtain m and tie up the input domain D of program to be measured;
Select the central point of described input domain D as use-case to be tested, described use-case to be tested is put into use-case set to be tested;
Whether the use-case to be tested judged in described use-case set to be tested is all finished, if it is, according to executed test case, described input domain D is divided, 2 after being dividedm*nIndividual sub-input domain, wherein, described n is for dividing number of times;If not, perform unenforced use-case to be tested in described use-case set to be tested, judge whether the current use-case to be tested performed hits failed areas, if, export executed test case quantity, if it does not, whether the use-case to be tested judged in described use-case set to be tested is all finished;
Select the center of every sub-input domain after dividing as use-case to be tested, described use-case to be tested is put into use-case set to be tested, whether the use-case to be tested judged in described use-case set to be tested is all finished, till exporting executed test case quantity;
Wherein, after often performing a use-case to be tested, described test case quantity increases by 1, and executed use-case to be tested is labeled as executed test case.
2. Loop partition method of testing according to claim 1, it is characterised in that unenforced use-case to be tested in the described use-case set to be tested of described execution, including:
According to pre-set priority division rule, the use-case to be tested in described use-case set to be tested is divided;
Unenforced use-case to be tested in described use-case set to be tested is performed successively according to priority order from high to low.
3. Loop partition method of testing according to claim 1, it is characterised in that unenforced use-case to be tested in the described use-case set to be tested of described execution, including:
According to pre-set priority division rule, use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set, the priority of wherein said first priority set is more than described second priority set, and the priority of described second priority set is more than described third priority set;
Whether the use-case to be tested judged in described first priority set is finished, if not, perform unenforced use-case to be tested in described first priority set successively, if, whether the use-case to be tested judged in described second priority set is finished, if it does not, perform unenforced use-case to be tested in described second priority set successively, if it is, the use-case unenforced to be tested performed successively in described third priority set.
4. Loop partition method of testing according to claim 3, it is characterized in that, described according to pre-set priority division rule, the use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set, including:
Occur the priority of maximum change that rule is set according to the maximum failure area causing when performing use-case to be tested currently can putting into, the use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set.
5. Loop partition method of testing according to claim 3, it is characterised in that
Use-case to be tested in described first priority set satisfies condition: the index on often one-dimensional is not 0 or maximum, and the difference of the index on often one-dimensional and the indexes in other dimensions can be divided exactly by 2;
Use-case to be tested in described third priority set buys sufficient condition: the index on often one-dimensional is 0 or maximum;
Use-case to be tested in described second priority set is the use-case to be tested being not belonging to described first priority set and third priority set in described use-case set to be tested.
6. a Loop partition test system, it is characterised in that including:
Collecting unit, ties up the input domain D of program to be measured for obtaining m;
Use-case to be tested chooses unit, for when described input domain D is unallocated, selecting the central point of described input domain D as use-case to be tested, described use-case to be tested is put into use-case set to be tested;When described input domain D divides, described use-case to be tested, as use-case to be tested, is put into use-case set to be tested by the center of every sub-input domain after selecting the last time to divide;
Judging unit, for judging whether to get the stop signal of described performance element output, if, stopping action, otherwise, it is judged that whether the use-case to be tested in described use-case set to be tested is all finished, if, signal is triggered, if it does not, trigger signal to performance element output to division unit output;
Performance element, for when after the triggering signal getting the output of described judging unit, perform unenforced use-case to be tested in described use-case set to be tested, judge whether the current use-case to be tested performed hits failed areas, if it is, export executed test case quantity, stop continuing executing with use-case to be tested, stop signal is exported, if it does not, continue executing with unenforced use-case to be tested in described use-case set to be tested to described judging unit;
Division unit, for when, after the triggering signal getting the output of described performance element, according to executed test case, described input domain D being divided, 2 after being dividedm*nIndividual sub-input domain;
Wherein, after often performing a use-case to be tested, described test case quantity increases by 1, and executed use-case to be tested is labeled as executed test case.
7. Loop partition according to claim 6 test system, it is characterised in that described performance element includes:
First test case chooses unit, for when described performance element needs to perform unenforced use-case to be tested in described use-case set to be tested, according to pre-set priority division rule, the use-case to be tested in described use-case set to be tested is divided, by in described unit set to be tested, the highest use-case to be tested of priority is as the use-case to be tested performed needed for described performance element.
8. Loop partition according to claim 6 test system, it is characterised in that described performance element includes:
Set divides module, for according to pre-set priority division rule, use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set, the priority of wherein said first priority set is more than described second priority set, and the priority of described second priority set is more than described third priority set;
Second test case chooses unit, for when described performance element needs to perform unenforced use-case to be tested in described use-case set to be tested, whether the use-case to be tested judged in described first priority set is finished, if not, using unenforced use-case to be tested in described first priority set as the use-case to be tested performed needed for described performance element, if, whether the use-case to be tested judged in described second priority set is finished, if not, using unenforced use-case to be tested in described second priority set as the use-case to be tested performed needed for described performance element, if, using use-case to be tested unenforced in described third priority set as the use-case to be tested performed needed for described performance element.
9. Loop partition according to claim 8 test system, it is characterized in that, described set divide module specifically for, occur the priority of maximum change that rule is set according to the maximum failure area causing when performing use-case to be tested currently can putting into, the use-case to be tested in described use-case set to be tested is divided into the first priority set, the second priority set and third priority set.
10. Loop partition according to claim 8 test system, it is characterised in that described set divides module, specifically for:
Be not 0 or maximum by the index on often one-dimensional, and often one-dimensional on the use-case to be tested that can be divided exactly by 2 of the difference of index and the indexes in other dimensions import the first priority set;
By the index on often one-dimensional be 0 or the use-case to be tested of maximum import third priority set;
The use-case to be tested being not belonging to the first priority set and third priority set in described use-case set to be tested is imported described second priority set.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610160340.XA CN105786708B (en) | 2016-03-21 | 2016-03-21 | A kind of Loop partition test method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610160340.XA CN105786708B (en) | 2016-03-21 | 2016-03-21 | A kind of Loop partition test method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105786708A true CN105786708A (en) | 2016-07-20 |
CN105786708B CN105786708B (en) | 2018-06-01 |
Family
ID=56394197
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610160340.XA Active CN105786708B (en) | 2016-03-21 | 2016-03-21 | A kind of Loop partition test method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105786708B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107844939A (en) * | 2017-11-28 | 2018-03-27 | 广州真知码信息科技有限公司 | Sampling estimation cargo numbering method |
CN110221957A (en) * | 2018-12-10 | 2019-09-10 | 江苏大学 | A kind of self-adapting random test method divided equally based on iteration region with positioning |
CN110795349A (en) * | 2019-10-29 | 2020-02-14 | 毛澄映 | Self-adaptive random test case generation method based on central compensation strategy |
CN110825627A (en) * | 2019-10-30 | 2020-02-21 | 毛澄映 | Adaptive random test case generation method based on grid area density |
CN111367816A (en) * | 2020-03-25 | 2020-07-03 | 上海复深蓝软件股份有限公司 | Mobile test method and device, computer equipment and storage medium |
CN112035343A (en) * | 2020-08-13 | 2020-12-04 | 武汉大学 | Test case generation method and system based on Bayesian estimation |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090282289A1 (en) * | 2008-05-06 | 2009-11-12 | Microsoft Corporation | Generation and evaluation of test cases for software validation and proofs |
CN101908017A (en) * | 2010-06-01 | 2010-12-08 | 南京大学 | Regression test case screening method based on partial multi-coverage |
CN103279422A (en) * | 2013-06-17 | 2013-09-04 | 东南大学 | Self-adaptive random test method based on rejecting area |
US20130290786A1 (en) * | 2012-04-26 | 2013-10-31 | International Business Machines Corporation | Automated testing of applications with scripting code |
CN104820636A (en) * | 2015-04-09 | 2015-08-05 | 北京轩宇信息技术有限公司 | Ant colony algorithm based parallel test case sequence generation method |
-
2016
- 2016-03-21 CN CN201610160340.XA patent/CN105786708B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090282289A1 (en) * | 2008-05-06 | 2009-11-12 | Microsoft Corporation | Generation and evaluation of test cases for software validation and proofs |
CN101908017A (en) * | 2010-06-01 | 2010-12-08 | 南京大学 | Regression test case screening method based on partial multi-coverage |
US20130290786A1 (en) * | 2012-04-26 | 2013-10-31 | International Business Machines Corporation | Automated testing of applications with scripting code |
CN103279422A (en) * | 2013-06-17 | 2013-09-04 | 东南大学 | Self-adaptive random test method based on rejecting area |
CN104820636A (en) * | 2015-04-09 | 2015-08-05 | 北京轩宇信息技术有限公司 | Ant colony algorithm based parallel test case sequence generation method |
Non-Patent Citations (3)
Title |
---|
QU BO ET AL: "Test Case Prioritization for Black Box Testing", 《31ST ANNUAL INTERNATIONAL COMPUTER SOFTWARE AND APPLICATIONS CONFERENCE》 * |
ZHANG XIAOFANG ET AL: "An improved metric for test case prioritization", 《2011 EIGHTH WEB INFORMATION SYSTEMS AND APPLICATIONS CONFERENCE》 * |
仲晓芳等: "基于回归测试的软件测试方法的研究与应用", 《计算机技术与发展》 * |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107844939A (en) * | 2017-11-28 | 2018-03-27 | 广州真知码信息科技有限公司 | Sampling estimation cargo numbering method |
CN107844939B (en) * | 2017-11-28 | 2022-01-04 | 广州真知码信息科技有限公司 | Sampling estimation cargo numbering method |
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 |
CN110795349A (en) * | 2019-10-29 | 2020-02-14 | 毛澄映 | Self-adaptive random test case generation method based on central compensation strategy |
CN110795349B (en) * | 2019-10-29 | 2023-10-10 | 毛澄映 | Self-adaptive random test case generation method based on center compensation strategy |
CN110825627A (en) * | 2019-10-30 | 2020-02-21 | 毛澄映 | Adaptive random test case generation method based on grid area density |
CN110825627B (en) * | 2019-10-30 | 2023-08-04 | 毛澄映 | Adaptive random test case generation method based on grid area density |
CN111367816A (en) * | 2020-03-25 | 2020-07-03 | 上海复深蓝软件股份有限公司 | Mobile test method and device, computer equipment and storage medium |
CN112035343A (en) * | 2020-08-13 | 2020-12-04 | 武汉大学 | Test case generation method and system based on Bayesian estimation |
CN112035343B (en) * | 2020-08-13 | 2022-02-01 | 武汉大学 | Test case generation method and system based on Bayesian estimation |
Also Published As
Publication number | Publication date |
---|---|
CN105786708B (en) | 2018-06-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105786708A (en) | Iterative division testing method and system | |
CN104572462A (en) | Method for generating metamorphic test case based on adaptive random strategy | |
CN111835518B (en) | Error injection method and system in elliptic curve public key cryptographic algorithm security assessment | |
Chen et al. | Publicly verifiable databases with all efficient updating operations | |
CN104158748B (en) | A kind of topological detecting method towards system for cloud computing | |
Klocke et al. | Topological order and entanglement dynamics in the measurement-only XZZX quantum code | |
CN108572883A (en) | A kind of data correctness method of calibration and device | |
CN110221957A (en) | A kind of self-adapting random test method divided equally based on iteration region with positioning | |
Zhang et al. | Explicit determination of mean first-passage time for random walks on deterministic uniform recursive trees | |
CN110825627B (en) | Adaptive random test case generation method based on grid area density | |
CN110224876A (en) | A kind of application layer DDoS attacking and defending usefulness metric method | |
Sabor et al. | Adaptive random testing by static partitioning | |
CN109947846B (en) | Transaction data processing method and device, computer equipment and storage medium | |
CN104809175B (en) | The generation method and device of feature database | |
CN110502505A (en) | A kind of data migration method and device | |
CN110795349B (en) | Self-adaptive random test case generation method based on center compensation strategy | |
CN110099073A (en) | A kind of P2P botnet detection method, device and medium | |
de Lima et al. | A permutation technique for test case prioritization in a black-box environment | |
CN106411955B (en) | A kind of account generation method based on mould m congruence class ring | |
L'Écuyer et al. | Effective approximation of zero-variance simulation in a reliability setting | |
JP5507345B2 (en) | Measuring apparatus and measuring method | |
CN104297732B (en) | A kind of method and device producing MIMO radar signal based on frequency hopping | |
Showkatbakhsh et al. | Secure system identification | |
Sreeram et al. | A novel vulnerability index to select measurements for defense against false data injection attacks | |
Sarkar et al. | Centrality and community scoring functions in incomplete networks: their sensitivity, robustness, and reliability |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |