CN106095661A - Loop restructuring bankrupt in class integration testing - Google Patents

Loop restructuring bankrupt in class integration testing Download PDF

Info

Publication number
CN106095661A
CN106095661A CN201510631000.6A CN201510631000A CN106095661A CN 106095661 A CN106095661 A CN 106095661A CN 201510631000 A CN201510631000 A CN 201510631000A CN 106095661 A CN106095661 A CN 106095661A
Authority
CN
China
Prior art keywords
class
loop
word
test
abolish
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
CN201510631000.6A
Other languages
Chinese (zh)
Other versions
CN106095661B (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.)
China University of Mining and Technology CUMT
Original Assignee
China University of Mining and Technology CUMT
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 China University of Mining and Technology CUMT filed Critical China University of Mining and Technology CUMT
Priority to CN201510631000.6A priority Critical patent/CN106095661B/en
Publication of CN106095661A publication Critical patent/CN106095661A/en
Application granted granted Critical
Publication of CN106095661B publication Critical patent/CN106095661B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

Loop restructuring bankrupt in a kind of class integration testing, this restructuring bankrupt includes building complete object relation figure WORD, statistics WORD intermediate ring road number, abolishing WORD intermediate ring road;Abolish WORD intermediate ring road firstly the need of identifying the strong continune assembly SCCs formed in WORD by class and the dependence between them, then look up all of loop in each strong continune component SCCi, loop number involved by each edge in statistics SCCi, and then have ring figure to abolish loop to become an acyclic figure by one;The method more fully considers OO feature; as polymorphism, abstract class can not be different between instantiation and class inheritance; i.e. public inheritance; the features such as the inheritance impact on abolish loop different with private inheritance these three is inherited in protection; provide the deletion rule on limit in the loop of preferable static dependencies relation and dynamic dependency relation composition; reduce testing cost, improve the accuracy of test.

Description

Loop restructuring bankrupt in class integration testing
Technical field
The present invention relates to a kind of method abolishing loop, the loop restructuring bankrupt in a kind of class integration testing.
Background technology
In object-oriented program, the determination of Class Test Order is one of sixty-four dollar question in class cluster level testing.Object-oriented program call relation constitutes a complicated network structure.Therefore, start test wherefrom and how to define the problem that an integration testing is sequentially a needs research.If there is loop in category difference, tester must be removed from it some dependence, to abolish loop therein.Therefore, abolishing loop is a major issue in class integration testing.When deleting dependence, need to introduce test pile.Test pile refers to, when C1 relies on C2, and during incremental integration, when C1 is integrated, but C2 is not yet integrated, be used for simulating the serviced component of C2.
In the test of object-oriented program, exploitation test pile is the work that a cost is the highest, and the cost therefore reducing exploitation test pile determines that a vital task of Class Test Order.The method reducing exploitation test pile cost (testing cost) mainly has two classes: a class is to minimize the number of required test pile, the another kind of complexity being to minimize test pile.Wherein, test pile complexity is used to weigh the complexity building a test pile.Owing to the complexity standard of test pile is difficult to formulate, the complexity of test pile is the most wayward, and the complexity of test pile depends on the program capability of developer to a certain extent, owing to OOP has great motility, the programmer of different developing background develops the test pile of same class, it is entirely possible to generate the test pile that complexity differs greatly.Therefore, the present invention with minimize required test pile number be weigh testing cost standard.
At present; the existing method of loop of abolishing is mostly only for static dependencies relation; only have a few methods on the basis of static dependencies relation, analyze dynamic dependency relation and abstract class can not the impact on abolishing loop of the feature of instantiation; but still lack the loop restructuring bankrupt relatively comprehensively considering other features OO; such as inheritances different between class; i.e. public inheritance; the inheritance different with the private inheritance these three impact on abolishing loop is inherited in protection; ignoring these features, the Class Test Order obtained is inaccurate.Therefore, existing loop restructuring bankrupt the most increasingly can not meet and is actually needed..
Summary of the invention
nullIn order to solve existing loop restructuring bankrupt, OO feature is considered insufficient and cause the number deficiency of test pile,The Class Test Order obtained is inaccurate,The problem being difficult to final test,The present invention is to minimize the number of the test pile of required structure as the standard weighing testing cost,Loop restructuring bankrupt in a kind of class integration testing is provided,When using the method to abolish loop,Select to delete some limits,These selected limits need to meet deletes the condition that they required test pile complexity sums constructed are minimum,The method more fully considers OO feature,Such as polymorphism、Abstract class can not be different between instantiation and class inheritance,I.e. public inheritance,The features such as the inheritance impact on abolish loop different with private inheritance these three is inherited in protection,Provide the deletion rule on limit in the loop of preferable static dependencies relation and dynamic dependency relation composition,Reduce testing cost,Improve the accuracy of test.
The technical solution adopted for the present invention to solve the technical problems is: the loop restructuring bankrupt in such integration testing includes building complete object relation figure WORD, statistics WORD intermediate ring road number, abolishing WORD intermediate ring road, and its step is as follows:
(1) complete object relation figure WORD is built: in object relation figure ORD, increase the limit representing dynamic dependency relation, represent with the dotted line limit indicating Dy, and the form increasing use " node a " represents abstract class, available complete object relation figure, it is designated as WORD={V, E}, wherein, V is each category node in representation program, if the class that this node represents is abstract class, then representing with Va, E={EI ∪ EAg ∪ EAs ∪ EDy}, EI, EAg, EAs, EDy represent succession limit between class respectively, assemble limit, incidence edge and dynamic dependency limit.
(2) statistics WORD intermediate ring road number: in each the sub-strong continune component SCCi that will comprise in SCCs the most respectively, all limits organize together in the form of a tree, rule is will to be numbered each class represented from small to large by class successively as root node, the limit comprised in SCCi builds as branch, often select to build a different search tree during a different root node, the node repeated is avoided in one path when building a search tree, last using the node identical with root node as leaf node, leaf node in tree can not be met identical with root node until the limit in SCCi;Then these search trees are carried out preamble traversal, remove the path of repetition, finally obtain total loop number and all loops and path, the number of the loop that each limit relates in SCCi that SCCi includes.
(3) WORD intermediate ring road is abolished: abolish loop and determine that the key problem of inter-class test order, firstly the need of identifying the strong continune assembly SCCs formed in WORD by class and the dependence between them, then look up all of loop in each strong continune component SCCi, loop number involved by each edge in statistics SCCi, and then have ring figure to abolish loop to become an acyclic figure by one.
Structure test pile rule: assume that A class is the customer class of B class, B is the parent (i.e. class B is a service class and a parent) of C, and C is a customer class of A, then there is a dynamic dependency limit between A and C.When A tested before B Yu C, there is following two situation:
(1) if A → B is aggregation (Ag) or inheritance (I), and the type of A → B is publicly-owned (Public) or protection (Protected), and no matter whether B is abstract class, needs the subclass for class B, class C, and class C to construct test pile;If A → B is aggregation (Ag) or inheritance (I), and the type of A → B is privately owned (Private), and no matter whether B is abstract class, it is only necessary to construct test pile for class B.
(2) if A → B is incidence relation (As), the subclass for class B, class C, and class C is needed to construct test pile.
The structure rule of table 1 test pile
Abolish loop rule: assuming that λ is acyclic ORD, node A, B, C ∈ λ, A are the customer class of B, and B is the parent of C, and class B is that parent services again class, has dependence C → A, A → C and a C → A and other node the most not to constitute other new loop between C to A.According to the definition of dynamic dependency relation, there is a dynamic dependency relation A → C so that WORD increases a loop A → C → A.Loop can be abolished by following approach:
(1) A → B is deleted, then A → C disappears therewith, can abolish loop A → C → A.If B is not abstract class, then class B can be instantiated, and C can now need the subclass for class B, class C, and C to construct test pile with the data member of derived class B, and possible testing sequence is A, B, C or B, A, C;If B is abstract class, then class B can not be instantiated, but, it still illustrates the service required for class A, and this explanation is only the information segment simulating the test pile creating class B, in this case, need to construct test pile for class B, and B is abstract class, it can not be instantiated, and only test b is infeasible, should test in conjunction with an example of its subclass (class C), therefore, testing sequence is A, BC.
(2) delete C → A and can abolish loop A → C → A.When B is not abstract class, needs to construct test pile for A, and corresponding testing sequence is B, C, A;If B is abstract class, it can not be instantiated, and only test b is infeasible, it should an example of the subclass (class C) combining it is tested, accordingly, it is possible to testing sequence be BC, A;Furthermore, it is possible to abolish loop by deleting A → C: when B is not abstract class, needing to construct test pile for B, corresponding testing sequence is B, A, C;When B is abstract class, needing to construct test pile for class B, corresponding testing sequence is A, BC.
(3) delete dynamic dependency relation A → C and can abolish loop A → C → A.When B is not abstract class, needing to construct test pile for C, corresponding test sequence is B, A, C;When B is abstract class, it can not be instantiated, and only test class B is infeasible, it should an example of the subclass (class C) combining it is tested, accordingly, it is possible to Class Test Order be A, BC.
Loop restructuring bankrupt in WORD:
1) all of loop in WORD is found out;
2) the loop number involved by each edge in each loop is added up;
3) judge relate to loop most be any bar limit;
4) current loop sum is recalculated: loop sum deducts, equal to loop sum, the number abolishing loop;
5) recalculating the number of loop involved by remaining sides, circulation performs step 3) and 4).
The invention has the beneficial effects as follows: based on WORD should abolish loop method and provide the deletion rule on limit in the loop that preferable static dependencies relation and dynamic dependency relation are constituted, and reduce testing cost.This is owing to existing method only allows when abolishing loop to delete the weak contact limits such as incidence edge, and the present invention allows to delete any kind of contact limit, and rule 2 is followed to delete and is related to loop and the rule on the minimum limit of structure test pile number, therefore present invention only requires the less limit of deletion, and construct less test pile, just can eliminate all loops that category difference is constituted, the present invention, to minimize the number criterion as test cost of test pile, has saved testing cost.Inheritance (the public inheritance that the abstract class ignored in additive method can not be different between instantiation, class is considered during abolishing loop; protection is inherited; private inheritance) etc. the feature of object-oriented program necessary being; therefore; invention increases the accuracy of test, bring facility to the work of scientific research personnel.
Accompanying drawing explanation
The present invention is further described with embodiment below in conjunction with the accompanying drawings.
Fig. 1 is the schematic flow sheet of the present invention.
Fig. 2 is example WORD.
Detailed description of the invention
In Fig. 1, the loop restructuring bankrupt in such integration testing includes building complete object relation figure WORD, statistics WORD intermediate ring road number, abolishing WORD intermediate ring road, and its step is as follows:
(1) complete object relation figure WORD is built: in object relation figure ORD, increase the limit representing dynamic dependency relation, represent with the dotted line limit indicating Dy, and the form increasing use " node a " represents abstract class, available complete object relation figure, it is designated as WORD={V, E}, wherein, V is each category node in representation program, if the class that this node represents is abstract class, then representing with Va, E={EI ∪ EAg ∪ EAs ∪ EDy}, EI, EAg, EAs, EDy represent succession limit between class respectively, assemble limit, incidence edge and dynamic dependency limit.
(2) statistics WORD intermediate ring road number: in each the sub-strong continune component SCCi that will comprise in SCCs the most respectively, all limits organize together in the form of a tree, rule is will to be numbered each class represented from small to large by class successively as root node, the limit comprised in SCCi builds as branch, often select to build a different search tree during a different root node, the node repeated is avoided in one path when building a search tree, last using the node identical with root node as leaf node, leaf node in tree can not be met identical with root node until the limit in SCCi;Then these search trees are carried out preamble traversal, remove the path of repetition, finally obtain total loop number and all loops and path, the number of the loop that each limit relates in SCCi that SCCi includes.
(3) WORD intermediate ring road is abolished: abolish loop and determine that the key problem of inter-class test order, firstly the need of identifying the strong continune assembly SCCs formed in WORD by class and the dependence between them, then look up all of loop in each strong continune component SCCi, loop number involved by each edge in statistics SCCi, and then have ring figure to abolish loop by one to become an acyclic figure according to abolishing loop rule.In order to reduce the structure number of test pile, follow during abolishing loop and delete the principle relating to the most limit of loop (including dynamic dependency limit).
Structure test pile rule: assume that A class is the customer class of B class, B is the parent (i.e. class B is a service class and a parent) of C, and C is a customer class of A, then there is a dynamic dependency limit between A and C.When A tested before B Yu C, there is following two situation:
(1) if A → B is aggregation (Ag) or inheritance (I), and the type of A → B is publicly-owned (Public) or protection (Protected), and no matter whether B is abstract class, needs the subclass for class B, class C, and class C to construct test pile;If A → B is aggregation (Ag) or inheritance (I), and the type of A → B is privately owned (Private), and no matter whether B is abstract class, it is only necessary to construct test pile for class B.
(2) if A → B is incidence relation (As), the subclass for class B, class C, and class C is needed to construct test pile.
The structure rule of table 1 test pile
Abolish loop rule: assuming that λ is acyclic ORD, node A, B, C ∈ λ, A are the customer class of B, and B is the parent of C, and class B is that parent services again class, has dependence C → A, A → C and a C → A and other node the most not to constitute other new loop between C to A.According to the definition of dynamic dependency relation, there is a dynamic dependency relation A → C so that WORD increases a loop A → C → A.Loop can be abolished by following approach:
(1) A → B is deleted, then A → C disappears therewith, can abolish loop A → C → A.If B is not abstract class, then class B can be instantiated, and C can now need the subclass for class B, class C, and C to construct test pile with the data member of derived class B, and possible testing sequence is A, B, C or B, A, C;If B is abstract class, then class B can not be instantiated, but, it still illustrates the service required for class A, and this explanation is only the information segment simulating the test pile creating class B, in this case, need to construct test pile for class B, and B is abstract class, it can not be instantiated, and only test b is infeasible, should test in conjunction with an example of its subclass (class C), therefore, testing sequence is A, BC.
(2) delete C → A and can abolish loop A → C → A.When B is not abstract class, needs to construct test pile for A, and corresponding testing sequence is B, C, A;If B is abstract class, it can not be instantiated, and only test b is infeasible, it should an example of the subclass (class C) combining it is tested, accordingly, it is possible to testing sequence be BC, A;Furthermore, it is possible to abolish loop by deleting A → C: when B is not abstract class, needing to construct test pile for B, corresponding testing sequence is B, A, C;When B is abstract class, needing to construct test pile for class B, corresponding testing sequence is A, BC.
(3) delete dynamic dependency relation A → C and can abolish loop A → C → A.When B is not abstract class, needing to construct test pile for C, corresponding test sequence is B, A, C;When B is abstract class, it can not be instantiated, and only test class B is infeasible, it should an example of the subclass (class C) combining it is tested, accordingly, it is possible to Class Test Order be A, BC.
Loop restructuring bankrupt in WORD:
1) all of loop in WORD is found out;
2) the loop number involved by each edge in each loop is added up;
3) judge relate to loop most be any bar limit;
If the loop number involved by the Dy of dynamic dependency limit is most or Dy identical with the loop number involved by other limit (including the situation of the simplest loop of two classes and two limit Dy and other limit composition), loop rule is abolished according to the present invention, judge that the number of the test pile of the required structure in which bar limit of deletion is minimum, that limit that then number of the test pile that satisfied required structure is deleted in selection is minimum;If there are two limits between two classes in the same direction simultaneously, and the loop number that they relate to is identical and most, deletes this two limits the most simultaneously;If there is no dynamic dependency limit Dy, when certain limit relates to loop number at most, then delete this limit;If the loop number that a plurality of limit relates to is identical and most, then select that limit that the number of the test pile of the satisfied required structure of deletion is minimum;If the number meeting the test pile deleting the required structure in a plurality of limit is minimum and identical, then arbitrarily delete one therein.
4) current loop sum is recalculated: loop sum deducts, equal to loop sum, the number abolishing loop;
5) recalculating the number of loop involved by remaining sides, circulation performs step 3) and 4).

Claims (2)

1. the loop restructuring bankrupt in class integration testing, including: build complete object relation figure WORD, statistics WORD intermediate ring road number, abolish WORD intermediate ring road;It is characterized in that: abolish WORD intermediate ring road firstly the need of identifying the strong continune assembly SCCs formed in WORD by class and the dependence between them, then look up all of loop in each strong continune component SCCi, loop number involved by each edge in statistics SCCi, and then have ring figure to abolish loop to become an acyclic figure by one.
Loop restructuring bankrupt in class integration testing the most according to claim 1, it abolishes loop rule: assume that λ is acyclic ORD, node A, B, C ∈ λ, A are the customer class of B, B is the parent of C, class B is that parent services again class, has dependence C → A, A → C and a C → A and other node the most not to constitute other new loop between C to A;According to the definition of dynamic dependency relation, there is a dynamic dependency relation A → C so that WORD increases a loop A → C → A;Loop can be abolished by following approach:
(1) A → B is deleted, then A → C disappears therewith, can abolish loop A → C → A;If B is not abstract class, then class B can be instantiated, and C can now need the subclass for class B, class C, and C to construct test pile with the data member of derived class B, and possible testing sequence is A, B, C or B, A, C;If B is abstract class, then class B can not be instantiated, but, it still illustrates the service required for class A, and this explanation is only the information segment simulating the test pile creating class B, in this case, need to construct test pile for class B, and B is abstract class, it can not be instantiated, and only test b is infeasible, should test in conjunction with an example of its subclass (class C), therefore, testing sequence is A, BC;
(2) delete C → A and can abolish loop A → C → A;When B is not abstract class, needs to construct test pile for A, and corresponding testing sequence is B, C, A;If B is abstract class, it can not be instantiated, and only test b is infeasible, it should an example of the subclass (class C) combining it is tested, accordingly, it is possible to testing sequence be BC, A;Furthermore, it is possible to abolish loop by deleting A → C: when B is not abstract class, needing to construct test pile for B, corresponding testing sequence is B, A, C;When B is abstract class, needing to construct test pile for class B, corresponding testing sequence is A, BC;
(3) delete dynamic dependency relation A → C and can abolish loop A → C → A;When B is not abstract class, needing to construct test pile for C, corresponding test sequence is B, A, C;When B is abstract class, it can not be instantiated, and only test class B is infeasible, it should an example of the subclass (class C) combining it is tested, accordingly, it is possible to Class Test Order be A, BC.
CN201510631000.6A 2015-09-29 2015-09-29 Loop restructuring bankrupt in class integration testing Active CN106095661B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510631000.6A CN106095661B (en) 2015-09-29 2015-09-29 Loop restructuring bankrupt in class integration testing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510631000.6A CN106095661B (en) 2015-09-29 2015-09-29 Loop restructuring bankrupt in class integration testing

Publications (2)

Publication Number Publication Date
CN106095661A true CN106095661A (en) 2016-11-09
CN106095661B CN106095661B (en) 2018-12-28

Family

ID=57216259

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510631000.6A Active CN106095661B (en) 2015-09-29 2015-09-29 Loop restructuring bankrupt in class integration testing

Country Status (1)

Country Link
CN (1) CN106095661B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020092001A1 (en) * 2000-11-24 2002-07-11 Ryoko Fujikawa Record medium and method for analyzing a source file
CN102937933A (en) * 2012-11-14 2013-02-20 中国矿业大学 Class test sequence determining method based on testing level
CN102968375A (en) * 2012-11-30 2013-03-13 中国矿业大学 Inaccessible path detection method based on association rule mining

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020092001A1 (en) * 2000-11-24 2002-07-11 Ryoko Fujikawa Record medium and method for analyzing a source file
CN102937933A (en) * 2012-11-14 2013-02-20 中国矿业大学 Class test sequence determining method based on testing level
CN102968375A (en) * 2012-11-30 2013-03-13 中国矿业大学 Inaccessible path detection method based on association rule mining

Also Published As

Publication number Publication date
CN106095661B (en) 2018-12-28

Similar Documents

Publication Publication Date Title
US9176828B2 (en) System and method for merging results from multiple runs based on run inputs
AU2014216556B2 (en) Building applications for configuring processes
CN109388566A (en) A kind of code coverage rate analysis method, apparatus, equipment and storage medium
CN109347787A (en) A kind of recognition methods of identity information and device
CN107251021B (en) Filtering data lineage graph
US20200226232A1 (en) Method of selecting software files
CN104615544A (en) Problem-oriented GUI software correlation function analysis method and device
CN108369584A (en) Information processing system, function creation method and function creation program
Korobkin et al. Synthesis of the physical principle of operation of engineering systems in the software environment CPN TOOLS
Suda Vampire getting noisy: Will random bits help conquer chaos?(system description)
Busani Diffusive scaling limit of the Busemann process in Last Passage Percolation
CN109522086B (en) Operation method and device for window, computer device and readable storage medium
Deshpande et al. Testing the hypothesis of proportional hazards in two populations
CN104160389B (en) By having the method and system of the intelligent event dynamically aggregated content of non-illustration content
CN103593222A (en) Process for extracting Java software program class diagrams reversely
CN106095661A (en) Loop restructuring bankrupt in class integration testing
US20190080156A1 (en) Ensuring a desired distribution of images in a multimedia document utilizing facial signatures
Goldberg et al. The complexity of approximately counting tree homomorphisms
Bentert et al. Stable matching with multilayer approval preferences: approvals can be harder than strict preferences
Junior et al. FB-APSP: A new efficient algorithm for computing all-pairs shortest-paths
Cherubini et al. Amalgams vs Yamamura's HNN-extensions of inverse semigroups
Alnafisah An Algorithmic Solution for the “Hair Ball” Problem in Data Visualization
CN110297625A (en) The processing method and processing device of application
Biswas et al. An Efficient Approach for Constructing Spanning Trees by Applying BFS and DFS Algorithm Directly on Non-regular Graphic Sequences
Rosenberg The nonhomogeneous frog model on $\mathbb {Z} $

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