CN105786708B - A kind of Loop partition test method and system - Google Patents

A kind of Loop partition test method and system Download PDF

Info

Publication number
CN105786708B
CN105786708B CN201610160340.XA CN201610160340A CN105786708B CN 105786708 B CN105786708 B CN 105786708B CN 201610160340 A CN201610160340 A CN 201610160340A CN 105786708 B CN105786708 B CN 105786708B
Authority
CN
China
Prior art keywords
case
tested
priority
test
priority set
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610160340.XA
Other languages
Chinese (zh)
Other versions
CN105786708A (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.)
Suzhou University
Original Assignee
Suzhou University
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 Suzhou University filed Critical Suzhou University
Priority to CN201610160340.XA priority Critical patent/CN105786708B/en
Publication of CN105786708A publication Critical patent/CN105786708A/en
Application granted granted Critical
Publication of CN105786708B publication Critical patent/CN105786708B/en
Active 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/3684Test management for test design, e.g. generating new test cases

Abstract

The application provides a kind of Loop partition test method and system, by judging whether the use-case to be tested in use-case set to be tested has all been finished, if so, according to executed test case, the input domain D is divided, 2 that division is obtainedm*nThe central point of a sub- input domain imports use-case set to be tested as use-case to be tested;If not, perform the use-case to be tested being not carried out in the use-case set to be tested, judge whether currently performed use-case to be tested hits failed areas, if, export the test case quantity of executed, if not, judging whether the use-case to be tested in the use-case set to be tested has all been finished;This method combines the advantage of two kinds of traditional technologies of random test and partition testing, solves the confinement problems of the two.

Description

A kind of Loop partition test method and system
Technical field
The present invention relates to software testing technology fields, and in particular to a kind of iteration stroke for improving failure detection ability and efficiency Divide test method and system.
Background technology
Software test receives the extensive pass of academia and industrial quarters as an important technology in software quality assurance Note.It is often unpractical due to carrying out limit test to the entire input domain of software during software test, how Selection test case as few as possible becomes particularly important to find that program fails as early as possible.In existing numerous measuring technologies, Random test and partition testing are two kinds of classical measuring technologies.
Random test have many advantages, such as it is simple and effective, should be readily appreciated that and realize, however, due to not having during random test Using other any useful information, failure detection ability is frequently not highly desirable.Adaptive random testing is a kind of improvement Random test technology, by realizing test case being uniformly distributed on input domain, to improve the failure detection of random test Ability, but the technology also correspondingly brings a large amount of additional computing costs.
Partition testing is typically based on identical function or attribute carries out the division of subdomain, it would be desirable to obtain preferably division side Formula so that each subdomain is homogeneity, i.e., all inputs in same subdomain are correctly to input or cause the defeated of program failure Enter.On the basis of effectively division is obtained, partition testing is used to selecting the expense of test case and little, however, the son of early period Domain division but generally requires to expend a large amount of additional time overheads.
As it can be seen that either random test or partition testing, all with certain limitation.
The content of the invention
In view of this, the embodiment of the present invention provides a kind of Loop partition test method and system, with solve random test and The confinement problems of two kinds of traditional technologies of partition testing.
To achieve the above object, the embodiment of the present invention provides following technical solution:
A kind of Loop partition test method, including:
Obtain the input domain D that m ties up program to be measured;
Select the central point of the input domain D that the use-case to be tested is put into use-case to be tested as use-case to be tested Set;
Judge whether the use-case to be tested in the use-case set to be tested has all been finished, if so, according to Implementation of test cases divides the input domain D, 2 after being dividedm*nA sub- input domain, wherein, the n is division Number;If not, performing the use-case to be tested being not carried out in the use-case set to be tested, judge currently performed to be measured on probation Whether example hits failed areas, if so, the test case quantity of output executed, if not, judging the use-case to be tested Whether the use-case to be tested in set has all been finished;
The center of every sub- input domain after division is selected to be put into the use-case to be tested to be measured as use-case to be tested Example set on probation, judges whether the use-case to be tested in the use-case set to be tested has all been finished, until output is Until the test case quantity of execution;
Wherein, after often performing a use-case to be tested, the test case quantity increases by 1, by the to be measured on probation of executed Example is labeled as executed test case.
Preferably, in above-mentioned Loop partition test method, what is be not carried out in the execution use-case set to be tested treats Test case, including:
The use-case to be tested in the use-case set to be tested is divided according to pre-set priority division rule;
Performed successively according to the order of priority from high to low be not carried out in the use-case set to be tested it is to be measured on probation Example.
Preferably, in above-mentioned Loop partition test method, what is be not carried out in the execution use-case set to be tested treats Test case, including:
According to pre-set priority division rule, it is excellent that the use-case to be tested in the use-case set to be tested is divided into first First grade set, the second priority set and third priority set, wherein the priority of the first priority set is more than institute The second priority set is stated, the priority of the second priority set is more than the third priority set;
Judge whether the use-case to be tested in the first priority set is finished, if not, described in performing successively The use-case to be tested being not carried out in first priority set, if so, judging to be measured on probation in the second priority set Whether example is finished, if not, the use-case to be tested being not carried out in the second priority set is performed successively, if so, The use-case to be tested being not carried out in the third priority set is performed successively.
Preferably, it is described according to pre-set priority division rule in above-mentioned Loop partition test method, it will be described to be tested Use-case to be tested in use-case set is divided into the first priority set, the second priority set and third priority set, bag It includes:
According to the priority for causing the maximum failure area that can be currently put into that maximum variation occurs when performing use-case to be tested Rule is set, the use-case to be tested in the use-case set to be tested is divided into the first priority set, the second priority set It closes and third priority set.
Preferably, in above-mentioned Loop partition test method, the use-case to be tested in the first priority set meets item Part:It is not 0 or maximum per the index on one-dimensional, the difference for the indexes tieed up per the index on one-dimensional with other can be divided exactly by 2;
Use-case to be tested in the third priority set meets condition:It is 0 or maximum per the index on one-dimensional;
Use-case to be tested in the second priority set is to be not belonging to described first in the use-case set to be tested The use-case to be tested of priority set and third priority set.
A kind of Loop partition tests system, including:
Collecting unit, for obtaining the input domain D that m ties up program to be measured;
Use-case to be tested chooses unit, for when the input domain D is unallocated, selecting the central point of the input domain D As use-case to be tested, the use-case to be tested is put into use-case set to be tested;When the input domain D has been divided, selection The use-case to be tested is put into be measured on probation by the center of every sub- input domain after the last time division as use-case to be tested Example set;
Judging unit, for judging whether to get the stop signal of the execution unit output, if so, stopping dynamic Make, otherwise, judge whether the use-case to be tested in the use-case set to be tested has all been finished, if so, to division Unit exports trigger signal, if not, exporting trigger signal to execution unit;
Execution unit, for after the trigger signal of the judging unit output is got, performing the use-case to be tested The use-case to be tested being not carried out in set, judges whether currently performed use-case to be tested hits failed areas, if so, output The test case quantity of executed, stopping continue to execute use-case to be tested, and stop signal is exported to the judging unit, if It is no, continue to execute the use-case to be tested being not carried out in the use-case set to be tested;
Division unit, for after the trigger signal of judging unit output is got, according to executed test case, The input domain D is divided, 2 after being dividedm*nA sub- input domain;
Wherein, after often performing a use-case to be tested, the test case quantity increases by 1, by the to be measured on probation of executed Example is labeled as executed test case.
Preferably, in above-mentioned Loop partition test system, the execution unit includes:
First test case chooses unit, needs to perform in the use-case set to be tested not for working as the execution unit Perform use-case to be tested when, according to pre-set priority division rule to the use-case to be tested in the use-case set to be tested into Row division, by the use-case set to be tested, the use-case to be tested of highest priority is as execution needed for the execution unit Use-case to be tested.
Preferably, in above-mentioned Loop partition test system, the execution unit includes:
Gather division module, it, will be to be measured in the use-case set to be tested for according to pre-set priority division rule Example on probation is divided into the first priority set, the second priority set and third priority set, wherein first priority The priority of set is more than the second priority set, and the priority of the second priority set is more than the described 3rd preferentially Grade set;
Second test case chooses unit, needs to perform in the use-case set to be tested not for working as the execution unit During the use-case to be tested performed, judge whether the use-case to be tested in the first priority set is finished, if not, will The use-case to be tested being not carried out in the first priority set is as the use-case to be tested performed needed for the execution unit, such as Fruit is to judge whether the use-case to be tested in the second priority set is finished, if not, by second priority The use-case to be tested being not carried out in set is as the use-case to be tested performed needed for the execution unit, if so, by described The use-case to be tested being not carried out in three priority set is as the use-case to be tested performed needed for the execution unit.
Preferably, in above-mentioned Loop partition test system, the set division module is specifically used for, to be tested according to performing Cause the priority that maximum variation occurs for the maximum failure area that can be currently put into that rule is set during use-case, it will be described to be measured on probation Use-case to be tested in example set is divided into the first priority set, the second priority set and third priority set.
Preferably, in above-mentioned Loop partition test system, the set division module is specifically used for:
By it is every it is one-dimensional on index for 0 or maximum, and per the difference of index and the indexes in other dimensions on one-dimensional The use-case to be tested that can be divided exactly by 2 imports the first priority set;
By it is every it is one-dimensional on index for 0 or maximum use-case to be tested import third priority set;
The first priority set will be not belonging in the use-case set to be tested and the to be measured of third priority set is tried out Example imports the second priority set.
Based on above-mentioned technical proposal, Loop partition test method and system provided in an embodiment of the present invention, by using:Sentence Whether the use-case to be tested in the use-case set to be tested of breaking all has been finished, if not, performing described to be measured on probation The use-case to be tested being not carried out in example set, judges whether currently performed use-case to be tested hits failed areas, if so, defeated Go out the test case quantity of executed, if not, judging whether the use-case to be tested in the use-case set to be tested is whole It is finished;Judge that the use-case to be tested in the use-case set to be tested is all finished, if so, according to executed Test case divides the input domain D, 2 after being dividedm*nThe test mode of a sub- input domain, independent of appoint What divides the pretreatment of input domain, and computing cost is extremely low;It can realize the high uniformity distribution of test case, make it have good Good failure detection ability;The upper bound of test case quantity needed for detection failure can be calculated.Compared with existing measuring technology, sheet Invention has used for reference the equally distributed thought of adaptive random testing, has combined random test and division is surveyed from partition testing The advantage of two kinds of traditional technologies is tried, solves random test and the corresponding limitation of partition testing.
Description of the drawings
It in order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention, for those of ordinary skill in the art, without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow diagram of Loop partition test method disclosed in the embodiment of the present application;
Fig. 2 is a kind of flow diagram of Loop partition test method disclosed in another embodiment of the application
Fig. 3 is a kind of flow diagram of Loop partition test method disclosed in the another embodiment of the application;
Fig. 4 is the schematic diagram that 2 divisions generate 16 sub- input domains;
Fig. 5 is that the test case based on priority performs schematic diagram;
Fig. 6 is the structure diagram that a kind of Loop partition disclosed in the embodiment of the present application tests system.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other without making creative work Embodiment belongs to the scope of protection of the invention.
Based on existing related work and analysis, present invention seek to address that failure detection ability and time in software test procedure The equilibrium problem of expense the present invention is by partition testing, while has been used for reference the equally distributed thought of adaptive random testing, has been carried A kind of Loop partition measuring technology is gone out.The technology is a kind of Loop partition measuring technology based on input domain spatial information, compared with Other partition testing technologies based on information such as function, path or risks, the input domain spatial information needed for the technology is easy It obtains and additional pretreatment need not be done, significantly reduce expense of the partition testing in terms of pretreatment.It is meanwhile of the invention Technological borrowing adaptive random testing equally distributed thought, can be using only close to the basis of random test time overhead On, obtain even preferably failure detection ability close with adaptive random testing.
Specifically, referring to Fig. 1, Loop partition test method can include disclosed in the embodiment of the present application:
Step S101:Obtain the input domain D that m ties up program to be measured;
The m is the dimension of input domain, and when program to be measured has m input parameter, the input domain of the program is empty for m dimensions Between, and assume to be the equidistant continuous space of each dimension, such as the m=2, the input domain is 2 dimension squares, when described During m=3, the input domain is 3-dimensional square;
Step S102:The central point of the input domain D is selected to be put into the use-case to be tested as use-case to be tested and treat Test case set;
In method disclosed in the present embodiment, use-case to be tested is chosen using the method for center sampling, i.e., when the input When domain D is not divided, the central point of the input domain D is selected as use-case to be tested, when the input domain D is divided Afterwards, the central point for choosing each subdomain that the last division obtains is not held as pending use-case to be tested, and by these Capable use-case to be tested is imported in use-case set to be tested;
Step S103:Judge whether the use-case to be tested in the use-case set to be tested has all been finished, if It is to perform step S104, if not, performing step S105;
Disclosed method in the use-case to be tested in performing the use-case set to be tested every time, is sentenced first With the presence or absence of the test case not being performed in the use-case set to be tested of breaking, if it is not, needing to perform step S104 The input domain D is divided again, obtains the subdomain after each division, to obtain each new use-case to be tested, if When there is the use-case to be tested being not carried out in the use-case set to be tested, the step S105 is performed, performs the test case;
Step S104:According to executed test case, the input domain D is divided, performs step S108;
In this step, it is necessary to again to institute after the use-case to be tested in the use-case set to be tested is finished It states input domain D to be divided, obtains new input domain, in method disclosed in the embodiment of the present application, division every time can obtain 2m*n A sub- input domain, wherein, the n is the number that currently divides, if for example, when this time division is divided if the 1st time, it is described N is 1, if this time division is divided if the 2nd time, the n is 2, divides the quantity of obtained sub- input domain every time in several What multiple increases;
Step S105:The use-case to be tested being not carried out in the use-case set to be tested is performed, enters step S106;
In this step, if there is the use-case to be tested do not tested in the use-case set to be tested, to institute It states the use-case to be tested being not carried out and carries out execution test;
Step S106:Judge whether currently performed use-case to be tested hits failed areas, if so, performing step S107, if not, performing step S103;
In this step, it is necessary to be carried out to the implementing result of the use-case to be tested after one use-case to be tested of every execution Judge, judge whether implementing result hits failed areas;
Step S107:Export the test case quantity of executed;
In this step, after failed areas is hit, the quantity of the test case of the executed of output is as the degree tested Amount standard, the test case quantity of executed is fewer, and the test case quantity for illustrating to test out needed for failed areas is fewer, test Efficiency is higher, and otherwise, testing efficiency is lower, wherein, after often performing a use-case to be tested, the test case quantity increases by 1, The use-case to be tested of executed is labeled as executed test case;
After this execution use-case to be tested fails to hit failed areas, continue to execute, step S103;
Step S108:The center of every sub- input domain after division is selected as use-case to be tested, it will be described to be measured on probation Example is put into use-case set to be tested, performs step S103, until the test case quantity for performing step S107 output executeds is Only.
Method disclosed in the above embodiments of the present application is compared with traditional partition testing technology, independent of any to input domain Pretreatment division, computing cost is extremely low;It can realize the high uniformity distribution of test case, make it have good failure inspection Survey ability;The upper bound of test case quantity needed for detection failure can be calculated.It is of the invention from division compared with existing measuring technology Test is set out, and has used for reference the equally distributed thought of adaptive random testing, combines two kinds of tradition of random test and partition testing The advantage of technology solves corresponding limitation respectively.
Show by actual emulation experiment using method disclosed in the above embodiments of the present application, when to software test, Using only close in the case of traditional random test technology time overhead, can reach it is close with adaptive random testing even more Good failure detection ability.Meanwhile the present invention also showed in higher-dimension input domain, different failure modes and true program it is good It is good, there is wide applicability and high efficiency.
It is understood that in the use-case to be tested in performing the use-case set to be tested, can be needed according to user Ask and select different implementation strategy, for example, can be used Loop partition measuring technology (Iterative Partition Testing, IPT Loop partition measuring technology (the Iterative Partition based on priority can also be used in the implementation strategy in) Testing based on Priority Sampling, IPT-PS) in implementation strategy;
If during using implementation strategy in IPT, the step S105 is specifically as follows:Using the selection do not put back at random Mode chooses the use-case to be tested in the use-case set to be tested one by one;
If during using implementation strategy in IPT-PS, referring to Fig. 2, the step S105 is specifically as follows:
Step S1051:According to pre-set priority division rule to the use-case to be tested in the use-case set to be tested into Row division;
In this step, user can select suitable priority division rule according to self-demand, be advised according to the division Then the priority of each use-case to be tested in the use-case set to be tested is divided, is performing the set of uses case to be tested During the use-case to be tested being not carried out in conjunction, the highest use-case to be tested being not carried out of preferential execution priority;
Step S1052:It performs in the use-case set to be tested and is not carried out successively according to the order of priority from high to low Use-case to be tested.
Specifically, during using implementation strategy in IPT-PS, except each use-case to be tested is carried out priority ranking it Outside, can also be specifically referring to Fig. 3, the step S105:
Step S1053:According to pre-set priority division rule, the use-case to be tested in the use-case set to be tested is drawn It is divided into the first priority set, the second priority set and third priority set;
Wherein, in this step, can be treated according to the type of the use-case to be tested in the use-case set to be tested by described Use-case to be tested in test case set is divided into multiple priority set, when performing use-case to be tested, preferentially performs excellent The use-case to be tested being not carried out in the first highest priority set of grade;In the present embodiment, the first priority set is excellent First grade is more than the second priority set, and the priority of the second priority set is more than the third priority set;
Step S1054:Judge whether the use-case to be tested in the first priority set is finished, if not, holding Row step S1055, if so, performing step S1056;
Step S1055:It is chosen successively by the way of not putting back to and performs what is be not carried out in the first priority set Use-case to be tested;
Step S1056:Judge whether the use-case to be tested in the second priority set is finished, if not, holding Row step S1057;If so, perform step S1058;
Step S1057:It is chosen successively by the way of not putting back to and performs what is be not carried out in the second priority set Use-case to be tested;
Step S1058:It is chosen and performed successively by the way of not putting back to and is not carried out in the third priority set Use-case to be tested.
Specifically, different priority level initializing rules can cause method testing efficiency disclosed in the above embodiments of the present application Difference, in order to ensure testing efficiency, in the above method, the step S1053 is specifically as follows:During according to performing use-case to be tested Cause the priority that maximum variation occurs for the maximum failure area that can be currently put into that rule is set, by the use-case set to be tested In use-case to be tested be divided into the first priority set, the second priority set and third priority set.
More specifically, the use-case to be tested in the first priority set meets condition:Index on often one-dimensional is not For 0 or maximum, the difference for the indexes tieed up per the index on one-dimensional with other can be divided exactly by 2;The third priority set In use-case to be tested meet condition:It is 0 or maximum per the index on one-dimensional;It is to be tested in the second priority set Use-case is tried out to be not belonging to the first priority set and the to be measured of third priority set in the use-case set to be tested Example.
The course of work of method disclosed in the above embodiments of the present application, the application are more clearly from understood in order to facilitate user Also use specific embodiment that the implementation procedure of this method is described in detail using 2 dimension programs to be measured as test object;
It is assumed that failure domain is block pattern.When using the implementation strategy of IPT, in Fig. 4 shown in (a)-(d), select first The central point a for selecting input domain A is performed as test case, if a fails to hit failed areas, input domain is divided into 4 according to a A sub- input domain B1-B4, the central point b1-b4 for choosing B1-B4 respectively are performed as use-case to be tested and successively.If b1-b4 is equal Fail to hit failed areas, then input domain is divided into 16 sub-regions C1-C16 according to b1-b4, choose respectively in C1-C16 Heart point c1-c16 is as use-case to be tested and performs successively.At this point, the central point c4 of upper right side subregion C4 will hit area of failing Domain detects to fail, export the quantity of the use-case to be tested of executed.If conversely, c1-c16 fail hit failed areas, Iteration is then subjected to next round division, generates 64 sub-regions.
For the implementation strategy of IPT-PS, the input domain of program to be measured is also assumed that as 2 dimension rectangular areas, domain of failing For block pattern.In Fig. 5 shown in (a):Have been carried out 1 division, 5 test cases symbol " " table of executed early period Show, the central point of 16 sub- input domains forms use-case set { c1-c16 } to be tested produced by the 2nd division.It is to be measured according to these 16 test cases are divided into three kinds of different priority levels by the spatial character of example on probation, and corresponding collection is combined into T1, T2, T3, same In the case of priority, wherein any one test case will be performed at random, it is to be understood that when not to the input domain into During row division, because use-case to be tested there are one only having in the use-case set to be tested, therefore two in set T1, T2, T3 A collection is combined into sky.
To realize the executing rule of IPT-PS, it must be understood that how by pending test case classification, and assign each treat The different priority of test case.In method disclosed in the above embodiments of the present application, the priority of use-case to be tested depends on Whether the execution of the test case can cause the maximum failure that can be currently put into region area (being denoted as S) to generate variation.Such as Fig. 5 (a) shown in-(d), it is assumed that the area of input domain is 1, before the test case of 2 " * " is added in, S=1/4, when being put into 2 " * " Test case after, S will be changed toAfter the test case of 10 " Δ " is added in, S will be changed toAfter the test case of last 4 " ο " is added in, S is remained unchanged.It can be seen that in this example, labeled as " * " Test case belong to set T1, highest priority;Belong to set T2 labeled as the test case of " Δ ", priority is taken second place;Mark The test case for being denoted as " ο " belongs to set T3, and priority is minimum.
Wherein, the computational methods of the implementation strategy division use-case priority to be tested of IPT-PS are as follows:As shown in Fig. 5 (b), For it is every it is one-dimensional divided by n times 2nThe central point of a subdomain, i.e., 2nA pending test case establishes index, is denoted as Ik =0,1,2 ... 2n- 1 }, wherein subscript k represents kth dimension.In this way, in 2 dimension spaces, pending 22nA test case can be with With (i1,i2) uniquely tagged, wherein i1∈I1,i2∈I2.Fig. 5 is observed it can be found that the element in T1 need to meet following two simultaneously A condition:(1) it is not 0 or maximum (i.e. i per the index on one-dimensional1≠0,2n- 1 and i2≠0,2n-1);(2)|i1-i2|mod 2 For 0 (mod represents remainder).Element in T3 meets:It is 0 or maximum per the index on one-dimensional.T2 is then 22nA use-case to be measured In be not belonging to T1 and T3 test case form set.
When being generalized to m-dimensional space from 2 dimension spaces, divided by n times 2mnA use-case to be measured can use (i1, i2,…,im) uniquely tagged, wherein ik∈Ik.At this point it is possible to by 2mnA use-case to be measured is respectively put into T1, T2 according to following rule, T3:
Element in T1 meets:(1) it is not 0 or maximum (i.e. i per the index on one-dimensionalk≠0,2n, and (2) -1) | ij- ij+1| mod 2 is 0, wherein j ∈ { 1,2 ..., m-1 }.
Element in T3 meets:It is 0 or maximum per the index on one-dimensional.
T2 is 2mnThe set that the test case of T1 and T3 is formed is not belonging in a use-case to be measured.
Test method disclosed in the above embodiments of the present application, it is different according to its implementation strategy, can be divided into IPT methods of testing and IPT-PS methods of testing, when carrying out simulation test to the IPT methods of testing, main flow is as follows:
Input:M ties up the input domain D, failed areas F of program to be measured
Output:Used test case quantity F-count when detecting first failure
Step 1:Initialize F-count=0, division hierachy number n=0;
Step 2:The central point a for choosing input domain D is performed, F-count++;
IF central points a hits failed areas;
THEN RETURN F-count;
ELSE n++;
ENDIF;
Step 3 (Loop partition):Current input domain is divided into 2 according to executed test casemnA sub- input domain;
Step 4 (center sampling):Sampling 2mnThe central point of a 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, chooses test with not putting back to successively use Example t ∈ TestSet are performed, F-count++;
IF test cases t hits failed areas;
THEN RETURN F-count;
ENDIF;
Step 6:N++ turns to step 3.
Wherein 2 are obtained in step 4mnAfter the central point of a subdomain forms set of uses case to be measured, step 5 (use-case execution) can adopt It is such as random to perform including being based on equiprobable implementation strategy with a variety of implementation strategies, order performs etc.;And based on not etc. general The implementation strategy of rate, such as the execution based on priority.Step 5 (use-case execution) is performed using random in IPT algorithms.
When carrying out simulation test to the IPT-PS methods of testing, main flow is as follows:
Input:M ties up the input domain D, failed areas F of program to be measured;
Output:Used test case quantity F-count when detecting first failure;
Step 1:Initialize F-count=0, division hierachy number n=0;
Step 2:The central point a for choosing input domain D is performed, F-count++;
IF central points a hits failed areas;
THEN RETURN F-count;
ELSE n++;
ENDIF;
Step 3 (Loop partition):Current input domain is divided into 2 according to executed test casemnA sub- input domain;
Step 4 (center sampling):Sampling 2mnThe central point of a 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 2mnA use-case to be measured is respectively put into set T1,T2,T3;
Set Ti (i=1,2,3) is directed to successively;
WHILE();
At random from Ti selections test case tj (j=1,2 ... | Ti |) perform;
Ti=Ti-{ tj }, F-count++;
IF test cases tj hits failed areas;
THEN RETURN F-count;
ENDIF;
ENDWHILE;
Step 6:N++ turns to step 3.
The Loop partition and center sampling process of IPT-PS technologies are identical with IPT algorithms, and difference lies in IPT-PS technologies Step 5 will be performed using the use-case based on priority.
The present invention illustrates the service condition of above two technology using emulation experiment first, is analyzed then in conjunction with true program Feasibility of the present invention in true application.
Wherein, the parameter that above-mentioned emulation experiment is related to includes:Dimension, crash rate, test method and experiment number, say one by one It is bright as follows:
Dimension:When program to be measured has m input parameter, the input domain of the program is m-dimensional space, and it is each dimension to assume Equidistant continuous space, i.e., 2 dimension input domains are square, and 3-dimensional input domain is square.
Crash rate:I.e. failure input domain accounts for the ratio of entire input domain, it is clear that crash rate θ ∈ [0,1].Simultaneously it is assumed that losing Effect input domain is also the equidistant continuous space of each dimension.
Test method:IPT test methods and IPT-PS methods of testing, IPT:Loop partition proposed by the present invention, center sampling Partition testing technology.IPT-PS:What Loop partition proposed by the present invention, center sampling and the use-case based on priority performed draws Divide measuring technology.
Experiment number:It is the influence in order to effectively avoid randomness to experimental result to repeat certain experiment number:When The randomness of failure domain position, second is that the randomness of test method selection test case.It, can be by repeating 1000 in emulation experiment Or more time experiment come overcome failure domain position randomness;It, can be by repeating 2000 on the premise of given failure domain position Or more time experiment overcome the randomness of test cases selection.
It is configured according to above-mentioned experiment parameter, emulation experiment process specifically can be summarized as:
Input domain is generated according to dimension;
It is calculated according to crash rate and generates failure domain, in testing each time, randomly place failure domain;
Test case is selected according to test method one by one, then thinks that it detects mistake when use-case to be tested is hit in failure domain Region is imitated, records the test case quantity F-count of current executed;
When completing to provide experiment number, the average value of F-count is denoted as F-measure, and records spent by experiment Total time.
The measurement of this experiment includes measure of effectiveness and efficiency metric.In terms of measure of effectiveness, using various technologies The ratio of the theoretical value of F-measure and the F-measure of random test (i.e. 1/ θ), is denoted as F-ratio, to weigh various skills The improvement of art relatively random test in failure detection ability.Obviously, F-ratio is smaller, then the technology relatively random test It improves more apparent.In terms of efficiency metric, the average time needed for a failure detection is completed using various technologies, is denoted as Runtime carrys out the time overhead of more various technologies.
Applicant by carrying out above-mentioned emulation experiment, shows method disclosed in the above embodiments of the present application:Using only In the case of tradition random test time overhead, IPT-PS technologies of the invention can reach and adaptive random testing phase Nearly even preferably failure detection ability.For IPT methods, IPT-PS methods can effectively reduce the F- of algorithm ratio.Meanwhile IPT-PS also has wide applicability in higher-dimension input domain, different failure modes.
In addition, IPT-PS methods are also applied to the C program (select in Numerical Recipes by applicant Program) analyzing IP of coming up T-PS methods applicability.The input of Select programs is two integers and a floating number array (unsigned long k, unsigned long n, float arr []) is exported as a floating number, i.e., in n dimensions group Number small k.
Specific implementation procedure is as follows:
Variation is generated using Csaw instruments at random, failed areas is implanted into the initial version of program;
After variation generation, variation is made choice and simplified:One is randomly selected in the variation identical from all failure modes A variation is as effectively variation, that is to say, that and each failure mode for effectively making a variation is all different, wherein, select shares 8 Effectively variation;
For each effective variation, repeat to test for 30 times and record random test and IPT-PS methods is detect the variation The quantity of required test case;
When completing to provide experiment number, N is madeRT、NIPT-PSTest case quantity respectively needed for random test and the present invention Average;
Make the ratio that N-ratio is test case quantity needed for test case quantity needed for IPT-PS methods and random test Value, i.e. N-ratio=NIPT-PS/NRT, work as N-ratio<When 1, illustrate IPT-PS methods performance disclosed in the present application better than traditional Random test;Work as N-ratio>When 1, illustrate that IPT-PS methods performance disclosed in the present application is inferior to random test.
The experimental results showed that in 8 effective variations of select, there are 6 (75%) variation, corresponding N- ratio<1;The corresponding N-ratio of only 2 variations>1.As it can be seen that for select and its variation version, the application is implemented There is the very big possibility for being quickly detected failure for IPT-PS methods disclosed in example.
To sum up, the verification of above-mentioned true program and its version that makes a variation is passed through, it is seen that above-mentioned side disclosed in the embodiment of the present application Method is feasible in true application, and there is the possibility for being quickly detected failure.
It is understood that being directed to the above method, disclosed herein as well is a kind of Loop partitions to test system, the side Technical characteristic between method and system can be used for reference mutually, referring to Fig. 6, including:
Collecting unit 100, for obtaining the input domain D that m ties up program to be measured;
Use-case to be tested chooses unit 200, for when the input domain D is unallocated, selecting the center of the input domain D Point is used as use-case to be tested, and the use-case to be tested is put into use-case set to be tested;When the input domain D has been divided, choosing The center of every sub- input domain after the last division is selected as use-case to be tested, the use-case to be tested is put into be tested Use-case set;
Judging unit 300, for judging whether to get the stop signal of the execution unit output, if so, stopping Action, otherwise, judge whether the use-case to be tested in the use-case set to be tested has all been finished, if so, to stroke Subdivision exports trigger signal, if not, exporting trigger signal to execution unit;
Execution unit 400, it is described to be measured on probation for after the trigger signal of the judging unit output is got, performing The use-case to be tested being not carried out in example set, judges whether currently performed use-case to be tested hits failed areas, if so, defeated Going out the test case quantity of executed, stopping continues to execute use-case to be tested, and stop signal is exported to the judging unit, if It is no, continue to execute the use-case to be tested being not carried out in the use-case set to be tested;
Division unit 500, for after the trigger signal of the judging unit output is got, being used according to executed test Example, divides the input domain D, 2 after being dividedm*nA sub- input domain;
Wherein, after often performing a use-case to be tested, the test case quantity increases by 1, by the to be measured on probation of executed Example is labeled as executed test case.
Corresponding with the above method, the execution unit 400 can include:
First test case chooses unit, needs to perform in the use-case set to be tested not for working as the execution unit Perform use-case to be tested when, according to pre-set priority division rule to the use-case to be tested in the use-case set to be tested into Row division, by the use-case set to be tested, the use-case to be tested of highest priority is as execution needed for the execution unit Use-case to be tested, alternatively, first test case chooses unit, for using the selection mode do not put back at random, one by one Choose the use-case to be tested in the use-case set to be tested.
Corresponding with the above method, the execution unit 400 can include:
Gather division module, it, will be to be measured in the use-case set to be tested for according to pre-set priority division rule Example on probation is divided into the first priority set, the second priority set and third priority set, wherein first priority The priority of set is more than the second priority set, and the priority of the second priority set is more than the described 3rd preferentially Grade set;
Second test case chooses unit, needs to perform in the use-case set to be tested not for working as the execution unit During the use-case to be tested performed, judge whether the use-case to be tested in the first priority set is finished, if not, will The use-case to be tested being not carried out in the first priority set is as the use-case to be tested performed needed for the execution unit, such as Fruit is to judge whether the use-case to be tested in the second priority set is finished, if not, by second priority The use-case to be tested being not carried out in set is as the use-case to be tested performed needed for the execution unit, if so, by described The use-case to be tested being not carried out in three priority set is as the use-case to be tested performed needed for the execution unit.
Corresponding with the above method, the set division module is specifically used for, and foundation causes to work as when performing use-case to be tested The priority that maximum variation occurs for the preceding maximum failure area being put into sets rule, by treating in the use-case set to be tested Test case is divided into the first priority set, the second priority set and third priority set.
Corresponding with the above method, the set division module is specifically used for, by it is every it is one-dimensional on index be not 0 or most Big value, and to import first preferential for the use-case to be tested that can be divided exactly by 2 of the difference per the index on one-dimensional and the indexes in other dimensions Grade set;
By it is every it is one-dimensional on index for 0 or maximum use-case to be tested import third priority set;
The first priority set will be not belonging in the use-case set to be tested and the to be measured of third priority set is tried out Example imports the second priority set.
Each embodiment is described by the way of progressive in this specification, the highlights of each of the examples are with other The difference of embodiment, just to refer each other for identical similar portion between each embodiment.For device disclosed in embodiment For, since it is corresponded to the methods disclosed in the examples, so description is fairly simple, related part is said referring to method part It is bright.
The foregoing description of the disclosed embodiments enables professional and technical personnel in the field to realize or use the present invention. A variety of modifications of these embodiments will be apparent for those skilled in the art, it is as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention The embodiments shown herein is not intended to be limited to, and is to fit to and the principles and novel features disclosed herein phase one The most wide scope caused.

Claims (10)

1. a kind of Loop partition test method, which is characterized in that including:
The input domain D, the m for obtaining m dimensions program to be measured are the dimension of input domain;
Select the central point of the input domain D that the use-case to be tested is put into use-case set to be tested as use-case to be tested;
Judge whether the use-case to be tested in the use-case set to be tested has all been finished, if so, according to executed Test case divides the input domain D, 2 after being dividedm*nA sub- input domain, wherein, the n is division time Number;If not, performing the use-case to be tested being not carried out in the use-case set to be tested, currently performed use-case to be tested is judged Whether failed areas is hit, if so, the test case quantity of output executed, if not, judging the set of uses case to be tested Whether the use-case to be tested in conjunction has all been finished;
The center of every sub- input domain after division is selected to be put into the use-case to be tested to be measured on probation as use-case to be tested Example set, judges whether the use-case to be tested in the use-case set to be tested has all been finished, until output executed Test case quantity until;
Wherein, after often performing a use-case to be tested, the test case quantity increases by 1, by the use-case mark to be tested of executed It is denoted as executed test case.
2. Loop partition test method according to claim 1, which is characterized in that described to perform the set of uses case to be tested The use-case to be tested being not carried out in conjunction, including:
The use-case to be tested in the use-case set to be tested is divided according to pre-set priority division rule;
Perform the use-case to be tested being not carried out in the use-case set to be tested successively according to the order of priority from high to low.
3. Loop partition test method according to claim 1, which is characterized in that described to perform the set of uses case to be tested The use-case to be tested being not carried out in conjunction, including:
According to pre-set priority division rule, the use-case to be tested in the use-case set to be tested is divided into the first priority Set, the second priority set and third priority set, wherein the priority of the first priority set is more than described the Two priority set, the priority of the second priority set are more than the third priority set;
Judge whether the use-case to be tested in the first priority set is finished, if not, performing described first successively The use-case to be tested being not carried out in priority set, if so, judging that the use-case to be tested in the second priority set is It is no to be finished, if not, the use-case to be tested being not carried out in the second priority set is performed successively, if so, successively Perform the use-case to be tested being not carried out in the third priority set.
4. Loop partition test method according to claim 3, which is characterized in that described divided according to pre-set priority is advised Then, the use-case to be tested in the use-case set to be tested is divided into the first priority set, the second priority set and Three priority set, including:
It is set according to the priority for causing the maximum failure area that can be currently put into that maximum variation occurs when performing use-case to be tested Rule, by the use-case to be tested in the use-case set to be tested be divided into the first priority set, the second priority set and Third priority set.
5. Loop partition test method according to claim 3, which is characterized in that
Use-case to be tested in the first priority set meets condition:It is not 0 or maximum per the index on one-dimensional, it is each The difference of index and the index in other dimensions in dimension can be divided exactly by 2;
Use-case to be tested in the third priority set meets condition:It is 0 or maximum per the index on one-dimensional;
Use-case to be tested in the second priority set is preferential to be not belonging to described first in the use-case set to be tested The use-case to be tested of grade set and third priority set.
6. a kind of Loop partition tests system, which is characterized in that including:
Collecting unit, for obtaining the input domain D that m ties up program to be measured;
Use-case to be tested chooses unit, for when the input domain D is unallocated, select the central point of the input domain D as The use-case to be tested is put into use-case set to be tested by use-case to be tested;When the input domain D has been divided, selection is nearest The use-case to be tested is put into set of uses case to be tested by the center of every sub- input domain after once dividing as use-case to be tested It closes;
Judging unit for judging whether to get the stop signal of execution unit output, if so, stopping acts, otherwise, is sentenced Whether the use-case to be tested in the use-case set to be tested of breaking all has been finished, is touched if so, being exported to division unit It signals, if not, exporting trigger signal to execution unit;
Execution unit, for after the trigger signal of the judging unit output is got, performing the use-case set to be tested In the use-case to be tested that is not carried out, judge whether currently performed use-case to be tested hits failed areas, if so, output has been held Capable test case quantity, stopping continue to execute use-case to be tested, and stop signal is exported to the judging unit, if not, after It is continuous to perform the use-case to be tested being not carried out in the use-case set to be tested;
Division unit, for after the trigger signal of judging unit output is got, according to executed test case, to institute It states input domain D to be divided, 2 after being dividedm*nA sub- input domain;
Wherein, after often performing a use-case to be tested, the test case quantity increases by 1, by the use-case mark to be tested of executed It is denoted as executed test case.
7. Loop partition according to claim 6 tests system, which is characterized in that the execution unit includes:
First test case chooses unit, needs to perform in the use-case set to be tested for working as the execution unit and is not carried out Use-case to be tested when, the use-case to be tested in the use-case set to be tested is drawn according to pre-set priority division rule Point, by the use-case set to be tested, the use-case to be tested of highest priority is treated as what is performed needed for the execution unit Test case.
8. Loop partition according to claim 6 tests system, which is characterized in that the execution unit includes:
Gather division module, for according to pre-set priority division rule, will be in the use-case set to be tested it is to be measured on probation Example is divided into the first priority set, the second priority set and third priority set, wherein the first priority set Priority be more than the second priority set, the priority of the second priority set is more than the third priority collection It closes;
Second test case chooses unit, needs to perform in the use-case set to be tested for working as the execution unit and is not carried out Use-case to be tested when, judge whether the use-case to be tested in the first priority set is finished, if not, will described in The use-case to be tested being not carried out in first priority set as the use-case to be tested performed needed for the execution unit, if It is to judge whether the use-case to be tested in the second priority set is finished, if not, by second priority set The use-case to be tested being not carried out in conjunction is as the use-case to be tested performed needed for the execution unit, if so, by the described 3rd The use-case to be tested being not carried out in priority set is as the use-case to be tested performed needed for the execution unit.
9. Loop partition according to claim 8 tests system, which is characterized in that the set division module is specifically used In foundation causes the maximum failure area that can be currently put into that the maximum priority setting rule changed occur when performing use-case to be tested Then, the use-case to be tested in the use-case set to be tested is divided into the first priority set, the second priority set and Three priority set.
10. Loop partition according to claim 8 tests system, which is characterized in that the set division module is specific to use In:
By it is every it is one-dimensional on index for 0 or maximum, and can be by 2 per the difference of the index on one-dimensional and the indexes in other dimensions The use-case to be tested divided exactly imports the first priority set;
By it is every it is one-dimensional on index for 0 or maximum use-case to be tested import third priority set;
The use-case to be tested that the first priority set and third priority set are not belonging in the use-case set to be tested is led Enter the second priority set.
CN201610160340.XA 2016-03-21 2016-03-21 A kind of Loop partition test method and system Active CN105786708B (en)

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 CN105786708A (en) 2016-07-20
CN105786708B true 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)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107844939B (en) * 2017-11-28 2022-01-04 广州真知码信息科技有限公司 Sampling estimation cargo numbering method
CN110221957B (en) * 2018-12-10 2023-06-09 江苏大学 Adaptive random test method based on iterative region equipartition and positioning
CN110795349B (en) * 2019-10-29 2023-10-10 毛澄映 Self-adaptive random test case generation method based on center compensation strategy
CN110825627B (en) * 2019-10-30 2023-08-04 毛澄映 Adaptive random test case generation method based on grid area density
CN111367816B (en) * 2020-03-25 2021-04-02 上海复深蓝软件股份有限公司 Mobile test method and device, computer equipment and storage medium
CN112035343B (en) * 2020-08-13 2022-02-01 武汉大学 Test case generation method and system based on Bayesian estimation

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN104820636A (en) * 2015-04-09 2015-08-05 北京轩宇信息技术有限公司 Ant colony algorithm based parallel test case sequence generation method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
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
US9135147B2 (en) * 2012-04-26 2015-09-15 International Business Machines Corporation Automated testing of applications with scripting code

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN104820636A (en) * 2015-04-09 2015-08-05 北京轩宇信息技术有限公司 Ant colony algorithm based parallel test case sequence generation method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
An improved metric for test case prioritization;Zhang Xiaofang ET AL;《2011 Eighth Web Information Systems and Applications Conference》;20111023;第1-6页 *
Test Case Prioritization for Black Box Testing;Qu Bo ET AL;《31st Annual International Computer Software and Applications Conference》;20070727;第1-8页 *
基于回归测试的软件测试方法的研究与应用;仲晓芳等;《计算机技术与发展》;20100130;第1-5页 *

Also Published As

Publication number Publication date
CN105786708A (en) 2016-07-20

Similar Documents

Publication Publication Date Title
CN105786708B (en) A kind of Loop partition test method and system
Weyuker et al. Analyzing partition testing strategies
Bae et al. Identifying and ranking influential spreaders in complex networks by neighborhood coreness
Bacchus et al. Dynamic variable ordering in CSPs
Ren et al. Simple probabilistic algorithm for detecting community structure
Reid et al. Percolation computation in complex networks
CN104572462A (en) Method for generating metamorphic test case based on adaptive random strategy
Conrad et al. Empirically studying the role of selection operators duringsearch-based test suite prioritization
Niu et al. Identifying failure-inducing combinations using tuple relationship
CN110221957A (en) A kind of self-adapting random test method divided equally based on iteration region with positioning
Czédli et al. Notes on planar semimodular lattices. VII. Resections of planar semimodular lattices
Morrison et al. Cyclic best first search: Using contours to guide branch‐and‐bound algorithms
Hui et al. MT-ART: A test case generation method based on adaptive random testing and metamorphic relation
Huang et al. Adaptive random prioritization for interaction test suites
CN110825627B (en) Adaptive random test case generation method based on grid area density
Chen et al. An optimized method for generating cases of metamorphic testing
Yang et al. A complete solution to the set covering problem
Shi et al. Optimum mixed level detecting arrays
Leeb Random numbers for computer simulation
Sinanoglu et al. Efficient construction of aliasing-free compaction circuitry
Parsa et al. A new algorithm to Test Suite Reduction based on cluster analysis
Schottlender The effect of guess choices on the efficiency of a backtracking algorithm in a Sudoku solver
Kalaji et al. A testability transformation approach for state-based programs
CN110795349A (en) Self-adaptive random test case generation method based on central compensation strategy
Abd Razak et al. A Comparison on Similarity Distances and Prioritization Techniques for Early Fault Detection Rate

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