CN101710305A - Method and system for realizing white box testing of computer software - Google Patents

Method and system for realizing white box testing of computer software Download PDF

Info

Publication number
CN101710305A
CN101710305A CN200910242657A CN200910242657A CN101710305A CN 101710305 A CN101710305 A CN 101710305A CN 200910242657 A CN200910242657 A CN 200910242657A CN 200910242657 A CN200910242657 A CN 200910242657A CN 101710305 A CN101710305 A CN 101710305A
Authority
CN
China
Prior art keywords
minimum
independent
condition
test
case
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN200910242657A
Other languages
Chinese (zh)
Other versions
CN101710305B (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.)
Institute of Computing Technology of CAS
Original Assignee
Institute of Computing Technology of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Computing Technology of CAS filed Critical Institute of Computing Technology of CAS
Priority to CN2009102426578A priority Critical patent/CN101710305B/en
Publication of CN101710305A publication Critical patent/CN101710305A/en
Application granted granted Critical
Publication of CN101710305B publication Critical patent/CN101710305B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a method and a system for realizing the white box testing of computer softwares. The realization method comprises the following steps: (1) resolving and judging the independent pair of each condition in a Boolean expression; (2) resolving and judging minimum independent pair ensemble based on the independent pairs corresponding to each condition and resolving and judging a reference case ensemble formed by the minimum independent pair sets; (3) selecting one minimum independent pair ensemble in the reference case ensemble and generating a test case ensemble corresponding to the minimum independent pair case ensemble, wherein the test case ensemble is a minimum test ensemble; and (4) carrying out modification condition/decision coverage test on a source program by the minimum test ensemble. The invention can reduce the cost of the modification condition/decision coverage (MC/DC) test and avoid the processes of generating a large number of test cases and simplifying the test cases.

Description

A kind of implementation method of white box testing of computer software and system
Technical field
The present invention relates to computer software fields, relate in particular to a kind of implementation method and system of white box testing of computer software.
Background technology
Software test is the important step in the soft project, because there is different testing standards in the difference of test target.Correction conditions/judgement covers (Modified Condition/Decision Coverage is called for short MC/DC), is a kind of testing standard in the Logical Coverage Testing technology of software white-box testing field.This standard is to be proposed first in the DO-178B standard by John Joseph Chilenski and two slip-stick artists of Steven P.Miller in 1994 the earliest.The DO-178B standard is formulated by aviation radio technological associations, and US Federal Aviation Administration uses it for all avionic softwares newly developed of test, has become the testing standard of a widespread use in the test of avionic software and key safety domain software even to this day.In the meaning of having illustrated MC/DC among the DO-178B: for critical real-time program, surpass the executable code of half may be all to express formula relevant with Boolean calculation, the complicacy of expression formula should obtain paying close attention to.The MC/DC testing standard mainly is the mistake that may exist in the middle of the Boolean expression in the trace routine.
Condition (condition) expression during correction conditions/judgement covers does not contain the Boolean expression of logical operator, for example (x>20), (x>y>10); If same Boolean expression has occurred repeatedly in a judgement, this expression formula should be can be regarded as a plurality of conditions so.Judge the Boolean expression that (decision) expression is made up of condition and zero or a plurality of logical operator, for example Z=((x>20) or (y>20)) and ((x>20) or (z<20)) has represented a judgement, and this judgement can be abbreviated as: (A or B) and (A orD).Four condition: A, B, A, D are arranged in this judgement.The MC/DC testing standard has four criterions:
A) entrance of program and exit point all will be performed;
B) all possible outcomes of each judgement all will be performed in the program;
C) all possible outcomes of each condition during each is judged in the program all will be performed;
D) result that can both independent effect judges of each condition in judging.
A most important criterion is exactly in the MC/DC standard: the result that each condition in the judgement can both independent effect be judged.Opposite as if the value for certain condition in one group of two test case, and keep other condition values constant, if the result who judges is also opposite, show that then this condition can independently influence the result of judgement, illustrate that this condition logically is effectively, so a pair of test case can constitute the independent effect of this condition in the MC/DC testing standard to (abbreviate as independent to) simultaneously.For example boolean's value combination (true, and true) (false, it is right true) to can be used as the independence of the middle condition A of judgements (A and B), for the sake of simplicity, hereinafter all will represent true with capital T, and capital F is represented false.Import above-mentioned value combination, the result of judgement becomes F by T, when condition A changes, has kept the value of condition B.Use the MC/DC testing standard, key be exactly in the computational discrimination independence of each condition right.
In the independent right actual solution procedure of MC/DC, also need to consider two problems, one is the short circuit calculation in the Boolean calculation; Another one is the coupled relation between the condition in the predicated expressions.
The short circuit calculation of so-called Boolean expression is meant and need not operands whole in the expression formula and operational character are calculated the Boolean that just can obtain expression formula.For example for Boolean expression: Z=(A and B), if A is false, the value that then need not to calculate B just can determine that Z must be false.During judging, this when the value of A is false, can carry out short circuit calculation; Otherwise,, then also need calculate the value of B if the value of A is true.
In addition, in actual test process, owing to may have coupled relation between the condition in judging, change the value of a condition and keep constant this principle of other condition values can not guarantee sometimes.Coupled relation between the condition can be divided into following two classes:
A) strong coupling: refer to change the value of a condition, will inevitably change the value of some other conditions, for example judge: condition (x>0) and (x<=0) among (x>0) and (y>10) or (x<=0); The value of two conditions is inevitable opposite.
B) weak coupling: refer to change the value of a condition, may change the value of some other condition, for example judge: two conditions among (x>0) and (x>20).Weak coupling also can cause the combination of some values to obtain, if (x>20) be true, then (x>0) must be true, and therefore (x>0) be false, and (x>20) to be the value of true make up and can't obtain.
Exist between the condition such coupled relation cause find the solution independent right in, can not guarantee that other condition values remain unchanged when changing the value of a condition, then need make corresponding modify to the independent right definition and the mode of finding the solution this moment.The independence that mainly contains two kinds of forms in using at present is to defining the corresponding different modes of finding the solution, that is: sole cause method (unique-cause method) and screen method (maskingmethod).
So-called sole cause method, it is independent right to find the solution according to independent right original definition exactly.That is when the boolean's value that changes when precondition, the value of other conditions is constant in keeping judging, if the result changes, it is right that two case before and after then explanation changes have constituted the independence of working as precondition;
So-called screen method exactly in finding the solution independent right process, masks the value of coupling condition, as judging ((A 1And B) ‖ (A 2And C)) in, A 1, A 2It is identical condition (subscript is represented the diverse location of condition in judgement).Solving condition A 1Independence to the time, keep subexpression (A 2And C) value is that false (value that means conservation condition C is false) can mask A 2To A 1Influence.
Usually in finding the solution independent right process, generally adopt short circuit calculation; Adopt the sole cause method in predicated expressions under the situation of unconditional coupling, if there is coupling, it is independent right then to adopt screen method to find the solution.
No matter adopt which kind of method, finding the solution independent right final purpose all is in order from independent the result to be instructed the generation of test case, source program to be tested its MC/DC coverage rate, detecting the mistake of Boolean expression in the source program according to this.
The MC/DC testing standard is the software test standard that is widely used in key safety fields such as aviation, national defence, is mainly used in the mistake of Boolean expression in the trace routine.In test process, traditional flow process is as follows:
The 1st step: it is right to find the solution the independence of each condition in the predicated expressions earlier: under the situation of unconditional coupling, it is independent right to adopt the sole cause method to find the solution; If there is the situation of coupling (particularly strong coupling) in judging between each condition, it is independent right then to adopt screen method to find the solution.
The 2nd step: generate test case:, each case is generated corresponding test case because each is independent of comprising two case according to independent right solving result.
The 3rd step: in the 2nd step, the independence of each condition correspondence in some cases can be a lot of to the result, when for example adopting screen method to find the solution.Will generate a large amount of test cases this moment, especially in to the whole procedure test, a large amount of judgements will generate the test case of magnanimity in the program, in order to save testing cost, to reduce difficulty of test, need simplify a large amount of test cases, in the hope of obtaining the test case set (that is minimum test set) of a minimum.
The 4th step: with minimum test set as input, the relevant mistake of Boolean expression in the trace routine.
Traditional flow process is that to find the solution in the predicated expressions independence of condition earlier right on the whole, according to independent to generating test case.Owing to often have redundant part in a large amount of test cases, and, need simplify to obtain minimum test set test case usually in order to reduce the test job amount.If can find the solution the independent pair set that obtains a minimum to the result, instruct with minimum independent pair set to generate minimum test set from independent.Then can avoid the process that generates a large amount of test cases and test case is simplified.Still find no the method for the independent pair set of directly finding the solution this type of minimum (or optimum) at present.
Summary of the invention
In order to solve above-mentioned technical matters, the invention provides a kind of implementation method and system of white box testing of computer software, mainly be at the MC/DC testing standard.Its purpose is, avoids the process that generates a large amount of test cases and test case is simplified.
The invention provides a kind of implementation method of white box testing of computer software, comprising:
Step 1, it is right to find the solution the independence of judging each condition correspondence in the Boolean expression;
Step 2 is judged minimum independent pair set based on the independence of each condition correspondence to finding the solution, and finds the solution the minimum independent pair set formation that determines and gathers with reference to use-case;
Step 3 is chosen an independent pair set of minimum in the set of reference use-case, and generates the test case set corresponding with the independent pair set of this minimum, and this test case set is minimum test set;
Step 4 is carried out correction conditions/judgement coverage test with minimum test set to source program;
Minimum independent pair set satisfies following condition:
Judge Z for given one, this judgement contains N condition, contains M unequal condition in N the condition, 2 in the truth table of M unequal condition MIndividual use-case C iForm the use-case S set, i ∈ [1,2 M]; The corresponding limited independence of non-NULL of each condition is to results set R k(i ∈ [1, N]), R kIn element be independent to P, independent P is comprised two use-case C i, C j, i, j ∈ [1,2 M]; Independent by N to P kIn all use-cases constitute set D, P arbitrarily k∈ R k, k ∈ [1, N]; Satisfying the set element number | the D of D| minimum is minimum independent pair set.
In the step 1, the independence of finding the solution each condition correspondence according to sole cause method or screen method is right.
In the step 2, select one to make up and generate independent pair set, and select the minimum independent pair set of element in the independent pair set as the independent pair set of minimum from the independent centering of each condition correspondence.
In the step 4, add up the coverage rate of correction conditions/judgement covering of minimum test set; If judge that according to coverage rate needs replenish test case, then choose at least one also execution in step 3 at the independent pair set of remaining minimum, generate corresponding test case as a supplement.
The invention provides a kind of realization system of white box testing of computer software, comprising:
Independent of finding the solution module, it is right to be used for finding the solution the independence of judging each condition of Boolean expression;
Minimum independent pair set is found the solution module, is used for judging minimum independent pair set based on the independence of each condition correspondence to finding the solution, and finds the solution the minimum independent pair set formation that determines and gathers with reference to use-case;
The test case generation module is used for selecting an independent pair set of minimum with reference to the use-case set, and generates the test case set corresponding with the independent pair set of this minimum, and this test case is gathered and is minimum test set;
Correction conditions/judgement coverage test module is used for minimum test set source program being carried out correction conditions/judgement coverage test;
Minimum independent pair set satisfies following condition:
Judge Z for given one, this judgement contains N condition, contains M unequal condition in N the condition, 2 in the truth table of M unequal condition MIndividual use-case C iForm the use-case S set, i ∈ [1,2 M]; The corresponding limited independence of non-NULL of each condition is to results set R k(i ∈ [1, N]), R kIn element be independent to P, independent P is comprised two use-case C i, C j, i, j ∈ [1,2 M]; Independent by N to P kIn all use-cases constitute set D, P arbitrarily k∈ R k, k ∈ [1, N]; Satisfying the set element number | the D of D| minimum is minimum independent pair set; M, N are natural number.
Independent of finding the solution module, the independence that is used for finding the solution according to sole cause method or screen method each condition correspondence is right.
Minimum independent pair set is found the solution module, is used for selecting one to make up and generate independent pair set from the independent centering of each condition correspondence, and selects the minimum independent pair set of element in the independent pair set as the independent pair set of minimum.
Correction conditions/judgement coverage test module, the coverage rate that also is used to add up correction conditions/judgement covering of minimum test set; If judge that according to coverage rate needs replenish test case, then choose at least one notice test case generation module and generate corresponding test case as a supplement at the independent pair set of remaining minimum.
The present invention possesses higher efficient, can reduce the cost of MC/DC test significantly, has avoided the process that generates a large amount of test cases and test case is simplified.
Description of drawings
Fig. 1 is that example provided by the invention is judged the minimum independent pair set solution procedure of MC/DC of (A and B or C);
Fig. 2 is treatment scheme provided by the invention and result;
Fig. 3 is that the expression tree of judgement provided by the invention (A and B) or (C and D) is represented;
Fig. 4 is function process provided by the invention (condition_index, process flow diagram OPT_LIST);
Fig. 5 is the implementation method process flow diagram of a kind of white box testing of computer software provided by the invention.
Embodiment
Below in conjunction with accompanying drawing, the present invention is described in further detail.
In a judgement, no matter adopt which kind of method for solving, among the result who finally obtains, the right quantity of the independence of each condition is (when particularly adopting screen method to find the solution) often, (the corresponding respectively index value of judging in the truth table of a pair of numeral in the bracket shown in the example procedure of accompanying drawing 1, each index value is represented boolean's value combination of each condition, is called a use-case (case), distinguishes mutually with the actual test case that generates with this).Preamble is mentioned, in the MC/DC test, generate test case according to independent right solving result, but owing to generate test case itself is the process of a complexity, and independent right result is numerous, if to each to independent to all generating two test cases, will certainly increase substantially testing cost.Meanwhile, therefore the independence of being not difficult to find different condition after generating test case, also need test case is refined, in the hope of finding a minimum test set to there being some repetitions between the result usually.But the effect that the technical scheme of the minimum test set of existing searching can reach is all undesirable.As mentioned above, in the test process, utilize independently earlier often solving result is generated test case, again test case is simplified afterwards, to obtain minimum test set.If can be from existing independence to finding the independent pair set of a minimum the result, in this minimum independent pair set, each condition can both find the independence of oneself right from this set in the judgement, by this minimum independent pair set generation test case of setting out, can directly obtain minimum test set so then.If the value of current minimum independent each condition of pair set can not produce test case owing to there is the situation of strong and weak coupling, also only need to replenish a spot of test case and get final product.
Just for these reasons, the present invention proposes a kind of implementation method of the software white-box testing based on the MC/DC testing standard, and provided concrete implementation step and system.In this implementation method, the notion of the minimum independent pair set of MC/DC has been proposed, different with in the past implementation method is, we try to achieve the minimum independent pair set of judgement by the independence of each condition to the result earlier, is directly instructed by the independent pair set of minimum to generate minimum test set.The result of this method as shown in Figure 2.At first provide the definition of the minimum independent pair set of MC/DC:
Judge that Z, this judgement contain N condition and (wherein contain the individual unequal condition of M, that is do not have strong coupling between any two conditions, M≤N): 2 in its truth table for given one MIndividual use-case C i(i ∈ [1,2 M]) composition use-case S set; The corresponding limited independence of non-NULL of each condition is to results set R i(i ∈ [1, N]), R iIn element promptly independent P is comprised two use-case C i, C j(i, j ∈ [1,2 M]).Independent by N to P i(any P i∈ R i, i ∈ [1, N]) in all use-cases constitute set D.Satisfying the set element number | the D of D| minimum is called the minimum independent pair set of MC/DC of current judgement.If the independence of choosing is to P iBetween do not have the use-case that repeats, then | D| reaches maximal value 2N; Otherwise, if any two independences that extract are to P iBetween all have the use-case that repeats, then | D| reaches minimum value N+1, with reference to the example of figure 1.
Be necessary to illustrate difference and contact between minimum test set and the minimum independent pair set at this.So-called minimum test set, non-formal definition is: in this test set, the independence of each condition guarantees each condition in judging is tested effectively with this to can both therefrom finding, and requires the test case minimum number in the minimum test set.In some academic article, also the minimum independent pair set that the present invention carried is referred to as minimum test set; Minimum test set refers in particular to minimum test case set among the present invention, and generally speaking, the use-case in the minimum independent pair set is corresponding one by one with the test case in the minimum test set, need replenish the partial test use-case under a few cases in minimum test set.Only need test case generate this process the set from the independent pair set of minimum to minimum test case, existing at present relevant tool and method can directly be finished this process, for example the method for generating test case that detects based on model etc.In the present invention, looking minimum independent pair set is two different notions with minimum test set.
Minimum independent pair set of MC/DC and method for solving thereof that the minimum test set of the support that the present invention proposes generates have following characteristics:
1) the minimum independent pair set of MC/DC find the solution independence based on all conditions to the result, with concrete method for solving irrelevant (adopting sole cause method or screen method no matter be), so this method has broad applicability;
2) finally finding the solution the minimum independent pair set of the MC/DC that obtains has a plurality of optional, if owing to there is the relation of coupling between the condition value, the minimum test set that the minimum independent pair set of the current MC/DC that selects for use generates can not satisfy test request, both can increase some test cases and replenish current test set, the minimum independent pair set of also optional other MC/DC as a reference.Provide support for generating final minimum test set;
3) the present invention searches optimum also promptly minimum independent pair set in the mode of search traversal, and the characteristics of method for solving itself can guarantee to obtain minimum set.
In the present invention, independent right representation is based on the truth table index of judgement, the judgement of shape as (Aand B or C), and the form of its truth table is as shown in fig. 1.Have 2 in the truth table of the judgement that condition quantity is N (prerequisite is not have strong coupling between the condition) N, the present invention is referred to as 2 NIndividual use-case (case).For above-mentioned judgement, be not difficult to know { (A=F, B=T, C=F); (A=T, B=T, C=F) } to have constituted a pair of MC/DC that condition A in the current judgement finds the solution with the sole cause method independent right for this a pair of value; 1 and 6 two use-case in the corresponding truth table, thus also can be independent right with a pair of MC/DC of (1,6) expression condition A, and it is independent right hereinafter all will to explain by this way.In fact, in finding the solution the right process of MC/DC independence, can not need analyze based on truth table, it is right to adopt the expression tree of judging can find the solution MC/DC independence based on diverse ways too.For example the expression tree of judgement (A andB) or (C and D) as shown in Figure 3.If it is independent right to adopt the sole cause method to find the solution, then the independence of condition A is to being expressed as:
( T and T ) or ? ( F and ? ) or F
But, above-mentioned independence still can be mapped with its truth table (table 1) to form:
(T and T) or? corresponding with (13,14,15,16) in the truth table;
(F and?) or F is corresponding with (1,2,3,5,6,7) in the truth table.
So it is independent of possessing generality and versatility that the present invention adopts the call number of truth table to represent.
Table 1 is judged the truth table of ((A and B) or (C and D))
??CASE ??A ??B ??C ??D ??RESULT
??1 ??F ??F ??F ??F ??F
??2 ??F ??F ??F ??T ??F
??3 ??F ??F ??T ??F ??F
??4 ??F ??F ??T ??T ??T
??5 ??F ??T ??F ??F ??F
??6 ??F ??T ??F ??T ??F
??7 ??F ??T ??T ??F ??F
??8 ??F ??T ??T ??T ??T
??9 ??T ??F ??F ??F ??F
??10 ??T ??F ??F ??T ??F
??11 ??T ??F ??T ??F ??F
??12 ??T ??F ??T ??T ??T
??13 ??T ??T ??F ??F ??T
??14 ??T ??T ??F ??T ??T
??15 ??T ??T ??T ??F ??T
??16 ??T ??T ??T ??T ??T
In obtaining judging by diverse ways (sole cause method or screen method) independence of each condition to after, independent of will (A B) preserves with the form of pairing.No matter adopt which kind of analytical approach, the result that final resulting independence is right all can be expressed as similar form, as shown in Figure 1.If wherein certain condition do not exist independent to (this situation particularly adopt the sole cause method find the solution independent to the time can occur), then the method at first provides warning message, next the independence that certain condition in judging is described find the solution the minimum independent pair set of corresponding M C/DC to remaining all conditions to not existing.
The independence of finding the solution traversal search all conditions in the process of the minimum independent pair set of MC/DC is right, and the mode of traversal can be based on adopting the round-robin mode also can adopt recursive mode.In calculation process, safeguard a working set (WORK_LIST) preservation Search Results simultaneously, safeguard that simultaneously the set of a working set is used to store the minimum independent pair set of all possible MC/DC that finds.Element in the working set is an integer, the call number in the corresponding truth table, and basic data structure is as follows:
OPT_LIST: a working set (WORK_LIST), be called the odd-job collection, be used for preserving all use-cases that find in the computation process.After a search is finished, the minimum independent pair set of MC/DC that is found in current this time of the element representation that odd-job is concentrated search procedure.
LIST_SET: in fact having represented the array of a WORK_LIST, also is the set of the minimum independent pair set of a MC/DC, and one of them element is represented an independent pair set of minimum.Because it is a plurality of that the minimum independent pair set of the MC/DC that tries to achieve may have, this set is used for preserving the minimum independent pair set of all MC/DC that find in the search procedure.
OPT_SIZE: for the sake of simplicity, the present invention is called optimized amount.Be used for writing down the element number that odd-job is concentrated in the current search process.The minimum value of this value under ideal state is N+1 (quantity of condition during wherein N represents to judge), is 2N to the maximum, so OPT_SIZE ∈ [N+1,2N].
The main flow process of searching algorithm as shown in Figure 4, this is that (this recursive function comprises that two parameter: condition_index represent the index of condition to a recursive call processing function Process for condition_index, process OPT_LIST), span is [1, N]; OPT_LIST is exactly the odd-job collection.Concrete solution procedure is as follows:
Step 1: the initialization operation that carries out data structure: odd-job collection OPT_LIST and working set array LIST_SET are initialized as sky, with optimized amount OPT_SIZE be initialized as predefined big several G (G>>2N), guarantee OPT_SIZE when initial necessarily greater than 2N.
Step 2: the recursive call search function, concrete steps can be divided into:
Step 2.1: because searching algorithm Process () is the process of a recurrence,, illustrate that the element among the current OPT_LIST is filled, change step 3 and handle if the index value of the current condition of importing into has surpassed the sum of condition in the judgement.
Step 2.2: attempt from when the independence of precondition to choosing i the result to independent right, i be used in traversal when precondition independent of a counter in the outcome procedure, that is independent index to the result.If i has exceeded independent right sum among the result, then explanation is independent of traveling through when independent all among the result of precondition, and program is returned; Otherwise program continues to carry out.
Step 2.3: two elements of the independent centering that will choose join among the OPT_LIST, and condition index value condition_index adds one, promptly handles next condition.Continue recursive call function Process (), two elements that will add are before deleted from OPT_LIST afterwards.Independent index value i is as a result added 1, change step 2.1.
Step 3: the intermediate result of search is kept among the OPT_LIST, and once Bian Li result need at first judge and just can join among the working set array LIST_SET, and concrete steps can be divided into:
Step 3.1:, illustrate that then the minimum independent pair set of the current MC/DC that finds of traversal this time is better than or equals the minimal set that the front has been found if the element number among the OPT_LIST is not more than optimized amount OPT_SIZE.Otherwise illustrate that this time traversal is got nothing, program is returned.
Step 3.2: further judge found littler more excellent set, therefore, the LIST that has stored among the LIST_SET is all emptied, upgrade the value of OPT_SIZE if the element number among the OPT_LIST less than optimized amount OPT_SIZE, then illustrates.Otherwise directly change step 3.3.
Step 3.3: new OPT_LIST copy is added among the working set array LIST_SET, and this time traversal finishes, and program is returned.
The detailed process of searching algorithm comprises:
Step 401 is judged when precondition index value greater than condition sum whether, if, execution in step 407, otherwise execution in step 402;
Step 402 independent is initialized as 1 to index value as a result;
Step 403 judges independent whether index value as a result have been exceeded independence when precondition to sum, if, return, otherwise execution in step 404;
Step 404, from when the independence of precondition right to taking out independent independence the result to index value correspondence as a result; Two elements adding odd-jobs are wherein concentrated;
Step 405, the condition index value adds one, simultaneously from this function of recursive call;
Step 406 is concentrated deletion with two elements that add before from odd-job; Independent index value is as a result added one, execution in step 403;
Whether step 407 judges the concentrated element number of odd-job smaller or equal to optimized amount, if, execution in step 408, otherwise return;
Whether step 408 judges the concentrated element number of odd-job less than optimized amount, if, execution in step 409, otherwise execution in step 410;
Step 409 runs into more excellent minimal set, and empty the working set array this moment; Optimized amount is set to odd-job and concentrates the element number size;
Step 410 copies and the odd-job collection is joined in the working set array, returns.
Being achieved as follows that the present invention proposes based on the method for testing of MC/DC testing standard:
Step 501, according to independent right definition, it is right to adopt sole cause method or screen method to find the solution in the predicated expressions independence of each condition;
Step 502 is called the minimum independent pair set that searching algorithm is found the solution judgement;
Step 503, select in the minimum independent pair set arbitrarily for use, minimum independent pair set is a use-case (case) set, and for each use-case (case) in this set generates corresponding test case, this step can adopt the method that detects based on model to realize; Obtain a minimum test set;
Step 504, with minimum test set source program is carried out the MC/DC test, add up its MC/DC coverage rate, if coverage rate do not reach test request (as there not being 100% all conditions in the judgement of covering) then explanation cover insufficient, need to replenish test case this moment, can in the independent pair set of remaining minimum, choose one or some set as required, extract in these set with independence that coverage condition is not relevant to generation test case additional as current minimum test set.
In order to set forth the flow process of finding the solution of the minimum independent pair set of MC/DC more intuitively, can be with reference to judging that for example (A and B or C) finds the solution the result of the minimum independent pair set of MC/DC among the flow process among the figure 2 and Fig. 1.
The present invention also provides a kind of realization system of white box testing of computer software, comprising:
Independent of finding the solution module, it is right to be used for finding the solution the independence of judging each condition of Boolean expression;
Minimum independent pair set is found the solution module, is used for judging minimum independent pair set based on the independence of each condition correspondence to finding the solution, and finds the solution the minimum independent pair set formation that determines and gathers with reference to use-case;
The test case generation module is used for selecting an independent pair set of minimum with reference to the use-case set, and generates the test case set corresponding with the independent pair set of this minimum, and this test case is gathered and is minimum test set;
Correction conditions/judgement coverage test module is used for minimum test set source program being carried out correction conditions/judgement coverage test;
Minimum independent pair set satisfies following condition:
Judge Z for given one, this judgement contains N condition, contains M unequal condition in N the condition, 2 in the truth table of M unequal condition MIndividual use-case Ci forms use-case S set, i ∈ [1,2 M]; The corresponding limited independence of non-NULL of each condition is to results set R k(i ∈ [1, N]), R kIn element be independent to P, independent P is comprised two use-case C i, C j, i, j ∈ [1,2 M]; Independent by N to P kIn all use-cases constitute set D, P arbitrarily k∈ R k, k ∈ [1, N]; Satisfying the set element number | the D of D| minimum is minimum independent pair set; M, N are natural number.
Those skilled in the art can also carry out various modifications to above content under the condition that does not break away from the definite the spirit and scope of the present invention of claims.Therefore scope of the present invention is not limited in above explanation, but determine by the scope of claims.

Claims (8)

1. the implementation method of a white box testing of computer software is characterized in that, comprising:
Step 1, it is right to find the solution the independence of judging each condition in the Boolean expression;
Step 2 is judged minimum independent pair set based on the independence of each condition correspondence to finding the solution, and finds the solution the minimum independent pair set formation that determines and gathers with reference to use-case;
Step 3 is chosen an independent pair set of minimum in the set of reference use-case, and generates the test case set corresponding with the independent pair set of this minimum, and this test case set is minimum test set;
Step 4 is carried out correction conditions/judgement coverage test with minimum test set to source program;
Minimum independent pair set satisfies following condition:
Judge Z for given one, this judgement contains N condition, contains M unequal condition in N the condition, 2 in the truth table of M unequal condition MIndividual use-case C iForm the use-case S set, i ∈ [1,2 M]; The corresponding limited independence of non-NULL of each condition is to results set R k(i ∈ [1, N]), R kIn element be independent to P, independent P is comprised two use-case C i, C j, i, j ∈ [1,2 M]; Independent by N to P kIn all use-cases constitute set D, P arbitrarily k∈ R k, k ∈ [1, N]; Satisfying the set element number | the D of D| minimum is minimum independent pair set.
2. the implementation method of white box testing of computer software as claimed in claim 1 is characterized in that, in the step 1, the independence of finding the solution each condition correspondence according to sole cause method or screen method is right.
3. the implementation method of white box testing of computer software as claimed in claim 1, it is characterized in that, in the step 2, select one to make up and generate independent pair set from the independent centering of each condition correspondence, and select the minimum independent pair set of element in the independent pair set as the independent pair set of minimum.
4. the implementation method of white box testing of computer software as claimed in claim 1 is characterized in that, in the step 4, adds up the coverage rate of correction conditions/judgement covering of minimum test set; If judge that according to coverage rate needs replenish test case, then choose at least one also execution in step 3 at the independent pair set of remaining minimum, generate corresponding test case as a supplement.
5. the realization system of a white box testing of computer software is characterized in that, comprising:
Independent of finding the solution module, it is right to be used for finding the solution the independence of judging each condition of Boolean expression;
Minimum independent pair set is found the solution module, is used for judging minimum independent pair set based on the independence of each condition correspondence to finding the solution, and finds the solution the minimum independent pair set formation that determines and gathers with reference to use-case;
The test case generation module is used for selecting an independent pair set of minimum with reference to the use-case set, and generates the test case set corresponding with the independent pair set of this minimum, and this test case is gathered and is minimum test set;
Correction conditions/judgement coverage test module is used for minimum test set source program being carried out correction conditions/judgement coverage test;
Minimum independent pair set satisfies following condition:
Judge Z for given one, this judgement contains N condition, contains M unequal condition in N the condition, 2 in the truth table of M unequal condition MIndividual use-case C iForm the use-case S set, i ∈ [1,2 M]; The corresponding limited independence of non-NULL of each condition is to results set R k(i ∈ [1, N]), R kIn element be independent to P, independent P is comprised two use-case C i, C j, i, j ∈ [1,2 M]; Independent by N to P kIn all use-cases constitute set D, P arbitrarily k∈ R k, k ∈ [1, N]; Satisfying the set element number | the D of D| minimum is minimum independent pair set; M, N are natural number.
6. the realization system of white box testing of computer software as claimed in claim 5 is characterized in that, and is independent of finding the solution module, and the independence that is used for finding the solution according to sole cause method or screen method each condition correspondence is right.
7. the realization system of white box testing of computer software as claimed in claim 5, it is characterized in that, minimum independent pair set is found the solution module, be used for selecting one to make up and generate independent pair set, and select the minimum independent pair set of element in the independent pair set as the independent pair set of minimum from the independent centering of each condition correspondence.
8. the realization system of white box testing of computer software as claimed in claim 5 is characterized in that, correction conditions/judgement coverage test module, the coverage rate that also is used to add up correction conditions/judgement covering of minimum test set; If judge that according to coverage rate needs replenish test case, then choose at least one notice test case generation module and generate corresponding test case as a supplement at the independent pair set of remaining minimum.
CN2009102426578A 2009-12-14 2009-12-14 Method and system for realizing white box testing of computer software Active CN101710305B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009102426578A CN101710305B (en) 2009-12-14 2009-12-14 Method and system for realizing white box testing of computer software

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009102426578A CN101710305B (en) 2009-12-14 2009-12-14 Method and system for realizing white box testing of computer software

Publications (2)

Publication Number Publication Date
CN101710305A true CN101710305A (en) 2010-05-19
CN101710305B CN101710305B (en) 2012-04-18

Family

ID=42403097

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009102426578A Active CN101710305B (en) 2009-12-14 2009-12-14 Method and system for realizing white box testing of computer software

Country Status (1)

Country Link
CN (1) CN101710305B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102323906A (en) * 2011-09-08 2012-01-18 哈尔滨工程大学 MC/DC test data automatic generation method based on genetic algorithm
CN107678973A (en) * 2017-10-31 2018-02-09 北京润科通用技术有限公司 The automatic generation method and system of a kind of test script
CN107748721A (en) * 2017-11-27 2018-03-02 中国航空无线电电子研究所 A kind of test use cases automatic generation method
CN109062812A (en) * 2018-09-30 2018-12-21 中电科(德阳广汉)特种飞机系统工程有限公司 Test method, equipment and the readable storage medium storing program for executing of software based on many condition operation
CN109669436A (en) * 2018-12-06 2019-04-23 广州小鹏汽车科技有限公司 A kind of method for generating test case and device of the functional requirement based on electric car
CN110888803A (en) * 2019-11-08 2020-03-17 北京新能源汽车技术创新中心有限公司 Method and system for converting test decision table into test case
CN116383070A (en) * 2023-04-07 2023-07-04 南京航空航天大学 Symbol execution method for high MC/DC

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102323906A (en) * 2011-09-08 2012-01-18 哈尔滨工程大学 MC/DC test data automatic generation method based on genetic algorithm
CN102323906B (en) * 2011-09-08 2014-01-08 哈尔滨工程大学 MC/DC test data automatic generation method based on genetic algorithm
CN107678973A (en) * 2017-10-31 2018-02-09 北京润科通用技术有限公司 The automatic generation method and system of a kind of test script
CN107678973B (en) * 2017-10-31 2020-06-05 北京润科通用技术有限公司 Automatic generation method and system of test script
CN107748721A (en) * 2017-11-27 2018-03-02 中国航空无线电电子研究所 A kind of test use cases automatic generation method
CN109062812A (en) * 2018-09-30 2018-12-21 中电科(德阳广汉)特种飞机系统工程有限公司 Test method, equipment and the readable storage medium storing program for executing of software based on many condition operation
CN109669436A (en) * 2018-12-06 2019-04-23 广州小鹏汽车科技有限公司 A kind of method for generating test case and device of the functional requirement based on electric car
CN109669436B (en) * 2018-12-06 2021-04-13 广州小鹏汽车科技有限公司 Test case generation method and device based on functional requirements of electric automobile
CN110888803A (en) * 2019-11-08 2020-03-17 北京新能源汽车技术创新中心有限公司 Method and system for converting test decision table into test case
CN110888803B (en) * 2019-11-08 2023-08-22 北京国家新能源汽车技术创新中心有限公司 Method and system for converting test decision table into test case
CN116383070A (en) * 2023-04-07 2023-07-04 南京航空航天大学 Symbol execution method for high MC/DC
CN116383070B (en) * 2023-04-07 2023-12-05 南京航空航天大学 Symbol execution method for high MC/DC

Also Published As

Publication number Publication date
CN101710305B (en) 2012-04-18

Similar Documents

Publication Publication Date Title
CN101710305B (en) Method and system for realizing white box testing of computer software
US10810210B2 (en) Performance and usability enhancements for continuous subgraph matching queries on graph-structured data
JP6253555B2 (en) System and method for a high performance graph analysis engine
Alrabaee et al. Oba2: An onion approach to binary code authorship attribution
US7676453B2 (en) Partial query caching
CN102279738B (en) Identify the technology of the entrance and exit of strong connected component
Xian et al. Fuzzy linguistic induced Euclidean OWA distance operator and its application in group linguistic decision making
US20210329013A1 (en) Distributed digital security system
EP4250645A2 (en) Distributed digital security system
EP3896935A1 (en) Distributed digital security system
CN108052394A (en) The method and computer equipment of resource allocation based on SQL statement run time
US20210326452A1 (en) Distributed digital security system
EP3896937A1 (en) Distributed digital security system
CN104461625A (en) Hot patch realization method and system
US9823913B2 (en) Method of adding local variables in place of global in JavaScript
CN114817927B (en) Effective symbol execution method based on branch coverage guidance
US20180165333A1 (en) Big data calculation method and system
EP3156902B1 (en) Data flow analysis with collapsed contexts
Berthold et al. Analyzing the computational impact of MIQCP solver components
CN104756079A (en) Rule distribution server, as well as event processing system, method, and program
Augusto et al. Advanced process discovery techniques
De León et al. Incorporating negative information to process discovery of complex systems
Madsen Improvements to message computation in lazy propagation
US20060173852A1 (en) Apparatus and method for highlighting discrepancies between query performance estimates and actual query performance
CN106681787A (en) Method and device for developing application

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant