CN102193864B - Test Case Collection Optimization Method Based on Coverage-Based Error Location Technology - Google Patents

Test Case Collection Optimization Method Based on Coverage-Based Error Location Technology Download PDF

Info

Publication number
CN102193864B
CN102193864B CN201110126632.9A CN201110126632A CN102193864B CN 102193864 B CN102193864 B CN 102193864B CN 201110126632 A CN201110126632 A CN 201110126632A CN 102193864 B CN102193864 B CN 102193864B
Authority
CN
China
Prior art keywords
test case
test
correct
test cases
coverage
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.)
Expired - Fee Related
Application number
CN201110126632.9A
Other languages
Chinese (zh)
Other versions
CN102193864A (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.)
Nanjing University
Original Assignee
Nanjing University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University filed Critical Nanjing University
Priority to CN201110126632.9A priority Critical patent/CN102193864B/en
Publication of CN102193864A publication Critical patent/CN102193864A/en
Application granted granted Critical
Publication of CN102193864B publication Critical patent/CN102193864B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a test case set optimization method of a coverage-based error positioning technology. The method comprises the following steps of: identifying accidental right test cases from a given test case set T by clustering, wherein the accidental right test cases mean that the error statements are executed and the execution results are still 'pass'; and processing the identified accidental right test cases to obtain an optimized test case set for coverage-based error positioning. The method has the advantages of optimizing the quality of the test case set at the same time of reducing the size of the original test case set, and reducing the interference of the accidental right test cases to the coverage-based error positioning so as to improve the efficiency and the accuracy of automatic error positioning and save the time cost of seeking errors by a programmer.

Description

基于覆盖度的错误定位技术的测试用例集优化方法Test Case Collection Optimization Method Based on Coverage-Based Error Location Technology

技术领域 technical field

本发明属于软件测试技术领域,尤其是自动化测试领域,用于基于覆盖度的错误定位技术CBFL,为一种基于覆盖度的错误定位技术的测试用例集优化方法。The invention belongs to the technical field of software testing, in particular to the field of automatic testing, which is used for the coverage-based error location technology CBFL, and is a test case set optimization method for the coverage-based error location technology.

背景技术 Background technique

作为自动化测试的一项重要技术,基于覆盖度的错误定位技术CBFL正逐渐走向成熟并且被广泛接受。但是,CBFL错误定位的有效性会被偶然性正确的测试用例所影响。As an important technology of automated testing, coverage-based error localization technology CBFL is gradually becoming mature and widely accepted. However, the effectiveness of CBFL error localization is affected by the occasional correct test cases.

CBFL记录程序中每条语句在通过和未通过的测试用例中的执行信息:执行或者未执行,利用公式,计算每条语句的可疑度。CBFL方法认为,那些在未通过的测试用例中执行的语句更有可能是错误语句。但是,Jeffrey M.Voas提出的PIE模型认为,要让程序失效必须满足3个条件:1)错误语句被执行;2)程序达到″被感染″的状态;3)″被感染″的状态随着控制流被传播到输出。因此,错误语句被执行只是产生失效的必要条件,而非充分条件。只满足条件1)但仍然通过的测试用例被叫做弱偶然性正确的测试用例,而满足条件1)和2)但仍然通过的测试用例被叫做强偶然性正确的测试用例。以下所指的偶然性正确的测试用例都是指前者。CBFL records the execution information of each statement in the program in the passed and failed test cases: executed or not executed, using formulas to calculate the suspiciousness of each statement. The CBFL method considers that those statements executed in the failed test cases are more likely to be error statements. However, the PIE model proposed by Jeffrey M.Voas believes that three conditions must be met to make the program invalid: 1) the wrong statement is executed; 2) the program reaches the "infected" state; 3) the "infected" state follows Control flow is propagated to the output. Therefore, the fact that the erroneous statement is executed is only a necessary condition for failure to occur, but not a sufficient condition. A test case that only satisfies condition 1) but still passes is called a test case with weak chance correctness, while a test case that satisfies conditions 1) and 2) but still passes is called a test case with strong chance correctness. The occasional correct test cases referred to below refer to the former.

2009年,Wes Masri等人提出了几种影响CBFL错误定位效果的因素,偶然性正确的测试用例名列其中。也就是说,当测试用例集中存在有偶然性正确的测试用例时,错误语句的可疑度会被其影响而降低。In 2009, Wes Masri et al. proposed several factors that affect the effect of CBFL error localization, and the test cases that are accidentally correct are listed among them. That is to say, when there are occasionally correct test cases in the test case set, the suspiciousness of the wrong statement will be reduced by its influence.

近几年来,聚类分析被引入了测试用例选择的领域中。通过对测试用例的执行剖面进行聚类,拥有相似执行路径/行为特征的测试用例被聚集到同一个类簇中。利用这一特点,Vangala等人通过对原始的测试用例集进行聚类,来识别测试用例集中的冗余测试用例。无独有偶,Dickinson等人也利用了聚类分析来做测试用例选择,并且提出了聚类过滤(cluster filtering)的概念。这种技术先对测试用例的执行剖面进行聚类,然后利用某种抽样技术,从每个类簇中抽取一些测试用例来表示整个类簇。这种用部分抽样所得的测试用例来代表整个测试用例集的方法大大约简了测试用例的个数。In recent years, cluster analysis has been introduced into the field of test case selection. By clustering the execution profiles of test cases, test cases with similar execution paths/behavioral characteristics are gathered into the same cluster. Taking advantage of this feature, Vangala et al. identified redundant test cases in the test case set by clustering the original test case set. Coincidentally, Dickinson et al. also used cluster analysis to select test cases and proposed the concept of cluster filtering. This technique clusters the execution profiles of test cases first, and then uses some sampling technique to extract some test cases from each cluster to represent the entire cluster. This method of using partially sampled test cases to represent the entire test case set greatly reduces the number of test cases.

发明内容 Contents of the invention

本发明要解决的问题是:对于基于覆盖度的错误定位技术CBFL,识别并处理原始测试用例集里的偶然性正确的测试用例,从而改进基于覆盖度的自动化错误定位的效果。The problem to be solved by the present invention is: for the coverage-based error localization technology CBFL, identify and process occasionally correct test cases in the original test case set, thereby improving the effect of automatic error localization based on coverage.

本发明的技术方案为:基于覆盖度的错误定位技术的测试用例集优化方法,对于给定的测试用例集T,通过聚类从中识别偶然性正确测试用例,所述偶然性正确测试用例指错误语句被执行,但执行结果仍然为″通过″的测试用例,对识别出的偶然性正确的测试用例进行处理,得到优化的测试用例集用于基于覆盖度的错误定位:The technical solution of the present invention is: a test case set optimization method based on the error location technology of coverage, for a given test case set T, identify the correct test case by clustering, and the correct test case by chance means that the wrong statement is Execution, but the execution result is still "passed" test cases, the identified occasional correct test cases are processed, and the optimized test case set is used for error location based on coverage:

1)在需要测试的目标程序上运行测试用例集T,在运行测试用例的同时,收集测试用例的执行剖面信息,运行完测试用例集T之后,根据输出结果,判定每个测试用例的执行结果为″通过″或者″未通过″;1) Run the test case set T on the target program that needs to be tested. While running the test cases, collect the execution profile information of the test cases. After running the test case set T, determine the execution result of each test case according to the output results "Pass" or "Fail";

2)对得到的执行剖面信息进行聚类;本发明聚类的方法不受限制;2) clustering the obtained execution profile information; the clustering method of the present invention is not limited;

3)识别偶然性正确的测试用例:执行剖面信息进行聚类后,测试用例被划分到若干个类簇中,将那些和″未通过″的测试用例聚集在一个类簇中的″通过″的测试用例标识为偶然性正确的测试用例,并把它们加入到集合Ticc中,集合Ticc即为所识别出的偶然性正确的测试用例的集合;3) Identify test cases that are contingency correct: After performing clustering on the profile information, the test cases are divided into several clusters, and the "passed" tests that are gathered together with the "failed" test cases in one cluster The use cases are identified as occasional correct test cases, and they are added to the set Ticc, which is the set of identified occasional correct test cases;

4)处理偶然性正确的测试用例:任选以下两种方式中的一种处理集合Ticc中的识别结果:4) Handling of occasional correct test cases: choose one of the following two ways to process the recognition results in the set Ticc:

41)过滤策略,将Ticc中的测试用例从测试用例集T中删除;41) filter strategy, the test case in Ticc is deleted from test case collection T;

42)重贴标签策略,将Ticc中的测试用例的执行结果判定标签从″通过″改成″未通过″;42) relabeling strategy, the execution result judgment label of the test case in the Ticc is changed from "passed" to "failed";

标识为偶然性正确的测试用例经过上述处理后,得到优化的测试用例集T’。After the above-mentioned processing is performed on the test cases identified as accidental correctness, an optimized test case set T' is obtained.

由于本发明的偶然性正确测试用例的识别方法利用了测试用例的覆盖度信息,所以该方法仅用于CBFL,但是它适用于属于CBFL的所有错误定位方法。Because the identification method of the occasional correct test case of the present invention utilizes the coverage information of the test case, this method is only used for CBFL, but it is applicable to all error location methods belonging to CBFL.

聚类分析在测试用例选择领域已有应用,本发明在偶然性正确问题上也引入了这种技术。虽然两者都属于测试用例集优化的范畴,但是前者的目的在于缩减测试用例集的大小,这可以帮助程序员尽早地发现错误,减少回归测试的时间,而本发明的目的在于提高测试用例集帮助错误定位的能力,减少程序员查找错误的时间,从而降低调试错误的成本,两者的聚类目标不同,聚类后的处理也不同。Cluster analysis has been applied in the field of test case selection, and the present invention also introduces this technology in the problem of accidental correctness. Although both belong to the category of test case set optimization, the purpose of the former is to reduce the size of test case set, which can help programmers to find errors as early as possible and reduce the time of regression testing, while the purpose of the present invention is to improve test case set The ability to help error location reduces the time for programmers to find errors, thereby reducing the cost of debugging errors. The clustering goals of the two are different, and the processing after clustering is also different.

由于一个类簇中的测试用例拥有相似的执行路径,因此,不难推断,一个类簇中的通过的测试用例可能和这个类簇中的未通过的测试用例一样,经过了错误语句,但是由于它们没有全部满足PIE模型中提出的3个条件,所以没有引发失效。因此,这些通过的测试用例极有可能是偶然性正确的测试用例。Since the test cases in a class cluster have similar execution paths, it is not difficult to infer that the passed test cases in a class cluster may pass through the error statement just like the failed test cases in this class cluster, but due to They do not all meet the three conditions proposed in the PIE model, so no failure is triggered. Therefore, these passing test cases are highly likely to be correct by chance.

本发明的有益效果是:在约简了原测试用例集的大小的同时优化了测试用例集的质量,减少了偶然性正确的测试用例对基于覆盖度的错误定位的干扰作用,从而提高了自动化错误定位的效率和准确度,节省了程序员寻找错误的时间成本。The beneficial effects of the present invention are: while reducing the size of the original test case set, the quality of the test case set is optimized, and the interference effect of occasional correct test cases on error positioning based on coverage is reduced, thereby improving automation error The efficiency and accuracy of positioning saves the time and cost of programmers looking for errors.

附图说明 Description of drawings

图1为本发明的流程示意图。Fig. 1 is a schematic flow chart of the present invention.

图2为本发明实施例中,识别偶然性正确测试用例的准确度,p代表聚类个数的比例,图2(a)-(e)分别表示p=1%,2%,4%,6%,8%。。Fig. 2 is in the embodiment of the present invention, the accuracy of identifying the correct test case of contingency, p represents the ratio of the number of clusters, Fig. 2 (a)-(e) represent respectively p=1%, 2%, 4%, 6 %,8%. .

图3为本发明实施例中,应用过滤策略,对基于覆盖度的错误定位的方法的提高效果,p代表聚类个数的比例,图3(a)-(e)分别表示p=1%,2%,4%,6%,8%。Fig. 3 is in the embodiment of the present invention, applies filtering strategy, to the improving effect of the method for error localization based on coverage, p represents the ratio of the number of clusters, Fig. 3 (a)-(e) represent p=1% respectively , 2%, 4%, 6%, 8%.

图4为本发明实施例中,应用重贴标签策略,对基于覆盖度的错误定位的方法的提高效果,p代表聚类个数的比例,图4(a)-(e)分别表示p=1%,2%,4%,6%,8%。Figure 4 is the embodiment of the present invention, applying the relabeling strategy, the improvement effect of the method based on the coverage of the error location, p represents the ratio of the number of clusters, Figure 4 (a)-(e) respectively represent p=1 %, 2%, 4%, 6%, 8%.

具体实施方式 Detailed ways

本发明将聚类分析应用到偶然性正确的测试用例的挑选问题上,把挑选出的测试用例从原始测试用例集中删除或者改变这些测试用例的执行结果标签,通过以上2种方法来优化原始测试用例集,在优化后的测试用例集上应用已有的自动化错误定位技术,使得错误定位的效率和准确度得到提高。The present invention applies clustering analysis to the selection of test cases with correct chance, deletes the selected test cases from the original test case set or changes the execution result labels of these test cases, and optimizes the original test cases by the above two methods Set, the existing automatic error location technology is applied to the optimized test case set, so that the efficiency and accuracy of error location are improved.

对于给定的测试用例集T,这个测试用例集由2部分组成:Tp和Tf,本发明的目标就是从Tp中识别出Tcc,识别的结果为Ticc,Ticc中的每一个测试用例都有很大的可能性属于Tcc,其中:For a given test case set T, this test case set consists of 2 parts: Tp and Tf, the object of the present invention is to identify Tcc from Tp, the result of recognition is Ticc, and each test case in Ticc has many The big possibility belongs to Tcc, where:

T:对一个给定的程序所使用的测试用例集T: the set of test cases used for a given program

Tp:通过的测试用例的集合Tp: the collection of passed test cases

Tf:未通过的测试用例的集合Tf: collection of failed test cases

Tcc:偶然性正确的测试用例的集合Tcc: a collection of test cases that are accidentally correct

Ticc:所识别出的偶然性正确的测试用例的集合Ticc: the set of identified test cases that are incidentally correct

在实际应用中,需要通过5个步骤来完成本发明的工作,如图1:In practical application, need to finish the work of the present invention by 5 steps, as Fig. 1:

1)在需要测试的目标程序上运行测试用例集。在运行测试用例的同时,收集测试用例的执行剖面信息。运行完测试用例集之后,根据输出结果,判定每个测试用例的执行结果为″通过″或者″未通过″;1) Run the test case set on the target program that needs to be tested. While running the test case, collect the execution profile information of the test case. After running the test case set, according to the output result, it is judged that the execution result of each test case is "passed" or "failed";

2)对执行剖面进行聚类,聚类的方法不受限制,具有相似的执行剖面的测试用例被聚类即可;2) Clustering the execution profiles, the clustering method is not limited, and the test cases with similar execution profiles can be clustered;

3)识别偶然性正确的测试用例;3) Identify test cases that are occasionally correct;

4)处理偶然性正确的测试用例;4) Handle occasional correct test cases;

5)在优化过的测试用例集上应用已有的基于覆盖度的自动错误定位技术。5) Apply the existing coverage-based automatic error location technology on the optimized test case set.

其中,步骤1)、2)、5)在自动化错误定位和聚类分析中都有现成的方法和应用,在此不再赘述。这里主要针对步骤3)、4)进行详细的解释。Among them, steps 1), 2), and 5) have ready-made methods and applications in automatic error location and cluster analysis, and will not be repeated here. The detailed explanation mainly focuses on steps 3) and 4) here.

对执行剖面进行聚类之后,测试用例被划分到若干个类簇中。每个类簇中都可能包含有通过和未通过的测试用例,本发明将那些和未通过的测试用例聚集在一个类簇中的通过的测试用例标识为偶然性正确的测试用例,并把它们加入到集合Ticc中。Ticc中的元素极有可能是偶然性正确的测试用例,理由如下:After clustering the execution profiles, the test cases are divided into several clusters. Each class cluster may contain passed and failed test cases, and the present invention gathers those passed test cases in a class cluster with the failed test cases as occasional correct test cases, and adds them into the set Ticc. Elements in Ticc are highly likely to be correct test cases by chance for the following reasons:

(1)执行过错误语句的测试用例并不一定会引发失效,但反之不成立,未通过的测试用例必然执行过错误语句;(1) A test case that has executed an erroneous statement does not necessarily cause failure, but the opposite is not true, and a test case that fails must have executed an erroneous statement;

(2)具有相似的执行剖面的测试用例会被划分到一个类簇中,这就意味着所挑选出的通过的测试用例和未通过的测试用例具有相似的执行路径。(2) Test cases with similar execution profiles will be divided into a class cluster, which means that the selected passed test cases and failed test cases have similar execution paths.

综上所述,那些被挑选出的测试用例很有可能执行了错误语句,但仍然给出了正确输出,这和偶然性正确的定义相符。In summary, those selected test cases have a high probability of executing the wrong statement, but still giving the correct output, which is consistent with the definition of being correct by chance.

为了处理Ticc,本发明提出了2种不同的策略:To deal with Ticc, the present invention proposes 2 different strategies:

●过滤策略。Ticc中的测试用例会被从原始测试用例集中删除,从而减少这些测试用例对自动化错误定位的干扰作用。●Filter strategy. The test cases in Ticc will be deleted from the original test case set, so as to reduce the interference effect of these test cases on automatic error localization.

●重贴标签策略。Ticc中的测试用例的结果判定标签会被从″通过″改成″未通过″。这样,错误语句的可疑度被提高,可能导致该语句的可疑度排名上升。● Relabeling strategy. The result judgment label of the test case in Ticc will be changed from "Passed" to "Failed". In this way, the suspiciousness of the erroneous statement is increased, which may lead to an increase in the suspiciousness ranking of the statement.

下面通过具体的实施例来说明本发明的实施。The implementation of the present invention will be described below through specific examples.

西门子测试用例集是在学术领域被广泛使用的测试用例集。很多评估软件测试以及错误发现的方法都使用它作为目标程序来进行实验。表1列出了西门子程序的详细信息。The Siemens test case set is a test case set widely used in the academic field. Many methods of evaluating software testing and bug discovery use it as the target program for experimentation. Table 1 lists the details of the Siemens program.

表1 西门子程序的详细信息Table 1 Details of the Siemens program

Figure BSA00000497020700051
Figure BSA00000497020700051

以西门子程序为例,本发明的实施方式如下:Taking the Siemens program as an example, the embodiment of the present invention is as follows:

1、执行测试用例并收集执行剖面。1. Execute test cases and collect execution profiles.

使用gcov(GNU call-coverage profiler)作为收集执行剖面的工具。为此,需要在执行测试用例的自动化脚本中添加编译选项。gcov能够获得语句级的程序覆盖信息。在测试用例ti∈T被执行过后,会产生一个.gcov文件。这个文件记录了每行代码被执行的次数。对测试用例ti来说,它的语句覆盖剖面pi=<e1,e2,e3,...,en>,其中,n代表给定程序的代码行数,如果该行代码被执行过,那么ei=1,否则ei=0。Use gcov (GNU call-coverage profiler) as a tool to collect execution profiles. To do this, compile options need to be added to the automation scripts that execute the test cases. gcov can obtain statement-level program coverage information. After the test case ti∈T is executed, a .gcov file will be generated. This file records the number of times each line of code is executed. For the test case ti, its statement coverage profile pi=<e1, e2, e3, ..., en>, where n represents the number of code lines of a given program, if this line of code has been executed, then ei =1, otherwise ei=0.

2、聚类分析。2. Cluster analysis.

上一步收集的执行剖面是聚类分析的输入。每个测试用例的剖面信息都是聚类的对象。对象的总数和测试用例集T包含的测试用例数相等。我们使用Weka作为聚类工具,用n-维Eudlidean距离作为距离函数。给定2个测试用例t:<e1,e2,...,en>和t′:<e1′,e2′,...,en′>的剖面,这2个测试用例的距离就是:The execution profile collected in the previous step is the input for the cluster analysis. The profile information of each test case is the object of clustering. The total number of objects is equal to the number of test cases contained in the test case set T. We use Weka as the clustering tool and n-dimensional Eudlidean distance as the distance function. Given the profile of 2 test cases t: <e1, e2, ..., en> and t′: <e1′, e2′, ..., en′>, the distance of these 2 test cases is:

DD. (( tt ,, tt &prime;&prime; )) == &Sigma;&Sigma; ii == 11 nno (( ee ii -- ee ii &prime;&prime; )) 22 ..

我们使用简单K-means作为聚类算法。简单K-means使用类簇的个数作为参数。本发明中,这个参数的大小是根据测试用例集T的大小来设定的。令CN代表类簇的个数,CN=|T|*p,|T|是测试用例集T的大小,并且0<p<1。由于本实施例选择K-means聚类方法,该方法使用类簇的个数作为参数,所以代码的长度应该满足一定的条件,使得所有测试用例的执行剖面满足一定的差异度,否则达不到设定的类簇个数。We use simple K-means as the clustering algorithm. Simple K-means uses the number of clusters as an argument. In the present invention, the size of this parameter is set according to the size of the test case set T. Let CN represent the number of clusters, CN=|T|*p, |T| is the size of test case set T, and 0<p<1. Since this embodiment selects the K-means clustering method, which uses the number of clusters as a parameter, the length of the code should meet certain conditions, so that the execution profiles of all test cases meet a certain degree of difference, otherwise it will not reach Set the number of clusters.

3、偶然性正确的测试用例的识别和处理。3. Identification and processing of occasionally correct test cases.

识别偶然性正确的测试用例:执行剖面信息进行聚类后,测试用例被划分到若干个类簇中,将那些和″未通过″的测试用例聚集在一个类簇中的″通过″的测试用例标识为偶然性正确的测试用例,并把它们加入到集合Ticc中,集合Ticc即为所识别出的偶然性正确的测试用例的集合;Identify test cases that are occasionally correct: After performing clustering on the profile information, the test cases are divided into several clusters, and those "passed" test cases are identified in a cluster with the "failed" test cases For the test cases that are occasionally correct, and add them to the set Ticc, the set Ticc is the set of identified test cases that are occasionally correct;

处理偶然性正确的测试用例:任选以下两种方式中的一种处理集合Ticc中的识别结果:Handling of occasional correct test cases: choose one of the following two ways to process the recognition results in the set Ticc:

1)过滤策略,将Ticc中的测试用例从测试用例集T中删除;1) filtering strategy, the test cases in Ticc are deleted from the test case set T;

2)重贴标签策略,将Ticc中的测试用例的执行结果判定标签从″通过″改成″未通过″;2) Relabeling strategy, changing the execution result judgment label of the test case in Ticc from "pass" to "fail";

标识为偶然性正确的测试用例经过上述处理后,得到优化的测试用例集T’。After the above-mentioned processing is performed on the test cases identified as accidental correctness, an optimized test case set T' is obtained.

上述识别和处理可以使用Java开发编写的程序实现,该程序以第2步的聚类结果和每个测试用例的执行结果为输入,按照上述识别和处理偶然性正确的测试用例所描述的方法挑选并处理偶然性正确的测试用例。The above identification and processing can be implemented using a program written in Java. The program takes the clustering results of the second step and the execution results of each test case as input, selects and processes the test cases described above for identifying and processing contingency correct test cases and Handle occasional correct test cases.

4、错误定位。4. Wrong positioning.

使用Tarantula作为基于覆盖度的错误定位方法。它是第一个将基于频谱的排序方法应用到软件诊断领域的系统。它的输入是经过约简和优化后的测试用例集,输出按照可疑度从大到小排列的可疑语句的列表。程序员可以根据该列表逐个检查相关语句,直到找到错误语句为止。Use Tarantula as a coverage-based error localization method. It is the first system to apply spectrum-based ranking methods to the field of software diagnostics. Its input is a reduced and optimized test case set, and the output is a list of suspicious statements arranged in descending order of suspiciousness. Programmers can check related statements one by one against the list until an erroneous statement is found.

图2-4为本发明在西门子程序上的实验效果图。Fig. 2-4 is the experimental effect diagram of the present invention on the Siemens program.

图2表示的是本发明的识别偶然性正确测试用例的准确度,p代表聚类个数的比例,图2(a)-(e)分别表示p=1%,2%,4%,6%,8%。“FN”和“FP”分别代表“”“false negative”和“false positive”。“False negative”的计算公式为:|Tcc-Ticc|/|Tcc|,这个度量值评估了本发明识别偶然性正确的测试用例的能力,也就是说,本发明是否能够尽可能多地识别出偶然性正确的测试用例。这个度量值越小越好。“false positive”的计算公式为:|(Tp-Tcc)∩Ticc|/|Tp-Tcc|,这个度量值评估了本发明识别偶然性正确的测试用例的正确性。也就是说,本发明是否能够尽可能少地将其他测试用例误认为是偶然性正确的测试用例。横坐标代表了“FN”和“FP”所在的区间,纵坐标代表了落在相应区间的程序版本所占的比例。What Fig. 2 represented is the accuracy of the correct test case of identifying contingency of the present invention, and p represents the ratio of the number of clusters, and Fig. 2 (a)-(e) represents p=1%, 2%, 4%, 6% respectively ,8%. "FN" and "FP" stand for "" "false negative" and "false positive" respectively. The calculation formula of "False negative" is: |Tcc-Ticc|/|Tcc|, this metric evaluates the ability of the present invention to identify test cases with contingency correctness, that is, whether the present invention can identify contingency as much as possible correct test case. The smaller this metric, the better. The calculation formula of "false positive" is: |(Tp-Tcc)∩Ticc|/|Tp-Tcc|, this metric evaluates the correctness of the present invention to identify test cases that are contingency correct. That is to say, whether the present invention can mistake other test cases as accidental correct test cases as little as possible. The abscissa represents the range where "FN" and "FP" are located, and the ordinate represents the proportion of program versions that fall in the corresponding range.

图3表示的是应用过滤策略,本发明对基于覆盖度的错误定位的方法的提高效果,p代表聚类个数的比例,图3(a)-(e)分别表示p=1%,2%,4%,6%,8%。What Fig. 3 represented is to apply filter strategy, the present invention is to the improving effect of the method for error localization based on coverage, p represents the ratio of clustering number, and Fig. 3 (a)-(e) represent respectively p=1%, 2 %, 4%, 6%, 8%.

图4表示的是应用重贴标签策略,本发明对基于覆盖度的错误定位的方法的提高效果,p代表聚类个数的比例,图4(a)-(e)分别表示p=1%,2%,4%,6%,8%。What Fig. 4 represents is to apply relabeling strategy, the present invention is to the improving effect of the method for the error localization based on coverage, p represents the ratio of clustering number, Fig. 4 (a)-(e) represent p=1% respectively, 2%, 4%, 6%, 8%.

图3和图4用箱线图表示了对每个目标程序而言T-score reduction的统计结果,T-scorereduction △TS=TS-TS’,其中,TS和TS’分别代表了在应用本发明之前和之后的T-score。T-score是用来评估错误定位方法的有效的度量值。它代表了为了发现错误所需检查的代码占总代码量的比例。这个度量值越小越好。用公式表示T-score的含义如下:Fig. 3 and Fig. 4 have represented the statistical result of T-score reduction for each target program with the box plot, T-scorereduction △ TS=TS-TS', wherein, TS and TS ' have represented respectively in applying the present invention T-score before and after. T-score is an effective metric for evaluating error localization methods. It represents the proportion of code that needs to be checked in order to find errors. The smaller this metric, the better. The meaning of the T-score expressed by the formula is as follows:

TS=|Vexamined|/|V|*100%TS=|Vexamined|/|V|*100%

其中,|V|代表了目标程序的可执行语句的总数,|Vexamined|代表了为了找到错误语句,程序员需要检查的代码行数。因此,T-score reduction的值越大,意味着对错误定位的改进效果越好。Among them, |V| represents the total number of executable statements of the target program, and |Vexamined| represents the number of lines of code that the programmer needs to check in order to find the wrong statement. Therefore, the larger the value of T-score reduction, the better the improvement of error localization.

图3和图4的箱图的上下2条线分别代表了第三四分位数和第一四分位数。箱图中间的横线代表了中位数,而黑点代表了平均数。箱子上方和下方的点分别代表了最大值和最小值。The upper and lower lines of the boxplots in Figures 3 and 4 represent the third quartile and the first quartile, respectively. The horizontal line in the middle of the boxplot represents the median, while the black dot represents the mean. The points above and below the box represent the maximum and minimum values, respectively.

作为参考,图3和图4还显示了理想情况下使用各自的策略对CBFL效果的影响。所谓的理想情况,就是假设所有的偶然性正确的测试用例都被挑选出来的情况,即“falsenegative”和“false positive”都是0%的情况。For reference, Figures 3 and 4 also show the effect of CBFL using the respective strategies ideally. The so-called ideal situation is the situation where it is assumed that all the occasional correct test cases are selected, that is, the situation where "false negative" and "false positive" are both 0%.

Claims (1)

1. the test suite optimization method of the location of mistake technology based on coverage, it is characterized in that for given test use cases T, by cluster, therefrom identify the correct test case of contingency, the correct test case of described contingency refers to that mistake statement is performed, the test case of " passing through " but execution result is still, the test case that the contingency identifying is correct is processed, and the test use cases being optimized is for the location of mistake based on coverage:
1) on the target program of needs test, move test use cases T, in operation test case, collect the execution profile information of test case, after having moved test use cases T, according to Output rusults, the execution result of judging each test case as " pass through " or " by ";
2) the execution profile information obtaining is carried out to cluster;
3) the correct test case of identification contingency: execution profile information is carried out after cluster, test case is divided in several classes bunch, by the test case of those and " not by " be gathered in a class bunch " by " test case be designated the test case that contingency is correct, and they are joined in set Ticc, set Ticc is the set of the test case that identified contingency is correct;
4) process the correct test case of contingency: a kind of recognition result of processing in set Ticc in optional following two kinds of modes:
41) filtering policy is deleted the test case in Ticc from test use cases T;
42) relabel strategy, by the execution result of the test case in Ticc judge label from " by " make " not passing through " into;
Be designated test case that contingency is correct after above-mentioned processing, the test use cases T ' being optimized;
5) by using Tarantula system as the location of mistake based on coverage, by input, through the test use cases T ' optimization, the list of the suspicious statement that output is arranged from big to small according to suspicious degree, checks correlative one by one according to this list, until find wrong statement.
CN201110126632.9A 2011-05-13 2011-05-13 Test Case Collection Optimization Method Based on Coverage-Based Error Location Technology Expired - Fee Related CN102193864B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110126632.9A CN102193864B (en) 2011-05-13 2011-05-13 Test Case Collection Optimization Method Based on Coverage-Based Error Location Technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110126632.9A CN102193864B (en) 2011-05-13 2011-05-13 Test Case Collection Optimization Method Based on Coverage-Based Error Location Technology

Publications (2)

Publication Number Publication Date
CN102193864A CN102193864A (en) 2011-09-21
CN102193864B true CN102193864B (en) 2014-02-26

Family

ID=44601960

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110126632.9A Expired - Fee Related CN102193864B (en) 2011-05-13 2011-05-13 Test Case Collection Optimization Method Based on Coverage-Based Error Location Technology

Country Status (1)

Country Link
CN (1) CN102193864B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10037264B2 (en) 2015-04-29 2018-07-31 Hcl Technologies Ltd. Test suite minimization

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2986879B1 (en) * 2012-02-15 2014-10-17 Airbus Operations Sas METHOD AND SYSTEM FOR DETECTING ANOMALIES SOLVING IN AN AIRCRAFT
CN102708052B (en) * 2012-04-27 2017-10-20 北京邮电大学 Software fault automatic positioning method in a kind of unit testing
CN102799525A (en) * 2012-07-04 2012-11-28 中国科学技术大学 Method and apparatus for generating test case
CN103744789B (en) * 2014-01-23 2017-01-11 中国科学院软件研究所 Method of locating software errors by 3D surface representation
CN105512021A (en) * 2014-09-25 2016-04-20 阿里巴巴集团控股有限公司 Method and device for Diff analysis used for software testing
CN105117331B (en) * 2015-08-17 2018-04-13 浪潮(北京)电子信息产业有限公司 Coincidence correctness test case recognition methods and device towards location of mistake
CN109254924B (en) * 2018-09-28 2022-02-08 中国科学院长春光学精密机械与物理研究所 A software fault location method, apparatus, device and readable storage medium
CN111026671B (en) * 2019-12-16 2023-11-03 腾讯科技(深圳)有限公司 Test case set construction method and test method based on test case set
CN111881033A (en) * 2020-07-23 2020-11-03 深圳慕智科技有限公司 Deep learning model quality evaluation method based on operation environment error analysis
CN112559377A (en) * 2020-12-25 2021-03-26 上海高顿教育科技有限公司 Method and device for generating first test case
CN114328228B (en) * 2021-12-29 2024-07-19 北京华峰测控技术股份有限公司 Software error verification method, device and system based on test case extension

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101814055A (en) * 2010-04-06 2010-08-25 南京大学 Sampling method for test cases in clusters
CN101866317A (en) * 2010-06-29 2010-10-20 南京大学 A Regression Test Case Selection Method Based on Cluster Analysis

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101814055A (en) * 2010-04-06 2010-08-25 南京大学 Sampling method for test cases in clusters
CN101866317A (en) * 2010-06-29 2010-10-20 南京大学 A Regression Test Case Selection Method Based on Cluster Analysis

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
An Improved Regression Test Selection Technique by Clustering Execution Profiles;Zhenyu Chen,etc;《2010 10th International Conference on Quality Software》;20100715;171-178 *
Zhenyu Chen,etc.An Improved Regression Test Selection Technique by Clustering Execution Profiles.《2010 10th International Conference on Quality Software》.2010,171-178.

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10037264B2 (en) 2015-04-29 2018-07-31 Hcl Technologies Ltd. Test suite minimization

Also Published As

Publication number Publication date
CN102193864A (en) 2011-09-21

Similar Documents

Publication Publication Date Title
CN102193864B (en) Test Case Collection Optimization Method Based on Coverage-Based Error Location Technology
Mao et al. Slice-based statistical fault localization
D'Ambros et al. On the relationship between change coupling and software defects
CN103294594B (en) A kind of wrong report of the static analysis based on test removing method
US20130024842A1 (en) Software test automation systems and methods
CN105159827B (en) A Reliability Acceleration Testing Method for GUI Software
CN103294596B (en) A contractual software fault warning method based on program invariants
CN103995780B (en) A kind of program error localization method based on sentence frequency statistics
CN107025169B (en) Software error hierarchical diagnosis method based on Bayesian network inference
CN106886490B (en) A Method of Locating Program Errors Based on Failure Trajectories
CN103198016B (en) Based on combining the software error localization method relying on probabilistic Modeling
CN104572474B (en) A kind of lightweight location of mistake Implementation Technology based on Dynamic Slicing
CN104503908A (en) Predicate frequency statistics based software fault locating method
Bodhe et al. Reduction of diagnostic fail data volume and tester time using a dynamic N-cover algorithm
CN109165155B (en) A method for extracting software defect repair templates based on cluster analysis
CN102521130B (en) Error location method based on cluster invariant analysis
CN106681851A (en) Defect report missing analysis and solving method of code-level memory in program
CN107102942B (en) Input domain error positioning-based minimum fault positioning method
Li et al. IRBFL: an information retrieval based fault localization approach
Kaur et al. A quantitative investigation of software metrics threshold values at acceptable risk level
Chandrasekaran et al. Evaluating the effectiveness of ben in localizing different types of software fault
CN108804308B (en) New version program defect detection method and device
Wang et al. Invariant based fault localization by analyzing error propagation
CN103150254B (en) Error locating method for software based on state-dependent probabilistic modeling
CN102043710A (en) Testing system for visualization software

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent of invention or patent application
CB03 Change of inventor or designer information

Inventor after: Chen Zhenyu

Inventor after: Zhao Zhihong

Inventor after: Jiu Yi

Inventor after: Ji Changbin

Inventor after: Zhang Zhidie

Inventor before: Zhao Zhihong

Inventor before: Jiu Yi

Inventor before: Chen Zhenyu

Inventor before: Ji Changbin

COR Change of bibliographic data

Free format text: CORRECT: INVENTOR; FROM: ZHAO ZHIHONG MIAO YI CHEN ZHENYU JI CHANGBIN TO: CHEN ZHENYU ZHAO ZHIHONG MIAO YI JI CHANGBIN ZHANG ZHIYI

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: 20140226

Termination date: 20170513

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