CN113934643A - Test case determination method and system based on influence domain path analysis - Google Patents

Test case determination method and system based on influence domain path analysis Download PDF

Info

Publication number
CN113934643A
CN113934643A CN202111430805.6A CN202111430805A CN113934643A CN 113934643 A CN113934643 A CN 113934643A CN 202111430805 A CN202111430805 A CN 202111430805A CN 113934643 A CN113934643 A CN 113934643A
Authority
CN
China
Prior art keywords
test case
test
program
path
regression
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.)
Pending
Application number
CN202111430805.6A
Other languages
Chinese (zh)
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.)
Shanghai aerospace computer technology research institute
Original Assignee
Shanghai aerospace computer technology research institute
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 Shanghai aerospace computer technology research institute filed Critical Shanghai aerospace computer technology research institute
Priority to CN202111430805.6A priority Critical patent/CN113934643A/en
Publication of CN113934643A publication Critical patent/CN113934643A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a test case determining method based on influence domain path analysis, which comprises the steps of analyzing the grammar and the control flow of a test program, and extracting nodes of a program control flow chart; compressing the nodes of the control flow chart to generate a path branching chart; establishing a mapping relation between a path branching diagram and a first round test case set; comparing the first round test program with the regression test program, generating a regression test change module, performing change influence domain analysis, and generating a change path branching diagram of the regression test program; and selecting a minimum test case set meeting the maximum coverage rate index of the modified path branching diagram from the test cases to serve as a regression test case set of the current version. The invention also provides a test case determining system. The invention has the advantages that: the number of test cases used by the regression test is reduced, and the efficiency of the regression test is improved.

Description

Test case determination method and system based on influence domain path analysis
Technical Field
The invention relates to the technical field of software testing, in particular to a method and a system for determining a test case based on influence domain path analysis.
Technical Field
In the process of software testing, if a software defect is found in the first round of complete testing, the software needs to be upgraded and regression testing needs to be carried out, and if the software defect is still found in the regression testing, the regression testing needs to be continuously iterated until the software is free of defects or the software defect is in the range of acceptable degree. In the regression testing process, usually, a tester analyzes and compares differences among different versions, selects an execution case from a whole set of test cases or designs a new test case, and in the process, only an affected function call path can be analyzed in the subsequent test by analyzing an affected domain after each software change, so that the testing cost can be saved, and the efficiency can be improved. At present, the work mainly depends on manual analysis, but the efficiency of the manual analysis is not high, and the coverage requirement of the test strategy is difficult to guarantee.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and a system for determining a minimum test case meeting a maximum coverage requirement based on an influence domain path analysis, aiming at the defects in the prior art.
The technical scheme adopted by the invention for solving the technical problems is as follows: a test case determination method based on influence domain path analysis comprises the following steps,
analyzing the grammar and the control flow of the test program, and extracting nodes of a program control flow chart;
compressing the nodes of the control flow chart to generate a path branching chart;
establishing a mapping relation between a path branching diagram and a first round test case set;
comparing the first round test program with the regression test program, generating a regression test change module, performing change influence domain analysis, and generating a change path branching diagram of the regression test program;
and selecting a minimum test case set meeting the maximum coverage rate index of the modified path branching diagram from the test cases to serve as a regression test case set of the current version.
Preferably, the method for extracting the nodes of the program control flow chart is that sequential execution statements are merged, and branch statements and jump statements are reserved.
Preferably, the program control flowchart is represented by a directed graph G ═ (N, E, S, T), where N is a set of nodes of the directed graph and represents a node statement in the program; e is an edge set of the directed graph and represents the control flow among nodes in the program; s is a program starting node, T is a program ending node,
the method for compressing the nodes of the control flow chart comprises the following steps:
if the edge EiIs node NaTo NbHas a directed edge of, and NaThe out-degree of Nb is 1, the in-degree of Nb is 1, the node N is connectedaAnd NbMerge into a new node NabNew node NabHas an input edge of NaThe input side and the output side of (1) are NbThe output edge of (1); the edges in the directed graph G are traversed until there is no directed edge in the directed graph G that satisfies the merge condition.
Preferably, the mapping relationship between the path branching diagram and the first-round test case set includes one-to-many mapping between a test case and a branch node included in the test case execution path, and one-to-many mapping between a branch node in the path branching diagram and a test case covering the branch node.
Preferably, the method for generating the modified path branching diagram is,
comparing the first round of whole test program with the regression test program to obtain difference codes, wherein in a path branch graph of the regression test program, a path covering a node where any difference code is located is a changed path, a set of all changed paths is the changed path branch graph, and a test case of the regression test completely covers the changed path branch graph.
Preferably, the method for selecting the regression test case from the first round of whole set of test cases is a greedy algorithm or a dynamic programming algorithm.
Preferably, the coverage indexes of the modified path branch graph comprise statement coverage, branch coverage and control flow coverage.
Preferably, when a plurality of candidate test case sets exist, the candidate test case set meeting the requirement of the maximum coverage index lower limit is used as the test case set of the current regression test, and when the coverage rates of the plurality of candidate test case sets all meet the maximum coverage index lower limit, the candidate test case set with the least test cases is used as the test case set of the current regression test.
Preferably, when no test case meeting the requirement of the maximum coverage index lower limit exists, a new test case is supplemented to the test case set with the maximum coverage until the coverage is not less than the maximum coverage index lower limit, and the supplemented set is used as the test case set of the current regression test.
The invention also provides a test case determining system based on the influence domain path analysis, which comprises,
a node extraction module: analyzing the grammar and the control flow of the test program, and extracting nodes of a program control flow chart;
a path branching diagram generation module: compressing the nodes of the control flow chart to generate a path branching chart;
a mapping establishment module: establishing a mapping relation between a path branching diagram and a first round test case set;
the influence domain analysis module: comparing the first round test program with the regression test program, generating a regression test change module, performing change influence domain analysis, and generating a change path branching diagram of the regression test program;
the test case determining module: and selecting a minimum test case set meeting the maximum coverage rate index of the modified path branching diagram from the test cases to serve as a regression test case set of the current version.
Compared with the prior art, the invention has the following beneficial effects:
by extracting and compressing key nodes of the program control flow chart, the path of the program processing flow is simplified, and a mutual mapping relation is established based on the compressed path and the branch nodes, so that after an influence domain of the regression test is determined, the branch nodes which can cover the influenced modified path branches are quickly determined, and the minimum test case set covering the influenced branch nodes is determined according to the branch nodes, thereby reducing the number of test cases used by the regression test and improving the efficiency of the regression test.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts. Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
fig. 1 is a flowchart of a test case determination method based on an influence domain path analysis according to an embodiment of the present invention;
FIG. 2 is an execution logic diagram of a test case determination method based on an influence domain path analysis according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a test case determination system based on impact domain path analysis according to an embodiment of the present invention.
Detailed Description
The present invention will be described in detail with reference to specific examples. The following examples will assist those skilled in the art in further understanding the invention, but are not intended to limit the invention in any way. It should be noted that variations and modifications can be made by persons skilled in the art without departing from the spirit of the invention. All falling within the scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The technical solution of the present invention will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
As shown in fig. 1, this embodiment provides a test case determining method based on impact domain path analysis, including,
analyzing the grammar and the control flow of the test program, and extracting nodes of a program control flow chart;
compressing the nodes of the control flow chart to generate a path branching chart;
establishing a mapping relation between a path branching diagram and a first round test case set;
comparing the first round test program with the regression test program, generating a regression test change module, performing change influence domain analysis, and generating a change path branching diagram of the regression test program;
and selecting a minimum test case set meeting the maximum coverage rate index of the modified path branching diagram from the test cases to serve as a regression test case set of the current version.
In this embodiment, by extracting and compressing the key nodes of the program control flow chart, the path of the program processing flow is simplified, and a mutual mapping relationship is established based on the compressed path and the branch nodes, so that after the influence domain of the regression test is determined, the branch nodes included in the modified path branches that can cover the influence are quickly determined, and the minimum test case set covering the influenced branch nodes is determined according to the branch nodes, thereby reducing the number of test cases used in the regression test and improving the efficiency of the regression test.
Specifically, with reference to fig. 1 and fig. 2, the test case determination method provided in this embodiment includes,
s1: analyzing the grammar and the control flow of the test program, and extracting nodes of a program control flow chart;
the method for extracting the nodes of the program control flow chart comprises the steps of merging sequential execution statements, and reserving branch statements and jump statements; specifically, for each program module, the sequential execution statements in the module are merged, and only control flow nodes such as branch statements and jump statements are reserved.
S2: compressing the nodes of the control flow chart to generate a path branching chart;
the program control flow diagram is represented by a directed graph G ═ N, E, S and T, wherein N is a node set of the directed graph and represents a node statement in a program; e is an edge set of the directed graph and represents the control flow among nodes in the program; s is a program starting node, T is a program ending node,
the method for compressing the nodes of the control flow chart comprises the following steps:
if the edge EiIs node NaTo NbHas a directed edge of, and NaThe out-degree of Nb is 1, the in-degree of Nb is 1, the node N is connectedaAnd NbMerge into a new node NabNew node NabHas an input edge of NaThe input side and the output side of (1) are NbThe output edge of (1); the edges in the directed graph G are traversed until there is no directed edge in the directed graph G that satisfies the merge condition.
S3: establishing a mapping relation between a path branching diagram and a first round test case set;
the mapping relation between the path branching diagram and the first round test case set comprises one-to-many mapping between the test cases and branch nodes contained in the test case execution path, and one-to-many mapping between the branch nodes in the path branching diagram and the test cases covering the branch nodes. Therefore, the branch nodes and the test cases are mapped with each other, and the coverage relation is convenient to determine.
S4: comparing the first round test program with the regression test program, generating a regression test change module, performing change influence domain analysis, and generating a change path branching diagram of the regression test program;
comparing the first round of whole test program with the regression test program to obtain difference codes, wherein in a path branching diagram of the regression test program, a path covering a node where any difference code is located is a changed path, a set of all changed paths is the changed path branching diagram, and a test case of the regression test completely covers the changed path branching diagram;
the method for selecting the regression test case from the first round of whole test case set is a greedy algorithm or a dynamic planning algorithm.
S5: and selecting a minimum test case set meeting the maximum coverage rate index of the modified path branching diagram from the test cases to serve as a regression test case set of the current version.
The coverage rate indexes of the modified path branching diagram comprise statement coverage rate, branch coverage rate and control flow coverage rate; and when the coverage rates of the plurality of alternative test case sets meet the lower limit of the maximum coverage rate index, taking the alternative test case set with the least test cases as the test case set of the current regression test.
And when the test case meeting the requirement of the maximum coverage rate index lower limit does not exist, supplementing a new test case to the test case set with the maximum coverage rate until the coverage rate is not less than the maximum coverage rate index lower limit, and taking the supplemented set as the test case set of the current regression test.
Referring to fig. 3, the embodiment further provides a test case determination system based on the analysis of the influence domain path, which includes
A node extraction module: analyzing the grammar and the control flow of the test program, and extracting nodes of a program control flow chart;
a path branching diagram generation module: compressing the nodes of the control flow chart to generate a path branching chart;
a mapping establishment module: establishing a mapping relation between a path branching diagram and a first round test case set;
the influence domain analysis module: comparing the first round test program with the regression test program, generating a regression test change module, performing change influence domain analysis, and generating a change path branching diagram of the regression test program;
the test case determining module: and selecting a minimum test case set meeting the maximum coverage rate index of the modified path branching diagram from the test cases to serve as a regression test case set of the current version.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus (system) or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes and modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention.

Claims (10)

1. A test case determining method based on influence domain path analysis is characterized by comprising the following steps:
analyzing the grammar and the control flow of the test program, and extracting nodes of a program control flow chart;
compressing the nodes of the control flow chart to generate a path branching chart;
establishing a mapping relation between a path branching diagram and a first round test case set;
comparing the first round test program with the regression test program, generating a regression test change module, performing change influence domain analysis, and generating a change path branching diagram of the regression test program;
and selecting a minimum test case set meeting the maximum coverage rate index of the modified path branching diagram from the test cases to serve as a regression test case set of the current version.
2. The method for determining the test case based on the impact domain path analysis according to claim 1, wherein the method for extracting the node of the program control flowchart is to merge sequential execution statements and reserve branch statements and jump statements.
3. The method for determining the test case based on the influence domain path analysis according to claim 2, wherein the program control flowchart is represented by a directed graph G ═ (N, E, S, T), where N is a node set of the directed graph and represents a node statement in the program; e is an edge set of the directed graph and represents the control flow among nodes in the program; s is a program starting node, T is a program ending node,
the method for compressing the nodes of the control flow chart comprises the following steps:
if the edge EiIs node NaTo NbHas a directed edge of, and NaIs 1, NbIf the degree of income is 1, the node N is connectedaAnd NbMerge into a new node NabNew node NabHas an input edge of NaThe input side and the output side of (1) are NbThe output edge of (1);
the edges in the directed graph G are traversed until there is no directed edge in the directed graph G that satisfies the merge condition.
4. The method according to claim 1, wherein the mapping relationship between the path branching diagram and the first-round test case set includes one-to-many mapping between a test case and a branch node included in the test case execution path, and one-to-many mapping between a branch node in the path branching diagram and a test case covering the branch node.
5. The method for determining test cases based on impact domain path analysis according to claim 4, wherein the method for generating the modified path branching diagram is,
comparing the first round of whole test program with the regression test program to obtain difference codes, wherein in a path branch graph of the regression test program, a path covering a node where any difference code is located is a changed path, a set of all changed paths is the changed path branch graph, and a test case of the regression test completely covers the changed path branch graph.
6. The method for determining the test case based on the analysis of the influence domain path according to claim 5, wherein the method for selecting the regression test case from the first round of the whole set of test cases is a greedy algorithm or a dynamic programming algorithm.
7. The method of claim 5, wherein the coverage indicators of the modified path branching graph include statement coverage, branch coverage, and control flow coverage.
8. The method for determining the test case based on the influence domain path analysis according to claim 7, wherein when a plurality of candidate test case sets exist, the candidate test case set meeting the requirement of the lower limit of the maximum coverage index is used as the test case set of the current regression test, and when the coverage rates of the candidate test case sets all meet the lower limit of the maximum coverage index, the candidate test case set with the least test cases is used as the test case set of the current regression test.
9. The method for determining the test case based on the influence domain path analysis according to claim 8, wherein when there is no test case satisfying the requirement of the maximum coverage index lower limit, a new test case is supplemented to the test case set with the maximum coverage until the coverage is not less than the maximum coverage index lower limit, and the supplemented set is used as the test case set of the current regression test.
10. A test case determination system based on influence domain path analysis is characterized by comprising:
a node extraction module: analyzing the grammar and the control flow of the test program, and extracting nodes of a program control flow chart;
a path branching diagram generation module: compressing the nodes of the control flow chart to generate a path branching chart;
a mapping establishment module: establishing a mapping relation between a path branching diagram and a first round test case set;
the influence domain analysis module: comparing the first round test program with the regression test program, generating a regression test change module, performing change influence domain analysis, and generating a change path branching diagram of the regression test program;
the test case determining module: and selecting a minimum test case set meeting the maximum coverage rate index of the modified path branching diagram from the test cases to serve as a regression test case set of the current version.
CN202111430805.6A 2021-11-29 2021-11-29 Test case determination method and system based on influence domain path analysis Pending CN113934643A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111430805.6A CN113934643A (en) 2021-11-29 2021-11-29 Test case determination method and system based on influence domain path analysis

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111430805.6A CN113934643A (en) 2021-11-29 2021-11-29 Test case determination method and system based on influence domain path analysis

Publications (1)

Publication Number Publication Date
CN113934643A true CN113934643A (en) 2022-01-14

Family

ID=79288481

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111430805.6A Pending CN113934643A (en) 2021-11-29 2021-11-29 Test case determination method and system based on influence domain path analysis

Country Status (1)

Country Link
CN (1) CN113934643A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116302994A (en) * 2023-02-28 2023-06-23 浙江大学 Hierarchical matching method, device and equipment for program paths and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101436128A (en) * 2007-11-16 2009-05-20 北京邮电大学 Software test case automatic generating method and system
CN104536896A (en) * 2015-01-12 2015-04-22 牟永敏 Regression test case selecting and ranking method and system oriented to function call path
CN108763094A (en) * 2018-06-01 2018-11-06 百度在线网络技术(北京)有限公司 Method for generating test case, device, equipment and storage medium
CN109783387A (en) * 2019-01-18 2019-05-21 深圳壹账通智能科技有限公司 Thread test method, device, computer equipment and storage medium
CN111897733A (en) * 2020-08-07 2020-11-06 北京理工大学 Fuzzy test method and device based on minimum set coverage

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101436128A (en) * 2007-11-16 2009-05-20 北京邮电大学 Software test case automatic generating method and system
CN104536896A (en) * 2015-01-12 2015-04-22 牟永敏 Regression test case selecting and ranking method and system oriented to function call path
CN108763094A (en) * 2018-06-01 2018-11-06 百度在线网络技术(北京)有限公司 Method for generating test case, device, equipment and storage medium
CN109783387A (en) * 2019-01-18 2019-05-21 深圳壹账通智能科技有限公司 Thread test method, device, computer equipment and storage medium
CN111897733A (en) * 2020-08-07 2020-11-06 北京理工大学 Fuzzy test method and device based on minimum set coverage

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116302994A (en) * 2023-02-28 2023-06-23 浙江大学 Hierarchical matching method, device and equipment for program paths and storage medium
CN116302994B (en) * 2023-02-28 2023-10-10 浙江大学 Hierarchical matching method, device and equipment for program paths and storage medium

Similar Documents

Publication Publication Date Title
US8307354B2 (en) Program creation device, program test device, program execution device, information processing system
CN101788907B (en) Automatic generation method for combination service simplified test case and device therefor
Fahland et al. Model repair—aligning process models to reality
US9021449B2 (en) Software regression testing using symbolic execution
US11995438B2 (en) System and method for software architecture redesign
Buijs et al. Improving business process models using observed behavior
CN105022691A (en) Highly automatic software testing method based on UML diagram
CN113238932B (en) Automatic test case generation method
CN111858301B (en) Change history-based composite service test case set reduction method and device
CN110990274A (en) Data processing method, device and system for generating test case
CN113934643A (en) Test case determination method and system based on influence domain path analysis
CN111258876B (en) Accurate regression testing method and device under micro-service architecture
US6502235B1 (en) Apparatus, method, and storage medium for generating input parameter
CN108897678B (en) Static code detection method, static code detection system and storage device
CN112395199B (en) Distributed software instance testing method based on cloud computing and software development platform
JP2009211424A (en) Optimization point determining device, optimization point determination system, computer program, and optimization point determination method
CN113900662A (en) LLVM compiling option selection method
CN113688403A (en) Intelligent contract vulnerability detection method and device based on symbolic execution verification
CN111062342B (en) Debugging method and device of face recognition system
CN113268419A (en) Method, device, equipment and storage medium for generating test case optimization information
CN110738384B (en) Event sequence checking method and system
Zhang et al. Long Method Detection Using Graph Convolutional Networks
CN111160583A (en) Data processing method and device
JP5910410B2 (en) Schematic program test data generation apparatus and method, and program
CN114610320B (en) LLVM (LLVM) -based variable type information restoration and comparison method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination