簡易檢索 / 詳目顯示

研究生: 林瑋婷
Lin, Wei-Ting
論文名稱: 基於 AI 的軟體單元測試產生及效能分析
AI Based Software Unit Test Case Generation and Performance Analysis
指導教授: 謝孫源
Hsieh, Sun-Yuan
學位類別: 碩士
Master
系所名稱: 電機資訊學院 - 資訊工程學系
Department of Computer Science and Information Engineering
論文出版年: 2024
畢業學年度: 112
語文別: 英文
論文頁數: 65
中文關鍵詞: 軟體單元測試ChatGPT4Claude3CopilotGenimi1.5 Pro
外文關鍵詞: Software unit testing, ChatGPT4, Claude3, Copilot, Genimi1.5 Pro
相關次數: 點閱:71下載:30
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 在軟體開發領域,軟體單元測試在確保程式碼可靠性和功能方面發揮著重要作用。本文討論了軟體單元測試的重要性,並探討了利用人工智慧模型自動產生軟體單元測試用例的效率。本研究透過使用 ChatGPT-4、Claude 3、GitHub Copilot 和 Gemini 1.5 Pro 等先進的 AI 模型,分析並比較它們在產生單元測試案例方面的表現。研究結果顯示人工智慧驅動的方法在增強軟體工程實踐、減少編碼工作和提高測試覆蓋率方面具有潛力。這項研究不僅強調了人工智慧對軟體工程的變革性影響,還強調了進一步分析和比較不同人工智慧模型以優化單元測試案例產生的必要性。

    In the domain of software development, software unit testing plays an important role in ensuring code reliability and functionality. This thesis discusses the importance of software unit testing and explores the efficiency of leveraging AI models to generate software unit test cases automatically. By using advanced AI models such as ChatGPT-4, Claude 3, GitHub Copilot, and Gemini 1.5 Pro, this study analyzes and compares their performance in generating unit test cases. The research results indicate the potential of AI-driven approaches to enhance software engineering practices, reduce coding effort, and improve test coverage. This research not only highlights the transformative impact of AI on software engineering but also emphasizes the necessity for further analysis and comparison of different AI models to optimize unit test case generation.

    1 Introduction 1 2 Related Works 3 3 Materials and Methods 6 3.1 Generating Unit Test Code 7 3.2 Model Introduction 8 3.2.1 ChatGPT-4 8 3.2.2 Claude 3 9 3.2.3 GitHub Copilot 10 3.2.4 Gemini 1.5 11 3.3 Prompt 12 3.3.1 Prompt for Generating Unit Test Code 12 3.4 Quality Check 16 3.4.1 Compilation 16 3.4.2 Test Case Fail Rate 16 3.4.3 Line Coverage 16 3.4.4 Branch Coverage 17 3.5 Pseudo Code 18 3.5.1 Get JSON Files 18 3.5.2 Append Postfix to Filenames 18 3.5.3 Update Class Name 18 3.5.4 Find Original Class Name 18 3.5.5 Extract Class Name 18 3.5.6 Check Compilable 19 3.5.7 Generate Solution File 19 3.5.8 Extract Data Ratio 19 3.5.9 Generate Test File 19 3.5.10 Compile and Test 19 3.5.11 Main Function 20 4 Experiments and Results 21 4.1 Performance Analysis 33 4.1.1 Average Test Line and Branch Coverage by Difficulty 33 4.1.2 Average Test Line and Branch Coverage by Question Type 35 4.1.3 Average Test Line and Branch Coverage by Tests Run 37 4.1.4 Average Test Line and Branch Coverage by Test Failure Rate 39 4.1.5 Coverage Distribution 47 4.1.6 Summary Statistics 47 4.1.7 ANOVA(Analysis of Variance) 47 4.1.8 T-Test 47 5 Conclusion 52 5.0.1 Overall Insights 52 5.0.2 Future Works 53 Bibliography 54

    [1] Annibale Panichella, Fitsum Kifetew, P. T. Automated Test Case Gen- eration as a Many-Objective Optimisation Problem with Dynamic Selection of the Targets. IEEE Transactions on Software Engineering, pp. 122–158, 2018.
    [2] Beck, K. Test Driven Development. By Example (Addison-Wesley Signature). Addison-Wesley Professional, 2002.
    [3] Cornella, J., and Johnson, S. Integrating Unit Testing in Agile Methodologies. Agile Journal of Software Practices, vol. 10, no. 4, pp. 198–203, 2014.
    [4] Draˇzen Marijan, Shaukat Ali, A. G. Practical Guidelines for E↵ective Test Generation with Search-Based Software Testing. Software Testing, Verification and Reliability, vol.29, issue 4–5, 2019.
    [5] Fraser, G., and Arcuri, A. EvoSuite: Automatic Test Suite Generation for Object-Oriented Software. Empirical Software Engineering, vol. 19, no. 2, pp. 531– 577, 2013.
    [6] Leloudas, P. The Importance of Software Testing. Introduction to Software Test- ing: A Practical Guide to Testing, Design, Automation, and Execution (Apress), pp. 1–4, 2023.
    [7] Meszaros, G. xUnit Test Patterns: Refactoring Test Code. Addison Wesley Pro- fessional, 2007.
    [8] Poshyvanyk, C. W. M. T. E. C. M. D. P. G. B. M. W. D. Learning to Gen- erate Test Cases from Bug Reports using Neural Machine Translation. Proceedings of the ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE), 2021.
    [9] Sun, Y., and Li, J. J. AI-Driven Mutation Testing for Enhanced Software Relia- bility. Software Quality Journal, vol. 28, pp. 539–556, 2020.
    [10] White, M. T. C. W. G. B. M. D. P. M., and Poshyvanyk, D. An empirical study on learning bug-fixing patches in the wild via neural machine translation. ACM Transactions on Software Engineering and Methodology (TOSEM), pp. 1–29, 2019.
    [11] Whittaker, J. A. Exploratory Software Testing: Tips, Tricks, Tours, and Tech- niques to Guide Test Design. Addison-Wesley Professional, 2012.
    [12] Winkler, D., and Spillner, J. Fault Detection in Software Testing: Improving Quality and Performance. Springer, 2012.

    下載圖示 校內:立即公開
    校外:立即公開
    QR CODE