
Unit testing is instrumental in enhancing code quality, documenting system behavior, and preventing regressions in contemporary software development. One of the current limitations of the most popular existing unit-testing frameworks for the Kotlin language (e.g., MockK and Mockito) is that they are inherently tied to the Java Virtual Machine (JVM), restricting their use to JVM-compatible environments. To overcome this limitation, in this paper we present an extended version of Mockative, a Kotlin-specific mocking framework designed to operate across multiple platforms beyond the JVM. While originally Mockative was limited to interface mocking, we have enhanced it to support class mocking and spying through the utilization of Kotlin Symbol Processing (KSP) and KotlinPoet libraries. We show that Mockative is a viable alternative to traditional JVM-bound frameworks, particularly in Kotlin/Native environments. Our extension can mock simple classes up to four times faster than MockK and Mockito, although it exhibits a marginal performance decline in scenarios involving classes with extensive method definitions.
Mock, Unit Testing, Kotlin
Mock, Unit Testing, Kotlin
| selected citations These citations are derived from selected sources. This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | 0 | |
| popularity This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network. | Average | |
| influence This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | Average | |
| impulse This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network. | Average |
