CN104536880A - GUI program testing case augmentation method based on symbolic execution - Google Patents

GUI program testing case augmentation method based on symbolic execution Download PDF

Info

Publication number
CN104536880A
CN104536880A CN201410712797.8A CN201410712797A CN104536880A CN 104536880 A CN104536880 A CN 104536880A CN 201410712797 A CN201410712797 A CN 201410712797A CN 104536880 A CN104536880 A CN 104536880A
Authority
CN
China
Prior art keywords
measured
program
class
parameter
jpf
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
CN201410712797.8A
Other languages
Chinese (zh)
Other versions
CN104536880B (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.)
Jiangsu Testing and Certification Co., Ltd.
Original Assignee
JIANGSU SUCE SOFTWARE DETECTION TECHNOLOGY Co Ltd
Nanjing University
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 JIANGSU SUCE SOFTWARE DETECTION TECHNOLOGY Co Ltd, Nanjing University filed Critical JIANGSU SUCE SOFTWARE DETECTION TECHNOLOGY Co Ltd
Priority to CN201410712797.8A priority Critical patent/CN104536880B/en
Publication of CN104536880A publication Critical patent/CN104536880A/en
Application granted granted Critical
Publication of CN104536880B publication Critical patent/CN104536880B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a GUI program testing case augmentation method based on symbolic execution. The GUI program testing case augmentation method based on the symbolic execution includes that using a JPF tool to create a .jpf file for a program to be tested, statically analyzing codes of the program to be tested, and acquiring an effective input value generated after symbolic execution analysis; using the name attribute of a control as a keyword to search and locate a position which needs a new input value in an existed testing case script, using the effective input value to replace an original value, and generating a new testing case to realize the original testing case set augmentation. The GUI program testing case augmentation method based on the symbolic execution serves as a GUI interface testing technology, the symbolic execution technology is led into the GUI program testing case augmentation method, the GUI program testing case augmentation method based on the symbolic execution can use the symbolic execution method to augment the GUI program foreground interface testing cases and enable the GUI program foreground interface testing to be more complete, and the GUI program foreground interface testing efficiency is improved.

Description

Based on the gui program test case amplification method of semiology analysis
Technical field
The invention belongs to software testing technology field, especially test case amplification field in software test, for the amplification of gui program test case.
Background technology
Software test is an inquiry activity being intended to that helper applications practitioner assesses the quality condition of tested software.Software project worker is assessed the quality of project institute development and availability by software test activity, thus obtains the assessment result with reference.In complete software development flow, software test activity is carried throughout, occupies the most of the time of development project, needs a large amount of human and material resources to drop into.As can be seen here, in the exploitation of software project, the software test for the purpose of the quality ensureing software product is in occupation of extremely important status.Outstanding, successful software test procedure can find out exist in tested software product mistake, defect, inefficacy and accident, thus helper applications product development person carries out rationally effective reparation and improvement to software product, and improve the quality of software product, shorten the gap between software product and product demand developed, the quality and functionality deviation of the software product developed is controlled within tolerance interval.
Test case is the important component part of software test, and from the essence of software test activity, software test is exactly design for software under testing and develop multiple test case.While researcher all over the world furthers investigate software testing technology, the various technology improving Efficiency of Software Testing by changing test case is also suggested in succession, such as, improve test activity efficiency by being in optimized selection test case, by robotization generating test use case to reduce the technology such as resource cost in test activity.
In software test procedure, designing and develop efficient test case for software test personnel, is not a gravy jobs.When resolution chart user interface (GUI) software product, how the various functions that Experience of Software Testing Work person not only should be familiar with tested software use, also need the backstage being familiar with software product to realize logic, thus design high covering, high efficiency test case.But the situation that software development activity is undertaken by different personnel arrangement from test activity from industry member, tester is difficult to the background process logic fully understanding software program, causes test activity insufficient.In order to reduce manpower and property resource consumption, some software suppliers can recruit the software practitioner lacked experience and carry out software test activity, can increase the time spent by development and testing use-case like this, reduce the testing efficiency of the test case generated.
Summary of the invention
The problem to be solved in the present invention is: in Graphic User Interface software test, and the Test cases technology for spooler test not only needs at substantial resource, and the test case generated is not sufficient to ensure its branch covering rate and validity.
Technical scheme of the present invention is: based on the gui program test case amplification method of semiology analysis, for a GUI program to be measured, use instrument Java Path Finder, be called for short JPF, for program source code to be measured creates " .jpf " file, and static analysis program code to be measured, obtain effective input value that the analysis of JPF semiology analysis produces afterwards; Determine the parameter needing in existing test case to revise, then according to the attribute of name of control as the keyword search position corresponding with navigating to the parameter that to need described in program to be measured to revise, obtain the effective input value of amendment parameter, the input value of correspondence position in the existing former script of test case is replaced again by the effective input value of described amendment parameter, generate new test case, described new test case is for the former test use cases that increases.
Generate " .jpf " file according to following steps and carry out semiology analysis:
1) scan in program to be measured the class to be measured comprised, and determine the number of program technic wherein and input parameter;
2) to each input parameter, parameter value is produced at random;
3) for each class to be measured, automatically generate the java file comprising main () method, namely " .jpf " file, comprises methods all in class to be measured in main () method;
4) parameter when performing according to newly-generated java file configuration JPF, comprises these 6 execution parameter of target, classpath, symbolic.method, listener, search.multiple_errors and vm.storage.class:
Target: specify the newly-generated name comprising the java file of class to be measured;
Classpath: the bin file place catalogue after specifying the newly-generated java file determining to comprise class to be measured to compile;
Symbolic.method: specify the method to be measured in class to be measured, if a method in class to be measured is by another method call, then only using the method for carrying out calling as the candidate of method to be measured, ignore invoked method;
Listener: specify the watch-dog for semiology analysis in JPF, be set to .symbc.SymbolicListener;
Search.multiple_errors: comprise True and False two kinds of values, even if True refers to that encountering mistake in Symbolic Execution still can continue to perform, stop when False refers to encounter mistake in Symbolic Execution performing, default value is True;
Vm.storage.class: for the class of store status, be set to nail, namely empty;
5) according to step 4) execution parameter of JPF that sets, perform the newly-generated java file comprising class to be measured with JPF, obtain such semiology analysis result, obtain effective input value.
For a GUI program to be measured, the input domain of its front end is corresponding with the parameter of backstage code, to determine according to attribute of name the position upgrading input value.
The test case of gui program is tested mainly for program interface.The existing test case amplification method based on semiology analysis is less at present, and most of method is for order line program, can not carry out test case amplification to gui program interface.Main cause is-symbol perform for be background logic code, directly with semiology analysis generate test case might not meet the system level requirements of gui program or effectively find gui program Problems existing.Suppose that the traditional semiology analysis of utilization obtains two test case T and T ' on different path, although the execution route of T with T ' is not identical, the gui interface that this two paths is corresponding may be the same.In addition, for some gui interface, can not determine its corresponding Program path, traditional semiology analysis cannot carry out.Therefore, the existing test case amplification method based on semiology analysis of simple use can not meet the testing requirement of gui software amplification.
The present invention proposes a kind of test case amplification method based on semiology analysis of improvement, the method is improved on the basis that conventional symbols performs, by corresponding with background logic code for interface, gui program foreground, in program to be measured, the attribute of name of control is searched in the script of program to be measured as key word needs with location the position inserting new input value, then uses semiology analysis to generate the test use cases of amplification.
The present invention introduces symbolic execution technique as a kind of gui interface measuring technology, by artificial or automatic means, interface, gui program foreground is combined with background logic code, obtain the path that can perform interface to be measured, make it possible to use the method for semiology analysis to complete amplification to gui program foreground interface detection use-case, make the test at interface, gui program foreground more abundant, thus make tester can obtain more sufficient test use cases, substantially increase the testing efficiency at interface, gui program foreground.
Accompanying drawing explanation
Fig. 1 is the main flow figure of the embodiment of the present invention.
Fig. 2 is the process flow diagram of the inventive method.
Fig. 3 is the code sample of semiology analysis.
Fig. 4 is the controlling stream graph of Fig. 3 code sample.
Fig. 5 is the semiology analysis tree of Fig. 3 code sample.
Embodiment
Three major techniques that the present invention uses are path analysis (Path Analysis) technology respectively, semiology analysis (Symbolic Execution) technology and constraint solving (Constrain Solving) technology.Below introduction method flow process and illustrate the embodiment of every technology used in the present invention.
1 path analysis technology
Symbolic execution technique is the technology based on path (control flow check), before replacing the operating real variable of tested program with symbolic variable, need to carry out static analysis to tested program code, obtain the controlling stream graph in code, the code sample of the semiology analysis such as shown in Fig. 3, its controlling stream graph is as Fig. 4, and semiology analysis tree is as Fig. 5.Normally, each node in controlling stream graph corresponds to a statement in program source code.
2 symbolic execution technique
By path analysis, the controlling stream graph of program to be measured can be obtained.Symbolic execution technique refers under the prerequisite of not executive routine, uses the variable in symbolic variable replacement program.Then simulate run time version, and record is carried out to the program execution state in each step.The program execution state of record is needed generally to have value of symbol, path condition (PC), the programming indicia of program variable.Wherein, path condition is the constraint condition of program statement, and programming indicia is the subsequent node information of current execution point.After semiology analysis, just obtain semiology analysis tree.
Semiology analysis is divided into again process inner analysis and interprocedural analysis (also known as global analysis).Process inner analysis refers to and only analyzes single hop code, and global analysis refers to analyze whole software code, comprises and considers recalls information and environmental information etc. between current function.
Traditional semiology analysis is processing on a large scale or the larger problem of comparatively complicated program existence; such as; if the satisfiability of some path constraints cannot be determined or comprise comparatively complicated data type in program; traditional semiology analysis just cannot Exact Solution path, thus cannot obtain the test case meeting path constraint.
In recent years, dynamic symbol performed and have also been obtained broad development.Perform different from traditional static symbol, the basic thought of dynamic symbol is combined at symbol input and concrete input value.When encountering pahtfinder hard or extensive path, replacing symbol input by concrete input value, the constrained path that semiology analysis also can obtain solving can be proceeded like this, improve the efficiency of semiology analysis.Further, because partial symbols input is replaced by concrete input value, the complex data structures in semiology analysis or expression formula are simplified, substantially reduces the cost of semiology analysis.
3 constraint solving technology
Semiology analysis tree describes all paths performed when symbolic execution technique acts on tested software, and it has following two features:
● for each paths in semiology analysis tree, total exist actual input value tested program code can be made to perform leaf node on this path.
● have from two paths of common root node and only have a node of divergence.
Semiology analysis tree has very important significance to semiology analysis, and the whether correct direct relation of the node sequence wherein comprised, path condition the correctness of semiology analysis.Each node in semiology analysis tree have recorded the value of symbol of each variable in program current state, and path condition (pc).Constraint solver can carry out constraint solving at the leaf node place of every paths, thus obtains the input value that can cover every paths.
Below by concrete example, enforcement of the present invention is described:
The present invention have selected two java programs as experimental arrangement.Two programs are the program of increasing income.Table 1 lists the details of these two programs.
Program Program line number Initial testing number
Triangle 191 2
J3Calculator 2202 10
Fig. 1 is the flow process of experiment, and wherein elementary test case is not that the present invention generates, and is existing test case.The present invention needs to revise initial test case to generate new test case.
The present invention first determines to need in existing test case the parameter revised, and then corresponding with navigating in program to be measured the parameter that needs to revise according to the name search of control position, then solves this value, carry out amplification assay use-case by the value obtained.Embodiment is as Fig. 2, be described below: for a gui program to be measured, first instrument Java Path Finder is used, be called for short JPF, for program source code to be measured creates " .jpf " file, and static analysis program code to be measured, obtain effective input value that the analysis of JPF semiology analysis produces afterwards; Determine the parameter needing in existing test case to revise, then according to the attribute of name of control corresponding to parameter as the keyword search position corresponding with navigating to the parameter that to need described in program to be measured to revise, obtain the effective input value of amendment parameter, the present invention searches for by name here, needs the name of the parameter of amendment to be consistent with the name of control.Then replace the input value of correspondence position in the existing former script of test case by the effective input value of amendment parameter, generate new test case, described new test case is for the former test use cases that increases.Wherein, owing to directly using jpf to need main function, therefore we generate " .jpf " file according to following steps and carry out semiology analysis:
1) scan in program to be measured the class to be measured comprised, and determine the number of program technic wherein and input parameter;
2) to each input parameter, parameter value is produced at random;
3) for each class to be measured, automatically generate the java file comprising main () method, namely " .jpf " file, comprises methods all in class to be measured in main () method;
4) parameter when performing according to newly-generated java file configuration JPF, comprises these 6 execution parameter of target, classpath, symbolic.method, listener, search.multiple_errors and vm.storage.class:
Target: specify the newly-generated name comprising the java file of class to be measured;
Classpath: the bin file place catalogue after specifying the newly-generated java file determining to comprise class to be measured to compile;
Symbolic.method: specify the method to be measured in class to be measured, namely in the method for class to be measured, specify a method, etc. pending test, if a method in class to be measured is by another method call, then only using the method for carrying out calling as the candidate of method to be measured, ignore invoked method;
Listener: specify the watch-dog for semiology analysis in JPF, be set to .symbc.SymbolicListener;
Search.multiple_errors: comprise True and False two kinds of values, even if True refers to that encountering mistake in Symbolic Execution still can continue to perform, stop when False refers to encounter mistake in Symbolic Execution performing, default value is True;
Vm.storage.class: for the class of store status, be set to nail, namely empty;
5) according to step 4) execution parameter of JPF that sets, perform the newly-generated java file comprising class to be measured with JPF, obtain such semiology analysis result, obtain effective input value.
For a gui software, the input domain of front end is corresponding with the parameter of backstage code, using the attribute of name of control (name) as key word, in existing test case script, search needs with location the position inserting new input value, then replace the input value in the existing former script of test case by effective input value that semiology analysis generates, generate new test case.The correspondence of the input domain of front end and the parameter of backstage code can carry out correspondence by the following two kinds:
1) manually determine.The method artificial the parameter of the input domain of front end and backstage code is carried out correspondence, and in order to reduce cost, we allow the writer of code carry out correspondence, can improve corresponding efficiency and accuracy like this.The advantage of the method is the accuracy that can ensure that the parameter of the input domain of front end and backstage code is corresponding, and shortcoming is that efficiency is lower and need to consume a large amount of manpower and materials etc.
2) automatically determine.The method is that the parameter of the input domain of front end and backstage code is carried out correspondence by the functional based method by carrying in java class bag.The advantage of the method is that cost is less, and shortcoming is relative to manually determining, the accuracy of the method has much room for improvement.
The present invention uses JAVA PATH FINDER (JPF) instrument, in ECLIPSE development platform, based on symbolic execution technique, by changing the input value of existing test case, strengthens its testing efficiency.We use JAVA language to achieve test case enhancing technology based on semiology analysis: carry out semiology analysis static analysis to source program, extraction and analysis result, and acted in elementary test case by analysis result, thus obtain the test case after strengthening.

Claims (3)

1. based on the gui program test case amplification method of semiology analysis, it is characterized in that for a GUI program to be measured, use instrument Java Path Finder, be called for short JPF, for program source code to be measured creates " .jpf " file, and static analysis program code to be measured, obtain effective input value that the analysis of JPF semiology analysis produces afterwards; Determine the parameter needing in existing test case to revise, then according to the attribute of name of control as the keyword search position corresponding with navigating to the parameter that to need described in program to be measured to revise, obtain the effective input value of amendment parameter, the input value of correspondence position in the existing former script of test case is replaced again by the effective input value of described amendment parameter, generate new test case, described new test case is for the former test use cases that increases.
2. the gui program test case amplification method based on semiology analysis according to claim 1, is characterized in that generating " .jpf " file according to following steps and carrying out semiology analysis:
1) scan in program to be measured the class to be measured comprised, and determine the number of program technic wherein and input parameter;
2) to each input parameter, parameter value is produced at random;
3) for each class to be measured, automatically generate the java file comprising main () method, namely " .jpf " file, comprises methods all in class to be measured in main () method;
4) parameter when performing according to newly-generated java file configuration JPF, comprises these 6 execution parameter of target, classpath, symbolic.method, listener, search.multiple_errors and vm.storage.class:
Target: specify the newly-generated name comprising the java file of class to be measured;
Classpath: the bin file place catalogue after specifying the newly-generated java file determining to comprise class to be measured to compile;
Symbolic.method: specify the method to be measured in class to be measured, if a method in class to be measured is by another method call, then only using the method for carrying out calling as the candidate of method to be measured, ignore invoked method;
Listener: specify the watch-dog for semiology analysis in JPF, be set to .symbc.SymbolicListener;
Search.multiple_errors: comprise True and False two kinds of values, even if True refers to that encountering mistake in Symbolic Execution still can continue to perform, stop when False refers to encounter mistake in Symbolic Execution performing, default value is True;
Vm.storage.class: for the class of store status, be set to nail, namely empty;
5) according to step 4) execution parameter of JPF that sets, perform the newly-generated java file comprising class to be measured with JPF, obtain such semiology analysis result, obtain effective input value.
3. the gui program test case amplification method based on semiology analysis according to claim 1 and 2, it is characterized in that for a GUI program to be measured, the input domain of its front end is corresponding with the parameter of backstage code, to determine according to attribute of name the position upgrading input value.
CN201410712797.8A 2014-11-28 2014-11-28 Gui program test case amplification method based on semiology analysis Expired - Fee Related CN104536880B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410712797.8A CN104536880B (en) 2014-11-28 2014-11-28 Gui program test case amplification method based on semiology analysis

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410712797.8A CN104536880B (en) 2014-11-28 2014-11-28 Gui program test case amplification method based on semiology analysis

Publications (2)

Publication Number Publication Date
CN104536880A true CN104536880A (en) 2015-04-22
CN104536880B CN104536880B (en) 2017-09-15

Family

ID=52852410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410712797.8A Expired - Fee Related CN104536880B (en) 2014-11-28 2014-11-28 Gui program test case amplification method based on semiology analysis

Country Status (1)

Country Link
CN (1) CN104536880B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106709356A (en) * 2016-12-07 2017-05-24 西安电子科技大学 Static taint analysis and symbolic execution-based Android application vulnerability discovery method
CN106933735A (en) * 2015-12-30 2017-07-07 优信拍(北京)信息科技有限公司 Test case update method and device
CN107885663A (en) * 2017-11-29 2018-04-06 中国电子产品可靠性与环境试验研究所 Method, apparatus, computer equipment and the storage medium of automatic generating test case
CN107885095A (en) * 2017-09-26 2018-04-06 浙江浙大列车智能化工程技术研究中心有限公司 CBTC system automations test device and its method of testing

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6044346A (en) * 1998-03-09 2000-03-28 Lucent Technologies Inc. System and method for operating a digital voice recognition processor with flash memory storage
CN101212362A (en) * 2006-12-26 2008-07-02 中兴通讯股份有限公司 Automatic testing device and method incorporating a variety of testing tools

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6044346A (en) * 1998-03-09 2000-03-28 Lucent Technologies Inc. System and method for operating a digital voice recognition processor with flash memory storage
CN101212362A (en) * 2006-12-26 2008-07-02 中兴通讯股份有限公司 Automatic testing device and method incorporating a variety of testing tools

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
钟诚 等: "运用类复制变异和JPF技术生成类间测试用例", 《小型微型计算机系统》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933735A (en) * 2015-12-30 2017-07-07 优信拍(北京)信息科技有限公司 Test case update method and device
CN106709356A (en) * 2016-12-07 2017-05-24 西安电子科技大学 Static taint analysis and symbolic execution-based Android application vulnerability discovery method
CN106709356B (en) * 2016-12-07 2019-05-24 西安电子科技大学 Android application bug excavation method based on static stain analysis and semiology analysis
CN107885095A (en) * 2017-09-26 2018-04-06 浙江浙大列车智能化工程技术研究中心有限公司 CBTC system automations test device and its method of testing
CN107885663A (en) * 2017-11-29 2018-04-06 中国电子产品可靠性与环境试验研究所 Method, apparatus, computer equipment and the storage medium of automatic generating test case

Also Published As

Publication number Publication date
CN104536880B (en) 2017-09-15

Similar Documents

Publication Publication Date Title
US10025696B2 (en) System and method for equivalence class analysis-based automated requirements-based test case generation
Kamimura et al. Extracting candidates of microservices from monolithic application code
US20130179863A1 (en) Bug variant detection using program analysis and pattern identification
CN106354630B (en) A kind of software defect detection method executed based on dynamic symbol
CN106649100A (en) Automatic test method and system
CN102804147A (en) Code inspection executing system for performing a code inspection of ABAP source codes
Kirbas et al. The relationship between evolutionary coupling and defects in large industrial software
CN103092761A (en) Method and device of recognizing and checking modifying code blocks based on difference information file
US20070061641A1 (en) Apparatus and method for generating test driver
CN103425572A (en) Code analyzing method and system
CN104899147A (en) Code static analysis method oriented to security check
US9619212B2 (en) Providing code, code generator and software development environment
CN103425584A (en) Large-scale application regression testing information processing method based on Java bytecode
CN108710571B (en) Method and device for generating automatic test code
CN110059006B (en) Code auditing method and device
CN108804304B (en) Test case generation method and device, storage medium and electronic equipment
CN104536880A (en) GUI program testing case augmentation method based on symbolic execution
CN105930257A (en) Method and apparatus for determining target test cases
CN109614325B (en) Method and device for determining control attribute, electronic equipment and storage medium
CN106371997A (en) Code checking method and device
CN104615544A (en) Problem-oriented GUI software correlation function analysis method and device
US20150286555A1 (en) System and method for converting the business processes to test-centric activity diagrams
Zhou et al. Extracting configuration knowledge from build files with symbolic analysis
CN103914379A (en) Automatic fault injection and fault detecting method and system
Conejero et al. Early crosscutting metrics as predictors of software instability

Legal Events

Date Code Title Description
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: 210093 Hankou Road, Drum Tower District, Nanjing, Jiangsu Province, No. 22

Co-patentee after: Jiangsu Testing and Certification Co., Ltd.

Patentee after: Nanjing University

Address before: 210093 Hankou Road, Drum Tower District, Nanjing, Jiangsu Province, No. 22

Co-patentee before: JIANGSU SUCE SOFTWARE DETECTION TECHNOLOGY CO., LTD.

Patentee before: Nanjing University

CP01 Change in the name or title of a patent holder
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170915

Termination date: 20201128

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