Uppsats

C# Unit Test Generation Using Google Gemini Code Assist : An Empirical Study

Master-uppsats

KTH/Skolan för elektroteknik och datavetenskap (EECS)

Publicerad: 2025

Språk: Engelska

Sammanfattning

As software systems grow increasingly complex, software testing becomes essential to ensure functionality and quality. Unit testing, a well-established testing method that enables early bug detection, is tedious and timeconsuming, making automation inevitable. While large language model (LLM)-based unit test generation is gaining popularity, the approach remains in its early stages, particularly for C#, where the impact of prompting strategies on test quality requires further investigation. This thesis evaluates 941 unit tests generated for 11 C# classes using Gemini Code Assist and three prompting strategies: zero-shot, few-shot, and chain-of-thought. The tests are compared against a human-written baseline using quantitative (code coverage, mutation score) and qualitative (maintainability, contextual relevance) metrics. Results indicate that all prompting patterns produce tests with comparable code coverage and mutation scores to the baseline. However, qualitative analysis reveals maintainability issues in LLM-generated tests. Among the three strategies, few-shot prompting performs best, yielding the most contextually relevant tests. However, due to the limited sample size used in this thesis, further research is recommended to conclusively determine the optimal prompting strategy for LLM-based unit test generation in C#.

Information

Författare
Catir, Emir
Lärosäte / institution
KTH/Skolan för elektroteknik och datavetenskap (EECS)
Publiceringsdatum
2025
Uppsatstyp
Master-uppsats
Språk
Engelska

Utforska vidare

Liknande uppsatser

Uppsatser med liknande ämnen och nyckelord.