LLM 기반 테스트 생성 시 커버된 코드 제거를 통한 성능 향상
Enhancing LLM-Based Test Generation by Eliminating Covered Code
자동화된 테스트 생성은 소프트웨어 품질 보증에 필수적이며, 테스트의 완전성을 보장하는 핵심 지표로 커버리지 비율이 사용됩니다. 최근 대규모 언어 모델(LLM)의 발전은 테스트 생성 성능을 향상시키는 데 큰 잠재력을 보여주며, 특히 더 높은 커버리지를 달성하는 데 기여합니다. 그러나 기존의 LLM 기반 테스트 생성 솔루션은 작은 코드 조각에서는 잘 작동하지만, 복잡한 메서드에 적용될 경우 어려움을 겪습니다. 이러한 문제를 해결하기 위해, 우리는 확장 가능한 LLM 기반 단위 테스트 생성 방법을 제안합니다. 우리의 접근 방식은 두 가지 주요 단계로 구성됩니다. 첫 번째 단계는 컨텍스트 정보 검색 단계로, LLM과 정적 분석을 활용하여 테스트 대상 복잡한 메서드와 관련된 관련 컨텍스트 정보를 수집합니다. 두 번째 단계는 코드 제거를 통한 반복적 테스트 생성 단계로, 코드 조각에 대한 단위 테스트를 반복적으로 생성하고, 달성된 커버리지를 추적하며, 이미 커버된 코드 조각을 선택적으로 제거합니다. 이 과정은 테스트 작업을 단순화하고, 지나치게 긴 컨텍스트로 인해 발생하는 토큰 제한 또는 추론 효과 감소 문제를 완화합니다. 오픈 소스 프로젝트에 대한 종합적인 평가를 통해, 우리의 접근 방식은 최첨단 LLM 기반 및 검색 기반 방법보다 뛰어난 성능을 보이며, 복잡한 메서드에서 높은 커버리지를 달성하는 데 효과적임을 입증합니다.
Automated test generation is essential for software quality assurance, with coverage rate serving as a key metric to ensure thorough testing. Recent advancements in Large Language Models (LLMs) have shown promise in improving test generation, particularly in achieving higher coverage. However, while existing LLM-based test generation solutions perform well on small, isolated code snippets, they struggle when applied to complex methods under test. To address these issues, we propose a scalable LLM-based unit test generation method. Our approach consists of two key steps. The first step is context information retrieval, which uses both LLMs and static analysis to gather relevant contextual information associated with the complex methods under test. The second step, iterative test generation with code elimination, repeatedly generates unit tests for the code slice, tracks the achieved coverage, and selectively removes code segments that have already been covered. This process simplifies the testing task and mitigates issues arising from token limits or reduced reasoning effectiveness associated with excessively long contexts. Through comprehensive evaluations on open-source projects, our approach outperforms state-of-the-art LLM-based and search-based methods, demonstrating its effectiveness in achieving high coverage on complex methods.
No Analysis Report Yet
This paper hasn't been analyzed by Gemini yet.
Log in to request an AI analysis.