شماره ركورد
34996
پديد آورنده
احمدرضا كنگاوري
عنوان
توليد آزمون واحد با استفاده از مدل هاي زباني وسيع
مقطع تحصيلي
كارشناسي ارشد
رشته تحصيلي
مهندسي نرمافزار
سال تحصيل
1402
تاريخ دفاع
1404/12/9
استاد راهنما
دكتر مهرداد آشتياني
استاد مشاور
ندارد
دانشكده
مهندسي كامپيوتر
چكيده
در دنياي پيچيده مهندسي نرمافزار، نوشتن آزمونهاي واحد به عنوان پايهاي براي تضمين كيفيت و قابليت اطمينان نرمافزار شناخته ميشود. با اين حال، فرآيند نوشتن دستي اين آزمونها با چالشهاي بزرگي مانند هزينهي زياد و همچنين خطاهاي انساني روبرو است. اين چالشها در پروژههاي بزرگمقياس ميتواند مانعي جدي براي توليد نرمافزارهاي باكيفيت باشد. بنابراين، انگيزهي اصلي اين پژوهش، حركت به سمت خودكارسازي فرآيند توليد آزمون واحد براي كاهش اين بار سنگين و افزايش دقت است. اما نكتهي كليدي اين است كه خودكارسازي صِرف كافي نيست؛ بلكه هدف، ارائهي راهكاري است كه به طور يكپارچه در فرآيندهاي مهندسي نرمافزار پذيرفتهشده، مانند توسعه آزمونمحور، ادغام شود. به عبارت ديگر، مسئله اصلي، يافتن روشي نظاممند است كه نه تنها آزمون توليد كند، بلكه اين آزمونها معنادار بوده و رفتار واقعي مورد انتظار از نرمافزار را بسنجند.
در پژوهشهاي پيشين، راهكارهاي متعددي براي توليد خودكار آزمون واحد ارائه شده است كه عمدتاً يا به افزايش پوشش كد تكيه دارند، يا از مدلهاي زباني بزرگ با رهنمودهاي متني براي توليد آزمون استفاده ميكنند. روشهاي دسته نخست، اگرچه در بهبود معيارهاي كمي پوشش موفقاند، اما عموماً قادر به سنجش معناي رفتاري و صحت منطقي نرمافزار نيستند. رويكردهاي مبتني بر مدلهاي زباني نيز آزمونهايي شبيه به آزمونهاي انساني توليد ميكنند، اما به شدت به كيفيت رهنمود وابسته بوده و فاقد چارچوبي نظاممند براي ادغام در فرآيند توسعه آزمونمحور هستند. در نتيجه، عليرغم اين پيشرفتها، همچنان نياز به رويكردي ساختيافته براي توليد آزمونهاي معنادار و يكپارچه با فرآيند توسعه احساس ميشود.
براي تحقق اين هدف، پژوهش حاضر يك مدل محاسباتي چندمرحلهاي مبتني بر مدلهاي زباني بزرگ در قالب يك معماري سناريومحور پيشنهاد ميدهد. اين مدل با تكيه بر امضاي تابع، با توليد دادههاي مناسب و پيشبيني سناريوهاي استفاده، آزمونهاي معنادار اوليه را ايجاد و آنها را با معيارهاي مشخص ارزيابي و بازسازي ميكند. در مقايسهي نظري با روشهاي مرسوم كه اغلب بر معيار پوشش كد متمركزند و آزمونهاي معنادار توليد نميكنند، اين رويكرد بهطور ذاتي براي ادغام در فرآيند توسعه آزمونمحور طراحي شده است. ارزيابي عملي با مقايسهي اين مدل و روش استفاده مستقيم از مدل زباني با رهنمود مناسب، نشان داد كه مدل پيشنهادي بهطور ميانگين حدود سي درصد و در توابع پيچيده تا چهل و پنج درصد عملكرد بهتري در توليد آزمونهاي صحيح و معنادار دارد.
تاريخ ورود اطلاعات
1405/03/28
عنوان به انگليسي
Unit Test Generation by Large Language Models
تاريخ بهره برداري
2/28/2027 12:00:00 AM
دانشجوي وارد كننده اطلاعات
احمدرضا كنگاوري
چكيده به لاتين
In the complex world of software engineering, writing unit tests is recognized as a fundamental practice for ensuring software quality and reliability. However, the manual process of writing these tests faces significant challenges, including high costs and the risk of human error. In large-scale projects, these challenges can become a serious obstacle to the development of high-quality software. Consequently, the primary motivation of this research is to move toward automating the unit test generation process in order to reduce this burden and improve accuracy. The key point, however, is that automation alone is not sufficient; rather, the goal is to provide a solution that can be seamlessly integrated into established software engineering processes, such as test-driven development. In other words, the main challenge lies in identifying a systematic approach that not only generates tests, but also ensures that these tests are meaningful and accurately validate the expected behavior of the software.
Previous studies have proposed various approaches for automated unit test generation, which generally either focus on increasing code coverage or rely on large language models with textual prompts to produce tests. While the former approaches are effective in improving quantitative coverage metrics, they are typically unable to capture the behavioral semantics and logical correctness of the software. Approaches based on large language models, on the other hand, are capable of generating tests that resemble human-written ones; however, they are highly dependent on the quality of the prompts and lack a systematic framework for integration into the test-driven development process. As a result, despite these advancements, there remains a clear need for a structured approach that can generate meaningful tests while being naturally aligned with the software development lifecycle.
To address this need, this research proposes a multi-stage computational model based on large language models within a scenario-oriented architecture. Relying solely on function signatures, the model generates appropriate data and predicts usage scenarios to produce initial meaningful tests, which are then evaluated and refined using predefined criteria. In contrast to conventional approaches that primarily emphasize code coverage and fail to produce behaviorally meaningful tests, the proposed approach is inherently designed for integration into the test-driven development process. An empirical evaluation comparing this model with the direct use of a large language model guided by prompts demonstrates that the proposed model achieves, on average, approximately a thirty percent improvement in generating correct and meaningful unit tests, with improvements reaching up to forty-five percent for more complex functions.
كليدواژه هاي فارسي
ﺁﺯﻣﻮﻥ ﻭﺍﺣﺪ , ﺁﺯﻣﻮﻥ ﻧﺮﻡ ﺍﻓﺰﺍﺭ , مدلهاي زباني بزرگ , هوش مصنوعي , مهندسي نرمافزار
كليدواژه هاي لاتين
Unit Test , Software Testing , Large Language Models , Artificial Intelligence , Software Engineering
Author
Ahmadreza Kangavari
SuperVisor
Dr. Mehrdad Ashtiani