探究:软件工程中的test oracle到底是什么意思?

前言

在百度上查找test oracle,但是没有找到我想要的结果,于是我深入搜索并整理出test oracle的释义,在此记录。

1. 简介

一开始搜索test oracle,返回的最佳结果就是:参考知乎网页 https://www.zhihu.com/question/30250441 [1]

里面说到:

测试准则–CSTQB中的术语oracle是ISTQB中ETM(ISTQB专家级-测试管理)的内容oracle的中文术语为【结果参照物】test oracle是ISTQB中F-AT(ISTQB基础级扩展敏捷测试)的内容test oracle的中文术语为【测试结果参照物】意为:在测试时确定与实际结果进行比较的预期结果的源。它可能包括现有系统(作基准)、用户手册、或个人的专业知识等,但不是代码。[与Adrion 一致]

我感觉这个定义还是不够,也没有足够的证据支撑,所以决定自己探索一下。

2. 探究过程

2.1 在百度学术上以“test oracle”为关键字进行搜索

根据搜索结果及显示出来的文章摘要,我选择了两篇文章并下载:

1)Xie T. Augmenting Automatically Generated Unit-Test Suites with Regression Oracle Checking[J]. 2006, 4067:380-403.
这篇文章是软工领域(尤其是软件自动测试方向)著名学者谢涛教授的文章。很厉害

2)Tu D, Chen R, Du Z, et al. A Method of Log File Analysis for Test Oracle[C]// International Conference on Scalable Computing and Communications; Eighth International Conference on Embedded Computing, 2009. Scalcom-Embeddedcom. IEEE, 2009:351-354.
这个也讲的是test oracle相关的内容。

其中,文章1)给了一个很明确的定义

A test case consists of two parts: a test input to exercise the program under test and a test oracle to check the correctness of the test execution. A test oracle is often in the form of executable assertions such as in the JUnit testing framework. Manually generated test cases are valuable in exposing program faults in the current program version or regression faults in future program versions.

这里说的是:1个测试用例 = 1个测试输入(test input) + 1个test oracle。test input(测试输入)是用来执行程序的,测试oracle是用来检查测试执行的正确性的。且test oracle通常是以可执行的assertions语句(比如在JUnit test 框架中)的形式出现的。

看到这里我觉得test oracle的定义和形式就比较清楚了:
首先,test oracle是测试用例的一部分,而且是用来检查测试输入执行过后产生结果的正确性的;
其次,test oracle常常以可执行的assertions语句出现(比如JUnit测试中的assertEquals和assertTrue函数,其操作可参考[4]

此外,[5] 对test oracle有进一步理解:
在这里插入图片描述
这里也说的很清楚。test oracle的概念是很明确的(即:就是用来检查程序的输出是不是正确的),但是它的形式却很宽泛,可以使程序,可以是文档,甚至可以是人(震惊= =)。

在这里插入图片描述
这里也说的很有趣,巧妙的使用test oracle能够减轻程序员的测试负担。

[6]还补充了oracle的概念和构成:

An oracle is a mechanism for determining whether the program has passed or failed a test.


A complete oracle would have three capabilities and would carry them out perfectly:


1)A generator, to provide predicted or expected results for each test.
2)A comparator, to compare predicted and obtained results.
3)An evaluator, to determine whether the comparison results are sufficiently close to be a pass.

wiki百科[7]也有相关定义。

但是呢,问题出现了:test oracle用中文到底怎么说??
所以有了更进一步的查阅。

2.2 查找test oracle中文表述

在谷歌翻译中[8]中找到:
在这里插入图片描述

所以最后我倾向于认为:
test oracle的中文表述是:测试预言
(之前好像也有老师讲过这个术语,但是我记不清 了)

3. 总结

每次写CSDN都要半小时,这还是我在已经找好所有资料(仔细阅读了网页,明白了概念)的情况下。转化成文字还是费时间。

可能是自己的功力不够。
僵硬…

继续努力鸭。

参考文献

[1] 软件测试中的test oracle指什么? https://www.zhihu.com/question/30250441

[2] Xie T. Augmenting Automatically Generated Unit-Test Suites with Regression Oracle Checking[J]. 2006, 4067:380-403.

[3] Tu D, Chen R, Du Z, et al. A Method of Log File Analysis for Test Oracle[C]// International Conference on Scalable Computing and Communications; Eighth International Conference on Embedded Computing, 2009. Scalcom-Embeddedcom. IEEE, 2009:351-354.

[4] junit 方法:assertEquals 和 assertTrue. https://blog.csdn.net/expect521/article/details/77747964

[5] What is a test oracle, and what is it used for? https://stackoverflow.com/questions/23522166/what-is-a-test-oracle-and-what-is-it-used-for

[6] A Course in Black Box Software Testing-Examples of Test Oracles. http://www.testingeducation.org/k04/OracleExamples.htm

[7] Test oracle. https://en.wikipedia.org/wiki/Test_oracle

[8] oracle. https://translate.google.com/#en/zh-CN/oracle

  • 87
    点赞
  • 45
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值