论文标题

内联测试

Inline Tests

论文作者

Liu, Yu, Nie, Pengyu, Legunsen, Owolabi, Gligoric, Milos

论文摘要

单元测试被广泛用于检查源代码质量,但它们可能过于粗糙或不适合测试单个程序语句。我们介绍了内联测试,以便更容易检查语句中的故障。我们通过多种语言功能和常见的测试方案激励内联测试,其中内联测试可能是有益的。例如,直列测试可以使开发人员可以测试适当的正则表达式。我们还为内联测试框架定义了语言不可能的要求。最后,我们实现了I-Test,这是第一个内联测试框架。 I测试适用于Python和Java,它满足了大多数要求。我们通过使用它在31个Python程序和37个Java计划中测试144个语句来评估I测试的I测试。我们还进行用户研究。所有九个用户研究参与者都说,内联测试易于编写,并且内联测试是有益的。运行内联测试的成本可以忽略不计,为0.007x - 0.014x,我们的内联测试帮助发现了开发人员已解决的两个故障。

Unit tests are widely used to check source code quality, but they can be too coarse-grained or ill-suited for testing individual program statements. We introduce inline tests to make it easier to check for faults in statements. We motivate inline tests through several language features and a common testing scenario in which inline tests could be beneficial. For example, inline tests can allow a developer to test a regular expression in place. We also define language-agnostic requirements for inline testing frameworks. Lastly, we implement I-Test, the first inline testing framework. I-Test works for Python and Java, and it satisfies most of the requirements. We evaluate I-Test on open-source projects by using it to test 144 statements in 31 Python programs and 37 Java programs. We also perform a user study. All nine user study participants say that inline tests are easy to write and that inline testing is beneficial. The cost of running inline tests is negligible, at 0.007x--0.014x, and our inline tests helped find two faults that have been fixed by the developers.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源