Zimic: Towards Compliant TypeScript API Mocks
Diego Cruz de Aquino, Everton L. G. Alves · 2025
Mocks are a common strategy to reduce flakiness and complexity in automated testing. API mocks, which intercept communications with external services, must align with the actual implementation to ensure realistic test scenarios. However, current solutions for TypeScript API mocking do not adequately support testers in declaring compliant API mocks. In this paper, we introduce Zimic, a novel approach to TypeScript API mocking that enhances compliance through static validation and test abstractions. We evaluated Zimic in two empirical studies involving students and professional testers. Our results show that Zimic improves mock compliance by 24.1%, test completeness by 27.2%, and readability by 15.1% compared to existing solutions.