arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2510.09108cs.SE
收藏

面向机器学习库的约束引导单元测试生成

Constraint-Guided Unit Test Generation for Machine Learning Libraries

University of Passau(帕绍大学);JetBrains Research(JetBrains研究院)

Lukas Krodinger, Altin Hajdari, Stephan Lukasczyk, Gordon Fraser

AI总结:

本文提出PynguinML,通过改进Pynguin测试生成器以利用从官方API文档提取的约束,为PyTorch和TensorFlow等ML库生成合规输入,显著提升测试有效性,代码覆盖率最高提升63.9%。

摘要:

PyTorch和TensorFlow等机器学习(ML)库对于广泛的现代应用至关重要。通过测试确保ML库的正确性至关重要。然而,ML API通常施加涉及张量等复杂数据结构的严格输入约束。Pynguin等自动化测试生成工具未感知这些约束,常生成不合规输入。这导致测试过早失败和有限的代码覆盖率。先前工作研究了从官方API文档中提取约束。本文提出PynguinML,该方法改进Pynguin测试生成器以利用这些约束为ML API生成合规输入,实现更彻底的测试和更高的代码覆盖率。我们的评估基于来自PyTorch和TensorFlow的165个模块,将PynguinML与Pynguin进行比较。结果表明,PynguinML显著提升了测试有效性,代码覆盖率最高提升63.9%。

英文摘要:

Machine learning (ML) libraries such as PyTorch and TensorFlow are essential for a wide range of modern applications. Ensuring the correctness of ML libraries through testing is crucial. However, ML APIs often impose strict input constraints involving complex data structures such as tensors. Automated test generation tools such as Pynguin are not aware of these constraints and often create non-compliant inputs. This leads to early test failures and limited code coverage. Prior work has investigated extracting constraints from official API documentation. In this paper, we present PynguinML, an approach that improves the Pynguin test generator to leverage these constraints to generate compliant inputs for ML APIs, enabling more thorough testing and higher code coverage. Our evaluation is based on 165 modules from PyTorch and TensorFlow, comparing PynguinML against Pynguin. The results show that PynguinML significantly improves test effectiveness, achieving up to 63.9 % higher code coverage.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑