google搜索 51Testing站内搜索                    软件测试门户 | 软件测试培 训 | 文章资料精选 | 软件测试论坛 | 软件测试博客 | 测试招聘求职 
打印

【原创】Metamorphic Testing 蜕变测试 简介

【原创】Metamorphic Testing 蜕变测试 简介


下面是一个比较正式的关于蜕变测试(Metamorphic Testing)的定义:
Metamorphic testing is used in conjunction with other test case selection strategies Given a test case selection strategy S, such as path coverage, a set of test cases T ={t1,t2,t3...tn} , where is n>=1 generated. The program is then tested on T . If no failure is revealed after running all in T for i = 2, .. . , n,then T will be a set of successful test cases.

At this stage, metamorphic testing can be carried out to generate follow-up test cases according to metamorphic relations. A metamorphic relation (MR) is an expected relation among the inputs and outputs of multiple executions of the target program. For a successful test case and a chosen MR, we can construct follow-up test say ti' and run the program again. Let p denote the program under test. We check ti, p(ti),ti' and p(ti')against the MR. If MR cannot be satisfied, the program must have failed.

简而言之,蜕变测试是利用一些成功的测试用例来产生后续测试用例的一种技术,我们将后续的测试用例和前者之间的关系称作metamorphic relation(MR)。举一个很简单的例子来说,假设我们有一个计算sin函数的程序(输入值为弧度),一般情况下我们可以利用一些特殊值去进行测试,比如sin(0)=0,sin(Pi/2)=1 等。但是假设我们有这么一个测试用例sin(2)其程序结果为0.909,那我们如何能判定这个结果的正确性呢?这种情况下,我们可以根据一些已知的MR去产生后续测试用例进行测试,比如sin(x)=-sin(-x),sin(x)=sin(pi-x)(这就是MR)等。如果有任何违反以上关系的情况发生,那么我们就可以认定程序中存在错误。

当然实际工作中的情况远比所举的例子要复杂,但这可以作为在测试中的一个新思路去更好地发现BUG

TOP

学习一下

TOP

 
当前时区 GMT+8, 现在时间是 2008-10-12 03:46Copyright(C)上海博为峰软件技术有限公司 2001-2007 电话:021-64471599-8017
当您在访问网站、论坛及博客过程中遇到问题时可发送email:webmaster@51testing.com或发送论坛短信至管理员风在吹