We use cookies to improve your experience with our site.

分解复合更改在软件发展中的代码审查和回归测试选择中的使用

Decomposing Composite Changes for Code Review and Regression Test Selection in Evolving Software

  • 摘要: 检查和测试代码的更改通常需要花费开发人员大量的工作。随着系统的发展,开发人员一般不会解决一个单一的问题(原子更改),而是通过混合多个开发问题来创建复合更改。检查复合更改通常会非常耗时且容易出错。对于那些和更改没有关联的代码,重新运行所有回归测试可能需要过多的时间。为了解决这个问题,我们提出了一种用于变更分解的交互式技术(CHGCUTTER),以支持代码审查和回归测试选择。当开发人员用diff命令指定一个代码更改时,CHGCUTTER会将复合更改分解成一组相关的,具有凝聚力和自包含性原子更改。对于复合变更检查,CHGCUTTER会生成一个中间程序版本,该版本仅包含使用程序依赖关系的相关变更子集。为了降低回归测试成本,它只选择在中间版本被更改所影响的测试。为了评估,我们将CHGCUTTER应用于四个开源项目中的28个复合变更。CHGCUTTER以95.7%的准确率分解了这些变更,同时以89.0%的准确率选择受影响的测试。我们与PayPal的专业软件工程师进行了用户研究,发现CHGCUTTER有助于理解和验证复合变更,并可以扩展到行业项目中。目的:随着系统的发展,开发人员一般不会解决一个单一的问题,而是通过混合多个开发问题来创建复合更改。并且对于那些和更改没有关联的代码,重新运行所有回归测试可能需要花费更多的时间。我们的目的是为了解决在检查复合更改中耗时且容易出错的问题。创新点:我们提出了一种用于变更分解的交互式技术(CHGCUTTER),以支持代码审查和回归测试选择。方法:CHGCUTTER首先让开发人员用diff命令指定一个代码更改区域。其次,它会自动地将复合更改分解为原子更改并找到它们的程序依赖关系。第三,它根据用户指定的更改区域,通过匹配搜索得到相关的变更子集。最后,它结合得到的变更子集和原始程序版本生成一个可编译的中间程序版本,以及在中间程序版本被更改所影响的测试。结论: 我们将CHGCUTTER应用于四个开源项目中的28个复合变更。CHGCUTTER以95.7%的准确率分解了这些变更,同时以89.0%的准确率选择受影响的测试。

     

    Abstract: Inspecting and testing code changes typically require a significant amount of developer effort. As a system evolves, developers often create composite changes by mixing multiple development issues, as opposed to addressing one independent issue — an atomic change. Inspecting composite changes often becomes time-consuming and error-prone. To test unrelated edits on composite changes, rerunning all regression tests may require excessive time. To address the problem, we present an interactive technique for change decomposition to support code reviews and regression test selection, called ChgCutter. When a developer specifies code change within a diff patch, ChgCutter partitions composite changes into a set of related atomic changes, which is more cohesive and self-contained regarding the issue being addressed. For composite change inspection, it generates an intermediate program version that only includes a related change subset using program dependence relationships. For cost reduction during regression testing, it safely selects only affected tests responsible for changes to an intermediate version. In the evaluation, we apply ChgCutter to 28 composite changes in four open source projects. ChgCutter partitions these changes with 95.7% accuracy, while selecting affected tests with 89.0% accuracy. We conduct a user study with professional software engineers at PayPal and find that ChgCutter is helpful in understanding and validating composite changes, scaling to industry projects.

     

/

返回文章
返回