一句话:通过对照实验与访谈调查,揭示测试驱动代码评审对缺陷发现与开发者偏好的影响。
论文研究 Test-Driven Code Review (TDR):评审者先检查变更的测试代码,再检查生产代码。作者结合 93 名开发者完成的 150 余次评审对照实验,以及 9 次半结构化访谈和 103 份问卷,系统考察 TDR 的效果、普及、问题与优势。实验发现,采用 TDR 的开发者发现生产代码缺陷比例相同,但发现更多测试代码缺陷,代价是生产代码可维护性问题发现更少;多数开发者仍偏好先评审生产代码,认为其更关键且测试应随之而来;测试代码质量普遍不佳和缺乏工具支持阻碍 TDR 采用。
Test-Driven Code Review (TDR) is a code review practice in which a reviewer inspects a patch by examining the changed test code before the changed production code. Although this practice has been mentioned positively by practitioners in informal literature and interviews, there is no systematic knowledge of its effects, prevalence, problems, and advantages. In this paper, we aim at empirically understanding whether this practice has an effect on code review effectiveness and how developers' perceive TDR. We conduct (i) a controlled experiment with 93 developers that perform more than 150 reviews, and (ii) 9 semi-structured interviews and a survey with 103 respondents to gather information on how TDR is perceived. Key results from the experiment show that developers adopting TDR find the same proportion of defects in production code, but more in test code, at the expenses of fewer maintainability issues in production code. Furthermore, we found that most developers prefer to review production code as they deem it more critical and tests should follow from it. Moreover, general poor test code quality and no tool support hinder the adoption of TDR. Public preprint: https://doi.org/10.5281/zenodo.2551217, data and materials: https://doi.org/10.5281/zenodo.2553139
@inproceedings{SpadiniPBHBB19,
title = {Test-Driven Code Review: An Empirical Study},
author = {Davide Spadini and Fabio Palomba and Tobias Baum and Stefan Hanenberg and Magiel Bruntink and Alberto Bacchelli},
booktitle = {ICSE},
year = {2019},
doi = {10.1109/icse.2019.00110}
}