Zimic: Towards Compliant TypeScript API Mocks
Abstract
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.References
de Aquino, D. C. and Alves, E. L. G. (2025). Zimic: Bridging the gaps in api mocking for typescript projects. In Proceedings of the IEEE International Computer Software and Applications Conference (COMPSAC). Accepted for publication.
Mackinnon, T., Freeman, S., and Craig, P. (2000). Endo-testing: unit testing with mock objects. Extreme programming examined, pages 287–301.
Spadini, D., Aniche, M., Bruntink, M., and Bacchelli, A. (2017). To mock or not to mock? an empirical study on mocking practices. In 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR), pages 402–412. IEEE.
Thomas, D. and Hunt, A. (2002). Mock objects. IEEE Software, 19(3):22–24.
Torkar, R. and Mankefors, S. (2003). A survey on testing and reuse. In Proceedings 2003 Symposium on Security and Privacy, pages 164–173. IEEE.
Viglianisi, E., Dallago, M., and Ceccato, M. (2020). Resttestgen: automated black-box testing of restful apis. In 2020 IEEE 13th International Conference on Software Testing, Validation and Verification (ICST), pages 142–152. IEEE.
Mackinnon, T., Freeman, S., and Craig, P. (2000). Endo-testing: unit testing with mock objects. Extreme programming examined, pages 287–301.
Spadini, D., Aniche, M., Bruntink, M., and Bacchelli, A. (2017). To mock or not to mock? an empirical study on mocking practices. In 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR), pages 402–412. IEEE.
Thomas, D. and Hunt, A. (2002). Mock objects. IEEE Software, 19(3):22–24.
Torkar, R. and Mankefors, S. (2003). A survey on testing and reuse. In Proceedings 2003 Symposium on Security and Privacy, pages 164–173. IEEE.
Viglianisi, E., Dallago, M., and Ceccato, M. (2020). Resttestgen: automated black-box testing of restful apis. In 2020 IEEE 13th International Conference on Software Testing, Validation and Verification (ICST), pages 142–152. IEEE.
Published
2025-09-22
How to Cite
AQUINO, Diego C. de; ALVES, Everton L. G..
Zimic: Towards Compliant TypeScript API Mocks. In: SOFTWARE ENGINEERING UNDERGRADUATE RESEARCH COMPETITION - BRAZILIAN CONFERENCE ON SOFTWARE: THEORY AND PRACTICE (CBSOFT), 16. , 2025, Recife/PE.
Anais [...].
Porto Alegre: Sociedade Brasileira de Computação,
2025
.
p. 52-53.
DOI: https://doi.org/10.5753/cbsoft_estendido.2025.13578.
