CN104615535A - Method and device for generating test case based on extended data flow model - Google Patents

Method and device for generating test case based on extended data flow model Download PDF

Info

Publication number
CN104615535A
CN104615535A CN201510046509.4A CN201510046509A CN104615535A CN 104615535 A CN104615535 A CN 104615535A CN 201510046509 A CN201510046509 A CN 201510046509A CN 104615535 A CN104615535 A CN 104615535A
Authority
CN
China
Prior art keywords
data flow
flow model
test case
program
variable
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
CN201510046509.4A
Other languages
Chinese (zh)
Other versions
CN104615535B (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.)
North China University of Technology
Original Assignee
North China University of Technology
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 North China University of Technology filed Critical North China University of Technology
Priority to CN201510046509.4A priority Critical patent/CN104615535B/en
Publication of CN104615535A publication Critical patent/CN104615535A/en
Application granted granted Critical
Publication of CN104615535B publication Critical patent/CN104615535B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a device for generating a test case based on an extended data flow model, wherein the device comprises a data collection and preprocessing module, an extended data flow model construction module, an extended data flow model based influence analysis module and an extended data flow model based test case amplification module; the invention realizes the effective method for test case amplification based on the extended data flow model by defining the extended data flow model, and provides the basic service required by test case amplification. The traditional test case amplification method considers the change of a program structure before and after software modification. The method and the device of the invention take the change of the data stream before and after the software modification into consideration.

Description

A kind of data flow model based on expansion carrys out the method and apparatus of generating test use case
Technical field
The present invention relates to test case amplification method and the device of software test, particularly a kind of data flow model based on expansion carrys out the method and apparatus of generating test use case.
Background technology
The data stream of fault in program mostly and in program is closely related.The behavioral characteristic that these faults produce with the fault caused by other program elements (such as predicate, function or method etc.) is different.In fact, relevant to data stream in program fault presents the feature of some uniquenesses:
1. some fault execution route that can not lead to errors, but its result of calculation is incorrect: namely program performs track is correct, do not produce control flow check mistake, but the value of certain or some variablees occurs abnormal, even program may until final Output rusults time, just show not being inconsistent of Output rusults and expection.
2. some fault can cause the Control flow path in program to occur mistake, if but only utilize control flow check information in program to carry out the amplification of test case, not to be very good to the effect of fault detect.
3. some fault needs just to trigger through the value repeatedly calculating variable.After successive ignition calculating carried out in certain circulation inside, such as only just likely cause certain variate-value to occur overflowing, cross the border, the problem such as error is excessive.This kind of phenomenon can be described as cumulative effect or iteration effect.This kind of fault often relates to the variable of complicated type, as array, chained list, and object class etc.When needs carry out test case amplification this kind of fault is detected time, the track following the trail of variable states is just quite important.
4. some fault can present transitivity often, and namely the wrong value of a variable can cause the value of another variable also to occur mistake, claims this to be error propagation (or the propagate) characteristic of variable.The dependence of this situation often between variable in action, is therefore necessary the dependence of carrying out test case amplification and coming considering during this kind of fault detect between variable.
Can learn from above-mentioned analysis, the various faults of software, particularly relevant to result of calculation or its steering logic fault, great majority are all relevant to data stream, are namely subject to the change of variable states and the impact of dependence each other thereof.These impacts are be interlaced with one another with complicated often, make program contain the various uncertain feature with being difficult to accurately simple identification.
Summary of the invention
The present invention is that a kind of data flow model based on expansion carrys out the method and apparatus of generating test use case, to be solved be how to build expansion data flow model, utilize the data flow model of expansion to carry out the technical matters of impact analysis and generating test use case.By the change to growth data flow model before and after modification of program, utilize the information that these change, targetedly generating test use case.What utilize is the technological means of static data flow analysis and dynamic dataflow information, thus realizes the information to growth data flow model, obtains to generate to have the special technique effect for the test case of data stream dependent failure.
Technology of the present invention is dealt with problems and is: for the fault that data stream in program is relevant, study its behavioural characteristic, the behavior model particularly after corresponding failure is triggered, provide a kind of test case amplification method and device of data flow model of expansion.The device provides the impact analysis for data stream before and after to modification of program, dynamically the mechanism of increasing etc. is carried out to test case, reach special object of carrying out testing for data stream failure.
Technical solution of the present invention: a kind of data flow model based on expansion carrys out the device of generating test use case, it is characterized in that: this device includes collection and pretreatment module, the structure module of growth data flow model, the impact analysis module based on growth data flow model, the amplification of the test case based on the growth data flow model module of data.
Growth data flow model describes the change information of variable when performing in program, and the dependence between variable.And the Method and Technology of existing data-flow analysis, data links, although reacted the definition of variable, the feature of use, but but be difficult to " track " that in the execution of formation program, variable is complete, this analysis causing data stream to change after giving modification of program brings certain difficulty.Growth data flow model is made up of two parts: the dependence between the transfer relationship of variable states (i.e. variable in a program be assigned represented state each time) and variable states.The transfer relationship of variable states refer in the operational process of program, the change sequence of variable states.Dependence between variable states refers to one, and for variable x assignment statement, x appears at the left side of assignment statement, and other occurrences is on the right side of assignment statement, then variable x and other variable Existence dependency relationship.
The construction method of growth data flow model is by obtaining the dependence of variable states and obtaining the transfer relationship of variable states.It is 0 that variable states all in static data stream information is all given tacit consent to, and according to the sequencing of program execution statement when carrying out static data flow analysis, arranges the sequence number of the variable states in static data stream information respectively.Find the variable that each variable states relies on when carrying out dynamic data flow analysis, and variable states and the variable states relied on are stored.Obtain variable states transfer relationship to need to judge whether Two Variables state points to same variable and both are adjacent defining operation states.
Based on the impact analysis module of growth data flow model by obtaining before fault restoration affected statement collection So and affected statement collection Sp after obtaining fault restoration.Before obtaining fault restoration, affected statement integrates by finding with the variable states transfer track of the variable states of each amendment as starting point, can find the statement collection S that these transfer tracks are corresponding 1.By finding the variable states affected with the variable states of each amendment, corresponding statement collection S can be found 2.This two parts statement collection carries out duplicate removal process (i.e. S 1with S 2common factor), affected statement collection So before fault restoration will be obtained.The variable states that after obtaining fault restoration, affected statement collection step is corresponding after first finding reparation, and the state transfer track that the variable states that searching changes after repairing with each is starting point, can find the statement collection that these transfer tracks are corresponding.By finding the variable states that after each is repaired, the variable states of change affects, corresponding statement collection can be found.This two parts statement collection carries out duplicate removal process, affected statement collection Sp before will obtaining fault restoration.Finally ask the difference set So-Sp of So and Sp, namely can obtain statement collection S variable states information corresponding to relevant to fault.
Test case based on growth data flow model increases module then based on existing test use cases, by dynamically modifying to its input, and check whether it covers the statement collection S before and after amendment corresponding to variable states information, if covered, then increase this test case.
Adopt test case amplification method and the device of the data flow model of above-mentioned expansion, its feature is: be studied program variable-value behavior operationally, propose a kind of model comprising dependence between variable states variation track and variable states, wherein between variable states variation track and variable states dependence information extraction and abstract be the key building extended data stream model.Variable states change has timing, and namely the change of variable is carried out according to a definite sequence, and according to the difference of input, variable states can present different changes.
Because between the change of program run-time variables state and variable, dependence often presents the problems such as quantity is many, relation is complicated, therefore the data flow model formation gathering method increased and construction method are also the features of this device, and wherein the most key is to obtain the title of the variable that program uses in Dynamic Execution process, the method at place and relative index etc.When carrying out history of program execution Data Collection, need collection procedure in all previous test execution, the various variable related in each bar perform statement and use-pattern (variable operation) thereof, and dependence each other, also need to collect the statistical informations such as the change frequency of these variablees in operational process simultaneously, and build the data flow model of expansion accordingly.
Test case amplification is a very important research direction in software test.There are some researches show: " if to the change of program source code within 10 row or less, so first time just correct correction program possibility can reach 50%.If changed about 50 row the source code of program, so first time only only has 20% with regard to the possibility of correct correction program." therefore need to carry out regression test after amendment code.And when regression tested result does not meet expection, likely need supplementary new test case.
Utilize in modification of program process the element relevant to data stream found, as new test target, thus generate new test case.These test cases on the basis of existing test case, as the special supplementary test case for data stream dependent failure, thus can help developer or tester to confirm whether fault is repaired, and attempt going to find more how potential fault.
The present invention's beneficial effect is compared with prior art:
(1) for the change of variable states in program, a kind of data flow model of expansion is proposed.
(2) be difficult to the feature obtained for variable states information in program, propose a kind of construction method of growth data flow model.
(3) on the basis of growth data flow model, propose the impact analysis method based on growth data flow model, determine the correlative set at modification of program front-to-back effect program data stream.
(4) be difficult to the demand detected for data stream dependent failure, propose the test case amplification method based on growth data flow model, be specifically designed to the detection to data stream dependent failure.
Accompanying drawing explanation
Fig. 1 is structural representation of the present invention.
Fig. 2 is extended data stream model information collection method figure.
Fig. 3 is the developing algorithm figure of growth data flow model.
Fig. 4 is the impact analysis algorithm pattern based on growth data flow model.
Fig. 5 is the test case amplification method figure in growth data flow model.
Embodiment
Below in conjunction with accompanying drawing, the present invention is described in further detail.
Because the test case in existing counting is mostly by a large amount of artificial analyses, there is artificial subjective factor and cause the covering of test case not comprehensive.The present invention, by definition growth data flow model, achieves the effective ways that the test case based on growth data flow model increase, provide test case increase required for infrastructure service.Traditional test case amplification method considers the change of software modification backward-forward procedure structure, and the inventive method and device then consider the change of data stream before and after software modification.
As shown in Figure 1, the invention provides the device that a kind of data flow model based on expansion carrys out generating test use case, this device comprises four modules.That is: collection and pretreatment module, the structure module of growth data flow model, the impact analysis module based on growth data flow model, the amplification of the test case based on the growth data flow model module of data is respectively.
(1) collection of data and pretreatment module:
Dynamic message when being run by the static information of collection procedure and program, and pre-service is carried out to these data, obtain pretreated data.
(2) the structure module of growth data flow model:
As shown in Figure 3, the structure module of growth data flow model is the part of growth data flow model by pretreated data construct in the middle of apparatus of the present invention, by obtaining the dependence of variable states and obtaining the transfer relationship of variable states and build extended data stream model and form.
The dependence obtaining variable states is by analyzing data, finding the dependence in program process between variable states.
The transfer relationship obtaining variable states is then by analyzing data, finding the transfer relationship in program process between variable states.
On the basis of the transfer relationship of the dependence and variable states that get variable states, growth data flow model can be constructed.
(3) based on the impact analysis module of growth data flow model:
By the statement set of impact suffered before and after routine analyzer amendment, analyze the situation of change of the program statement brought because of code revision, as shown in Figure 4.
(4) based on the test case amplification module of growth data flow model:
Test case amplification module utilizes existing test case, revises the input of these test cases and executive routine, in collection procedure implementation the statement set of process; If the statement set that this statement set and impact analysis module before this obtain has common factor, then increase this test case.
Extended data stream model information collection method in the present invention as shown in Figure 2, description be the collection process of extended data stream model data.The program needing to carry out localization of fault can obtain type of variables information in the control flow chart of program, traffic flow information and data stream by the method for static analysis.Except carrying out except static analysis to program, the collection of extended data stream model data also needs the way using dynamic monitoring, and information when running program processes.Dynamic monitoring can obtain program trace information operationally, can also obtain variable states track, in addition, can also obtain the information of the operationally definite value of variable.
In order to the extended data stream model information in acquisition program, need the static adduction relationship that can analyze variable, i.e. definition-use the relation of variable.The static informations such as the line number at variable place, then in conjunction with dynamic monitoring, obtain the information such as definite variable reference relation.This wherein static analysis mainly according to the syntax rule of Jimple.In static analysis, with variable contact closely be statement and expression formula.
As shown in Figure 2, Figure 4 shows, first need collection procedure revise before and after perform multidate information and modification of program before and after static information; Following Water demand goes out the dynamic transfer relation between dynamic dependency relation between program variable state and program variable state; After having this two parts information, the growth data flow model of construction procedures can be utilized to construct the growth data flow model before and after modification of program; Carry out impact analysis according to the growth data flow model before and after modification of program, obtain affected statement collection So and Sp before and after modification of program; If | So|<|Sp|, then do not need amplification assay use-case, if | So|>|Sp|, then before and after modification of program, affected statement set is So-Sp; Following change has the input of test case and executive routine, sees whether the statement set of execution and So-Sp have common factor, and occur simultaneously if existed, then increase this test case.
Utilize after extended data stream model information collection method collects data, growth data flow model can be built, this algorithm as shown in Figure 3, primarily of two main step compositions, be respectively obtain variable-definition mode of operation dependence and obtain variable-definition mode of operation transfer relationship.The dependence obtaining variable-definition mode of operation is positioned at the 7th and walks to the 21st row, and wherein the 10th row and the 11st row are variable-definition mode of operation setting operation sequence number.In static data stream information, it is 0 that all variable-definition modes of operation are all given tacit consent to.According to the sequencing of program execution statement, be respectively the operation sequence number assignment of the variable-definition mode of operation in static data stream information.Be find the variable that relies on of each variable-definition mode of operation at the 13rd row to the 16th row, and variable-definition mode of operation and the variable-definition mode of operation relied on are stored.
The transfer of acquisition variable-definition mode of operation is positioned at the 23rd and walks to 34 row, and wherein the 27th row use-case judges whether Two Variables defining operation state points to same variable and both are adjacent defining operation states.Then to both, who is that source state and dbjective state judge to 28th row.29th row and the 31st row preserve variable-definition transfer.
The test case amplification method of growth data flow model as shown in Figure 5, the method first need to record test case when performing the statement track of process, for amended redaction, need the information knowing those statements be performed, just can know which test case has covered the extended data stream model information relevant to fault in the present invention, and the test case performing the extended data stream model information relevant to fault is showed no sign of for those, can not be amplified.

Claims (3)

1. carry out a device for generating test use case based on the data flow model expanded, it is characterized in that: this device includes collection and pretreatment module, the structure module of growth data flow model, the impact analysis module based on growth data flow model, the amplification of the test case based on the growth data flow model module of data;
The collection of data and pretreatment module:
Dynamic message when being run by the static information of collection procedure and program, and pre-service is carried out to these data, obtain pretreated data;
The structure module of growth data flow model:
The structure module of growth data flow model is the part of growth data flow model by pretreated data construct in the middle of apparatus of the present invention; Be made up of with structure extended data stream model the transfer relationship of the dependence and acquisition variable states that obtain variable states; The dependence obtaining variable states is by analyzing data, finding the dependence in program process between variable states; The transfer relationship obtaining variable states is then by analyzing data, finding the transfer relationship in program process between variable states; On the basis of the transfer relationship of the dependence and variable states that get variable states, growth data flow model can be constructed;
Impact analysis module based on growth data flow model:
By the statement set of impact suffered before and after routine analyzer amendment, analyze the situation of change of the program statement brought because of code revision;
Test case amplification module based on growth data flow model:
Test case amplification module utilizes existing test case, revises the input of these test cases and executive routine, in collection procedure implementation the statement set of process; If the statement set that this statement set and impact analysis module before this obtain has common factor, then increase this test case.
2. application according to claim 1 carrys out the method for generating test use case based on the device that the data flow model of expansion carrys out generating test use case, it is characterized in that: first need collection procedure revise before and after static information before and after the multidate information that performs and modification of program; Following Water demand goes out the dynamic transfer relation between dynamic dependency relation between program variable state and program variable state, after having this two parts information, the extended data stream model algorithm of construction procedures can be utilized to construct the growth data flow model before and after modification of program; Carry out impact analysis according to the growth data flow model before and after modification of program, obtain affected statement collection So and Sp before and after modification of program; If | So|<|Sp|, then do not need amplification assay use-case, if | So|>|Sp|, then before and after modification of program, affected statement set is So-Sp; Following change has the input of test case and executive routine, sees whether the statement set of execution and So-Sp have common factor, and occur simultaneously if existed, then increase this test case.
3. the data flow model based on expansion according to claim 1 carrys out the device of generating test use case, it is characterized in that: first need to record in test case amplification module test case when performing the statement track of process, for amended redaction, need the information knowing those statements be performed, just can know which test case has covered the extended data stream model information relevant to fault, and the test case performing the extended data stream model information relevant to fault is showed no sign of for those, can not be amplified.
CN201510046509.4A 2015-01-29 2015-01-29 Method and device for generating test case based on extended data flow model Expired - Fee Related CN104615535B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510046509.4A CN104615535B (en) 2015-01-29 2015-01-29 Method and device for generating test case based on extended data flow model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510046509.4A CN104615535B (en) 2015-01-29 2015-01-29 Method and device for generating test case based on extended data flow model

Publications (2)

Publication Number Publication Date
CN104615535A true CN104615535A (en) 2015-05-13
CN104615535B CN104615535B (en) 2017-08-11

Family

ID=53149992

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510046509.4A Expired - Fee Related CN104615535B (en) 2015-01-29 2015-01-29 Method and device for generating test case based on extended data flow model

Country Status (1)

Country Link
CN (1) CN104615535B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933642A (en) * 2015-12-29 2017-07-07 阿里巴巴集团控股有限公司 The processing method and processing unit of application program
CN110096439A (en) * 2019-04-26 2019-08-06 河海大学 A kind of method for generating test case towards solidity language
CN110874325A (en) * 2019-10-31 2020-03-10 北方工业大学 Web application test case expansion method based on user session

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739339A (en) * 2009-12-29 2010-06-16 北京航空航天大学 Program dynamic dependency relation-based software fault positioning method
CN101916222A (en) * 2010-08-09 2010-12-15 哈尔滨工程大学 Software testing method based on combination of control flow graph traversal and slice forward traversal
KR20120025190A (en) * 2010-09-07 2012-03-15 한국전자통신연구원 Apparatus, system and method for integration testing of service-based application
CN102708047A (en) * 2012-04-23 2012-10-03 福建师范大学 Data flow test case generating method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739339A (en) * 2009-12-29 2010-06-16 北京航空航天大学 Program dynamic dependency relation-based software fault positioning method
CN101916222A (en) * 2010-08-09 2010-12-15 哈尔滨工程大学 Software testing method based on combination of control flow graph traversal and slice forward traversal
KR20120025190A (en) * 2010-09-07 2012-03-15 한국전자통신연구원 Apparatus, system and method for integration testing of service-based application
CN102708047A (en) * 2012-04-23 2012-10-03 福建师范大学 Data flow test case generating method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
YANG B,WU J,LIU C: "Mining Data Chain Graph for Fault Localization", 《COMPUTER SOFTWARE AND APPLICATIONS CONFERENCE WORKSHOPS,2012 IEEE 36TH ANNUAL》 *
戴翔,毛宇光,吴非,薛一帆: "基于数据流的测试用例自动生成研究", 《计算机技术与发展》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933642A (en) * 2015-12-29 2017-07-07 阿里巴巴集团控股有限公司 The processing method and processing unit of application program
CN110096439A (en) * 2019-04-26 2019-08-06 河海大学 A kind of method for generating test case towards solidity language
CN110096439B (en) * 2019-04-26 2020-07-14 河海大学 Test case generation method for solidity language
CN110874325A (en) * 2019-10-31 2020-03-10 北方工业大学 Web application test case expansion method based on user session
CN110874325B (en) * 2019-10-31 2023-04-07 北方工业大学 Web application test case expansion method based on user session

Also Published As

Publication number Publication date
CN104615535B (en) 2017-08-11

Similar Documents

Publication Publication Date Title
CN101286132B (en) Test method and system based on software defect mode
Heger et al. Automated root cause isolation of performance regressions during software development
CN106909510B (en) Method for obtaining test case and server
Chen et al. Revisiting the relationship between fault detection, test adequacy criteria, and test set size
Balci Guidelines for successful simulation studies
Tsantalis et al. Identification of extract method refactoring opportunities for the decomposition of methods
CN111382070B (en) Compatibility testing method and device, storage medium and computer equipment
CN104536883B (en) A kind of static defect detection method and its system
Levin et al. The co-evolution of test maintenance and code maintenance through the lens of fine-grained semantic changes
US6993736B2 (en) Pending bug monitors for efficient processor development and debug
CN105868116A (en) Semantic mutation operator based test case generation and optimization method
Alkawaz et al. A survey on test case prioritization and optimization techniques in software regression testing
CN108763064B (en) Code test generation method and device based on black box function and machine learning
CN104021072A (en) Machine and methods for evaluating failing software programs
CN104615535A (en) Method and device for generating test case based on extended data flow model
CN114706762A (en) Simulink software testing method based on reinforcement learning
CN104317707A (en) Program structure influence sensing based software error positioning method
CN104750608A (en) Automatic error locating method based on dynamic symbol operation in procedure
CN107423221A (en) A kind of web applies sustainable method of testing and system
CN112685320B (en) Software defect repairing method and device based on multiple candidate programs
CN108228232B (en) Automatic repairing method for circulation problem in program
CN104216703A (en) Development method of embedded software system program
CN103744776A (en) Static analysis method and system based on symbolic function abstracts
WO2016133607A1 (en) Small scale integration test generation
Ostrowski et al. Knowledge-based software testing agent using evolutionary learning with cultural algorithms

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170811

CF01 Termination of patent right due to non-payment of annual fee