CN102436417B - Code and function covering mapping system and covering mapping method thereof - Google Patents

Code and function covering mapping system and covering mapping method thereof Download PDF

Info

Publication number
CN102436417B
CN102436417B CN201110295759.3A CN201110295759A CN102436417B CN 102436417 B CN102436417 B CN 102436417B CN 201110295759 A CN201110295759 A CN 201110295759A CN 102436417 B CN102436417 B CN 102436417B
Authority
CN
China
Prior art keywords
code
coverage
mapping
control
gui
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201110295759.3A
Other languages
Chinese (zh)
Other versions
CN102436417A (en
Inventor
于秀山
于长钺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Software Evaluation Center
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201110295759.3A priority Critical patent/CN102436417B/en
Publication of CN102436417A publication Critical patent/CN102436417A/en
Application granted granted Critical
Publication of CN102436417B publication Critical patent/CN102436417B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a code and function covering mapping system which structurally comprises a white box testing tool, a code covering information extraction module, a code and control mapping processing module and a code covering and function covering mapping module. The invention also discloses a code and function covering mapping method and has the technical scheme that: a bridge between a white box testing and a black box testing can be set up, respective specialty of the white box testing and the black box testing can be fully exerted, and sufficiency and efficiency for a testing can be improved.

Description

Code and functional coverage mapped system and covering mappings method thereof
Technical field
The present invention relates to Software function test field, particularly a kind of code and functional coverage mapped system and covering mappings method thereof.
Background technology
White-box testing and Black-box Testing are two kinds of main method that software test adopts.In white-box testing field, in order accurately to grasp the coverage condition of test case to code, release successively business-like testing tool, representational have TestBed instrument, a CodeTest instrument etc.These instruments adopt program plug-in mounting technology, can accurately demonstrate the information such as statement, branch and path that test case covers, according to these information, tester can design new test case and cover those not by the code that current test case covered, thereby meets testing adequacy requirement.The advantage of this method is intuitively to show the coverage condition of test case to code, its shortcoming is in the time that the new test case of design covers not capped code, need tester's reading code, only have code is analyzed, could design the test case making new advances.This requires tester to have higher program design level on the one hand, needs on the other hand to spend a large amount of energy and times.
Corresponding with white-box testing method is Black-box Testing method, this method is only paid close attention to the function of software and is not considered program code structure, only considers the coverage condition of test case to software function and is indifferent to its coverage condition to bottom program code in when test.The advantage of this method is directly perceived, convenient, and its shortcoming shows three aspects, the one, cover granularity thicker.The test that meets functional coverage standard not necessarily can meet code coverage standard; The 2nd, cannot pass through the code coverage acquisition of information functional coverage situation corresponding with it.Although tester has obtained unlapped code information by white-box testing instrument, how design new test case from functional perspective and cover these codes and remain a difficult problem; The 3rd, there is variation and software function that software function does not change in those bottom program codes of None-identified.At present, test case can only be leaned on complicate statistics to the coverage information of software function, the aid of commercial-free.
White-box testing and Black-box Testing are two kinds of methods indispensable in software test, but owing to lacking effective method, these two kinds of method of testings, always in isolating state, have had a strong impact on testing adequacy and efficiency.
Summary of the invention
Technical matters solved by the invention is to provide a kind of code and functional coverage mapped system, can build bridge between white-box testing and Black-box Testing, gives full play to white-box testing and Black-box Testing speciality separately, improves testing adequacy and efficiency.
Technical scheme is as follows:
A kind of code and functional coverage mapped system, comprise white-box testing instrument, described white-box testing instrument is for extracting and demonstrate the code that test case covers, also comprise code coverage information extraction modules, code and control mapping processing module and code coverage and functional coverage mapping block, wherein
Code coverage information extraction modules, for receiving the code coverage information sending from described white-box testing instrument, and extract covered program statement from described code coverage information, and described program statement is sent to described code coverage and functional coverage mapping block;
Code and control mapping processing module, for routine analyzer statement source program code, obtain the mark stream in described source program code, build abstract syntax tree and symbol table according to the described mark stream obtaining, realize on this basis the mapping of source program code and software interface control, and mapping relations are sent to code coverage and functional coverage mapping block;
Code coverage and functional coverage mapping block, for being converted to functional coverage information according to the mapping relations of described source program code and software interface control by described program statement.
It is further: when described code and control mapping processing module are carried out morphology and grammatical analysis, described morphology and grammatical analysis adopt class Principles & Technology of Compiler Design, tested software source code is carried out to morphology and grammatical analysis, obtain described abstract syntax tree and symbol table by analysis.
Further: described code and control mapping processing module adopt depth first search technique in graphic user interface GUI control identification process, travel through described abstract syntax tree and symbol table, obtain GUI controls all in source code.
Further: described code and control mapping processing module, for generating the source code of tested program and the code control mapping table of GUI control, by the statement of the definition to GUI control and use in code analysis, obtain code control mapping table.
Further: described code coverage and functional coverage mapping block are according to the not covering code information of input, by code control mapping table is searched for, obtain relevant unlapped graphic user interface GUI list of controls, do not cover code scan code control mapping table by traversal and generate and do not cover GUI list of controls.
Another technical matters solved by the invention is to provide a kind of code and functional coverage mapping method, can build bridge between white-box testing and Black-box Testing, gives full play to white-box testing and Black-box Testing speciality separately, improves testing adequacy and efficiency.
Technical scheme is as follows:
A kind of code and functional coverage mapping method, comprising:
White-box testing instrument is used for extracting and demonstrate the code coverage information of test case, and sends to code coverage information extraction modules;
Code coverage information extraction modules receives the code coverage information sending from described white-box testing instrument, and extract covered program statement from described code coverage information, and described program statement is sent to described code coverage and functional coverage mapping block;
Source program code in code and control mapping processing module routine analyzer statement, obtain the mark stream in described source program code, build abstract syntax tree and symbol table according to the described mark stream obtaining, realize on this basis the mapping of source program code and software interface control, and mapping relations are sent to code coverage and functional coverage mapping block;
Code coverage and functional coverage mapping block are converted to functional coverage information according to the mapping relations of described source program code and software interface control by described program statement.
Further: when described code and control mapping processing module are carried out morphology and grammatical analysis, morphology and grammatical analysis adopt class Principles & Technology of Compiler Design, and tested software source code is carried out to morphology and grammatical analysis, obtain abstract syntax tree and symbol table by analysis.
Further: described code and control mapping processing module adopt depth first search technique in graphic user interface GUI control identification process, travel through described abstract syntax tree and symbol table, obtain GUI controls all in source code.
Further: described code and control mapping processing module, for generating the source code of tested program and the code control mapping table of GUI control, by the statement of the definition to GUI control and use in code analysis, obtain code control mapping table.
Further: described code coverage and functional coverage mapping block are according to the not covering code information of input, by code control mapping table is searched for, obtain relevant unlapped graphic user interface GUI list of controls, do not cover code scan code control mapping table by traversal and generate and do not cover GUI list of controls.
Technique effect comprises:
1, the present invention mainly solves and how code coverage information is converted to functional coverage infotech problem, a kind of method that code coverage information is converted to functional coverage information is provided, thereby build bridge between white-box testing and Black-box Testing, give full play to white-box testing and Black-box Testing speciality separately, improve testing adequacy and efficiency.
2, the present invention adopts code and software function mapping method, by code control mapping table, code coverage is converted to functional coverage, tester is by functional coverage information, can design simply, intuitively the test case making new advances, this is also the most outstanding feature of the present invention.
Brief description of the drawings
Fig. 1 is the structured flowchart of code and functional coverage mapped system in the present invention;
Fig. 2 is the main flow chart of code and functional coverage mapping method in the present invention;
Fig. 3 is the workflow diagram of code and control mapping processing module in the present invention;
Fig. 4 is morphology and grammatical analysis process flow diagram in the present invention;
Fig. 5 is the workflow diagram of control discrimination method in the present invention;
Fig. 6 is the groundwork process flow diagram of code control map analysis in the present invention;
Fig. 7 is the workflow diagram of code coverage and functional coverage mapping in the present invention;
Fig. 8 is the 6th abstract syntax tree that walks to eighth row code in the present invention;
Fig. 9 is the abstract syntax tree of the 22nd row to the 24 line codes in the present invention;
Figure 10 is the main interface of the corresponding actual software of code sample schematic diagram in the present invention;
Figure 11 is the pop-up window interface schematic diagram of " test menu item 1 " guiding in code sample of the present invention.
Embodiment
Below with reference to accompanying drawing and preferred embodiment, technical solution of the present invention is described in detail.
As shown in Figure 1, be the structured flowchart of code and functional coverage mapped system in the present invention.
Code and functional coverage mapped system comprise: white-box testing instrument 101, code coverage information extraction modules 102, code and control mapping processing module 103 and code coverage and functional coverage mapping block 104 4 parts.
Wherein, white-box testing instrument 101 is for extracting and demonstrate the coverage information of test case to code, and sends coverage information to code coverage information extraction modules 102, and code coverage information comprises the information such as covered statement, branch and path.Code coverage information extraction modules 102 is for extract the program statement covering from code coverage information (can cause the statement that program execution path changes), and program statement is sent to code coverage and functional coverage mapping block 104.Code and control mapping processing module 103 are for realizing the mapping of source program code and software interface control, by analyzing source program code, build syntax tree and symbol table, on this basis, find out the mapping relations of source program code and software interface control, and mapping relations are sent to code coverage and functional coverage mapping block 104.Code coverage and functional coverage mapping block 104 are converted to functional coverage information according to the mapping relations of source program code and software interface control by program statement.
As shown in Figure 2, be main flow chart of the present invention.
Step 201: source program code is carried out to grammer and lexical analysis;
By analyzing, find out in code and can cause the statement that program execution path changes, build syntax tree and symbol table.
Step 202: for these statements, adopt the method for plug-in mounting that special mark is set, as covered program statement;
Step 203: re-start secondary compiling, and compiled code is downloaded in target machine and moved;
Step 204: in software running process, record with file mode the program statement that test case is covered;
Step 205: according to syntax tree and symbol table, set up source code and interface control mapping relations;
Step 206: the program statement covering according to test case and source code and interface control mapping relations, provide the coverage information of test case to software function.
Code and control mapping processing module 103 are for realizing the mapping of source program code and software interface control.
As shown in Figure 3, the workflow diagram of code and control mapping processing module 103.Workflow and each stage intermediate result of code and control mapping processing module 103 in figure, are represented.
Step 301: code and control mapping processing module 103 are carried out morphology and grammatical analysis.Morphology and grammatical analysis adopt class Principles & Technology of Compiler Design, and tested software source code is carried out to morphology and grammatical analysis, by analyzing, obtain abstract syntax tree and symbol table.
As shown in Figure 4, be morphology and grammatical analysis process flow diagram in the present invention.The fundamental purpose of this analysis is abstract syntax tree and the symbol table that obtains tested software source code.
Definition 1: abstract syntax tree is one tree T=<V, E>, wherein: V is the node of tree, is made up of the various syntactic structures in source code; E is the limit of tree, is responsible for connecting various syntactic structures.
Definition 2: symbol table is a table graphic data structure, the identifier producing in lexical analysis process is as the entrance of symbol table, and the information that subsequent analysis obtains, as the type of: identifier, use-pattern, storage space etc. can join in table as required.
Morphology and grammatical analysis are the bases of generating code and interface control mapping relations.This programme adopts general method to carry out morphology and grammatical analysis to the source code of tested software, is described by algorithm 2.
Algorithm 2.Lexical_Syntax_Analyze (P)
Input P: source code
Abstract syntax tree and the symbol table of output (AST, SymTable): P
1.TokenStream<-Lexical_Analyze(P)
2.(AST,SymTable)<-Syntax_Analyze(TokenStream)
3.Return(AST,SymTable)
Source code, after morphology and grammatical analysis, will obtain its abstract syntax tree and symbol table.The 1st step of algorithm 2 is carried out lexical analysis to source code P, obtains the mark stream TokenStream of P; The 2nd step is carried out grammatical analysis taking mark stream as basis, obtains abstract syntax tree AST and the symbol table SymTable of P; The 3rd step is returned to AST and SymTable.
Step 302:GUI (Graphical User Interface, is called for short GUI, and graphic user interface claims again graphical user interface) control identification.Adopt depth first search technique, traversal abstract syntax tree and symbol table, obtain GUI control all in source code (as: window, button etc.).
GUI control is the imbody of software function, and software function realizes by control.The object of GUI control identification is to find out all GUI controls designed in program, by the analysis to abstract syntax tree and symbol table, picks out all GUI controls that is:.This step is mainly by abstract syntax traversal of tree and having searched symbol table.Main method is: with depth first method traversal abstract syntax tree, if certain leaf node is variable, at this moment, by searching symbol table, can obtain this type of variables; If the type is GUI control type, illustrate this variable described be a GUI control.
GUI control identification in program compilation and this programme has all been used abstract syntax tree and symbol table, but both object differences, the former object is to generate and optimization aim code, and the latter's object is to find out GUI controls all in source code.
1, control type
Programming language difference, the control type that it comprises is also different, and taking Java Swing as example, its control comprising can be divided into following a few class:
(1) window and window frame class: JWindow, JColorChooser, JComponent, JDesktopPane, JDialog, JEditorPane, JFileChooser, JFrame, JInternalFrame, JLayeredPane, JOptionPane, JRootPane, JScrollPane, JSplitPane, JTabbedPane;
(2) button class: JButton, JToggleButton, JCheckBox, JCheckBoxMenuItem, JComboBox, JRadioButton, JRadioButtonMenuItem;
(3) menu class: JMenu, JMenuBar, JMenuItem, JPopupMenu;
(4) text input class: JTextArea, JTextComponent, JTextField, JPasswordField;
(5) other: JTree, JViewPort, JScrollBar, JSeparator, JSlider, JSpinner, JTable, JTableHeader, JToolBar, JToolTip, JLabel, JList, JProgressBar.
Although these controls have using method separately,, the mode that is certain control by certain variable-definition is to be determined by the specification of language itself, therefore, and can be according to these specifications, adopt unified these controls of method identification.
2, variable-definition mode
The definition mode of control variable is mainly contained to 2 kinds:
(1) variable declarations
Call the turn at program design language, the existence that variable declarations is responsible for pointing out certain variable with and relevant character, but it is not carried out to initialization.
For example: private javax.swing.JButtoncomputeButton; This statement has defined the variable computeButton that type is javax.swing.JButton.
(2) variable-definition
Call the turn at program design language, the existence that variable-definition is not only responsible for pointing out certain variable with and relevant character, also need it to carry out initialization.
For example: javax.swing.JMenufileMenu=new javax.swing.JMenu ();
This statement has defined the variable fileMenu that type is javax.swing.JMenu and has used the new statement to have carried out initialization to it.
3, control discrimination method
By in abstract syntax tree, above-mentioned two kinds of definition modes being searched for, the content in combined symbol table, just can pick out controls all in source code and variable thereof simultaneously.
As shown in Figure 5, be the workflow diagram of control discrimination method in the present invention.
By traveling through abstract syntax tree and searching symbol table, can generate GUI list of controls, can adopt algorithm 3 to express.
Algorithm 3.GEL_AST_SymTable (AST, SymTable) has described GUI control identification algorithm.
Algorithm 3.GEL_AST_SymTable (AST, SymTable)
Input AST: the abstract syntax tree of source code
Input SymTable: the symbol table of source code
Output GEL: the GUI list of controls in source code
1.GEL<-[];
2. all leaf node Node of traversal AST
3.if (LookUpType (SymTable, Node)=GUI control type)
4.GEL<-Node::GEL
5.Return GEL
The 1st step initialization rreturn value GEL of algorithm 3 is empty list; The 2nd step to the 4 steps start to travel through abstract syntax tree AST; Wherein the 3rd step call function LookUpType (SymTable, Node) judges that whether leaf node Node is GUI control type, if so, adds rreturn value GEL list in the 4th step by this node; After abstract syntax tree AST has traveled through, the 5th step is returned to GUI list of controls GEL.
Step 303: code control map analysis.Adopt depth first search technique, traversal abstract syntax tree and GUI list of controls, generating code control mapping table.
Code and control mapping processing module 103 are for generating the source code of tested program and the code control mapping table of GUI control.By the statement of the definition to GUI control and use in code analysis, obtain code control mapping table, workflow can be used algorithm 1 to describe.
Algorithm 1.GetGUICodeMap (P)
Input P: source code
Output T: code control mapping table
1.(AST,SymTable)<-Lexical_Syntax_Analyze(P)
2.GUIEmtList<-GEL_AST_SymTable(AST,SymTable)
3.T<-GCM_AST_GEL(AST,GUIEmtList)
4.Return T
The 1st step of algorithm 1, taking P (source code of tested software) as parameter call function Lexical_Syntactax_Analyze, obtains abstract syntax tree AST and the symbol table SymTable of P; The 2nd step, taking AST and SymTable as parameter call algorithm GEL_AST_SymTable, obtains the GUI list of controls GUIEmtList of P; The 3rd step, taking AST and GUIEmtList as parameter call algorithm GCM_AST_GEL, obtains code control mapping table T; The 4th step is returned to result.
The statement of 1.GUI control and definition
Before using a GUI control, need to define this control by stating and define the object of a control type.For example: in code below, first state the object menuBar of a MenuBar type, then use a new statement to define this object.
2.GUI control uses
To the use of GUI control be by the method to control object call realize.Taking the button control of the JButton type commonly used as example, in the time that button is pressed, conventionally can carry out certain user-defined function.User completes above-mentioned function by ActionLisener function of the addActionListener function passes to button.In ActionListener function, user need to realize actionPerformed function, this function is exactly the action that button is carried out while being pressed, if user wishes to carry out own certain function defining, this function can be joined in actionPerformed function.
For example,, in code below
OpenButton is the button of a JButton type, by openButtonActionPerformed function is joined in the actionPerformed function body in ActionListener function, can realize and in the time that openButton button is pressed, call openButtonActionPerformed function.
As shown in Figure 6, be the groundwork process flow diagram of code control map analysis in the present invention, process is described by algorithm 4.
Algorithm 4.GCM_AST_GEL (AST, GUIEmtList)
Input AST: the abstract syntax tree of source code
Input GUIEmtList: the GUI list of controls in source code
Output T: the two-way mapping table of code control
1.T<-Null
2. all GUI control GEmt1 in traversal GUIEmtList
3. traversal AST
The code segment corresponding with GEmt1 in 4.GCode<-AST
5.T<-T::[GEmt1,GCode]
6.Return T
The course of work of algorithm 4 is: rreturn value T is initialized as sky by the 1st step; All GUI control GEmt1 in the 2nd step traversal GUIEmtList; The 3rd step traversal abstract syntax tree AST; The 4th step finds the source code fragment that GEmt1 control is corresponding; The 5th step joins the mapping of GEmt1 and GCode in T; The 6th step is returned to result.
Code coverage and functional coverage mapping block 104 are for being converted to functional coverage information by code coverage information.In operational process, white-box testing instrument 101 can obtain the source program code that test case covers, these coverage informations are preserved with file mode, its file layout difference of different instruments, in this preferred embodiment, use conventional Codetest instrument, by analyzing its idb file, obtain code coverage information.
As shown in Figure 7, it is the workflow diagram of code coverage and functional coverage mapping in the present invention, code coverage and functional coverage mapping block 104, according to the not covering code information of input, by code control mapping table is searched for, obtain relevant unlapped GUI list of controls.Do not cover code scan code control mapping table by traversal, can generate and not cover GUI list of controls.
Algorithm 5.NCGL_NCC_T (NCC, T) has described and has not covered GUI list of controls generating algorithm.
Algorithm 5.NCGL_NCC_T (NCC, T)
Input NCC: do not cover code line number
Input T: code control mapping table
Output NCGL: do not cover GUI list of controls
1.NCGL<-[];
2. all code snippets in traversal NCC
The GUI control corresponding with NCC in 3.NCG<-T
4.NCGL<-NCG::NCGL
5.Return NCGL
The 1st step initialization rreturn value NCGL of algorithm 5 is empty list; The 2nd step to the 4 steps start to travel through NCC; Wherein the 3rd step is found corresponding GUI control from T; This GUI control is added rreturn value NCGL list by the 4th step; After NCC has traveled through, the 5th step will not cover GUI list of controls NCGL and will return.
With a specific embodiment, technical solution of the present invention is done to further checking below.Utilize the present invention, the code information covering according to test case, generates its corresponding functional coverage.
As shown in Figure 8, be the 6th abstract syntax tree that walks to eighth row code in the present invention, as shown in Figure 9, be the abstract syntax tree of the 22nd row to the 24 line codes in the present invention.First, use the algorithm 2 in this programme to carry out morphology and grammatical analysis to above code sample, obtain its abstract syntax tree (Fig. 8, Fig. 9) and symbol table (table 1).
Table 1: the symbol table of example code segment
Identifier Type Definition place line number
menuBar JMenuBar 3
fileMenu JMenu 4
exitMenuItem JMenuItem 5
testMenu JMenu 6
popTestMenuItem1 JMenuItem 7
popTestMenuItem2 JMenuItem 8
popFrame JFrame 30
pfButton1 JButton 31
Table 1 has provided the symbol table of example code segment.Wherein, have 8 symbols, the line number when having recorded their type in symbol table and being defined in source code.
According to the abstract syntax tree of example code segment and symbol table, use the algorithm 3 in this programme to carry out the identification of GUI control, thereby obtain its GUI list of controls, as shown in table 2.
Table 2:GUI list of controls
Identifier Show character Type
menuBar Nothing JMenuBar
fileMenu File JMenu
exitMenuItem Exit JMenuItem
testMenu Test menu JMenu
popTestMenuItem1 Test menu item 1 JMenuItem
popTestMenuItem2 Test menu item 2 JMenuItem
popFrame Pop-up window JFrame
pfButton1 Testing button JButton
As shown in figure 10, be the main interface of the corresponding actual software of code sample schematic diagram in the present invention.As shown in figure 11, be the pop-up window interface schematic diagram of " test menu item 1 " guiding in code sample of the present invention.Clicking " test menu item 1 " afterwards, will eject a window, in this window, there is one " testing button ".
According to its abstract syntax tree and GUI list of controls, use the algorithm 4 generating code control mapping tables in this programme, as shown in table 3.
Table 3: code control mapping table
While using white-box testing instrument 101 to carry out code coverage test, carrying out after other control of clicking except " test menu item 1 ", the code coverage result that white-box testing instrument 101 provides is as shown in code segment below.
By white-box testing instrument 101, tester can intuitively grasp the code that test case covers.Wherein 1-28 rower is green (representing with roman herein), represents to have covered; And 29-34 rower is red (representing by italic herein), represent not yet to cover.On this basis, according to coverage rate requirement, by manual analysis code, design new test case and cover the code that those are not capped, because needs carry out manual analysis to code, therefore, this method one be to tester require high, the 2nd, efficiency is low.In order to address these problems, the present invention adopts code and software function mapping method, by the code control mapping table obtaining before, code coverage is converted to functional coverage, tester is by functional coverage information, can design simply, intuitively the Test Sample Design making new advances, this is also the most outstanding feature of the present invention.
The step that realizes such scheme is as follows.
Step 1: by inquiry code control mapping table (table 3), use algorithm 5, can obtain: 29-34 line code is corresponding to " test menu item 1 ".That is: the test case of having carried out does not cover some function of " test menu item 1 ", therefore, need to design new test case for this control.
Step 2: cover " test menu item 1 ", the new test case needing is: test menu-> test menu item 1-> ejector button.That is: first click " test menu ", then click " test menu item 1 ", then click " ejector button ".
In sum, by the morphology to source code and grammatical analysis, the identification of GUI control and 3 steps of code control map analysis, just can obtain code control mapping table; Then, the code control mapping table providing in the unlapped code information providing according to white-box testing instrument and this programme, just can obtain unlapped software function, accordingly, tester can design the new test case that covers these functions easily.

Claims (10)

1. a code and functional coverage mapped system, comprise white-box testing instrument, described white-box testing instrument is for extracting and demonstrate the code coverage information of test case, it is characterized in that: also comprise code coverage information extraction modules, code and control mapping processing module and code coverage and functional coverage mapping block, wherein
Code coverage information extraction modules, for receiving the code coverage information sending from described white-box testing instrument, and extract covered program statement from described code coverage information, and described program statement is sent to described code coverage and functional coverage mapping block;
Code and control mapping processing module, for routine analyzer statement source program code, obtain the mark stream in described source program code, build abstract syntax tree and symbol table according to the described mark stream obtaining, realize on this basis the mapping of source program code and software interface control, and mapping relations are sent to code coverage and functional coverage mapping block;
Code coverage and functional coverage mapping block, for being converted to functional coverage information according to the mapping relations of described source program code and software interface control by described program statement.
2. code as claimed in claim 1 and functional coverage mapped system, it is characterized in that: when described code and control mapping processing module are carried out morphology and grammatical analysis, described morphology and grammatical analysis adopt class Principles & Technology of Compiler Design, tested software source code is carried out to morphology and grammatical analysis, obtain described abstract syntax tree and symbol table by analysis.
3. code as claimed in claim 2 and functional coverage mapped system, it is characterized in that: described code and control mapping processing module adopt depth first search technique in graphic user interface GUI control identification process, travel through described abstract syntax tree and symbol table, obtain GUI controls all in source code.
4. code as claimed in claim 3 and functional coverage mapped system, it is characterized in that: described code and control mapping processing module are for generating the source code of tested program and the code control mapping table of GUI control, by the statement of the definition to GUI control and use in code analysis, obtain code control mapping table.
5. code as claimed in claim 1 and functional coverage mapped system, it is characterized in that: described code coverage and functional coverage mapping block are according to the not covering code information of input, by code control mapping table is searched for, obtain relevant unlapped graphic user interface GUI list of controls, do not cover code scan code control mapping table by traversal and generate and do not cover GUI list of controls.
6. code and a functional coverage mapping method, comprising:
White-box testing instrument is used for extracting and demonstrate the code coverage information of test case, and sends to code coverage information extraction modules;
Code coverage information extraction modules receives the code coverage information sending from described white-box testing instrument, and extract covered program statement from described code coverage information, and described program statement is sent to described code coverage and functional coverage mapping block;
Source program code in code and control mapping processing module routine analyzer statement, obtain the mark stream in described source program code, build abstract syntax tree and symbol table according to the described mark stream obtaining, realize on this basis the mapping of source program code and software interface control, and mapping relations are sent to code coverage and functional coverage mapping block;
Code coverage and functional coverage mapping block are converted to functional coverage information according to the mapping relations of described source program code and software interface control by described program statement.
7. code as claimed in claim 6 and functional coverage mapping method, it is characterized in that: when described code and control mapping processing module are carried out morphology and grammatical analysis, morphology and grammatical analysis adopt class Principles & Technology of Compiler Design, tested software source code is carried out to morphology and grammatical analysis, obtain abstract syntax tree and symbol table by analysis.
8. code as claimed in claim 7 and functional coverage mapping method, it is characterized in that: described code and control mapping processing module adopt depth first search technique in graphic user interface GUI control identification process, travel through described abstract syntax tree and symbol table, obtain GUI controls all in source code.
9. code as claimed in claim 8 and functional coverage mapping method, it is characterized in that: described code and control mapping processing module are for generating the source code of tested program and the code control mapping table of GUI control, by the statement of the definition to GUI control and use in code analysis, obtain code control mapping table.
10. code as claimed in claim 6 and functional coverage mapping method, it is characterized in that: described code coverage and functional coverage mapping block are according to the not covering code information of input, by code control mapping table is searched for, obtain relevant unlapped graphic user interface GUI list of controls, do not cover code scan code control mapping table by traversal and generate and do not cover GUI list of controls.
CN201110295759.3A 2011-09-28 2011-09-28 Code and function covering mapping system and covering mapping method thereof Active CN102436417B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110295759.3A CN102436417B (en) 2011-09-28 2011-09-28 Code and function covering mapping system and covering mapping method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110295759.3A CN102436417B (en) 2011-09-28 2011-09-28 Code and function covering mapping system and covering mapping method thereof

Publications (2)

Publication Number Publication Date
CN102436417A CN102436417A (en) 2012-05-02
CN102436417B true CN102436417B (en) 2014-08-06

Family

ID=45984492

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110295759.3A Active CN102436417B (en) 2011-09-28 2011-09-28 Code and function covering mapping system and covering mapping method thereof

Country Status (1)

Country Link
CN (1) CN102436417B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102831057B (en) * 2012-08-13 2015-02-11 于秀山 Method for analyzing software function change and influence thereof by using function diagram
CN104657256B (en) * 2013-11-19 2018-07-31 阿里巴巴集团控股有限公司 A kind of method and apparatus for collecting mapping relations between use-case and code
CN106371999B (en) * 2016-10-20 2019-08-06 腾讯科技(深圳)有限公司 Program code test method and device
CN109977030B (en) * 2019-04-26 2022-04-19 北京信息科技大学 Method and device for testing deep random forest program

Citations (3)

* 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
US20100146340A1 (en) * 2008-12-09 2010-06-10 International Business Machines Corporation Analyzing Coverage of Code Changes
CN101916225A (en) * 2010-09-02 2010-12-15 于秀山 Graphical user interface software function coverage testing method

Patent Citations (3)

* 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
US20100146340A1 (en) * 2008-12-09 2010-06-10 International Business Machines Corporation Analyzing Coverage of Code Changes
CN101916225A (en) * 2010-09-02 2010-12-15 于秀山 Graphical user interface software function coverage testing method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
许彤等.嵌入式处理器在片调试功能的验证.《计算机辅助设计与图形学学报》.2007,第19卷(第4期),全文. *
隋颖等.GUI软件测试文档辅助工具的设计与实现.《计算机技术与发展》.2009,第19卷(第12期),第146-149页第1节"总体设计"、第2节"AutoDoc的实现".

Also Published As

Publication number Publication date
CN102436417A (en) 2012-05-02

Similar Documents

Publication Publication Date Title
CN102831057B (en) Method for analyzing software function change and influence thereof by using function diagram
CN106227668B (en) Data processing method and device
EP3745256A1 (en) External code integrations within a computing environment
US9747190B2 (en) Analysis system, analysis method, and computer program product
CN102436417B (en) Code and function covering mapping system and covering mapping method thereof
CN106709356A (en) Static taint analysis and symbolic execution-based Android application vulnerability discovery method
CN102243586B (en) Method for automatically acquiring software function diagram
CN109508298B (en) Graphical script test method and system
CN104156313A (en) Method for automatically generating Web service testing case
CN104035873A (en) Method and device for generating testing codes
CN105243018B (en) A kind of class testing data creation method of object-oriented
CN104572072A (en) MVC (model view controller) mode-based language transformation method and equipment for program
CN105183642A (en) Instrumentation based program behavior acquisition and structural analysis method
CN106295346A (en) A kind of application leak detection method, device and the equipment of calculating
CN115270131A (en) Java anti-serialization vulnerability detection method and system
CN107679402A (en) Malicious code behavioural characteristic extracting method
CN108563561B (en) Program implicit constraint extraction method and system
CN102063470B (en) Node real-time data analyzing method suitable for wireless sensor network
CN103235757B (en) Several apparatus and method that input domain tested object is tested are made based on robotization
CN102681932B (en) Method for detecting processing correctness of software on abnormal input
CN102087629A (en) Agent embedded software-based invariant test method and tool
Afroozeh et al. Island grammar-based parsing using gll and tom
CN108334441A (en) A kind of automated testing method and system of Software Development Kit
CN105045698A (en) Method for analyzing chip verification progress by using MATPLOTLIB of PYTHON
CN115454702A (en) Log fault analysis method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230418

Address after: No. 66, Zizhuyuan Road, Haidian District, Beijing 100048

Patentee after: China Software Evaluation Center

Address before: 4101, Building 3, Yard 6, Wanshou Road, Haidian District, Beijing, 100036

Patentee before: Yu Xiushan

TR01 Transfer of patent right