Skip to main content
QUICK REVIEW

[논문 리뷰] ChatGPT vs SBST: A Comparative Assessment of Unit Test Suite Generation

Yutian Tang, Zhijie Liu|arXiv (Cornell University)|2023. 07. 02.
Software Engineering ResearchComputer Science인용 수 9
한 줄 요약

논문은 ChatGPT와 EvoSuite(SBST)가 생성한 단위 테스트 스위트를 정확성, 가독성, 코드 커버리지, 버그 탐지 측면에서 비교하고, 테스트의 다양성과 현실성에서 ChatGPT의 강점을 드러내지만 컴파일 및 커버리지의 격차를 강조합니다.

ABSTRACT

Recent advancements in large language models (LLMs) have demonstrated exceptional success in a wide range of general domain tasks, such as question answering and following instructions. Moreover, LLMs have shown potential in various software engineering applications. In this study, we present a systematic comparison of test suites generated by the ChatGPT LLM and the state-of-the-art SBST tool EvoSuite. Our comparison is based on several critical factors, including correctness, readability, code coverage, and bug detection capability. By highlighting the strengths and weaknesses of LLMs (specifically ChatGPT) in generating unit test cases compared to EvoSuite, this work provides valuable insights into the performance of LLMs in solving software engineering problems. Overall, our findings underscore the potential of LLMs in software engineering and pave the way for further research in this area.

연구 동기 및 목표

  • ChatGPT가 Java 메서드에 대해 올바른 단위 테스트를 생성할 수 있는지 평가합니다.
  • ChatGPT가 생성한 테스트의 가독성과 유지보수성을 평가합니다.
  • ChatGPT가 생성한 테스트의 코드 커버리지를 EvoSuite(SBST)와 비교합니다.
  • 정적 분석을 사용하여 ChatGPT가 생성한 테스트의 버그 탐지 능력을 측정합니다.

제안 방법

  • Java 단위 테스트 생성을 위한 SBST 기준으로 EvoSuite를 사용합니다.
  • 표준 프롬트를 사용하여 코드 세그먼트를 포함해 ChatGPT에 JUnit 테스트 생성을 요청합니다.
  • 테스트를 컴파일/실행하고 SpotBugs로 버그를 분석하여 정확성을 평가합니다.
  • 코드 스타일 검사(Checkstyle) 및 복잡도 지표(cyclomatic 및 cognitive)를 통해 가독성을 측정합니다.
  • JaJaCo instruction/statement coverage and compare averages across subjects.
Figure 1: A Sample Use of GPT-3
Figure 1: A Sample Use of GPT-3

실험 결과

연구 질문

  • RQ1RQ1 Correctness: ChatGPT의 단위 테스트 스위트 제안이 정확한가?
  • RQ2RQ2 Readability: ChatGPT가 생성한 테스트 스위트가 얼마나 이해하기 쉬운가?
  • RQ3RQ3 Code Coverage: SBST에 비해 ChatGPT의 코드 커버리지는 어떤가?
  • RQ4RQ4 Bug Detection: ChatGPT와 SBST가 버그 탐지 테스트를 생성하는 데 얼마나 효과적인가?

주요 결과

  • 207 Java 클래스가 75개 프로젝트에서 Long-input 제약을 적용한 후 분석되었습니다.
  • ChatGPT가 생성한 테스트의 69.6%가 인간의 개입 없이 컴파일 및 실행되었습니다.
  • SpotBugs는 204개의 테스트 케이스에서 403개의 잠재적 버그를 발견했습니다(원래 3개는 컴파일 실패).
  • ChatGPT가 생성한 테스트 케이스의 61.2%가 버그 없다; 9.8%는 Scariest/Scary 우선순위 버그를 가지고 있었습니다.
  • Evosuite는 평균 문장 커버리지(74.2%)가 ChatGPT(55.4%)보다 높았고, 반면 ChatGPT는 207개 클래스 중 37개, 75개 프로젝트 중 10개에서 EvoSuite보다 우수했습니다.
Figure 2: A Sample Use of ChatGPT in a SE Task
Figure 2: A Sample Use of ChatGPT in a SE Task

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.