技术领域technical field
本发明涉及计算机领域的软件测试技术,尤其涉及一种用于包括多个函数测试模块的单元测试方法及装置。The invention relates to software testing technology in the computer field, in particular to a unit testing method and device including multiple function testing modules.
背景技术Background technique
软件测试包括对软件单元的单元测试以及多个单元的集成测试。Software testing includes unit testing of software units and integration testing of multiple units.
单元测试包括确定软件程序测试的最小模块,将所述最小模块从软件程序中分离出来,并对分离出的模块是否能按照预期运行进行测试。Unit testing includes determining the minimum module for software program testing, separating the minimum module from the software program, and testing whether the separated module can operate as expected.
集成测试是将多个单元按照软件程序的逻辑形成一个组件,且是对测试单元间接口是否能如预期相互关联运行进行测试(即实现测试单元间耦合性的测试)。Integration testing is to form multiple units into a component according to the logic of the software program, and it is to test whether the interface between the test units can be interrelated and run as expected (that is, to realize the test of the coupling between the test units).
模块化的思想导致软件程序中出现了越来越多的函数调用,研究表明现有的大多数软件程序中每20个指令就有一个函数调用。现有的单元测试中往往一个单元仅包括一个函数,出现函数调用时往往使用打桩的方式进行处理,导致函数调用的错误延迟到集成测试时才被发现,而集成测试中错误修复的成本远远大于单元测试。造成现有技术中一个单元仅能实现一个函数的测试的原因有:The idea of modularization has led to more and more function calls in software programs. Research shows that there is one function call for every 20 instructions in most existing software programs. In the existing unit tests, each unit only includes one function, and when a function call occurs, piling is often used to deal with it, causing the error of the function call to be delayed until the integration test, and the cost of error repair in the integration test is much higher. for unit testing. The reasons why a unit in the prior art can only realize the test of one function are as follows:
1、没有一种通用的方式处理各种格式的函数调用形式;1. There is no general way to handle function calls in various formats;
2、不能正确的处理函数的值参、引参以及返回值。2. The value parameter, reference parameter and return value of the function cannot be processed correctly.
综合上述,故如何在单元测试实现多个函数调用的测试,是现有的软件单元测试方法中亟待解决的问题。Based on the above, how to realize the test of multiple function calls in the unit test is an urgent problem to be solved in the existing software unit test method.
发明内容Contents of the invention
有鉴于此,本发明的主要目的在于提供一种用于包括多个函数测试模块的单元测试方法及装置,以实现在单元测试时测试出函数调用的错误。In view of this, the main purpose of the present invention is to provide a unit testing method and device including a plurality of function testing modules, so as to detect function call errors during unit testing.
为达到上述目的,本发明的技术方案是这样实现的:In order to achieve the above object, technical solution of the present invention is achieved in that way:
本发明提供一种用于包括多个函数测试模块的单元测试方法,所述方法包括:The present invention provides a unit test method for including a plurality of function test modules, the method comprising:
构建测试模块,所述测试模块包括两个以上有调用关系的函数;Build a test module, the test module includes more than two functions with calling relationship;
根据测试模块内程序的逻辑关系及函数间的调用关系形成若干条函数间路径;According to the logical relationship of the program in the test module and the calling relationship between functions, several paths between functions are formed;
为每一条所述函数间路径选择测试用例进行测试。A test case is selected for each of said inter-function paths to be tested.
上述方案中,所述形成若干条函数间路径包括:In the above solution, the formation of several inter-function paths includes:
构建对应于测试模块中各函数调用语句的语句控制流图;Construct a statement control flow graph corresponding to each function call statement in the test module;
构建对应于测试模块中各函数的函数控制流图;Build a function control flow graph corresponding to each function in the test module;
根据函数调用关系,关联所述语句控制流图以及所述函数控制流图形成模块控制流图;According to the function call relationship, associating the statement control flow graph and the function control flow graph to form a module control flow graph;
在所述模块控制流图中确定待覆盖节点,根据预设的路径选择策略选出经过所述待覆盖节点的所述函数间路径。The node to be covered is determined in the module control flow graph, and the inter-function path passing through the node to be covered is selected according to a preset path selection policy.
上述方案中,所述构建语句控制流图包括:In the above solution, the construction statement control flow graph includes:
步骤A:判断函数调用语句调用中当前运算是否为原子运算,若是则构建结束,若否则进行以下步骤;Step A: determine whether the current operation in the function call statement call is an atomic operation, if so, the construction ends, if otherwise, the following steps are performed;
步骤B:为当前运算构建一个语句控制流图;Step B: Construct a statement control flow graph for the current operation;
步骤C:构建所述语句控制图的入口节点;Step C: constructing an entry node of the statement control graph;
步骤D:在所述语句控制图中创建对应每个操作对象的操作对象节点;Step D: creating an operation object node corresponding to each operation object in the statement control graph;
步骤E:根据当前运算的运算先后顺序确定操作对象节点之间的连接顺序;Step E: Determine the connection sequence between the operation object nodes according to the operation sequence of the current operation;
步骤F:创建一个运算节点对应于当前运算的结果;Step F: Create an operation node corresponding to the result of the current operation;
步骤G:设置所述语句控制流图的出口节点;Step G: setting the exit node of the statement control flow graph;
步骤H:按顺序连接各节点,保存操作对象节点与运算节点之间的运算关系;Step H: Connect each node in order, and save the operation relationship between the operation object node and the operation node;
步骤I:为包括函数调用的操作对象节点创建对应的语句控制流图,并替换所述操作对象节点。Step I: Create a corresponding statement control flow graph for the operation object node including the function call, and replace the operation object node.
上述方案中,所述步骤I包括步骤I.1至步骤I.4;In the above scheme, the step I includes step I.1 to step I.4;
所述步骤I.1:获取包括函数调用的操作对象节点的操作对象;所述操作对象分为操作数以及由2个以上操作数之间的运算构成的操作式;The step I.1: Obtain the operation object of the operation object node including the function call; the operation object is divided into operands and operation formulas composed of operations between more than two operands;
所述步骤I.2:判断所述对象中是否有操作式;The step I.2: judging whether there is an operation formula in the object;
若有则进入步骤I.3,若否则构建结束;If there is, enter step I.3, otherwise the construction ends;
所述步骤I.3:将所述运算操作式视为当前运算,执行所述步骤A至步骤I,以构建所述操作式所对应的语句控制流图;The step I.3: regard the operation formula as the current operation, and execute the steps A to I to construct the statement control flow graph corresponding to the operation formula;
所述步骤I.4:将所述步骤I.3中所构建的语句控制流图,替换所述操作对象节点,并返回所述步骤I.1。The step I.4: replace the operation object node with the statement control flow graph constructed in the step I.3, and return to the step I.1.
上述方案中,所述根据预设的路径选择策略选出经过所述待覆盖节点的函数间路径包括:In the above solution, the selection of the inter-function path passing through the node to be covered according to the preset path selection strategy includes:
通过所述模块控制流图所对应的控制树和蕴含树,得出形成函数间路径必定经过的必经节点;Through the control tree and implication tree corresponding to the module control flow graph, the necessary nodes that must be passed through to form the path between functions are obtained;
根据最多覆盖原则补全所述必经节点之间的节点,并同时确保经过所述待覆盖节点,进而形成所述函数间路径。The nodes between the necessary nodes are completed according to the principle of maximum coverage, and at the same time, the nodes to be covered are ensured to pass through, so as to form the inter-function path.
上述方案中,所述函数控制流图包括主函数对应的函数控制流图以及被调用的子函数对应的函数控制流图;In the above solution, the function control flow graph includes a function control flow graph corresponding to the main function and a function control flow graph corresponding to the called sub-function;
形成模块控制流图包括:Forming a module control flow graph includes:
将语句控制流图替换主函数对应的函数控制流图中的函数调语句所对应的节点;Replace the statement control flow graph with the node corresponding to the function call statement in the function control flow graph corresponding to the main function;
将子函数对应的函数控制流图替换语句控制流图中调用函数节点。Replace the call function node in the statement control flow graph with the function control flow graph corresponding to the sub-function.
上述方案中,所述根据预设的路径选择策略选出经过所述待覆盖节点的函数间路径还包括:In the above solution, the selection of the inter-function path passing through the node to be covered according to the preset path selection strategy further includes:
判断所选择出的函数间路径是否为不可达路径,若否则函数间路径选择正确,若是则采用不可达前缀法进行路径重选。It is judged whether the selected inter-function path is an unreachable path, if not, the inter-function path is selected correctly, and if so, the unreachable prefix method is used for path reselection.
上述方案中,所述不可达路径的判定包括:In the above solution, the determination of the unreachable path includes:
获取节点的变量;所述变量包括对应语句控制流图的入口节点所对应的值参和引参、返回节点所述对应的返回值以及出口节点的值参和引参;Obtaining the variable of the node; the variable includes the value parameter and the reference parameter corresponding to the entry node of the control flow graph of the corresponding statement, the corresponding return value of the return node, and the value parameter and reference parameter of the exit node;
使用符号化执行技术表达变量之间的关联;Use symbolic execution techniques to express associations between variables;
使用区间运算技术处理路径约束判定所选的函数路径是否为不可达路径。The path constraints are processed by using interval operation technology to determine whether the selected function path is an unreachable path.
本发明提供一种用于包括多个函数测试模块的单元测试装置,所述装置包括:The present invention provides a unit test device for including a plurality of function test modules, the device includes:
测试模块构建单元,用以构建测试模块,所述测试模块包括两个以上有调用关系的函数;The test module construction unit is used to construct the test module, and the test module includes more than two functions with calling relationship;
函数路径形成单元,用以根据测试模块内程序的逻辑关系及函数间的调用关系形成若干条函数间路径;The function path forming unit is used to form several inter-function paths according to the logic relationship of the program in the test module and the calling relationship between functions;
测试单元,用以为每一条所述函数间路径选择测试用例进行测试。A test unit is used to select a test case for each of the inter-function paths for testing.
进一步地,所述函数路径形成单元包括:Further, the function path forming unit includes:
语句控制流图构建子单元,用以构建对应于测试模块中各函数调用语句的语句控制流图;The statement control flow graph construction subunit is used to construct the statement control flow graph corresponding to each function call statement in the test module;
函数控制流图构建子单元,用以构建对应于测试模块中各函数的函数控制流图;The function control flow graph construction subunit is used to construct the function control flow graph corresponding to each function in the test module;
模块控制流图构建子单元,用以根据函数调用关系,关联所述语句控制流图以及所述函数控制流图,从而形成模块控制流图;The module control flow graph constructs subunits, which are used to associate the statement control flow graph and the function control flow graph according to the function call relationship, so as to form a module control flow graph;
路径确定子单元,用以确定所述模块控制流图中待覆盖节点,根据预设的路径选择策略选出经过所述待覆盖节点的路径,形成所述函数间路径。本发明用于包括多个函数测试模块的单元测试方法及装置的有益效果:The path determining subunit is used to determine the nodes to be covered in the module control flow graph, select a path passing through the nodes to be covered according to a preset path selection strategy, and form the inter-function path. Beneficial effects of the present invention for the unit test method and device including multiple function test modules:
本发明所述的用于包括多个函数测试模块的单元测试方法及装置,在进行单元测试时,通过构建由多个函数调用形成的测试模块,选择出函数间路径进行了单元测试,从而在单元测试阶段即可及时发现函数调用中的错误,避免了将函数调用的错误延迟到集成测试中,进而及时的对软件中函数调用的错误进行修正,从而提高了软件测试的有效效率,并降低了测试及软件修正的成本。The unit test method and device for including multiple function test modules described in the present invention, when performing unit test, by constructing a test module formed by multiple function calls, the path between functions is selected to carry out unit test, thus in In the unit test stage, the errors in the function calls can be found in time, avoiding the delay of the function call errors to the integration test, and then timely correcting the function call errors in the software, thereby improving the effective efficiency of software testing and reducing cost of testing and software revisions.
附图说明Description of drawings
图1为本发明实施例所述的用于包括多个函数测试模块的单元测试方法的流程示意图;FIG. 1 is a schematic flow diagram of a unit testing method including a plurality of function testing modules described in an embodiment of the present invention;
图2为本发明实施例中所述的函数调用关系图;Fig. 2 is a function call relationship diagram described in the embodiment of the present invention;
图3为本发明实施例中所述的函数间路径形成的流程示意图;FIG. 3 is a schematic flow diagram of the formation of inter-function paths described in the embodiment of the present invention;
图4a为图2中所述函数调用关系图的主函数对应的函数控制流图;Fig. 4a is the function control flow diagram corresponding to the main function of the function call relation diagram described in Fig. 2;
图4b为图2中所述函数调用关系图的函数调用语句对应的语句控制流图;Figure 4b is a statement control flow diagram corresponding to the function call statement of the function call relationship diagram described in Figure 2;
图4c为图2中所述函数调用关系图的子函数所对应的函数控制流图;Fig. 4c is a function control flow diagram corresponding to the sub-function of the function call relation diagram described in Fig. 2;
图4d为图2中所述函数调用关系图所对应的测试模块的模块控制流图;Fig. 4d is the module control flow diagram of the test module corresponding to the function call relation diagram described in Fig. 2;
图5为本发明实施例中所述形成的函数调用语句的语句控制流图的流程示意图之一;5 is one of the flow diagrams of the statement control flow diagram of the function call statement formed in the embodiment of the present invention;
图6为本发明实施例中所述的形成函数调用语句的语句控制流图的流程示意图之二;Fig. 6 is the second schematic flow diagram of the statement control flow graph forming the function call statement described in the embodiment of the present invention;
图7为本发明实施例中所述的一种函数间路径的结构示意图;FIG. 7 is a schematic structural diagram of a path between functions described in an embodiment of the present invention;
图8a为本发明实施例中所述的一种函数调用语句的语句控制流图;Fig. 8a is a statement control flow diagram of a function call statement described in the embodiment of the present invention;
图8b为本发明实施例中所述的模块控制流图的形成示意图;Fig. 8b is a schematic diagram of the formation of the module control flow graph described in the embodiment of the present invention;
图9a为在图8b中所形成的模块控制流图中一条不可达的函数间路径;Figure 9a is an unreachable inter-function path in the module control flow graph formed in Figure 8b;
图9b为在图8b中所形成的模块控制流图中一条可达的函数间路径;Fig. 9b is a reachable inter-function path in the module control flow graph formed in Fig. 8b;
图10为本发明实施例中所述装置的结构示意图;Fig. 10 is a schematic structural diagram of the device described in the embodiment of the present invention;
图11为图10中所述函数间路径形成单元的结构示意图。FIG. 11 is a schematic structural diagram of the inter-function path forming unit in FIG. 10 .
具体实施方式detailed description
以下结合实施例与附图对本发明的技术方案进行详细的描述。The technical solution of the present invention will be described in detail below in conjunction with the embodiments and the accompanying drawings.
如图1所示,本实施例用于包括多个函数测试模块的单元测试方法包括:As shown in Figure 1, the unit test method used in this embodiment to include multiple function test modules includes:
步骤S110:构建测试模块,所述测试模块包括两个以上有调用关系的函数;Step S110: build a test module, the test module includes more than two functions with calling relationship;
步骤S120:根据测试模块内程序的逻辑关系及函数间的调用关系形成若干条函数间路径;Step S120: forming several inter-function paths according to the logical relationship of the program in the test module and the calling relationship between the functions;
步骤S130:为每一条所述函数间路径选择测试用例进行测试。Step S130: Select a test case for each inter-function path for testing.
在本实施例中所述测试模块包括了至少两个有相互调用关系的函数,相对于传统的单元测试中仅包括一个函数的测试模块,测试模块的构建即不同。In this embodiment, the test module includes at least two functions that call each other. Compared with the test module that only includes one function in the traditional unit test, the construction of the test module is different.
在具体的实现过程中,所述测试模块所对应的数学表达式可为二元组<caller,callees>。其中,caller为入口函数;callees为被调用的子函数列表。在子函数列表中包括了至少1个以上的函数。In a specific implementation process, the mathematical expression corresponding to the test module may be a binary group <caller, callees>. Among them, caller is the entry function; callees is the list of sub-functions to be called. At least one or more functions are included in the sub-function list.
具体的如图2所示,对应的程序中包括了函数f1、f2、f3、f4以及f5,且函数之间的调用关系如图中连接关系所示。根据本实施例所述的测试模块的构建方法,则f1和f2可以构成测试模块且f1为入口函数;f1、f4以及f2可以构成测试模块且f1为入口函数;f2以及f4可以构成测试模块且4为入口函数;f3以及f4不能构成模块,因为没有调用关系。Specifically, as shown in FIG. 2 , the corresponding program includes functions f1 , f2 , f3 , f4 and f5 , and the calling relationship among the functions is shown in the connection relationship in the figure. According to the construction method of the test module described in this embodiment, then f1 and f2 can constitute a test module and f1 is an entry function; f1, f4 and f2 can constitute a test module and f1 is an entry function; f2 and f4 can constitute a test module and 4 is the entry function; f3 and f4 cannot form a module because there is no calling relationship.
故在实施例所述测试模块在运行时,不仅涉及了函数内的逻辑关系,同样的还包括了函数调用关系。从而进行软件的单元测试时,软件的运行将从一个函数进入被调用的函数内部进行运行。故在选择函数间路径时,本实施例所述方法考虑了函数调用关系,从而能实现多个函数测试模块的单元测试方法。Therefore, when the test module described in the embodiment is running, not only the logical relationship within the function is involved, but also the function calling relationship is also involved. Therefore, when the unit test of the software is performed, the operation of the software will enter the called function from a function to run. Therefore, when selecting the path between functions, the method described in this embodiment considers the function call relationship, so that the unit test method of multiple function test modules can be realized.
所述步骤S130中所述的测试用例可以是现有方法中对应的测试用例,测试方法也可以采用现有的方法实现,具体的所述测试用例可以预先设置。The test case described in step S130 may be a corresponding test case in an existing method, and the test method may also be realized by using an existing method, and the specific test case may be preset.
综合上述,本实施例所述的单元测试方法,测试时不仅实现了对一个函数的测试,同时还实现了对函数调用的测试,从而能在单元测试时及早的发现函数调用的错误(具体的如接口错误),以免所述错误流入集成测试,从而节省了测试成本,提高了测试有效效率。In summary, the unit test method described in this embodiment not only realizes the test to a function, but also realizes the test to the function call during the test, so that the error of the function call can be found early during the unit test (specifically Such as interface error), so as to prevent the error from flowing into the integration test, thereby saving the test cost and improving the effective efficiency of the test.
在具体的实现过程中,所述函数路径的形成方法有多种,如图3所示,本实施例提供如下优选方法:In the specific implementation process, there are many ways to form the function path, as shown in Figure 3, the present embodiment provides the following preferred methods:
步骤S210:构建对应于测试模块中各函数调用语句的语句控制流图;Step S210: Construct a statement control flow graph corresponding to each function call statement in the test module;
步骤S220:构建对应于测试模块中各函数的函数控制流图;Step S220: building a function control flow graph corresponding to each function in the test module;
步骤S230:根据函数调用关系,关联所述语句控制流图以及所述函数控制流图,从而形成模块控制流图;Step S230: According to the function call relationship, associating the statement control flow graph and the function control flow graph, thereby forming a module control flow graph;
步骤S240:确定所述模块控制流图中待覆盖节点,根据预设的路径选择策略选出经过所述待覆盖节点的路径,形成所述函数间路径。Step S240: Determine the nodes to be covered in the module control flow graph, select a path passing through the nodes to be covered according to a preset path selection strategy, and form the inter-function path.
采用步骤S210至步骤S240形成函数间路径,提供了一种通用的方式处理各种格式的函数调用形式;且能正确的处理函数的值参、引参以及返回值。Using steps S210 to S240 to form an inter-function path provides a general way to process function calls in various formats; and can correctly process value parameters, reference parameters, and return values of functions.
所述函数控制流图包括主函数以及子函数所对应的函数控制流图其;中,所述子函数为被调用的函数。The function control flow graph includes a main function and a function control flow graph corresponding to a sub-function; wherein, the sub-function is a called function.
所述语句控制流图的数学表达式有多种,在本实施例中提供一种优选的数学表达式:所述语句控制流图的数学表达式为五元组(N,E,Entry,Exit,R);There are multiple mathematical expressions of the statement control flow graph, and a preferred mathematical expression is provided in this embodiment: the mathematical expression of the statement control flow graph is a quintuple (N, E, Entry, Exit ,R);
其中,所述N是节点的集合,所述节点包括操作对象节点以及运算节点;所述E是有向边的集合;所述Entry是唯一入口节点;所述Exit是唯一的退出节点;所述R表示节点间的运算关系。Wherein, the N is a collection of nodes, and the nodes include operation object nodes and computing nodes; the E is a collection of directed edges; the Entry is the only entry node; the Exit is the only exit node; R represents the operational relationship between nodes.
所述函数控制流图即可以采用现有单元测试中常用的控制流图构建方法来构建。The function control flow graph can be constructed by using a control flow graph construction method commonly used in existing unit tests.
所述函数控制流图、语句控制流图以及模块控制流图都是属于控制流图的一种,区别在于对应不同类型的程序代码。通常控制流图为一个抽象的数据结构,由若干个节点构成。节点之间通过箭头表示节点之间的逻辑关系。所述控制流图至少包括入口节点、出口节点以及真假分支结构等。The function control flow graph, the statement control flow graph and the module control flow graph are all one type of control flow graph, and the difference is that they correspond to different types of program codes. Usually the control flow graph is an abstract data structure consisting of several nodes. Arrows between nodes indicate the logical relationship between nodes. The control flow graph at least includes entry nodes, exit nodes, true and false branch structures, and the like.
voidf(inti){voidf(inti){
i=i>0?f1(i):f2(i);i=i>0? f1(i):f2(i);
}}
intf1(i){intf1(i){
return++i;return++i;
}}
intf2(i){intf2(i){
return--i;return--i;
}}
上述C程序代码当采用本实施例所述的函数路径构建方法,则至少包括对应了主函数f(inti)所对应的函数控制流图、子函数intf2(i)所对应的控制流图以及对应于i=i>0?f1(i):f2(i)的语句控制流图。When the above-mentioned C program code adopts the function path construction method described in this embodiment, it at least includes the function control flow graph corresponding to the main function f(inti), the control flow graph corresponding to the sub-function intf2(i), and the corresponding Since i=i>0? Statement control flow graph of f1(i):f2(i).
具体的如图4a为所述主函数f(inti)的函数控制流图,包括了节点11、12以及13;其中节点11为入口节点、节点12对应了f(inti);节点13为出口节点。Specifically, Fig. 4a is a function control flow graph of the main function f(inti), including nodes 11, 12 and 13; wherein node 11 is an entry node, and node 12 corresponds to f(inti); node 13 is an exit node .
具体的如图4b为函数调用语句i=i>0?f1(i):f2(i)的语句控制流图,包括了节点21、节点22、节点23、节点24以及节点25;其中节点21为入口节点对应了i>0的判断;T表示i>0为真,F表示为i>0为假。i>0判断为真时,顺序执行函数intf1(i),为假则调用子函数intf2(i)。节点22对应了f1(i),返回值为f1(i),节点23对应了f2(i),返回值为f2(i);节点24对应了三元运算i>0?f1(i):f2(i),如果A的返回值为真,则节点24返回值为B的返回值,否则返回值为节点23的返回值;节点25为出口节点对应的是赋值运算,返回值为i。Specifically, as shown in Figure 4b, the function call statement i=i>0? The statement control flow graph of f1(i):f2(i) includes node 21, node 22, node 23, node 24 and node 25; node 21 is the entry node and corresponds to the judgment of i>0; T means i> 0 is true, and F means i>0 is false. When i>0 is judged to be true, the function intf1(i) is executed sequentially, and the sub-function intf2(i) is called if it is false. Node 22 corresponds to f1(i), the return value is f1(i), node 23 corresponds to f2(i), and the return value is f2(i); node 24 corresponds to the ternary operation i>0? f1(i):f2(i), if the return value of A is true, then the return value of node 24 is the return value of B, otherwise the return value is the return value of node 23; node 25 is the exit node corresponding to the assignment operation, The return value is i.
具体的如图4c为子函数intf2(i)的控制流图,包括节点31、32以及33。节点3为入口节点、节点32应了原子运算“return–i”,节点33为出口节点。Specifically, FIG. 4 c is a control flow graph of the sub-function intf2(i), including nodes 31 , 32 and 33 . Node 3 is an entry node, node 32 responds to the atomic operation "return-i", and node 33 is an exit node.
所述步骤S230中,关联函数控制流图以及语句控制流图,形成模块控制流图包括以下步骤:In the step S230, associating the function control flow graph and the statement control flow graph to form the module control flow graph includes the following steps:
步骤1:将语句控制流图替换主函数对应的函数控制流图中的函数调语句所对应的节点。在图4d中函数调用语句所对应的节点为虚线圆框所形成的节点12。Step 1: Replace the statement control flow graph with the node corresponding to the function call statement in the function control flow graph corresponding to the main function. In FIG. 4 d , the node corresponding to the function call statement is the node 12 formed by the dotted circle.
步骤2:将子函数对应的函数控制流图替换语句控制流图中调用函数节点。在图4d中对应于调用子函数的节点为虚线圆框所形成的节点23。Step 2: Replace the calling function node in the statement control flow graph with the function control flow graph corresponding to the sub-function. In FIG. 4 d , the node corresponding to calling the sub-function is the node 23 formed by the dotted circle.
具体如图4c所示,上述步骤依次为,将图4b替换图4a中的节点12,再将图4c中的子函数的函数控制流图替换图4b中的节点23,从而形成了最终的模块控制流图如图4d所示,用以提供函数间路径。Specifically as shown in Figure 4c, the above steps are as follows: replace the node 12 in Figure 4a with Figure 4b, and then replace the function control flow graph of the sub-function in Figure 4c with the node 23 in Figure 4b, thus forming the final module A control flow graph, shown in Figure 4d, is used to provide paths between functions.
在具体的实施过程中语句控制流图的形成方法有多种,如图5所示提供一种优选的语句控制流图形成方法,具体如下:In the specific implementation process, there are many ways to form the statement control flow graph. As shown in Figure 5, a preferred statement control flow graph formation method is provided, specifically as follows:
步骤A:判断函数调用语句调用中当前运算是否为原子运算,若是则构建结束,若否则进行以下步骤;所述原子运算是不能再细分的运算。Step A: Judging whether the current operation in the function call statement call is an atomic operation, if so, the construction ends, if otherwise, the following steps are performed; the atomic operation is an operation that cannot be further subdivided.
步骤B:为当前运算构建一个语句控制流图。Step B: Construct a statement control flow graph for the current operation.
步骤C:构建所述语句控制图的入口节点;此处构成的入口节点可以是一个虚节点。Step C: Construct the entry node of the statement control graph; the entry node formed here may be a dummy node.
步骤D:在所述语句控制图中创建对应每个操作对象的操作对象节点。Step D: Create an operation object node corresponding to each operation object in the statement control graph.
步骤E:根据当前运算的运算先后顺序确定操作对象节点之间的连接顺序;当前运算先后顺序的确定需根据当前运算来确定的。若当前运算包括四则运算时,根据四则运算的结合性来确定;当前运算包括逻辑关系式时,根据逻辑关系式的逻辑关系来进行。所述逻辑关系式又分为分支结构运算以及非分支结构运算;若是分支结构运算则根据分支结构的逻辑连接操作对象节点,若为非分支结构运算则按顺序连接操作对象节点。通常所述分支结构运算包括三元表达式、逻辑与和逻辑或等。Step E: Determine the connection sequence between the operation object nodes according to the operation sequence of the current operation; the determination of the current operation sequence needs to be determined according to the current operation. If the current operation includes four arithmetic operations, it is determined according to the associativity of the four arithmetic operations; when the current operation includes a logical relational expression, it is determined according to the logical relation of the logical relational expression. The logical relational expression is further divided into branch structure operation and non-branch structure operation; if it is a branch structure operation, the operation object nodes are connected according to the logic of the branch structure, and if it is a non-branch structure operation, the operation object nodes are connected in order. Usually, the operation of the branch structure includes ternary expression, logic and and logic or and so on.
步骤F:创建一个运算节点对应于当前运算的结果。Step F: Create an operation node corresponding to the result of the current operation.
步骤G:设置所述语句控制流图的出口节点;本步骤中所述的出口节点同样的可以是一个虚节点。Step G: Setting the exit node of the statement control flow graph; the exit node described in this step can also be a virtual node.
步骤H:保存操作对象节点与运算节点之间的运算关系。Step H: Save the operation relationship between the operation object node and the operation node.
步骤I:为包括函数调用的操作对象节点创建对应的语句控制流图,并替换所述操作对象节点。具体的运算过程中,所述操作对象节点包括操作数以及由多个操作数通过运算符连接起来的操作式。所述操作数可以是常量或变量。所述操作符可以是四则运算法或逻辑关系符等。Step I: Create a corresponding statement control flow graph for the operation object node including the function call, and replace the operation object node. In a specific operation process, the operation object node includes operands and an operation formula in which multiple operands are connected through operators. The operands may be constants or variables. The operator may be a four-arithmetic algorithm or a logic relational operator.
具体的所述步骤I中可以优选以下方法。如图6所示,所述步骤I具体包括步骤I.1至步骤I.4;Can preferably following method in concrete described step 1. As shown in Figure 6, the step I specifically includes step I.1 to step I.4;
所述步骤I.1:获取包括函数调用的操作对象节点的操作对象;所述操作对象分为操作数以及由2个以上操作数之间的运算构成的操作式;The step I.1: Obtain the operation object of the operation object node including the function call; the operation object is divided into operands and operation formulas composed of operations between more than two operands;
所述步骤I.2:判断所述对象中是否有操作式;The step I.2: judging whether there is an operation formula in the object;
若有则进入步骤I.3,若否则构建结束;If there is, enter step I.3, otherwise the construction ends;
所述步骤I.3:将所述运算操作式视为当前运算,执行所述步骤A至步骤I,以构建所述操作式所对应的语句控制流图;The step I.3: regard the operation formula as the current operation, and execute the steps A to I to construct the statement control flow graph corresponding to the operation formula;
所述步骤I.4:将所述步骤I.3中所构建的语句控制流图,替换所述操作对象节点,并返回所述步骤I.1。The step I.4: replace the operation object node with the statement control flow graph constructed in the step I.3, and return to the step I.1.
结合上述,可知形成函数调用语句的语句控制流图中包括了递归算法的运用。Combining the above, it can be seen that the statement control flow graph forming the function call statement includes the use of recursive algorithms.
进一步的,所述函数路径选择包括:Further, the function path selection includes:
通过所述模块控制流图所对应的控制树和蕴含树,得出形成函数间路径必定经过的必经节点;所述控制树和蕴含树都是现有对程序代码流程分析的一种图示,具体的含义参见现有技术中的定义,在此就不再赘述;Through the control tree and implication tree corresponding to the module control flow graph, the necessary nodes that must be passed through to form the path between functions are obtained; the control tree and implication tree are both an illustration of the existing program code flow analysis , refer to the definition in the prior art for the specific meaning, and will not repeat them here;
根据最多覆盖原则补全所述必经节点之间的节点,并同时确保经过所述待覆盖节点,进而形成所述函数间路径。The nodes between the necessary nodes are completed according to the principle of maximum coverage, and at the same time, the nodes to be covered are ensured to pass through, so as to form the inter-function path.
采用控制树和蕴含树能快捷有效的找到形成路径的必经节点,再通过补全其他节点的方式,能快速的得到多条经过待覆盖节点的函数间路径,从而提高了函数间路径形成的效率。在具体的实现过程中,还可以采用遍历的方法,遍历的方法可以现有技术中的遍历有向图的方法。Using the control tree and implication tree can quickly and effectively find the necessary nodes to form the path, and then by complementing other nodes, it can quickly obtain multiple inter-function paths passing through the nodes to be covered, thus improving the efficiency of inter-function path formation efficiency. In a specific implementation process, a traversal method may also be used, and the traversal method may be the method of traversing a directed graph in the prior art.
作为上述函数间路径的进一步的优化,所述函数路径选择还包括:As a further optimization of the path between the above functions, the function path selection also includes:
判断所选择出的函数间路径是否为不可达路径,Determine whether the selected path between functions is an unreachable path,
若否则函数间路径选择正确,Otherwise, the path selection between functions is correct,
若是则采用不可达前缀法进行路径重选。If so, use the unreachable prefix method for path reselection.
在本实施例中通过函数间路径不可达的判定,提高了单元测试的有效测试效率。所述不可达前缀法步骤如下:In this embodiment, the effective test efficiency of the unit test is improved by judging that the paths between functions are unreachable. The steps of the unreachable prefix method are as follows:
给定待覆盖节点T和经过待覆盖节点T的路径p,当路径p不可达时依次进行如下步骤:Given a node T to be covered and a path p passing through the node T to be covered, when the path p is unreachable, the following steps are performed in sequence:
步骤1:找到路径p的不可达前缀路径q,所述前缀路径q为从起点到发生矛盾的分支节点所对应的路径;Step 1: find the unreachable prefix path q of the path p, the prefix path q is the path corresponding to the branch node from the starting point to the conflict;
步骤2:将前缀路径q中发生矛盾的分支转换为另一个未选择的分支路径,得到前缀路径q';Step 2: Convert the contradictory branch in the prefix path q to another unselected branch path to obtain the prefix path q';
步骤3:判断待覆盖节点T是否属于q',Step 3: Determine whether the node T to be covered belongs to q',
步骤3.1:如果T∈q',则q与q'连接形成了新选择的函数间路径;Step 3.1: If T ∈ q', then q is connected with q' to form a newly selected inter-function path;
步骤3.2:如果则选择q'到待覆盖节点T的路径,再选择待覆盖节点T到终点的路径,以形成新选择的函数间路径Step 3.2: If Then select the path from q' to the node T to be covered, and then select the path from the node T to be covered to the end point to form a newly selected inter-function path
步骤4:如果新选择的函数间路径仍不可达,继续转换不可达前缀的分支Step 4: If the newly selected inter-function path is still unreachable, continue to convert the branch of the unreachable prefix
步骤5:重复上述步骤直至找到可达路径Step 5: Repeat the above steps until a reachable path is found
在具体的实施过程中,所述函数间路径是否为不可达路径的判断方法有多种,以下提供一种优选方法。所述不可达路径的判定具体包括:In a specific implementation process, there are many methods for judging whether the inter-function path is an unreachable path, and a preferred method is provided below. The determination of the unreachable path specifically includes:
获取节点的变量;所述变量包括对应语句控制流图的入口节点所对应的值参和引参、返回节点所述对应的返回值以及出口节点的值参和引参;所述获取节点的变量信息,可以采用经典的数据流公式得到。Obtain the variable of the node; the variable includes the value parameter and the reference parameter corresponding to the entry node of the corresponding statement control flow graph, the corresponding return value of the return node and the value parameter and the reference parameter of the exit node; the variable of the acquisition node Information can be obtained by using the classical data flow formula.
使用符号化执行技术表达变量之间的关联。Use symbolic execution techniques to express associations between variables.
使用区间运算技术处理路径约束,从而判定所选的函数路径是否为不可达路径。The path constraint is processed by using interval operation technology, so as to determine whether the selected function path is an unreachable path.
由于本发明所述的单元测试是针对包括了多个相互有调用关系的测试模块,相对于现有技术中仅包括一个函数的测试模块,有以下区别点:Because the unit test of the present invention is aimed at including a plurality of test modules that have a calling relationship with each other, compared with the test module that only includes one function in the prior art, the following differences are arranged:
区别点1:子函数入口节点只继承其参数对应的变量,且需要区分值参、引参;Difference 1: The sub-function entry node only inherits the variables corresponding to its parameters, and needs to distinguish value parameters and reference parameters;
区别点2:子函数return节点需要记录函数的返回值;Difference 2: The sub-function return node needs to record the return value of the function;
区别点3:子函数出口节点需要对值参和引参,且对值参与引参需进行分别处理;Difference 3: The sub-function exit node needs to have value parameters and reference parameters, and the value participation reference parameters need to be processed separately;
区别点4:对于路径中属于语句控制流图的部分,表达式运算有以下区别:每个节点运算表达式的操作数必然已经在前一个节点计算完毕,直接从对应节点获取计算结果即可。Difference 4: For the part of the path that belongs to the statement control flow graph, the expression operation has the following difference: the operand of each node operation expression must have been calculated at the previous node, and the calculation result can be obtained directly from the corresponding node.
本实施例所述的不可达路径判断该方法是根据以上区别点为本发明所述的软件的单元测试特意设计的,这样不可达路径的判断准确简单。The method for judging the unreachable path described in this embodiment is specially designed for the unit test of the software described in the present invention based on the above differences, so that the judgment of the unreachable path is accurate and simple.
以下提供一个具体的示例:A concrete example is provided below:
structNode*del(structNode*head,intnum){structNode*del(structNode*head, intnum){
returnhead;return head;
}}
intmain(){intmain(){
intnum;intnum;
charstring[20];charstring[20];
structNode*head=create(1);structNode*head = create(1);
……
del(head,num);del(head, num);
……
}}
以上是一段取自链表操作的link.c的代码。其中,head是del函数的引参,num是del函数的值参,返回值为head。图7所示的是经过del函数的一条函数间路径;a是子函数del的前一个节点;b是子函数del的入口点;c是子函数del的return语句;d是子函数del的出口节点。子函数入口节点b从节点a得到参数head和num的值;函数return语句所对应的节点c记录函数调用运算的返回值为head;函数出口节点d从节点a取num的值以及head的值。The above is a piece of code taken from link.c of the linked list operation. Among them, head is the reference parameter of the del function, num is the value parameter of the del function, and the return value is head. Figure 7 shows an inter-function path through the del function; a is the previous node of the sub-function del; b is the entry point of the sub-function del; c is the return statement of the sub-function del; d is the exit of the sub-function del node. Sub-function entry node b obtains the values of parameters head and num from node a; node c corresponding to the function return statement records the return value of the function call operation as head; function exit node d obtains the values of num and head from node a.
此外,通过验证以及推理得出,本发明所述的用于包括多个函数测试模块的单元测试方法,在具体的进行测试单元模块大小确定时,代码行优选为不大于500行,否则不可达路径的百分率将较高,故测试模块所包括的代码行限制在500行以内方便提高测试效率以及准确度(其中一条语句通常对应一个代码行)。In addition, through verification and reasoning, it is concluded that the unit test method for including multiple function test modules described in the present invention, when specifically determining the size of the test unit module, the code line is preferably no more than 500 lines, otherwise it is not reachable The percentage of the path will be relatively high, so the lines of code included in the test module are limited to within 500 lines to improve test efficiency and accuracy (one statement usually corresponds to one line of code).
以下再提供一个采用上述方法进行软件的单元测试的示例:The following provides another example of unit testing of software using the above method:
所述示例针对的是以下代码:The example described is for the following code:
intmonth[12]={31,28,31,30,31,30,31,31,30,31,30,31};intmonth[12]={31,28,31,30,31,30,31,31,30,31,30,31};
intjudge(dated)intjudge(dated)
{{
returnreturn
((d.month==2)&&(d.day<month[d.month-1]+leap(d.year)))||((d.month==2)&&(d.day<month[d.month-1]+leap(d.year)))||
((d.month!=2)&&(d.day<month[d.month-1]))?1:0;((d.month!=2)&&(d.day<month[d.month-1]))? 1:0;
}}
intleap(intyear){intleap(intyear){
return((year%400==0)||((year%4==0)&&(year%100!=0)))?1:0;return((year%400==0)||((year%4==0)&&(year%100!=0)))? 1:0;
}}
上述代码内函数judge用以判断日期d的有效性,judge函数中调用了判断年份year是否为闰年的函数leap。The function judge in the above code is used to judge the validity of the date d, and the function leap that judges whether the year is a leap year is called in the judge function.
第一,确定了测试模块M,所述测试模块M包括入口函数judge以及被调用的子函数leap。First, the test module M is determined, and the test module M includes the entry function judge and the called sub-function leap.
第二,形成了函数调用语句——return语句所对应的语句控制流图,具体的如图8a所示。在所述图8a中:Second, a statement control flow graph corresponding to the function call statement—the return statement is formed, as shown in FIG. 8a specifically. In said Figure 8a:
节点A表示关系运算d.month==2。Node A represents the relational operation d.month==2.
节点B表示关系运算d.day<month[d.month-1]+leap(d.year),在此层函数调用语句分解中,此处函数调用语句变成了d.day<month[d.month-1]+leap(d.year)。Node B represents the relational operation d.day<month[d.month-1]+leap(d.year). In the decomposition of the function call statement at this layer, the function call statement here becomes d.day<month[d. month-1]+leap(d.year).
节点C表示关系运算(d.month!=2)&&(d.day<month[d.month-1]);此处由于为非函数调用语句故可以不将上述运算拆分为原子运算。Node C represents a relational operation (d.month!=2)&&(d.day<month[d.month-1]); here, since it is a non-function call statement, the above operation may not be split into atomic operations.
节点D表示逻辑运算表达式(d.month==2)&&(d.day<month[d.month-1]+leap(d.year))为真。Node D indicates that the logical operation expression (d.month==2)&&(d.day<month[d.month-1]+leap(d.year)) is true.
节点E表示逻辑运算表达式(d.month==2)&&(d.day<month[d.month-1]+leap(d.year))为假。Node E indicates that the logical operation expression (d.month==2)&&(d.day<month[d.month-1]+leap(d.year)) is false.
节点F表示逻辑运算||。节点G表示三元表达式的真分支所对应的常量。H表示三元表达式的假分支所对应的常量。I表示整个三元表达式运算。Node F represents the logical operation ||. Node G represents the constant corresponding to the true branch of the ternary expression. H represents the constant corresponding to the false branch of the ternary expression. I represents the entire ternary expression operation.
如图8b所示,函数judge(date)所对对应的函数控制流图CFG中包括入口节点A1、对应judge函数的节点B1以及包括出口节点C1;被调用的子函数leap的CFG包括三个节点,分别是节点A2、B2以及节点C2;其中节点A2为入口节点,B2为对应函数leap,C2为出口节点。As shown in Figure 8b, the function control flow graph CFG corresponding to the function judge(date) includes the entry node A1, the node B1 corresponding to the judge function, and the exit node C1; the CFG of the called sub-function leap includes three nodes , are nodes A2, B2 and node C2 respectively; where node A2 is the entry node, B2 is the corresponding function leap, and C2 is the exit node.
第三,进行函数控制流图CFG以及函数调用语句的语句控制流图SCFG的关联。如故8b所示,所述关联包括将语句控制流图替换主函数judge的函数控制流图中相应的节点B1,再将被调用的子函数的函数控制流图替换语句控制流图SCFG中的节点B,进而形成完整的模块控制流图。Thirdly, the function control flow graph CFG and the statement control flow graph SCFG of the function call statement are associated. As shown in Figure 8b, the association includes replacing the statement control flow graph with the corresponding node B1 in the function control flow graph of the main function judge, and then replacing the node in the statement control flow graph SCFG with the function control flow graph of the called sub-function B, and then form a complete module control flow graph.
第四,在完成模块控制流图形成之后,需要进行路径的确定。例如节点G为待覆盖节点,依据最多覆盖准则选出路径,得出的路径如图9a中虚线覆盖的路径。所述最多覆盖准则为选出一条覆盖待覆盖节点、必经节点且能覆盖最多节点路径的选择准则。采用最多覆盖准则,能一次对更多的代码进行测试,从而能减少测试用例的使用,从而能提高测试效率。Fourth, after completing the formation of the module control flow graph, it is necessary to determine the path. For example, node G is a node to be covered, and a path is selected according to the maximum coverage criterion, and the obtained path is the path covered by the dotted line in Fig. 9a. The maximum coverage criterion is to select a selection criterion that covers the nodes to be covered, must pass through nodes, and can cover the most nodes. By adopting the maximum coverage criterion, more codes can be tested at one time, so that the use of test cases can be reduced, and the test efficiency can be improved.
当采用如图9a中所述路径时,节点A的真分支和节点C的真分支矛盾,选出的函数间路径为不可达路径。对不可达前缀进行分支替换,即选择节点C的假分支,然后选择E到G的路径E→F→G。但对于新生成的路径,节点C的假分支和节点F的真分支矛盾。由于节点C再没有可以替换的分支,所以回到节点C的上一个分支节点B进行分支替换。替换成节点B的真分支后,选到的路径如图9b中虚线所覆盖的路径所示。判定新选择的路径为可达路径,则该路径为符合要求的函数间路径。When the path as shown in FIG. 9a is adopted, the true branch of node A and the true branch of node C are contradictory, and the selected path between functions is an unreachable path. Perform branch replacement for unreachable prefixes, that is, choose the false branch of node C, and then choose the path E→F→G from E to G. But for the newly generated path, the false branch of node C and the true branch of node F are contradictory. Since node C has no branch that can be replaced, it returns to node B, the last branch of node C, to perform branch replacement. After replacing with the true branch of node B, the selected path is shown as the path covered by the dotted line in Fig. 9b. If it is determined that the newly selected path is a reachable path, then the path is an inter-function path that meets the requirements.
在此说明,图8a、8b、9a以及9b的图示中的T均表示对应的判断为真,F均表示对应的判断为假。Here, T in the diagrams of FIGS. 8a , 8b , 9a and 9b all indicate that the corresponding judgment is true, and F all indicate that the corresponding judgment is false.
综合上述,本实施例提供了一种用于包括多个函数测试模块的单元测试方法,所针对的测试模块包括至少两个有相互调用关系的函数,从而在单元测试时同样的可以实现函数调用错误的测试,避免了函数调用的错误延迟到集成测试才能发现,进而提高了测试的有效效率并降低了测试以及软件错误校正的成本。To sum up the above, this embodiment provides a unit test method for including multiple function test modules, the target test module includes at least two functions that have a mutual calling relationship, so that function calls can also be implemented during unit testing The wrong test avoids the delay of the function call error until the integration test can find it, thereby improving the effective efficiency of the test and reducing the cost of testing and software error correction.
本实施例提供一种用于包括多个函数测试模块的单元测试装置,所述装置用于为上述实施例中所述的用于包括多个函数测试模块的单元测试方法实现所对应的功能的物理装置。如图10所示,所述装置包括:This embodiment provides a unit testing device including a plurality of function testing modules, and the device is used to realize corresponding functions for the unit testing method including a plurality of function testing modules described in the above embodiments physical device. As shown in Figure 10, the device includes:
测试模块构建单元110,用以构建测试模块,所述测试模块包括2个以上有调用关系的函数;The test module construction unit 110 is used to construct the test module, and the test module includes more than two functions with calling relationship;
函数路径形成单元120,用以根据测试模块内程序的逻辑关系及函数间的调用关系形成若干条函数间路径;The function path forming unit 120 is used to form several inter-function paths according to the logical relationship of the program in the test module and the calling relationship between the functions;
测试单元130,用以为每一条所述函数间路径选择测试用例进行测试。The testing unit 130 is configured to select a test case for each inter-function path for testing.
以上各个功能单元的具体结构均有多种,以下提供一种结构精巧的函数路径形成单元的优先结构。如图11所示,所述函数路径形成单元120包括:There are various specific structures of the above functional units, and a preferred structure of a functional path forming unit with an exquisite structure is provided below. As shown in Figure 11, the function path forming unit 120 includes:
语句控制流图构建子单元121,用以构建对应于测试模块中函数调用语句的语句控制流图;The statement control flow graph construction subunit 121 is used to construct the statement control flow graph corresponding to the function call statement in the test module;
函数控制流图构建子单元122,用以构建对应于测试模块中函数的函数控制流图;The function control flow graph construction subunit 122 is used to construct the function control flow graph corresponding to the function in the test module;
模块控制流图构建子单元123,用以根据函数调用关系,关联所述语句控制流图以及所述函数控制流图,从而形成模块控制流图;The module control flow graph construction subunit 123 is used to associate the statement control flow graph and the function control flow graph according to the function call relationship, so as to form a module control flow graph;
路径确定子单元124,用以确定所述模块控制流图中待覆盖节点,根据预设的路径选择策略选出经过所述待覆盖节点的路径,形成所述函数间路径。The path determination subunit 124 is configured to determine the nodes to be covered in the module control flow graph, select a path passing through the nodes to be covered according to a preset path selection strategy, and form the inter-function path.
本实施例中所述的用于包括多个函数测试模块的单元测试装置,具体的物理结构可以是包括一个处理器、存储单元、数据接口以及连接各部分原件的总线。所述处理器可以是中央处理,单片机,数字信号处理器或可编程阵列。所述处理器上运行有实现上述功能的软件和/或固件。The specific physical structure of the unit testing device for including multiple function testing modules described in this embodiment may include a processor, a storage unit, a data interface, and a bus connecting various components. The processor can be a central processing unit, a single chip microcomputer, a digital signal processor or a programmable array. Software and/or firmware to realize the above functions run on the processor.
本实施例中所述的用于包括多个函数测试模块的单元测试装置为与上述实施例中用于包括多个函数测试模块的单元测试方法相对应的装置,故能实现同样的功能,从而同样的具有在单元测试中就能发现函数调用中的错误,避免了函数调用的错位延迟到集成测试才发现,从而提高了测试的有效速率,并降低了测试成本。The unit test device for including a plurality of function test modules described in this embodiment is a device corresponding to the unit test method for including a plurality of function test modules in the above-mentioned embodiment, so the same function can be realized, thereby The same error can be found in the function call in the unit test, avoiding the misplacement of the function call and delaying the discovery until the integration test, thereby improving the effective rate of the test and reducing the test cost.
以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310581759.9ACN103593291B (en) | 2013-11-18 | 2013-11-18 | For comprising unit test method and the device of multiple function test module |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310581759.9ACN103593291B (en) | 2013-11-18 | 2013-11-18 | For comprising unit test method and the device of multiple function test module |
| Publication Number | Publication Date |
|---|---|
| CN103593291A CN103593291A (en) | 2014-02-19 |
| CN103593291Btrue CN103593291B (en) | 2016-03-09 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201310581759.9AExpired - Fee RelatedCN103593291B (en) | 2013-11-18 | 2013-11-18 | For comprising unit test method and the device of multiple function test module |
| Country | Link |
|---|---|
| CN (1) | CN103593291B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104915287B (en)* | 2014-03-11 | 2018-07-06 | 富士施乐实业发展(中国)有限公司 | Unit test method and system |
| CN104536896A (en)* | 2015-01-12 | 2015-04-22 | 牟永敏 | Regression test case selecting and ranking method and system oriented to function call path |
| CN105159835B (en)* | 2015-10-24 | 2017-11-03 | 北京航空航天大学 | A kind of pitching pile location acquiring method based on global superblock dominating figure |
| CN106020848A (en)* | 2016-06-07 | 2016-10-12 | 北京信息科技大学 | Function calling route generating method oriented to C# |
| CN109684189B (en)* | 2017-10-18 | 2022-02-11 | 富士通株式会社 | Logic verification method and device for block chain intelligent contract and computer storage medium |
| CN108021370B (en)* | 2017-12-26 | 2020-05-12 | 网易(杭州)网络有限公司 | Byte code optimization method and device, storage medium, processor and terminal |
| CN109960624A (en)* | 2017-12-26 | 2019-07-02 | 航天信息股份有限公司 | A kind of test method and system of JsDriver |
| CN113760771A (en)* | 2021-09-14 | 2021-12-07 | 中国农业银行股份有限公司 | Execution method and device for integration test case |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101286132A (en)* | 2008-06-02 | 2008-10-15 | 北京邮电大学 | A testing method and system based on software defect mode |
| CN101334753A (en)* | 2007-06-26 | 2008-12-31 | 中兴通讯股份有限公司 | Unit test method and its device |
| CN102419728A (en)* | 2011-11-01 | 2012-04-18 | 北京邮电大学 | Method for determining software testing process sufficiency based on coverage rate quantization index |
| CN102495796A (en)* | 2011-11-25 | 2012-06-13 | 中国人民解放军总参谋部第五十四研究所 | Software vulnerability test method based on unit testing |
| CN102708052A (en)* | 2012-04-27 | 2012-10-03 | 北京邮电大学 | Automatic positioning method of software failures in unit test |
| CN102855177A (en)* | 2011-06-30 | 2013-01-02 | 阿里巴巴集团控股有限公司 | Unit test method and device |
| CN102915271A (en)* | 2012-10-31 | 2013-02-06 | 北京邮电大学 | Method for optimizing unit regression test case set based on control flow diagram |
| CN103116540A (en)* | 2013-01-23 | 2013-05-22 | 电子科技大学 | Dynamic symbol execution method and device based on global superblock domination graph |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN100547562C (en)* | 2006-10-18 | 2009-10-07 | 国际商业机器公司 | Method and system for automatically generating unit test cases that reproduce runtime issues |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101334753A (en)* | 2007-06-26 | 2008-12-31 | 中兴通讯股份有限公司 | Unit test method and its device |
| CN101286132A (en)* | 2008-06-02 | 2008-10-15 | 北京邮电大学 | A testing method and system based on software defect mode |
| CN102855177A (en)* | 2011-06-30 | 2013-01-02 | 阿里巴巴集团控股有限公司 | Unit test method and device |
| CN102419728A (en)* | 2011-11-01 | 2012-04-18 | 北京邮电大学 | Method for determining software testing process sufficiency based on coverage rate quantization index |
| CN102495796A (en)* | 2011-11-25 | 2012-06-13 | 中国人民解放军总参谋部第五十四研究所 | Software vulnerability test method based on unit testing |
| CN102708052A (en)* | 2012-04-27 | 2012-10-03 | 北京邮电大学 | Automatic positioning method of software failures in unit test |
| CN102915271A (en)* | 2012-10-31 | 2013-02-06 | 北京邮电大学 | Method for optimizing unit regression test case set based on control flow diagram |
| CN103116540A (en)* | 2013-01-23 | 2013-05-22 | 电子科技大学 | Dynamic symbol execution method and device based on global superblock domination graph |
| Publication number | Publication date |
|---|---|
| CN103593291A (en) | 2014-02-19 |
| Publication | Publication Date | Title |
|---|---|---|
| CN103593291B (en) | For comprising unit test method and the device of multiple function test module | |
| US10990510B2 (en) | Associating attribute seeds of regression test cases with breakpoint value-based fingerprints | |
| CN103678121B (en) | A kind of embedded binary software test case prioritization method | |
| CN102831056A (en) | Regression testing sample generating method based on modification impact analysis | |
| CN102708052B (en) | Software fault automatic positioning method in a kind of unit testing | |
| CN103309805B (en) | The robotization system of selection of test target in xUnit framework Based on Object-Oriented Technology software | |
| CN110515843B (en) | Test case priority ordering method based on defect set and inverted index | |
| EP3264274B1 (en) | Input discovery for unknown program binaries | |
| CN107025169A (en) | A kind of software error layering diagnostic method based on Bayesian Network Inference | |
| US11250191B1 (en) | Offline functional coverage collection | |
| US9043746B2 (en) | Conducting verification in event processing applications using formal methods | |
| CN102819490A (en) | Method and system for software testing based on given defect description information | |
| CN101710305A (en) | Method and system for realizing white box testing of computer software | |
| Zhonglin et al. | An improved method of acquiring basis path for software testing | |
| CN104598381A (en) | Positioning method for failure test instance in metamorphic testing | |
| CN111190906B (en) | Sensor network data anomaly detection method | |
| US9563540B2 (en) | Automated defect positioning based on historical data | |
| CN104764455A (en) | Navigation electronic map data processing method and device | |
| US20180181683A1 (en) | Method and apparatus for finding logic equivalence between register transfer level and post synthesis nets | |
| CN105159826A (en) | Method and apparatus for positioning error statement in object program | |
| JP6169302B2 (en) | Specification configuration apparatus and method | |
| CN116305164A (en) | Cross-contract vulnerability detection method and device and electronic equipment | |
| CN111159262A (en) | Automatic driving simulation data processing method and device | |
| CN116430207A (en) | PAT parameter determination method and device of chip, electronic equipment and storage medium | |
| CN107908557A (en) | A kind of embedded software credible attribute modeling and verification method |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee | Granted publication date:20160309 Termination date:20211118 | |
| CF01 | Termination of patent right due to non-payment of annual fee |