To Mock or Not to Mock: Divergence in Mocking Practices Between LLM and Developers
Mock objects are essential for isolating unit tests and reducing dependencies in software testing. However, deciding what to mock requires careful judgment to balance isolation and maintainability. This study evaluates OpenAI's GPT-4o for automating mock decisions by comparing its outputs with developer choices. The findings reveal that while the LLM excels in identifying dependencies, their broader isolation strategy often results in Over-mocking compared to the developers. These insights suggest the potential for LLM-based tools to generate test cases with accurate and well-balanced mocking strategies.
Authors
- Hanbin Qin
Institutions
- Stevens Institute of Technology (US)
Publication Details
- Published
- 2025-04-27
- DOI
- https://doi.org/10.1109/icse-companion66252.2025.00077
- Primary Topic
- Artificial Intelligence in Law
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- National Science Foundation