无忧论文网 · 始于1999 · 学术论文辅导与论文发表推荐服务

扩展的Metamorphic测试

栏目
论文
具体类型
硕士毕业论文
语言
中文
用途
范文参考
更新
分类标签
自然科学计算机科学计算机应用
原站著录信息
原编号
lw200702131149226495
原文字数
33,504 字
原文件格式
DOC
原库登记日期
2007-02-13

摘要

摘 要 测试是保证软件质量最实际也是最常用的方法。测试的最终目的是确保交给用户的产品的功能符合用户的需求,把尽可能多的问题在产品交给用户之前发现并改正。为保证软件的质量,测试技术成为人们关注的热点。这些技术用于测试软件的内部逻辑和外部接口,以便发现程序在功能、行为和性能方面的错误。 测试中存在着基础性的测试困难——oracle问题。 为克服oracle问题带来的困难,提出了一些不依赖oracle的测试方法, Metamorphic测试(MT)是其中之一。Metamorphic测试依据程序的重要属性,产生连续测试用例…

摘 要

测试是保证软件质量最实际也是最常用的方法。测试的最终目的是确保交给用户的产品的功能符合用户的需求,把尽可能多的问题在产品交给用户之前发现并改正。为保证软件的质量,测试技术成为人们关注的热点。这些技术用于测试软件的内部逻辑和外部接口,以便发现程序在功能、行为和性能方面的错误。

测试中存在着基础性的测试困难——oracle问题。 为克服oracle问题带来的困难,提出了一些不依赖oracle的测试方法, Metamorphic测试(MT)是其中之一。Metamorphic测试依据程序的重要属性,产生连续测试用例来检测程序,而不是依据oracle来检测程序。测试结果不满足程序的重要属性则可判断程序有错。它的特点是检测几个输出之间的关系来判断程序是否正确,而不是判定单个输出结果是否正确。

由于MT方法是一种新的测试方法,它的适用范围和查错能力还需要进行进一步的考察。程序实现的功能不同使用的MT测试策略也不尽相同,测试的效果随测试关系的不同而有差别。确定测试关系是MT方法的关键,有必要进一步研究测试关系的选择和确定方法。

扩展的MT方法提出一种新的确定测试关系(MR)的方法。由于MT方法至少运行程序两遍。在运行第二个测试用例前,第一次的运行结果已经存在。因此第二个测试用例的产生,可以利用到已有输出结果的信息。扩展的MT方法将测试关系扩展为输入之间,输入和已有输出之间,输出之间三方面的关系,测试用例在测试程序的过程中产生。

为考察扩展的MT方法的查错能力,并与传统的MT方法进行比较,使用这两种方法测试0-1背包,最小生成树和哈夫曼编码三个算法程序。共测试了78种错误的情况,每一情况进行10500次随机测试,统计出针对单个错误而言的报错率和对所有错误而言的可查出错误的覆盖率。实验的结果表明,扩展的MT方法有较好的查错能力。通过三个对比实例验证了扩展的MT方法的有效性。说明利用已有输出结果信息,确定Metamorphic关系是一种可行,有效的方法。

关键词:软件测试,属性测试,测试关系,测试用例,0-1背包,最小生成树,哈夫曼编码

Abstract

Testing is the most popular method for assuring software quality. Testing is a process of executing a program with the intent of finding an error. People pay close attention to test technology. The technology is used for testing logic of the components of the software and outside interfaces, in order to find and correct the mistakes of the behavior and performance.

Oracle problem is one limitations of testing. In order to alleviate the oracle problem, some approaches have been proposed, one of them is Metamorphic testing (MT). It has been proposed by Chen et al. as a property-based test case selection strategy. It can be implemented regardless of whether an oracle is available. If we give several related inputs to a program, then their corresponding outputs must also have some relation among each other. Metamorphic testing checks these relations among several executions. If they do not satisfy the expected relations then a failure is detected. These relations among inputs and outputs named metamorphic relations (MR).

Because MT is a new method of testing, its scope of application and ability of checking mistakes need be further investigated. If functions of programs are not the same, they will use difference test strategies. How to identify a test strategy for a program is the key to MT. It is necessary to research the method to identify and select metamorphic relations.

Extended MT developed a new approach to identify metamorphic relations. It generates follow-up test cases not only according to relations of inputs but also using existing output information. MT method operates the procedure twice at least. Before the second running the target program, the first operation result had already existed. So the second test case can be generated from the first test case according to the existed output. Extended MT concerns the relations of inputs, the relations of input and existed output, and the relations of outputs. Test cases are generated during the process of testing.

We study the effect of applying Extended MT to alleviate the oracle problem for algorithms. We discuss three cases. They are: 0-1 knapsack algorithm, Minimum Spanning Tree algorithm and Huffman code algorithm. We identify metamorphic relations according to extended MT, and also identify metamorphic relations according to traditional MT for each target case. Using them to test the target program, and compare their ability of checking mistakes. 10500 random test values are used to test each mutant program. A fault is injected to a program, called a mutant program. We all test 78 mutant programs. The paper demonstrated the extended MT is more effective than traditional MT in algorithm area and using existed output to generate a follow-up test case is an available approach to identify metamorphic relations.

Keywords: software testing, metamorphic testing, metamorphic relations, test cases, 0-1knapsack, Minimum Spanning Tree, Huffman code

目 录

摘 要 ……………………………………………………………………………………………2

Abstract……………………………………………………………………………………………3

目 录 ……………………………………………………………………………………………4

第一章 引 言……………………………………………………………………………………6

1.1 测试方法简介………………………………………………………………………………6

1.2 测试中存在的问题…………………………………………………………………………6

1.2.1 可靠集问题…………………………………………………………………………… 7

1.2.2 oracle问题……………………………………………………………………………7

1.3 国内外发展概况……………………………………………………………………………7

1.3.1 相关研究………………………………………………………………………………7

1.3.2 Metamorphic测试(MT)………………………………………………………………8

1.3.3 MT方法与相关测试方法的区别……………………………………………………8

1.4 论文的工作及内容安排……………………………………………………………………9

第二章 Metamorphic测试(MT)方法…………………………………………………………10

2.1 MT方法简介…………………………………………………………………………… 10

2.2 MT方法分析…………………………………………………………………………… 10

2.3 MT已取得的研究成果………………………………………………………………… 11

2.4 MT的局限性…………………………………………………………………………… 12

第三章 扩展MT方法………………………………………………………………………… 13

3.1 扩展的MT方法………………………………………………………………………… 13

3.1.1 提出扩展MT方法的必要性…………………………………………………………13

3.1.2 扩展的MT方法………………………………………………………………………14

3.1.3 与传统MT方法的比较………………………………………………………………14

3.1.4 应用前景………………………………………………………………………………15

3.2 应用扩展的MT方法测试0-1背包算法……………………………………………… 15

3.2.1 简介0-1背包算法……………………………………………………………………15

3.2.2 测试0-1背包算法的具体策略………………………………………………………16

3.3 应用扩展的MT方法测试最小生成树算法………………………………………………17

3.3.1 简介最小生成树算法…………………………………………………………………17

3.3.2 测试最小生成树算法的具体策略……………………………………………………18

3.4 应用扩展的MT方法测试哈夫曼编码算法…………………………………………… 19

3.4.1 简介哈夫曼编码算法…………………………………………………………………19

3.4.2 测试哈夫曼编码算法的具体策略……………………………………………………20

第四章 实验工具的开发………………………………………………………………………23

4.1 需求分析…………………………………………………………………………………23

4.1.1 功能需求………………………………………………………………………………23

4.1.2 性能需求………………………………………………………………………………24

4.2 概要设计…………………………………………………………………………………24

4.2.1 主要模块………………………………………………………………………………24

4.2.1 模块接口………………………………………………………………………………25

4.3 详细设计…………………………………………………………………………………26

4.3.1 0-1背包模块 …………………………………………………………………………26

4.3.2 最小生成树模块………………………………

全文与附件

提交申请后,可在会员中心查看原件和附件的查找进度。

申请查询全文与附件