IDEAS home Printed from https://ideas.repec.org/a/gam/jdataj/v10y2025i10p156-d1761793.html

Automated Test Generation Using Large Language Models

Author

Listed:
  • Marcin Andrzejewski

    (GenerativeAI Academic Research Team (GART), Capgemini Insights & Data, 54-202 Wroclaw, Poland
    These authors contributed equally to this work.)

  • Nina Dubicka

    (GenerativeAI Academic Research Team (GART), Capgemini Insights & Data, 54-202 Wroclaw, Poland
    These authors contributed equally to this work.)

  • Jędrzej Podolak

    (GenerativeAI Academic Research Team (GART), Capgemini Insights & Data, 54-202 Wroclaw, Poland)

  • Marek Kowal

    (GenerativeAI Academic Research Team (GART), Capgemini Insights & Data, 54-202 Wroclaw, Poland)

  • Jakub Siłka

    (Faculty of Applied Mathematics, Silesian University of Technology, 44-100 Gliwice, Poland)

Abstract

This study explores the potential of generative AI, specifically Large Language Models (LLMs), in automating unit test generation in Python 3.13. We analyze tests, both those created by programmers and those generated by LLM models, for fifty source code cases. Our main focus is on how the choice of model, the difficulty of the source code, and the prompting strategy influence the quality of the generated tests. The results show that AI models can help automate test creation for simple code, but their effectiveness decreases for more complex tasks. We introduce an embedding-based similarity analysis to assess how closely AI-generated tests resemble human-written ones, revealing that AI outputs often lack semantic diversity. The study also highlights the potential of AI models for rapid test prototyping, which can significantly speed up the software development cycle. However, further customization and training of the models on specific use cases is needed to achieve greater precision. Our findings provide practical insights into integrating LLMs into software testing workflows and emphasize the importance of prompt design and model selection.

Suggested Citation

  • Marcin Andrzejewski & Nina Dubicka & Jędrzej Podolak & Marek Kowal & Jakub Siłka, 2025. "Automated Test Generation Using Large Language Models," Data, MDPI, vol. 10(10), pages 1-20, September.
  • Handle: RePEc:gam:jdataj:v:10:y:2025:i:10:p:156-:d:1761793
    as

    Download full text from publisher

    File URL: https://www.mdpi.com/2306-5729/10/10/156/pdf
    Download Restriction: no

    File URL: https://www.mdpi.com/2306-5729/10/10/156/
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Yinheng Li & Shaofei Wang & Han Ding & Hang Chen, 2023. "Large Language Models in Finance: A Survey," Papers 2311.10723, arXiv.org, revised Jul 2024.
    2. Murray Shanahan & Kyle McDonell & Laria Reynolds, 2023. "Role play with large language models," Nature, Nature, vol. 623(7987), pages 493-498, November.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Cheng Wang & Chuwen Wang & Shirong Zeng & Jianguo Liu & Changjun Jiang, 2025. "Advanced simulation paradigm of human behaviour unveils complex financial systemic projection," Papers 2503.20787, arXiv.org, revised May 2025.
    2. Tuomi, Aarni & Tussyadiah, Iis & Ascenção, Mário Passos, 2025. "Customized language models for tourism management: Implications and future research," Annals of Tourism Research, Elsevier, vol. 110(C).
    3. Tang, Yuanrong & Kang, Yu & Wang, Yifan & Wang, Tianhong & Zhong, Chen & Gong, Jiangtao, 2026. "A counselor-inspired agent framework for AI counselors to enhance client engagement," Technology in Society, Elsevier, vol. 84(C).
    4. Benjamin Coriat & Eric Benhamou, 2025. "HARLF: Hierarchical Reinforcement Learning and Lightweight LLM-Driven Sentiment Integration for Financial Portfolio Optimization," Papers 2507.18560, arXiv.org.
    5. Pedota, Mattia & Cicala, Francesco & Basti, Alessio, 2024. "A Wild Mind with a Disciplined Eye: Unleashing Human-GenAI Creativity Through Simulated Entity Elicitation," OSF Preprints 3bn95, Center for Open Science.
    6. Pedota, Mattia & Cicala, Francesco & Basti, Alessio, 2025. "Human agents, generative AI, and innovation: A formal model of hybrid creative process," Technovation, Elsevier, vol. 148(C).
    7. Hongshen Sun & Juanjuan Zhang, 2025. "From Model Choice to Model Belief: Establishing a New Measure for LLM-Based Research," Papers 2512.23184, arXiv.org.
    8. Tirulo, Aschalew & Yadav, Monika & Lolamo, Mathewos & Chauhan, Siddhartha & Siano, Pierluigi & Shafie-khah, Miadreza, 2026. "Beyond automation: Unveiling the potential of agentic intelligence," Renewable and Sustainable Energy Reviews, Elsevier, vol. 226(PA).
    9. Mehmet Caner & Agostino Capponi & Nathan Sun & Jonathan Y. Tan, 2026. "Designing Agentic AI-Based Screening for Portfolio Investment," Papers 2603.23300, arXiv.org.
    10. repec:osf:osfxxx:udz28_v1 is not listed on IDEAS
    11. Zhen Wang & Ruiqi Song & Chen Shen & Shiya Yin & Zhao Song & Balaraju Battu & Lei Shi & Danyang Jia & Talal Rahwan & Shuyue Hu, 2024. "Overcoming the Machine Penalty with Imperfectly Fair AI Agents," Papers 2410.03724, arXiv.org, revised May 2025.
    12. Wan Zhang & Jing Zhang, 2025. "Hallucination Mitigation for Retrieval-Augmented Large Language Models: A Review," Mathematics, MDPI, vol. 13(5), pages 1-33, March.
    13. Jimin Huang & Mengxi Xiao & Dong Li & Zihao Jiang & Yuzhe Yang & Yifei Zhang & Lingfei Qian & Yan Wang & Xueqing Peng & Yang Ren & Ruoyu Xiang & Zhengyu Chen & Xiao Zhang & Yueru He & Weiguang Han & S, 2024. "Open-FinLLMs: Open Multimodal Large Language Models for Financial Applications," Papers 2408.11878, arXiv.org, revised Jun 2025.
    14. Yangrui Yang & Pengfei Wang & Xuemei Liu & Wenyu Luo & Libo Yang, 2025. "A Multi-Agent and GraphRAG-Based Framework for Operation and Management Decision-Making in Hydraulic Projects," Water Resources Management: An International Journal, Published for the European Water Resources Association (EWRA), Springer;European Water Resources Association (EWRA), vol. 39(14), pages 7665-7687, November.
    15. Antoine Kazadi Kayisu & Miroslava Mikusova & Pitshou Ntambu Bokoro & Kyandoghere Kyamakya, 2024. "Exploring Smart Mobility Potential in Kinshasa (DR-Congo) as a Contribution to Mastering Traffic Congestion and Improving Road Safety: A Comprehensive Feasibility Assessment," Sustainability, MDPI, vol. 16(21), pages 1-53, October.
    16. repec:osf:osfxxx:udz28_v2 is not listed on IDEAS
    17. Hannah Rose Kirk & Iason Gabriel & Chris Summerfield & Bertie Vidgen & Scott A. Hale, 2025. "Why human–AI relationships need socioaffective alignment," Humanities and Social Sciences Communications, Palgrave Macmillan, vol. 12(1), pages 1-9, December.
    18. Aliya Amirova & Theodora Fteropoulli & Nafiso Ahmed & Martin R Cowie & Joel Z Leibo, 2024. "Framework-based qualitative analysis of free responses of Large Language Models: Algorithmic fidelity," PLOS ONE, Public Library of Science, vol. 19(3), pages 1-33, March.
    19. Elliot Xie & Lingxin Cheng & Jack Shireman & Yujia Cai & Jihua Liu & Chitrasen Mohanty & Mahua Dey & Christina Kendziorski, 2026. "CASSIA: a multi-agent large language model for automated and interpretable cell annotation," Nature Communications, Nature, vol. 17(1), pages 1-16, December.
    20. repec:osf:osfxxx:3bn95_v1 is not listed on IDEAS
    21. Simeon Allmendinger & Lukas Bonenberger & Kathrin Endres & Dominik Fetzer & Henner Gimpel & Niklas Kühl, 2026. "Multi-agent AI," Electronic Markets, Springer;IIM University of St. Gallen, vol. 36(1), pages 1-18, December.
    22. Anna Nesvijevskaia, 2025. "Sustaining the practitioners’ tacit knowledge in the age of Artificial Intelligence: new challenges emerging through multiple case study [La pérennisation du savoir tacite des acteurs métier à l’ère de l’Intelligence Artificielle : émergence d’enj," Post-Print hal-05413113, HAL.
    23. Haoyi Zhang & Tianyi Zhu, 2025. "Neither Consent nor Property: A Policy Lab for Data Law," Papers 2510.26727, arXiv.org, revised Apr 2026.

    More about this item

    Keywords

    ;
    ;
    ;
    ;
    ;

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:gam:jdataj:v:10:y:2025:i:10:p:156-:d:1761793. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: MDPI Indexing Manager (email available below). General contact details of provider: https://www.mdpi.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.