Unit testing is crucial in software engineering for ensuring quality. However, it's not widely used in parallel and high-performance computing software, particularly scientific applications, due to their smaller, diverse user base and complex logic. These factors make unit testing challenging and expensive, as it requires specialized knowledge and existing automated tools are often ineffective. To address this, we propose an automated method for generating unit tests for such software, considering their unique features like complex logic and parallel processing. Recently, large language models (LLMs) have shown promise in coding and testing. We explored the capabilities of Davinci (text-davinci-002) and ChatGPT (gpt-3.5-turbo) in creating unit tests for C++ parallel programs. Our results show that LLMs can generate mostly correct and comprehensive unit tests, although they have some limitations, such as repetitive assertions and blank test cases.
翻译:单元测试在软件工程中对确保质量至关重要。然而,由于并行与高性能计算软件(特别是科学应用)的用户群体规模较小且多样化,以及其逻辑复杂,单元测试在此类软件中并未得到广泛应用。这些因素使得单元测试具有挑战性且成本高昂,因为它需要专业知识,而现有的自动化工具往往效果不佳。为解决这一问题,我们提出了一种为此类软件生成单元测试的自动化方法,该方法考虑了其复杂逻辑和并行处理等独特特性。最近,大型语言模型(LLMs)在编码和测试方面展现出潜力。我们探索了Davinci(text-davinci-002)和ChatGPT(gpt-3.5-turbo)为C++并行程序创建单元测试的能力。我们的结果表明,LLMs能够生成大部分正确且全面的单元测试,尽管它们存在一些局限性,例如重复的断言和空测试用例。