CN106095661B - Loop restructuring bankrupt in class integration testing - Google Patents
Loop restructuring bankrupt in class integration testing Download PDFInfo
- Publication number
- CN106095661B CN106095661B CN201510631000.6A CN201510631000A CN106095661B CN 106095661 B CN106095661 B CN 106095661B CN 201510631000 A CN201510631000 A CN 201510631000A CN 106095661 B CN106095661 B CN 106095661B
- Authority
- CN
- China
- Prior art keywords
- class
- loop
- word
- test
- abstract
- 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
Links
Abstract
A kind of loop restructuring bankrupt in class integration testing, the restructuring bankrupt include constructing complete object relationship figure WORD, statistics WORD intermediate ring road number, abolishing WORD intermediate ring road;WORD intermediate ring road is abolished firstly the need of identifying the strong continune component SCCs formed in WORD by class and the dependence between them, then loop all in each strong continune component SCCi is searched, loop number involved in each edge in SCCi is counted, and then has ring figure to abolish loop as an acyclic figure for one;This method more fully considers the characteristics of object-oriented; as polymorphism, abstract class can not instantiate and class between different inheritance; that is public inheritance; influence of the features such as these three different inheritances with private inheritance to loop is abolished is inherited in protection; provide the deletion rule on side in the loop of preferable static dependencies relationship and dynamic dependency relation composition; testing cost is reduced, the accuracy of test is improved.
Description
Technical field
A kind of loop restructuring bankrupt the present invention relates to method for abolishing loop, in especially a kind of class integration testing.
Background technique
In object-oriented program, the determination of Class Test Order is one of sixty-four dollar question in class cluster level testing.Towards right
As routine call relationship constitutes a complicated reticular structure.Therefore, wherefrom start to test and how to define one
Integration testing sequence is one and needs the problem of studying.If there are loop in category difference, tester must be removed from it
Certain dependences, to abolish loop therein.Therefore, abolishing loop is a major issue in class integration testing.It is deleting
When except dependence, need to introduce test pile.Test pile refers to during C1 dependence C2, incremental integration, when C1 is integrated, but
C2 is not yet integrated, for simulating the serviced component of C2.
In the test of object-oriented program, exploitation test pile is the very high work of cost, therefore reduces exploitation and survey
The cost of test pile is a vital task of determining Class Test Order.Reduce the method master of exploitation test pile cost (testing cost)
Two classes: one kind is the number of test pile needed for minimizing, and another kind of is the complexity for minimizing test pile.Wherein, it tests
Stake complexity is the complexity for measuring one test pile of building.Since the complexity standard of test pile is difficult to formulate, survey
The complexity of test pile is just difficult to control, and the complexity of test pile depends on the programming energy of developer to a certain extent
Power, since Object-Oriented Programming has great flexibility, the programmer of different developing backgrounds develops the test pile of same class,
It is entirely possible to generate the test pile that complexity differs greatly.Therefore, the present invention is to minimize the number of required test pile as weighing apparatus
Measure the standard of testing cost.
Currently, the existing method for abolishing loop is mostly only for static dependencies relationship, only a few methods static state according to
Dynamic dependency relation is analyzed on the basis of the relationship of relying and influence the characteristics of abstract class can not instantiate to loop is abolished, still
Still lack the loop restructuring bankrupt of more comprehensive other features for considering object-oriented, such as inheritance different between class, i.e.,
Public inheritance, protection inherit these three influences of different inheritances to loop is abolished with private inheritance, ignore these features,
Obtained Class Test Order is inaccurate.Therefore, existing loop restructuring bankrupt is not able to satisfy practical need more and more
It wants.
Summary of the invention
Number that is insufficient and leading to test pile is considered to the characteristics of object-oriented in order to solve existing loop restructuring bankrupt
Mesh is insufficient, obtained Class Test Order inaccuracy, it is difficult to which the problem of completing final test, the present invention is to minimize required construction
The number of test pile provides the loop restructuring bankrupt in a kind of class integration testing, uses this as the standard for measuring testing cost
When method abolishes loop, some sides are deleted in selection, and the test pile that these selected sides construct required for needing satisfaction to delete them is multiple
The characteristics of the smallest condition of the sum of miscellaneous degree, this method more fully considers object-oriented, as polymorphism, abstract class can not instantiate
And these three different inheritances etc. are inherited with private inheritance in different inheritance between class, i.e. public inheritance, protection
Influence of the feature to loop is abolished provides deleting for side in the loop that preferable static dependencies relationship and dynamic dependency relation are constituted
Except rule, testing cost is reduced, improves the accuracy of test.
The technical solution adopted by the present invention to solve the technical problems is: the loop restructuring bankrupt packet in such integration testing
It includes the complete object relationship figure WORD of building, statistics WORD intermediate ring road number, abolish WORD intermediate ring road, its step are as follows:
(1) it constructs complete object relationship figure WORD: increasing the side for indicating dynamic dependency relation in object relationship figure ORD,
It is indicated with the dotted line side for indicating Dy, and the form for increasing use " node a " indicates abstract class, and complete object relationship figure can be obtained, and remembers
For WORD={ V, E }, wherein V is each class node in representation program, if the class that the node indicates is abstract class, uses Va
Indicate, E={ EI ∪ EAg ∪ EAs ∪ EDy }, EI, EAg, EAs, EDy respectively indicate inherit between class in, aggregation, incidence edge and
Dynamic dependency side.
(2) WORD intermediate ring road number is counted: first respectively will be in each sub- strong continune component SCCi for including in SCCs
All sides organize together in the form of a tree, and rule is successively to regard each class indicated from small to large by class number as root section
Point, the side for including in SCCi are constructed as branch, and when one different root node of every selection constructs a different lookup
Tree, avoids duplicate node, finally using node identical with root node as leaf in one path when constructing a search tree
Child node, until the side in SCCi be not able to satisfy tree in leaf node it is identical as root node until;Then to these search trees into
Row preamble traversal, removes duplicate path, finally obtains the total loop number for including in SCCi and all loops and path,
The number for the loop that each side is related in SCCi.
(3) it abolishes WORD intermediate ring road: abolishing the key problem that loop is determining inter-class test order, it is necessary first to identify
The strong continune component SCCs formed in WORD by class and the dependence between them, then searches each strong continune component
All loops in SCCi, count loop number involved in each edge in SCCi, so by one have ring figure abolish loop at
For an acyclic figure.
Construction test pile rule: assuming that A class is the customer class of B class, B be C parent (i.e. class B be both a service class again
It is a parent), C is a customer class of A, then there are a dynamic dependency sides between A and C.When A is carried out before B and C
When test, there are following two situations:
(1) if A → B is aggregation (Ag) or inheritance (I), and the type of A → B is publicly-owned (Public)
Or protection (Protected) needs to construct test pile for the subclass of class B, class C and class C regardless of whether B is abstract class;Such as
Fruit A → B is aggregation (Ag) or inheritance (I), and the type of A → B is privately owned (Private), regardless of B whether be
Abstract class, it is only necessary to construct test pile for class B.
(2) it if A → B is incidence relation (As), needs to construct test pile for the subclass of class B, class C and class C.
The construction rule of 1 test pile of table
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, class
B is both parent and service class, has dependence a C → A, A → C and C → A and other nodes not to constitute it between C to A
Its new loop.According to the definition of dynamic dependency relation, there are a dynamic dependency relation A → C, so that WORD increases a ring
Road A → C → A.Loop can be abolished by following approach:
(1) loop A → C → A can be abolished then A → C disappears therewith by deleting A → B.If B is not abstract class, class
B can be instantiated, and C can be needed at this time with the data member of derived class B for class B, and the subclass of class C and C construct test pile,
Possible testing sequence is A, B, C or B, A, C;If B is abstract class, class B cannot be instantiated, however, it still says
Service required for bright class A, and this explanation is only an information segment of the test pile of simulation creation class B, in this feelings
Under condition, need to construct test pile for class B, and B is abstract class, it cannot be instantiated, and only test b is infeasible, it should
It is tested in conjunction with an example of its subclass (class C), therefore, testing sequence A, BC.
(2) loop A → C → A can be abolished by deleting C → A.When B is not abstract class, need to construct test pile for A, and
Corresponding testing sequence is B, C, A;If B is abstract class, it cannot be instantiated, and only test b is infeasible, it should in conjunction with
One example of its subclass (class C) is tested, accordingly, it is possible to testing sequence be BC, A;Furthermore, it is possible to by deleting A → C
To abolish loop: when B is not abstract class, needing to construct test pile for B, corresponding testing sequence is B, A, C;When B is abstract
When class, need to construct test pile for class B, corresponding testing sequence is A, BC.
(3) loop A → C → A can be abolished by deleting dynamic dependency relation A → C.When B is not abstract class, need for C structure
Test pile is made, corresponding sequence of testing is B, A, C;When B is abstract class, it cannot be instantiated, and only test class B is infeasible
, it should tested in conjunction with an example of its subclass (class C), accordingly, it is possible to Class Test Order be A, BC.
Loop restructuring bankrupt in WORD:
1) loop all in WORD is found out;
2) loop number involved in each edge in each loop is counted;
3) judgement be related to loop it is most be which side;
4) recalculate current loop sum: loop sum is equal to loop sum and subtracts the number for abolishing loop;
5) number of loop involved in remaining sides is recalculated, circulation executes step 3) and 4).
The beneficial effects of the present invention are: should based on WORD abolish loop method provide preferable static dependencies relationship and
The deletion rule on side, reduces testing cost in the loop that dynamic dependency relation is constituted.This is because existing method is abolishing ring
Only allow to delete the weak connection sides such as incidence edge when road, and the present invention allows to delete any kind of connection side, and rule 2 follows
It deletes and is related to loop most and the rule on the construction least side of test pile number, therefore present invention only requires deleting less side,
And the test pile that construction is less, all loops of category difference composition just can be eliminated, the present invention is to minimize a of test pile
Measurement standard of the number as test cost, has saved testing cost.It considers in other methods and ignores during abolishing loop
Abstract class can not instantiate, inheritance different between class (public inheritance, protection inherit, private inheritance) etc. object-orienteds
The characteristics of program necessary being, therefore, invention increases the accuracy of test, bring convenience to the work of scientific research personnel.
Detailed description of the invention
Present invention will be further explained below with reference to the attached drawings and examples.
Fig. 1 is flow diagram of the invention.
Fig. 2 is example WORD.
Specific embodiment
In Fig. 1, the loop restructuring bankrupt in such integration testing includes constructing complete object relationship figure WORD, statistics WORD
Intermediate ring road number abolishes WORD intermediate ring road, and its step are as follows:
(1) it constructs complete object relationship figure WORD: increasing the side for indicating dynamic dependency relation in object relationship figure ORD,
It is indicated with the dotted line side for indicating Dy, and the form for increasing use " node a " indicates abstract class, and complete object relationship figure can be obtained, and remembers
For WORD={ V, E }, wherein V is each class node in representation program, if the class that the node indicates is abstract class, uses Va
Indicate, E={ EI ∪ EAg ∪ EAs ∪ EDy }, EI, EAg, EAs, EDy respectively indicate inherit between class in, aggregation, incidence edge and
Dynamic dependency side.
(2) WORD intermediate ring road number is counted: first respectively will be in each sub- strong continune component SCCi for including in SCCs
All sides organize together in the form of a tree, and rule is successively to regard each class indicated from small to large by class number as root section
Point, the side for including in SCCi are constructed as branch, and when one different root node of every selection constructs a different lookup
Tree, avoids duplicate node, finally using node identical with root node as leaf in one path when constructing a search tree
Child node, until the side in SCCi be not able to satisfy tree in leaf node it is identical as root node until;Then to these search trees into
Row preamble traversal, removes duplicate path, finally obtains the total loop number for including in SCCi and all loops and path,
The number for the loop that each side is related in SCCi.
(3) it abolishes WORD intermediate ring road: abolishing the key problem that loop is determining inter-class test order, it is necessary first to identify
The strong continune component SCCs formed in WORD by class and the dependence between them, then searches each strong continune component
All loops in SCCi, count loop number involved in each edge in SCCi, and then according to abolishing loop rule for one
There is ring figure to abolish loop as an acyclic figure.In order to reduce the construction number of test pile, followed during abolishing loop
Deletion is related to the most principle at (when including dynamic dependency) of loop.
Construction test pile rule: assuming that A class is the customer class of B class, B be C parent (i.e. class B be both a service class again
It is a parent), C is a customer class of A, then there are a dynamic dependency sides between A and C.When A is carried out before B and C
When test, there are following two situations:
(1) if A → B is aggregation (Ag) or inheritance (I), and the type of A → B is publicly-owned (Public)
Or protection (Protected) needs to construct test pile for the subclass of class B, class C and class C regardless of whether B is abstract class;Such as
Fruit A → B is aggregation (Ag) or inheritance (I), and the type of A → B is privately owned (Private), regardless of B whether be
Abstract class, it is only necessary to construct test pile for class B.
(2) it if A → B is incidence relation (As), needs to construct test pile for the subclass of class B, class C and class C.
The construction rule of 1 test pile of table
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, class
B is both parent and service class, has dependence a C → A, A → C and C → A and other nodes not to constitute it between C to A
Its new loop.According to the definition of dynamic dependency relation, there are a dynamic dependency relation A → C, so that WORD increases a ring
Road A → C → A.Loop can be abolished by following approach:
(1) loop A → C → A can be abolished then A → C disappears therewith by deleting A → B.If B is not abstract class, class
B can be instantiated, and C can be needed at this time with the data member of derived class B for class B, and the subclass of class C and C construct test pile,
Possible testing sequence is A, B, C or B, A, C;If B is abstract class, class B cannot be instantiated, however, it still says
Service required for bright class A, and this explanation is only an information segment of the test pile of simulation creation class B, in this feelings
Under condition, need to construct test pile for class B, and B is abstract class, it cannot be instantiated, and only test b is infeasible, it should
It is tested in conjunction with an example of its subclass (class C), therefore, testing sequence A, BC.
(2) loop A → C → A can be abolished by deleting C → A.When B is not abstract class, need to construct test pile for A, and
Corresponding testing sequence is B, C, A;If B is abstract class, it cannot be instantiated, and only test b is infeasible, it should in conjunction with
One example of its subclass (class C) is tested, accordingly, it is possible to testing sequence be BC, A;Furthermore, it is possible to by deleting A → C
To abolish loop: when B is not abstract class, needing to construct test pile for B, corresponding testing sequence is B, A, C;When B is abstract
When class, need to construct test pile for class B, corresponding testing sequence is A, BC.
(3) loop A → C → A can be abolished by deleting dynamic dependency relation A → C.When B is not abstract class, need for C structure
Test pile is made, corresponding sequence of testing is B, A, C;When B is abstract class, it cannot be instantiated, and only test class B is infeasible
, it should tested in conjunction with an example of its subclass (class C), accordingly, it is possible to Class Test Order be A, BC.
Loop restructuring bankrupt in WORD:
1) loop all in WORD is found out;
2) loop number involved in each edge in each loop is counted;
3) judgement be related to loop it is most be which side;
If loop number of the dynamic dependency involved by Dy at most or Dy and it is other while involved in loop number
It is identical (include the case where two classes and two while Dy and it is other while the simplest loop that constitutes), abolish according to the present invention
Loop rule judges that the number of the test pile constructed required for deleting which side is minimum, structure required for then selection deletion meets
That least side of the number for the test pile made;If existed simultaneously between two classes, two sides are in the same direction, and their rings for being related to
Number mesh is identical and most, then deletes this two sides simultaneously;If there is no dynamic dependency side Dy, when certain side is related to loop number
Mesh is most, then deletes the side;If the loop number that multiple summits are related to is identical and most, construction required for deleting satisfaction is selected
Test pile that least side of number;If satisfaction deletes the number of the test pile constructed required for multiple summits at least and phase
Together, then one therein is arbitrarily deleted.
4) recalculate current loop sum: loop sum is equal to loop sum and subtracts the number for abolishing loop;
5) number of loop involved in remaining sides is recalculated, circulation executes step 3) and 4).
Claims (1)
1. the loop restructuring bankrupt in class integration testing, comprising: construct complete object relationship figure WORD, statistics WORD intermediate ring road
Number abolishes WORD intermediate ring road;It is characterized in that: abolishing WORD intermediate ring road firstly the need of identifying in WORD by between class and they
Dependence formed strong continune component SCCs, then search loop all in each strong continune component SCCi, count
Loop number involved in each edge in SCCi, and then there is ring figure to abolish loop as an acyclic figure for one;
It abolishes loop rule are as follows: assuming that λ is acyclic ORD, node A, B, C ∈ λ, A are the customer class of B, and B is the parent of C, class
B is both parent and service class, has dependence a C → A, A → C and C → A and other nodes not to constitute it between C to A
Its new loop;According to the definition of dynamic dependency relation, there are a dynamic dependency relation A → C, so that WORD increases a ring
Road A → C → A;Loop can be abolished by following approach:
(1) loop A → C → A can be abolished then A → C disappears therewith by deleting A → B;If B is not abstract class, class B can
To be instantiated, C can be needed at this time with the data member of derived class B for class B, and the subclass of class C and C construct test pile, can
The testing sequence of energy is A, B, C or B, A, C;If B is abstract class, class B cannot be instantiated, however, it still illustrates
Service required for class A, and this explanation is only an information segment of the test pile of simulation creation class B, in such case
Under, it needs to construct test pile for class B, and B is abstract class, it cannot be instantiated, and only test b is infeasible, it should be tied
An example of its subclass (class C) is closed to test, therefore, testing sequence A, BC;
(2) loop A → C → A can be abolished by deleting C → A;When B is not abstract class, need to construct test pile for A, and corresponding
Testing sequence be B, C, A;If B is abstract class, it cannot be instantiated, and only test b is infeasible, it should in conjunction with it
One example of subclass (class C) is tested, accordingly, it is possible to testing sequence be BC, A;Furthermore, it is possible to be broken by deleting A → C
Except loop: 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,
Need to construct test pile for class B, corresponding testing sequence is A, BC;
(3) loop A → C → A can be abolished by deleting dynamic dependency relation A → C;When B is not abstract class, needs to construct for C and survey
Test pile, corresponding sequence of testing is B, A, C;When B is abstract class, it cannot be instantiated, and only test class B is infeasible,
Should be tested in conjunction with example of its subclass (class C), accordingly, it is possible to Class Test Order be A, BC.
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 CN106095661A (en) | 2016-11-09 |
CN106095661B true 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)
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 |
-
2015
- 2015-09-29 CN CN201510631000.6A patent/CN106095661B/en active Active
Patent Citations (3)
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 |
---|---|
CN106095661A (en) | 2016-11-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2014216556B2 (en) | Building applications for configuring processes | |
US9176828B2 (en) | System and method for merging results from multiple runs based on run inputs | |
Anselin | An introduction to spatial regression analysis in R | |
CN106294120A (en) | The test method of code, equipment and computer program | |
Davies et al. | Deconstructing the relationships between phylogenetic diversity and ecology: a case study on ecosystem functioning | |
CN102937933A (en) | Class test sequence determining method based on testing level | |
AU2021201363B2 (en) | Format-specific data processing operations | |
CN105095464B (en) | A kind of detection method and device of searching system | |
CN105335379B (en) | The method and apparatus to sort to the combination of mutation, test case, random seed in mutation test | |
US10830818B2 (en) | Ensuring completeness of interface signal checking in functional verification | |
CN108958890A (en) | Container microscope testing method, apparatus and electronic equipment | |
CN108363660A (en) | A kind of method of generating test program and device | |
CN106095661B (en) | Loop restructuring bankrupt in class integration testing | |
CN107430590A (en) | Data compare | |
CN103593222B (en) | A kind of method of reverse extraction Java software program class figure | |
US9740458B1 (en) | Restricting class inheritance relationships | |
US11138099B2 (en) | Method for testing software, and computing device and computer-readable storage medium thereof | |
Ayas et al. | An Empirical Analysis of Microservices Systems Using Consumer-Driven Contract Testing | |
CN109976802A (en) | A kind of software architecture reconstructing method of schema object | |
CN109753742A (en) | A kind of Fault Diagnosis of Aeroengines method, system based on unbalanced sample | |
Chini | Fine-Grained Complexity of Program Verification | |
CN110362466A (en) | Bid logic test method, device, computer equipment and storage medium | |
US9256406B1 (en) | Graphically scoped C-functions inside stateflow | |
Tiwari | Automatic Generation of Testcases for High MCDC Coverage | |
CN100520428C (en) | Automatic test pattern generation |
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 |