sigma-delta

简化失败的测试用例 (Simplify the Failing Test Case)

In software engineering, we write bugs and we want to catch them. Particularly in production-level solutions, our inputs can be fairly large and once it induces a software failure, we are lost and scratching our heads trying to identify sections of the input that trigger the failure. Once the input segments are isolated, it would be much easier to trace the program points where the bugs are hiding. In essence, we want a systematic approach to simplify and reduce a large failing input into the minimum form and still be able to reproduce the same error.

在软件工程中,我们编写错误并希望捕获它们。 特别是在生产级解决方案中,我们的输入可能会很大,一旦导致软件故障,我们就会迷失方向,摸索着试图找出触发故障的输入部分。 一旦隔离了输入段,就可以更容易地跟踪隐藏了错误的程序点。 本质上,我们需要一种系统化的方法来简化和减少大量的失败输入,并将其减少为最小形式,并且仍然能够再现相同的错误

Suppose we have a large HTML file (896 lines) causing a failure in the web browser, the graph below (red cross indicates test fail and green tick indicates test pass) illustrates the steps we partition the failing HTML file and gradually shrink the segment size which eventually isolate the bug-inducing segment of “<SELECT>”. Instead of using the original failing HTML file, we could reproduce the same error using a new HTML file with just keyword “SELECT”.

假设我们有一个较大HTML文件(896行),导致Web浏览器失败,下图(红叉表示测试失败,绿色对勾表示测试通过)说明了对失败HTML文件进行分区并逐步缩小段大小的步骤最终隔离了引起错误的段“ <SELECT> ”。 代替使用原始的失败HTML文件,我们可以使用仅带有关键字“ SELECT ”的新HTML文件来重现相同的错误。

Illustration of Simplifying Failing Inputs
简化失败的输入的图示

If you pay close attention, the above process of partitioning and searching is like a binary search — for each iteration, we recursively reduce the search space by half on the segment that induces the error. Does the binary search fit this use case and call it a day? Not necessarily, the last few steps are unlikely achieved by binary search and the algo could probably stop at the input size of 40 characters as a further partitioning results in the test passes for both subsets (substring <SELECT NAME= “priori (20 characters) will not induce the error). Though the 40-character reduced input is a satisfactory solution, it is not the minimum test case that induces the same error. So how minimum is minimum?

如果您密切注意,上面的分区和搜索过程就像一个二进制搜索-对于每次迭代,我们将在导致错误的段上递归地将搜索空间减少一半。 二进制搜索是否适合此用例并称之为一天? 不一定,二进制搜索不太可能实现最后几步,算法可能会以40个字符的输入大小停止,因为两个子集的测试通过进一步划分结果(子字符串<SELECT NAME =“ priori (20个字符)不会导致错误)。 尽管减少40个字符的输入是令人满意的解决方案,但并不是最小的测试用例会导致相同的错误。 那么最小值如何最小?

定义极简 (Defining Minimality)

In the above browser failure example, the 8-character “<SELECT>” is the global minimum as it is the smallest input that induces the failure. Ideally, we want our algorithm to reach such a global minimum but in practice, it incurs too much computation cost and requires an exponential number of passes. We plan to strike a balance between the computational cost and minimality (how close the size of the generated test case relates to the global minimum).

在上面的浏览器故障示例中,8个字符“ <SELECT> ”是全局最小值,因为它是引发故障的最小输入。 理想情况下,我们希望我们的算法达到这样的全局最小值,但在实践中,它将招致过多的计算成本,并且需要成倍的通过次数。 我们计划在计算成本和最小值之间取得平衡(生成的测试用例的大小与全局最小值之间的接近程度)。

Minimality of Test Case
测试用例的最小化

The above slide illustrates the relationship between different levels of minimality. From 1-minimal to global minimum, it represents a shrinking input space, tighter conditions, and more computation required. The 1-minimal is the weakest form of all the minimality. In practice, this is the form that our algorithm plans to identify systematically and automatically.

上面的幻灯片说明了不同最小级别之间的关系。 从1最小值到全局最小值,它表示缩小的输入空间,更严格的条件以及所需的更多计算。 1个最小值是所有最小值中的最弱形式。 实际上,这是我们的算法计划自动识别的形式。

Delta调试 (Delta Debugging)

The earlier paragraph mentioned the situation where binary search could not further divide the input space and induce the failure (both subsets pass the test). To tackle this and increase the probability of eventually getting a smaller & failing subset, we could either 1) test larger subsets 2) test smaller subsets. The delta debugging algorithm alternatively applies these two strategies to reach a 1-minimal solution.

前面的段落提到了二进制搜索无法进一步划分输入空间并导致失败(两个子集都通过测试)的情况。 为了解决此问题并增加最终获得较小且失败的子集的可能性,我们可以1)测试较大的子集2)测试较小的子集。 增量调试算法也可以应用这两种策略来达到1最小值的解决方案。

The failing input C_f input = C_fset n (partition_size)while (input.size >=n) {     partition input into n equal subsets: input = Δ_1 Δ_2 Δ_3... Δ_n (delta list)     get n corresponding complements of ∇_i: ∇_1, ∇_2, ... ∇_n where ∇_i = input - Δ_i (nabla list)

     // reduce to the failing subset in next iteration     if (any Δ_i induces failure) {         input = Δ_i     }      // reduce to the failing complement in next iteration     elif (any ∇_i induces failure) {         input = ∇_i         n = n - 1     }      // increase granularity, search finer space     else {         n = n * 2     }}

This algorithm is called “Minimizing Delta Debugging Algorithm” from this paper. It systematically executes the above two strategies by introducing the concept of the delta and nabla list.

这种算法是从这个被称为“ 最小化三角洲调试算法 ” 论文 。 通过引入delta和nabla list的概念,它系统地执行上述两种策略。

  1. When we find a failing subset Δ_i in the delta list, we immediately know we could reduce the search space and start new partitioning from Δ_i;当我们在增量列表中找到失败的子集Δ_i时,我们立即知道我们可以减少搜索空间并从Δ_i开始新的划分;
  2. When no failing subset is identified in the delta list but some failing subset appears in the nabla list (the complement list), we reduce the search space and start new partitioning from ∇_i (recall ∇_i is a larger subset as it is the complement of Δ_i)当增量列表中未标识出任何失败的子集而nabla列表(补语列表)中出现了某个失败的子集时,我们会缩小搜索空间并从∇_i开始新分区(回想∇_i是一个较大的子集,因为它是补数Δ_i)
  3. When there is no failing case in either delta or nabla list, for the current failing input, we increase the granularity and test smaller subsets (compared to the size of Δ_i in the previous iteration)当增量或nabla列表中都没有失败的情况时,对于当前失败的输入,我们增加了粒度并测试了较小的子集(与上一次迭代中Δ_i的大小相比)

闭幕 (Closing)

The “Minimizing Delta Debugging Algorithm” is an interesting and smart technique to reduce a complex failing input into a smaller & more manageable size while preserving the same error-inducing characteristics. The algorithm enhances the basic binary search or divide-and-conquer concept by introducing complementing nabla and delta lists. I see its application could be extended beyond testing but also to any feedback-enabled search application. If we can receive feedback on whether the current partition contains the info we are looking for, we could search smaller or bigger subsets systematically using this delta debugging algorithm.

最小化Delta调试算法 ”是一种有趣且智能的技术,可以将复杂的故障输入减少为更小且更易于管理的大小,同时保留相同的引起错误的特性。 通过引入互补的nabla和delta列表,该算法增强了基本的二进制搜索或分治法的概念。 我看到它的应用程序可以扩展到测试之外,还可以扩展到任何启用了反馈的搜索应用程序。 如果我们可以收到有关当前分区是否包含我们要查找的信息的反馈,则可以使用此增量调试算法系统地搜索较小或较大的子集。

Translate the algorithm pseudocode into a Java snippet:

将算法伪代码转换为Java代码段:

翻译自: https://medium.com/@d_dchris/delta-debugging-simplifying-failing-test-cases-e5a1d7613b4b

sigma-delta


http://www.taodudu.cc/news/show-2708317.html

相关文章:

  • 西安邮电大学计算机学院军训,高考状元染网瘾无法自拔 5次考上大学3次退学
  • 迷失在Blog(ZZ)
  • 广东的介绍
  • 读《啤酒与尿布》——大型超市购物篮中商品关联性分析
  • 2021-2022启航出发
  • PHP 的数组操作
  • 高红梅:第三章 第三节 从探寻自我到生命共同体的身份认同
  • 双十一的“后方战场”,闲鱼和转转吃饱了吗?
  • 过完双11,我去闲鱼当二道贩子
  • Fate
  • 掌握4点职场技巧,打破测试人中年危机
  • 大三期末网页设计作业 以旅游景点风景主题介绍网站设计与实现 (广东名胜古迹)
  • 狗生活在陆地上 java,第四晚,生活在陆地上的鱼
  • 复杂网络的学习——抗毁性
  • 商道
  • 淡水鱼生鱼片含有大量肝吸虫 可寄生于肝脏内30年
  • modbus通讯协议详解
  • 【Java开发 | 工具使用】JAVA使用exe4j打包项目为exe文件
  • 7个小学语文学习锦囊,让孩子取得好的成绩(转给家长)
  • OSChina 周一乱弹 —— 鱼生不值得
  • 我的黄色茶壶鱼生了
  • python之父考虑重构python解释器_Python之父考虑重构Python解释器
  • 2022年游戏出海行业研究报告
  • 2022年指数与指数公司行业研究报告
  • 如何用大数据炒股
  • 择时 配置 选股0909
  • 配置 择时 sel stock
  • 择时 配置 选股 2016-9-12 图形正确
  • sdfgasf
  • 截面数据 缺少行业风险

sigma-delta_Delta调试-简化失败的测试用例相关推荐

  1. Pycharm调试错误:连接 Python 调试器失败 Socket closed

    pycharm点击工具栏的调试按钮时出现错误:连接 Python 调试器失败 Socket closed 首先采用以下方法: 选择左上角工具栏"file"→"settin ...

  2. pycharm jupyter debug 连接 Python 调试器失败: No connection (command: 501 ) 已解决

    PyCharm jupyter调试代码时会出现: 连接 Python 调试器失败: No connection (command:  501 ) 这个问题是PyCharm 2021.2.2的问题,更新 ...

  3. vba vbscript.regexp加载dll错误_[原]排错实战——拯救加载调试符号失败的IDA

    本文之前发表的时候有些问题,作为强迫症患者的我又重新编辑后再次发表.如果您已经看过,请忽略.望见谅. 缘起 最近想借助IDA逆向一个函数.在windows下,调试器(比如vs, windbg)可以通过 ...

  4. [原]排错实战——拯救加载调试符号失败的IDA

    本文之前发表的时候有些问题,作为强迫症患者的我又重新编辑后再次发表.如果您已经看过,请忽略.望见谅. 缘起 最近想借助IDA逆向一个函数.在windows下,调试器(比如vs, windbg)可以通过 ...

  5. Pytest标记预期失败得测试用例@pytest.mark.xfail()

    pytest除了测试函数中使用这个方法pytest.xfail()外,xfail还有一种使用方法.就是@pytest.mark.xfail()标记预期会失败的用例,即期望测试用例是失败的,但是不会影响 ...

  6. VS远程调试连接失败

    错误现象: 无法连接到名为"Administrator@xxxx"的"Microsoft Visual Studio 远程调试监视器".目标计算机上的Visua ...

  7. 蓝桥ROS之f1tenth案例学习与调试(失败)

    过程和pc端完全一致: ROS域名解析问题记录(蓝桥云课ros.asc) ​​​​​​f1tenth案例学习与调试ros1版本pc端 在蓝桥云课ROS中测试一下是否可行(kinetic/melodic ...

  8. 微信小程序真机调试请求失败的解决

    微信小程序在电脑上一切正常,请求成功,但是在真机调试上请求失败,报错,是因为电脑和手机内网ip不同的问题 把请求地址改为本机局域网ip地址,手机和电脑连同一个局域网,就不会报错了 如果手机上还是获取不 ...

  9. VirtualKD + VMWare双机调试(失败)

    文章目录 VirtualKD-3.0 虚拟机 物理机 若干年以前,我的前同事酒若v霖(JIURL)写的<借助VMware实现单机使用WinDbg>一文,帮助了很多人,至今流传甚广.它介绍了 ...

最新文章

  1. How to Get Name of Months in ABAP/4
  2. Qt 编写应用程序升级的配置文件json 生成工具
  3. openpyxl 列 插入_openpyxl 基本使用
  4. 一种调用dll的巧妙方法
  5. python38环境变量的配置_Windows下python环境变量配置
  6. Silverlight图片处理——(伸展,裁剪,蒙版)
  7. 利用泛型与反射更新实体(ADO.NET Entity Framework)
  8. PyTorch学习—20.模型的微调(Finetune)
  9. java经典算法(八)---zws
  10. easyx——c语言实时动画时钟
  11. 洛杉矶儿童医院被列为美国西部第一,在全美儿童医院中的总体排名升至第五
  12. RuntimeError: Error(s) in loading state_dict for BNInception:size mismatch for
  13. 自动修改hosts文件
  14. java word 添加水印图片_Java添加Word文本水印和图片水印
  15. ionic loading(加载动作)
  16. 聚合支付收款码怎么申请
  17. 关于Java线程,看这一篇就绝对够用了
  18. Unity 骨骼动画 Anima2D
  19. [PRIMITIVE TECHNOLOGY]澳洲小哥的黑皮豆/black been/摩顿湾板栗(栗子)/Moreton Bay Chestnut...
  20. 基于SSM实现高校教材预定管理系统-毕业设计【附源码】

热门文章

  1. 基于华为云服务器Docker nginx安装和配置挂载
  2. 存储卡 SD/MMC/MS/CF/XD/SM/MICRO SD
  3. 手把手教你制作炫酷的PCB板3D效果图
  4. python文件定位函数_C语言中文件定位函数总结
  5. 一分钟搞懂app热更新
  6. Android 超级轻量的版本更新库AppUpdate
  7. 美团笔试(测试开发)
  8. 计算机毕业设计ssm焦虑自测与交流平台k43cf系统+程序+源码+lw+远程部署
  9. BZOJ 1050 旅行comf
  10. SD卡和文件系统那些事儿