一句话:提出并评估了面向 Pytest 的实用回归测试优先级排序工具 pytest-ranking,能在 CI 中更快发现测试失败。
回归测试优先级排序(RTP)旨在通过调整测试执行顺序更快暴露失败,为开发者提供更及时的反馈,已研究近三十年,但实用工具与实际评估仍然零散。本文提出 pytest-ranking,一个面向 Python 及其最流行测试框架 Pytest 的鲁棒 RTP 工具。作者在 GitHub Actions CI 上对 14 个开源 Python 项目的 4,308 次构建进行了评估,考察工具与 Pytest 生态的集成情况、运行时开销以及发现失败的速度。实验表明,该工具能够良好地集成到 Pytest 生态中,运行时开销低,并且相比默认顺序与随机顺序基线能更快地发现测试失败。
Regression Test Prioritization (RTP) can find test failures quicker and provide faster feedback to developers to help in debugging. While RTP has been researched for almost three decades, with many research techniques proposed, practical tools and evaluations are sporadic. We present pytest-ranking, a robust tool for Python and its most popular testing framework Pytest. We evaluate our tool on 4,308 builds for 14 open-source Python projects running on the GitHub Actions CI. Our experiments show that our tool integrates well with the Pytest ecosystem, has a low runtime overhead, and finds test failures faster than the default and random order baselines.