Detecting Semantic Conflicts with LLM-Generated Tests

  • Nathalia Barbosa UFPE
  • Paulo Borba UFPE
  • Léuson Da Silva Polytechnique Montreal

Abstract


Conflitos semânticos ocorrem quando um desenvolvedor introduz mudanças em uma base de código que afetam, de maneira não intencional, o comportamento de mudanças integradas em paralelo por outros desenvolvedores. Como as ferramentas de merge usadas na prática não conseguem detectar esse tipo de conflito, foram propostas ferramentas complementares, como SMAT, que é baseada na geração e execução de testes de unidade na linguagem Java. Apesar de apresentar boa capacidade de detecção de conflitos, SMAT apresenta alta taxa de falsos negativos (conflitos existentes mas não sinalizados pela mesma). Parte desse problema, deve-se às limitações naturais de ferramentas de geração de testes de unidade, no caso, Randoop e EvoSuite. Para entender se essas limitações podem ser superadas por modelos de linguagem de grande porte (LLMs), este trabalho propõe, e integra ao SMAT, uma nova ferramenta de geração de testes baseada no Code Llama 70B. Exploramos então a capacidade desse modelo de gerar testes, com diferentes estratégias de interação, prompts com diferentes conteúdos, e diferentes configurações de parâmetros do modelo. Avaliamos os resultados com duas amostras distintas, um benchmark com sistemas mais simples, usados em trabalhos relacionados, e uma amostra mais significativa baseada em sistemas complexos e utilizados na prática. Por fim, avaliamos a eficácia da nova extensão do SMAT na detecção de conflitos. Os resultados indicam que, embora a geração de testes por LLM em cenários complexos ainda represente um desafio e seja computacionalmente custosa, há potencial promissor na identificação de conflitos semânticos.
Keywords: Conflitos semânticos de código, Geração de testes de unidade, LLMs

References

Nathalia Barbosa. 2025. Apêndice Online. [link].

Nathalia Barbosa. 2025. SMAT com integração Code Llama. [link].

Yuriy Brun, Reid Holmes, Michael D. Ernst, and David Notkin. 2011. Crystal: precise and unobtrusive conflict warnings. In Proceedings of the 19th ACM SIGSOFT Symposium and the 13th European Conference on Foundations of Software Engineering (Szeged, Hungary) (ESEC/FSE ’11). Association for Computing Machinery, New York, NY, USA, 444–447. DOI: 10.1145/2025113.2025187

Léuson Da Silva, Paulo Borba, Toni Maciel, Wardah Mahmood, Thorsten Berger, João Moisakis, Aldiberg Gomes, and Vinícius Leite. 2024. Detecting semantic conflicts with unit tests. Journal of Systems and Software 214 (2024), 112070. DOI: 10.1016/j.jss.2024.112070

Eclipse Foundation. 2020. Eclipse Cargo Tracker: Applied Domain-Driven Design Blueprints for Jakarta EE. [link] Acessado em: 13 jun. 2025.

Gordon Fraser and Andrea Arcuri. 2011. Evosuite: automatic test suite generation for object-oriented software. In Proceedings of the 19th ACM SIGSOFT symposium and the 13th European conference on Foundations of software engineering. 416–419.

Chandra Maddila, Nachiappan Nagappan, Christian Bird, Georgios Gousios, and Arie van Deursen. 2021. ConE: A Concurrent Edit Detection Tool for Large-scale Software Development. ACM Trans. Softw. Eng. Methodol. 31, 2, Article 22 (Dec. 2021), 26 pages. DOI: 10.1145/3478019

Meta AI. 2023. Introducing Code Llama, a State-of-the-Art Large Language Model for Coding. [link] Accessed: 2025-05-10.

Ollama. 2023. Ollama - Run large language models locally. [link] Acesso em: 12 jun. 2025.

OpenLiberty. 2018. DayTrader8 Sample. [link] Acessado em: 13 jun. 2025.

Carlos Pacheco and Michael D Ernst. 2007. Randoop: feedback-directed random testing for Java. In Companion to the 22nd ACM SIGPLAN conference on Objectoriented programming systems and applications companion. 815–816.

Rangeet Pan, Myeongsoo Kim, Rahul Krishna, Raju Pavuluri, and Saurabh Sinha. 2025. ASTER: Natural and Multi-language Unit Test Generation with LLMs. arXiv:cs.SE/2409.03093 [link]

Anita Sarma, David F. Redmiles, and André van der Hoek. 2012. Palantir: Early Detection of Development Conflicts Arising from Parallel Code Changes. IEEE Transactions on Software Engineering 38, 4 (2012), 889–908. DOI: 10.1109/TSE.2011.64

Max Schäfer, Sarah Nadi, Aryaz Eghbali, and Frank Tip. 2024. An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generation. IEEE Transactions on Software Engineering 50, 1 (2024), 85–105. DOI: 10.1109/TSE.2023.3334955

Leuson Da Silva, Paulo Borba, Wardah Mahmood, Thorsten Berger, and João Moisakis. 2020. Detecting Semantic Conflicts via Automated Behavior Change Detection. In 2020 IEEE International Conference on Software Maintenance and Evolution (ICSME). 174–184. DOI: 10.1109/ICSME46990.2020.00026

Marcelo Sousa, Isil Dillig, and Shuvendu K. Lahiri. 2018. Verified three-way program merge. Proc. ACM Program. Lang. 2, OOPSLA, Article 165 (Oct. 2018), 29 pages. DOI: 10.1145/3276535

Tree-sitter. 2024. Tree-sitter - A parser generator tool and incremental parsing library. [link] Acesso em: 12 jun. 2025.

ZejunWang, Kaibo Liu, Ge Li, and Zhi Jin. 2024. HITS: High-coverage LLM-based Unit Test Generation via Method Slicing. In 2024 39th IEEE/ACM International Conference on Automated Software Engineering (ASE). 1258–1268.

Jules White, Quchen Fu, Sam Hays, Michael Sandborn, Carlos Olea, Henry Gilbert, Ashraf Elnashar, Jesse Spencer-Smith, and Douglas C. Schmidt. 2023. A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT. arXiv:cs.SE/2302.11382 [link]

Jialu Zhang, Mike Kaufman, Todd Mytkowicz, Ruzica Piskac, and Shuvendu Lahiri. 2022. Using Pre-trained Language Models to Resolve Textual and Semantic Merge Conflicts (Experience Paper). In ISSTA 2022: Proceedings of the 31st ACM SIGSOFT International Symposium on Software Testing and Analysis. ACM. [link]

Yuwei Zhang, Qingyuan Lu, Kai Liu,Wensheng Dou, Jiaxin Zhu, Li Qian, Chunxi Zhang, Zheng Lin, and Jun Wei. 2025. CITYWALK: Enhancing LLM-Based C++ Unit Test Generation via Project-Dependency Awareness and Language-Specific Knowledge. arXiv:cs.SE/2501.16155 [link]
Published
2025-09-22
BARBOSA, Nathalia; BORBA, Paulo; SILVA, Léuson Da. Detecting Semantic Conflicts with LLM-Generated Tests. In: BRAZILIAN SYMPOSIUM ON SYSTEMATIC AND AUTOMATED SOFTWARE TESTING (SAST), 10. , 2025, Recife/PE. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2025 . p. 18-27. DOI: https://doi.org/10.5753/sast.2025.13826.