Domain Adaptation for Code Model-based Unit Test Case Generation
Recently, deep learning-based test case generation approaches have been proposed to automate the generation of unit test cases. In this study, we leverage Transformer-based code models to generate unit tests with the help of Domain Adaptation (DA) at a project level. Specifically, we use CodeT5, a relatively small language model trained on source code data, and fine-tune it on the test generation task. Then, we apply domain adaptation to each target project data to learn project-specific knowledge (project-level DA). We use the Methods2test dataset to fine-tune CodeT5 for the test generation task and the Defects4j dataset for project-level domain adaptation and evaluation. We compare our approach with (a) CodeT5 fine-tuned on the test generation without DA, (b) the A3Test tool, and (c) GPT-4 on five projects from the Defects4j dataset. The results show that tests generated using DA can increase the line coverage by 18.62%, 19.88%, and 18.02% and mutation score by 16.45%, 16.01%, and 12.99% compared to the above (a), (b), and (c) baselines, respectively. The overall results show consistent improvements in metrics such as parse rate, compile rate, BLEU, and CodeBLEU. In addition, we show that our approach can be seen as a complementary solution alongside existing search-based test generation tools such as EvoSuite, to increase the overall coverage and mutation scores with an average of 34.42% and 6.8%, for line coverage and mutation score, respectively.
Code (0)
등록된 구현이 없습니다.
Tasks
Domain AdaptationLanguage ModellingSmall Language ModelMethods 이 논문이 사용한 방법론
Similar Papers 제목 키워드 기반
UniTTA: Unified Benchmark and Versatile Framework Towards Realistic Test-Time Adaptation
Test-Time Adaptation (TTA) aims to adapt pre-trained models to the target domain during testing. In reality, this adaptability can be influenced by multiple factors. Researchers have identified various challenging scenar…
Test-time AdaptationBeyond Model Adaptation at Test Time: A Survey
Machine learning algorithms have achieved remarkable success across various disciplines, use cases and applications, under the prevailing assumption that training and test samples are drawn from the same distribution. Co…
Domain AdaptationDomain GeneralizationSurveyTest-time AdaptationZero-shot Transfer of Article-aware Legal Outcome Classification for European Court of Human Rights Cases
In this paper, we cast Legal Judgment Prediction on European Court of Human Rights cases into an article-aware classification task, where the case outcome is classified from a combined input of case facts and convention …
ArticlesDomain AdaptationLegal ReasoningSemi-Supervised Segmentation of Functional Tissue Units at the Cellular Level
We present a new method for functional tissue unit segmentation at the cellular level, which utilizes the latest deep learning semantic segmentation approaches together with domain adaptation and semi-supervised learning…
Domain AdaptationSegmentationSemantic SegmentationUnsupervised Domain Adaptation for Learning Eye Gaze from a Million Synthetic Images: An Adversarial Approach
With contemporary advancements of graphics engines, recent trend in deep learning community is to train models on automatically annotated simulated examples and apply on real data during test time. This alleviates the bu…
Domain AdaptationGaze EstimationUnsupervised Domain Adaptation